Security article
HTB Academy - Curl
HTB Academy - Curl: cURL, APIs, and Browser DevTools Cheatsheet --- ## đ cURL Basics | Command | Description | |---------|-------------| | curl -h | Show cURL help menu | | curl {url} | Basic GET request | | curl -s -O | Download file | | curl -k | Skip HTTPS (SSL) certificate... ⢠Tutorials ⢠curl
cURL, APIs, and Browser DevTools Cheatsheet
đ cURL Basics
| Command | Description |
|---|---|
curl -h | Show the cURL help menu |
curl {url} | Send a basic GET request |
curl -s -O {url} | Download a file |
curl -k {url} | Skip HTTPS/SSL certificate validation |
curl -v {url} | Print full HTTP request and response details |
curl -I {url} | Send a HEAD request and display response headers only |
curl -i {url} | Display response headers and the response body |
curl -A 'Mozilla/5.0' {url} | Set the User-Agent header |
curl -u admin:admin http://<SERVER_IP>:<PORT>/ | Use HTTP Basic Authentication with a username and password |
curl http://admin:admin@<SERVER_IP>:<PORT>/ | Use HTTP Basic Authentication credentials in the URL |
curl -H 'Authorization: Basic YWRtaW46YWRtaW4=' http://<SERVER_IP>:<PORT>/ | Set a custom authorization header |
curl 'http://<SERVER_IP>:<PORT>/search.php?search=le' | Send GET parameters |
curl -X POST -d 'username=admin&password=admin' http://<SERVER_IP>:<PORT>/ | Send a POST request with form data |
curl -b 'PHPSESSID=c1nsa6op7vtk7kdis7bcnbadf1' http://<SERVER_IP>:<PORT>/ | Send a request with cookies |
curl -X POST -d '{"search":"london"}' -H 'Content-Type: application/json' http://<SERVER_IP>:<PORT>/search.php | Send a POST request with JSON data |
đ API Usage
| Command | Description |
|---|---|
curl http://<SERVER_IP>:<PORT>/api.php/city/london | Read a single entry |
curl -s http://<SERVER_IP>:<PORT>/api.php/city/ | jq | Read all entries and pretty-print the response with jq |
curl -X POST http://<SERVER_IP>:<PORT>/api.php/city/ -d '{"city_name":"HTB_City","country_name":"HTB"}' -H 'Content-Type: application/json' | Create an entry |
curl -X PUT http://<SERVER_IP>:<PORT>/api.php/city/london -d '{"city_name":"New_HTB_City","country_name":"HTB"}' -H 'Content-Type: application/json' | Update an entry |
curl -X DELETE http://<SERVER_IP>:<PORT>/api.php/city/New_HTB_City | Delete an entry |
đ ď¸ Browser DevTools
| Shortcut | Description |
|---|---|
CTRL+SHIFT+I or F12 | Open DevTools |
CTRL+SHIFT+E | Open the Network tab |
CTRL+SHIFT+K | Open the Console tab |