My Pentesting Space
LinkedIn
  • Welcome to Hackjiji
  • 🕸️web pentesting
    • Basics
    • Web pentest cheatsheet
    • Burpsuite and browser tricks
    • cUrl cheatsheet
    • CVE exploitation
    • JavaScript Obfuscation/Deobfuscation
  • Network pentesting
    • Basics
    • Nmap favorites
    • Host discovery
    • Port scanning
    • Network Services
      • RPC-NFC
      • WINRM - 5895-5896
      • FTP - 21
      • SMB - 445
      • RDP - 3389
      • SSH - 22
      • SMTP - 25
    • Firewall evasion
    • Pivoting and double pivoting
  • Physical pentesting
    • Bad USB - Rubber Duckies
  • Linux pentesting
    • Usefull command's
    • Privilege escalation
  • windows pentesting
    • Windows useful commands
    • Windows Reverse shell codes
    • Privilege escalation
  • Active Directory pentesting
    • Basics
    • AD
    • AAD
  • General
    • Hash cracking
    • Wordlist
    • Encoding/decoding
    • Environment setup
      • Install a new OS on seperated boot sector
      • Hyper-V
      • Virtualbox
    • Reverse-shell-cheatsheet
    • Metasploit cheatsheet
    • Vulnerability research
    • My scanning methodology
  • Events
    • HackTheBox Meetup - LFI2RCE
    • Radio Equans - QR Code Awareness campaign
    • Cybersecurity job campaign
Powered by GitBook
On this page
  • cUrl Cheatsheet
  • cUrl fo API
  1. web pentesting

cUrl cheatsheet

cUrl Cheatsheet

# Read entry
curl http://<SERVER_IP>:<PORT>/api.php/city/london

# Read all entries - add the "-s" flag to reduce cluttering the response with unnecessary data
curl -s http://<SERVER_IP>:<PORT>/api.php/city/ | jq

# Create (add) entry
curl -X POST http://<SERVER_IP>:<PORT>/api.php/city/ -d '{"city_name":"HTB_City", "country_name":"HTB"}' -H 'Content-Type: application/json'

# Update (modify) 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'

# Delete entry
curl -X DELETE http://<SERVER_IP>:<PORT>/api.php/city/New_HTB_City
# Set custom headers for API requests
curl -H "Authorization: Bearer <TOKEN>" http://<SERVER_IP>:<PORT>/api.php/city/london

# Use a specific HTTP method with custom headers
curl -X PATCH http://<SERVER_IP>:<PORT>/api.php/city/london -H "Authorization: Bearer <TOKEN>" -H 'Content-Type: application/json' -d '{"city_name":"Updated_City"}'

# Perform an API request with error handling and verbose mode
curl -v --fail-http http://<SERVER_IP>:<PORT>/api.php/city/london || echo "Request failed"

# Download a file from the API
curl -o output_file.txt http://<SERVER_IP>:<PORT>/api.php/file.txt
Command
Info

curl site.com

-O will download the index.html page

curl -o filename site.com/path

-o with the -o option we can specify a filename

curl -h

display th help message

curl --help all

display the full help page

-k allows you to skip the SSL veriifcation if you are testing a local webapp that does not yt contain a valid SSL cert

curl site.com -vvv

use -v verbose mode to show the http request and response headers

curl -I site.com

curl -i site.com

-I sends a HEAD request, while -i sends any request we specify and prints the headers as well. Head is very powerfull and allows us to request the metadata of a resoures like availability size, links without downloading it.

curl -i https://inlanefreight.com -A 'Jiji' -vvv

-A modifies the user agent to a custom value

cUrl fo API

Command

Description

curl http://<SERVER_IP>:<PORT>/api.php/city/london

Read entry

curl -s http://<SERVER_IP>:<PORT>/api.php/city/ | jq

Read all entries

curl -X POST http://<SERVER_IP>:<PORT>/api.php/city/ -d '{"city_name":"HTB_City", "country_name":"HTB"}' -H 'Content-Type: application/json'

Create (add) 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 (modify) entry

curl -X DELETE http://<SERVER_IP>:<PORT>/api.php/city/New_HTB_City

Delete entry

PreviousBurpsuite and browser tricksNextCVE exploitation

Last updated 4 months ago

(client URL) is a command-line tool and library that primarily supports HTTP along with many other protocols. This makes it a good candidate for scripts as well as automation, making it essential for sending various types of web requests from the command line, which is necessary for many types of web penetration tests.

🕸️
curl -k https://inlanefreight.com
cURL