@@ -41,18 +41,20 @@ def vulnTest():
4141 TESTS = (
4242 ("-h" , ("to see full list of options run with '-hh'" ,)),
4343 ("-u <url> --flush-session --wizard --check-internet" , ("Please choose:" , "back-end DBMS: SQLite" , "current user is DBA: True" , "banner: '3." , "~no connection detected" )),
44+ ("--dependencies" , ("sqlmap requires" , "third-party library" )),
4445 (u"-c <config> --flush-session --sql-query=\" SELECT '\u0161 u\u0107 uraj'\" --technique=U" , (u": '\u0161 u\u0107 uraj'" ,)),
4546 (u"-u <url> --flush-session --sql-query=\" SELECT '\u0161 u\u0107 uraj'\" --technique=B --no-escape --string=luther --unstable" , (u": '\u0161 u\u0107 uraj'" ,)),
4647 ("--dummy" , ("all tested parameters do not appear to be injectable" , "does not seem to be injectable" , "there is not at least one" , "~might be injectable" )),
4748 ("--list-tampers" , ("between" , "MySQL" , "xforwardedfor" )),
48- ("-r <request> --flush-session -v 5" , ("CloudFlare" , "possible DBMS: 'SQLite'" , "User-agent: foobar" )),
49+ ("-r <request> --flush-session -v 5 --test-skip='heavy' --save=<tmp> " , ("CloudFlare" , "possible DBMS: 'SQLite'" , "User-agent: foobar" , "~Type: time-based blind " )),
4950 ("-l <log> --flush-session --keep-alive --skip-waf -v 5 --technique=U --union-from=users --banner --parse-errors" , ("banner: '3." , "ORDER BY term out of range" , "~xp_cmdshell" , "Connection: keep-alive" )),
5051 ("-l <log> --offline --banner -v 5" , ("banner: '3." , "~[TRAFFIC OUT]" )),
52+ ("-u <url> --flush-session --banner --technique=B --first=1 --last=2" , ("banner: '3.'" ,)),
5153 ("-u <url> --flush-session --encoding=ascii --forms --crawl=2 --threads=2 --banner" , ("total of 2 targets" , "might be injectable" , "Type: UNION query" , "banner: '3." )),
5254 ("-u <url> --flush-session --data='{\" id\" : 1}' --banner" , ("might be injectable" , "3 columns" , "Payload: {\" id\" " , "Type: boolean-based blind" , "Type: time-based blind" , "Type: UNION query" , "banner: '3." )),
5355 ("-u <url> --flush-session -H 'Foo: Bar' -H 'Sna: Fu' --data='<root><param name=\" id\" value=\" 1*\" /></root>' --union-char=1 --mobile --answers='smartphone=3' --banner --smart -v 5" , ("might be injectable" , "Payload: <root><param name=\" id\" value=\" 1" , "Type: boolean-based blind" , "Type: time-based blind" , "Type: UNION query" , "banner: '3." , "Nexus" , "Sna: Fu" , "Foo: Bar" )),
54- ("-u <url> --flush-session --method=PUT --data='a=1&b=2&c=3&id=1' --skip-static --dump -T users --start=1 --stop=2" , ("might be injectable" , "Parameter: id (PUT)" , "Type: boolean-based blind" , "Type: time-based blind" , "Type: UNION query" , "2 entries" )),
55- ("-u <url> --flush-session -H 'id: 1*' --tables" , ("might be injectable" , "Parameter: id #1* ((custom) HEADER)" , "Type: boolean-based blind" , "Type: time-based blind" , "Type: UNION query" , " users " )),
56+ ("-u <url> --flush-session --method=PUT --data='a=1&b=2&c=3&id=1' --skip-static --har=<tmp> -- dump -T users --start=1 --stop=2" , ("might be injectable" , "Parameter: id (PUT)" , "Type: boolean-based blind" , "Type: time-based blind" , "Type: UNION query" , "2 entries" )),
57+ ("-u <url> --flush-session -H 'id: 1*' --tables -t <tmp> " , ("might be injectable" , "Parameter: id #1* ((custom) HEADER)" , "Type: boolean-based blind" , "Type: time-based blind" , "Type: UNION query" , " users " )),
5658 ("-u <url> --flush-session --banner --invalid-logical --technique=B --predict-output --test-filter='OR boolean' --tamper=space2dash" , ("banner: '3." , " LIKE " )),
5759 ("-u <url> --flush-session --cookie=\" PHPSESSID=d41d8cd98f00b204e9800998ecf8427e; id=1*; id2=2\" --tables --union-cols=3" , ("might be injectable" , "Cookie #1* ((custom) HEADER)" , "Type: boolean-based blind" , "Type: time-based blind" , "Type: UNION query" , " users " )),
5860 ("-u <url> --flush-session --null-connection --technique=B --tamper=between,randomcase --banner" , ("NULL connection is supported with HEAD method" , "banner: '3." )),
@@ -120,9 +122,15 @@ def _thread():
120122 dataToStdout ("\r [%s] [INFO] complete: %s" % (time .strftime ("%X" ), status ))
121123
122124 cmd = "%s %s %s --batch --non-interactive" % (sys .executable , os .path .abspath (os .path .join (os .path .dirname (__file__ ), ".." , ".." , "sqlmap.py" )), options .replace ("<url>" , url ).replace ("<direct>" , direct ).replace ("<request>" , request ).replace ("<log>" , log ).replace ("<config>" , config ))
125+
126+ if "<tmp>" in cmd :
127+ handle , tmp = tempfile .mkstemp ()
128+ os .close (handle )
129+ cmd = cmd .replace ("<tmp>" , tmp )
130+
123131 output = shellExec (cmd )
124132
125- if not all ((check in output if not check .startswith ('~' ) else check [1 :] not in output ) for check in checks ):
133+ if not all ((check in output if not check .startswith ('~' ) else check [1 :] not in output ) for check in checks ) or "unhandled exception" in output :
126134 dataToStdout ("---\n \n $ %s\n " % cmd )
127135 dataToStdout ("%s---\n " % clearColors (output ))
128136 retVal = False
0 commit comments