def test_replace_markers(session_string, dictio, expected_field, expected_result): options = CLParser(session_string.split(" ")).parse_cl() options.compile_seeds() res = resfactory.create("fuzzres_from_options_and_dict", options, dictio) assert rgetattr(res.history, expected_field) == expected_result
def do_wfuzz(self, cmd): try: session_options = CLParser(cmd).parse_cl().compile() except SystemExit: print "\n" pass except Exception: pass else: for res in session_options.fuzz(): self.model.AddRow(res)
def test_baseline(self): options = CLParser(['wfuzz', '-z', 'range,1-1', 'http://localhost:9000/FUZZ{first}']).parse_cl() seed = FuzzResultFactory.from_options(options) baseline = FuzzResultFactory.from_baseline(seed, options) self.assertEqual(baseline.description, 'first') options = CLParser(['wfuzz', '-z', 'range,1-1', '-z', 'range,2-2', 'http://localhost:9000/FUZZ{first}/FUZ2Z{second}']).parse_cl() seed = FuzzResultFactory.from_options(options) baseline = FuzzResultFactory.from_baseline(seed, options) self.assertEqual(baseline.description, 'first - second')
def test_ip_option(self): options = CLParser(['wfuzz', '--ip', '127.0.0.1']).parse_cl() self.assertEqual(options.data['connect_to_ip']['ip'], '127.0.0.1') self.assertEqual(options.data['connect_to_ip']['port'], '80') options = CLParser(['wfuzz', '--ip', '127.0.0.1:22']).parse_cl() self.assertEqual(options.data['connect_to_ip']['ip'], '127.0.0.1') self.assertEqual(options.data['connect_to_ip']['port'], '22') options = CLParser(['wfuzz', '--ip', '127.0.0.1:']).parse_cl() self.assertEqual(options.data['connect_to_ip']['ip'], '127.0.0.1') self.assertEqual(options.data['connect_to_ip']['port'], '80') with self.assertRaises(Exception) as cm: options = CLParser(['wfuzz', '--ip', ':80']).parse_cl() self.assertTrue("An IP must be specified" in str(cm.exception))
def test_ip_option(self): options = CLParser(["wfuzz", "--ip", "127.0.0.1"]).parse_cl() self.assertEqual(options.data["connect_to_ip"]["ip"], "127.0.0.1") self.assertEqual(options.data["connect_to_ip"]["port"], "80") options = CLParser(["wfuzz", "--ip", "127.0.0.1:22"]).parse_cl() self.assertEqual(options.data["connect_to_ip"]["ip"], "127.0.0.1") self.assertEqual(options.data["connect_to_ip"]["port"], "22") options = CLParser(["wfuzz", "--ip", "127.0.0.1:"]).parse_cl() self.assertEqual(options.data["connect_to_ip"]["ip"], "127.0.0.1") self.assertEqual(options.data["connect_to_ip"]["port"], "80") with self.assertRaises(Exception) as cm: options = CLParser(["wfuzz", "--ip", ":80"]).parse_cl() self.assertTrue("An IP must be specified" in str(cm.exception))
def test_ze_zd_option(self): with self.assertRaises(Exception) as cm: options = CLParser( ["wfuzz", "-z", "range,0-10", "--zD", "0-10", "url"]).parse_cl() self.assertTrue("exclusive" in str(cm.exception)) options = CLParser( ["wfuzz", "-z", "range", "--zD", "0-1", "--zE", "md5", "url"]).parse_cl() self.assertEqual( options.data["payloads"], [("range", { "default": "0-1", "encoder": ["md5"] }, None)], ) options = CLParser(["wfuzz", "-z", "range,0-1", "--zE", "md5", "url"]).parse_cl() self.assertEqual( options.data["payloads"], [("range", { "default": "0-1", "encoder": ["md5"] }, None)], ) options = CLParser( ["wfuzz", "-z", "range", "--zD", "0-1", "--zE", "md5", "url"]).parse_cl() self.assertEqual( options.data["payloads"], [("range", { "default": "0-1", "encoder": ["md5"] }, None)], ) options = CLParser(["wfuzz", "-z", "range", "--zD", "0-1"]).parse_cl() self.assertEqual( options.data["payloads"], [("range", { "default": "0-1", "encoder": None }, None)], ) options = CLParser(["wfuzz", "-z", "range,0-1"]).parse_cl() self.assertEqual( options.data["payloads"], [("range", { "default": "0-1", "encoder": None }, None)], )
def do_wfilter(self, cmd): from wfuzz.core import dictionary try: session_options = CLParser(cmd).parse_cl() except SystemExit: print "\n" pass except Exception: pass else: for res in dictionary.from_options(session_options): r = res[0] if "FuzzResult" in str(r.__class__): r.description = r.url self.model.AddRow(r)
def test_ze_zd_option(self): with self.assertRaises(Exception) as cm: options = CLParser( ['wfuzz', '-z', 'range,0-10', '--zD', '0-10', 'url']).parse_cl() self.assertTrue("exclusive" in str(cm.exception)) options = CLParser( ['wfuzz', '-z', 'range', '--zD', '0-1', '--zE', 'md5', 'url']).parse_cl() self.assertEqual(options.data['payloads'], [('range', { 'default': '0-1', 'encoder': ['md5'] }, None)]) options = CLParser(['wfuzz', '-z', 'range,0-1', '--zE', 'md5', 'url']).parse_cl() self.assertEqual(options.data['payloads'], [('range', { 'default': '0-1', 'encoder': ['md5'] }, None)]) options = CLParser( ['wfuzz', '-z', 'range', '--zD', '0-1', '--zE', 'md5', 'url']).parse_cl() self.assertEqual(options.data['payloads'], [('range', { 'default': '0-1', 'encoder': ['md5'] }, None)]) options = CLParser(['wfuzz', '-z', 'range', '--zD', '0-1']).parse_cl() self.assertEqual(options.data['payloads'], [('range', { 'default': '0-1', 'encoder': None }, None)]) options = CLParser(['wfuzz', '-z', 'range,0-1']).parse_cl() self.assertEqual(options.data['payloads'], [('range', { 'default': '0-1', 'encoder': None }, None)])
def test_listplugins(self): with self.assertRaises(SystemExit) as cm: CLParser(['wfuzz', '-e', 'iterators']).parse_cl() self.assertEqual(cm.exception.code, 0)
def test_listplugins(self): with self.assertRaises(SystemExit) as cm: CLParser(["wfuzz", "-e", "iterators"]).parse_cl() self.assertEqual(cm.exception.code, 0)