┌─[michael@parrot]─[~] └──╼ $python Python 2.7.14+ (default, Feb 62018, 19:12:18) [GCC 7.3.0] on linux2 Type"help", "copyright", "credits"or"license"for more information. >>> import wfuzz
现在,来体验一下使用库进行目录扫描是什么感觉:
1 2 3 4 5 6 7 8
>>> import wfuzz >>> for r in wfuzz.fuzz(url="http://testphp.vulnweb.com/FUZZ", hc=[404], payloads=[("file",dict(fn="wordlist/general/common.txt"))]): ... print r ... 00060: C=3017 L 12 W 184 Ch "admin" 00183: C=40310 L 29 W 263 Ch "cgi-bin" 00429: C=3017 L 12 W 184 Ch "images" ...
>>> import wfuzz >>> s=wfuzz.FuzzSession(url="http://testphp.vulnweb.com/FUZZ") >>> for r in s.fuzz(hc=[404], payloads=[("file",dict(fn="wordlist/general/common.txt"))]): ... print r ... 00060: C=3017 L 12 W 184 Ch "admin" 00183: C=40310 L 29 W 263 Ch "cgi-bin" ...
FuzzSession对象还可以当作上下文管理器来使用:
1 2 3 4 5 6
>>> with wfuzz.FuzzSession(url="http://testphp.vulnweb.com/FUZZ", hc=[404], payloads=[("file",dict(fn="wordlist/general/common.txt"))]) as s: ... for r in s.fuzz(): ... print r ... 00295: C=3017 L 12 W 184 Ch "admin" 00418: C=40310 L 29 W 263 Ch "cgi-bin"
>>> import wfuzz >>> for r in wfuzz.get_payload(range(5)).fuzz(url="http://testphp.vulnweb.com/FUZZ"): ... print r ... 00012: C=4047 L 12 W 168 Ch "0" 00013: C=4047 L 12 W 168 Ch "1" 00014: C=4047 L 12 W 168 Ch "2" 00015: C=4047 L 12 W 168 Ch "3" 00016: C=4047 L 12 W 168 Ch "4" >>>
这个方法在需要多个payloads的时候可以这样使用:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
>>> import wfuzz >>> for r in wfuzz.get_payloads([range(5), ["a","b"]]).fuzz(url="http://testphp.vulnweb.com/FUZZ/FUZ2Z"): ... print r ... 00028: C=4047 L 12 W 168 Ch "4 - b" 00027: C=4047 L 12 W 168 Ch "4 - a" 00024: C=4047 L 12 W 168 Ch "2 - b" 00026: C=4047 L 12 W 168 Ch "3 - b" 00025: C=4047 L 12 W 168 Ch "3 - a" 00022: C=4047 L 12 W 168 Ch "1 - b" 00021: C=4047 L 12 W 168 Ch "1 - a" 00020: C=4047 L 12 W 168 Ch "0 - b" 00023: C=4047 L 12 W 168 Ch "2 - a" 00019: C=4047 L 12 W 168 Ch "0 - a" >>>
生成Session
get_session方法可以使用命令行的参数来生成编程下的 FuzzSession 对象。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
>>> import wfuzz >>> for r in wfuzz.get_session("-z range,0-10 http://testphp.vulnweb.com/FUZZ").fuzz(): ... print r ... 00002: C=4047 L 12 W 168 Ch "1" 00011: C=4047 L 12 W 168 Ch "10" 00008: C=4047 L 12 W 168 Ch "7" 00001: C=4047 L 12 W 168 Ch "0" 00003: C=4047 L 12 W 168 Ch "2" 00004: C=4047 L 12 W 168 Ch "3" 00005: C=4047 L 12 W 168 Ch "4" 00006: C=4047 L 12 W 168 Ch "5" 00007: C=4047 L 12 W 168 Ch "6" 00009: C=4047 L 12 W 168 Ch "8" 00010: C=4047 L 12 W 168 Ch "9"