Back to index

python-biopython  1.60
Public Member Functions
test_NCBIStandalone.TestNCBIStandalone Class Reference

List of all members.

Public Member Functions

def test_command_injection
def test_pipe_redirection

Detailed Description

Definition at line 11 of file test_NCBIStandalone.py.


Member Function Documentation

Definition at line 13 of file test_NCBIStandalone.py.

00013 
00014     def test_command_injection(self):
00015         #Check the simple detection of command injection,
00016         for func in [NCBIStandalone.blastall,
00017                      NCBIStandalone.blastpgp,
00018                      NCBIStandalone.rpsblast]:
00019             try:
00020                 handle = func("/somewhere/blast", "blastz", "nr",
00021                               "/tmp/example.fasta",
00022                               expectation=10**-4,
00023                               matrix="IDENTITY -F 0; cat /etc/passwd'")
00024             except ValueError, e:
00025                 self.assertEqual(str(e), "Rejecting suspicious argument for matrix")
00026                 #Good
00027             else:
00028                 self.fail("Attempted command injection not caught!")

Definition at line 29 of file test_NCBIStandalone.py.

00029 
00030     def test_pipe_redirection(self):
00031         #Now check something similar using pipe redirection
00032         for func in [NCBIStandalone.blastall,
00033                      NCBIStandalone.blastpgp,
00034                      NCBIStandalone.rpsblast]:
00035             try:
00036                 handle = func("/somewhere/blast", "blastz", "nr",
00037                               "/tmp/example.fasta",
00038                               nprocessors=4,
00039                               expectation="0.001",
00040                               filter= "F > /etc/passwd'")
00041             except ValueError, e:
00042                 self.assertEqual(str(e), "Rejecting suspicious argument for filter")
00043                 #Good
00044             else:
00045                 self.fail("Attempted output redirection not caught!")
00046 


The documentation for this class was generated from the following file: