def __init__(self, fields, show_field): fr = FuzzRequest() fr.url = "http://www.wfuzz.org/path?param=1¶m2=2" fuzz_res = FuzzResult(history=fr) fuzz_res._fields = fields fuzz_res._show_field = show_field self.outfile = BytesIO() with gzip.GzipFile(fileobj=self.outfile, mode="wb") as f: pickle.dump(fuzz_res, f) self.outfile.seek(0) self.outfile.name = "mockfile"
def test_nonexisting(self): fr = FuzzRequest() fr.url = "http://www.wfuzz.org/path?param=1¶m2=2" fuzz_res = FuzzResult(history=fr) with self.assertRaises(Exception) as context: ffilter = FuzzResFilter(filter_string="url=-'test'") ffilter.is_visible(fuzz_res) self.assertTrue("rsetattr: Can't set" in str(context.exception)) with self.assertRaises(Exception) as context: ffilter = FuzzResFilter(filter_string="notthere=-'test'") ffilter.is_visible(fuzz_res) self.assertTrue("rgetattr: Can't get" in str(context.exception)) with self.assertRaises(Exception) as context: ffilter = FuzzResFilter( filter_string="r.params.get.notthere=-'test'") ffilter.is_visible(fuzz_res) self.assertTrue( "DotDict: Non-existing field" in str(context.exception))