curl
# Outputting the html file to try.html
curl -o try.html inlanefreight.com/index.html
# Downloading the file
curl -O inlanefreight.com/index.html
# Silent mode
curl -s -O inlanefreight.com/index.html
# Skip certificate check
curl -k https://inlanefreight.com
# Verbose
curl -v inlanefreight.com
# Extra verbose
curl -vvv inlanefreight.com
# Display the response headers and head request
curl -I inlanefreight.com
# Follow redirects with -L
curl inlanefreight.com/index.html -L
# Display both the headers and the response body
curl -i inlanefreight.com
# Set the User-Agent
curl https://www.inlanefreight.com -A 'Mozilla/5.0'
# Set credentials
curl -u admin:admin http://<SERVER_IP>:<PORT>/
# Set credentials
curl http://admin:admin@<SERVER_IP>:<PORT>/
# Set credentials using the Authorization
# You can get this in response header when you already set valid credentials
curl -H 'Authorization: Basic YWRtaW46YWRtaW4=' http://<SERVER_IP>:<PORT>/
# Set cookie with -b
curl -b 'PHPSESSID=c1nsa6op7vtk7kdis7bcnbadf1' http://<SERVER_IP>:<PORT>/
# Same as with cookie
curl -H 'Cookie: PHPSESSID=c1nsa6op7vtk7kdis7bcnbadf1' http://<SERVER_IP>:<PORT>/
# Set request header
# Set credentials
# The -d parameter is HTTP POST data
curl -X POST -d 'username=admin&password=admin' http://<SERVER_IP>:<PORT>/
# The -b parameter is Send cookies from string/load from file
curl -b 'PHPSESSID=c1nsa6op7vtk7kdis7bcnbadf1' http://<SERVER_IP>:<PORT>/
# Example - Option 1
curl -X POST -d '{"search":"flag"}' -b 'PHPSESSID=30ij4ep815vbqnmtaqnr3jncuv' -H 'Content-Type: application/json' http://<SERVER_IP>:<PORT>/search.php
# Option 2
curl 'http://83.136.254.223:39361/search.php' -H 'Cookie: PHPSESSID=gpsf0oduj0dfflqevvrnj55b3f' -H 'Content-Type: application/json' --data-raw '{"search":"flag"}'
# Get the jason data
curl http://<SERVER_IP>:<PORT>/api.php/city/london
# Get the json data and pretty format it
# Get the data that starts with lo
curl -s http://<SERVER_IP>:<PORT>/api.php/city/lo | jq
# Get the json data and pretty format it
curl -s http://<SERVER_IP>:<PORT>/api.php/city/london | jq
# Retrieve all the data from table
curl -s http://<SERVER_IP>:<PORT>/api.php/city/ | jq
# Create a new data - POST
curl -X POST http://<SERVER_IP>:<PORT>/api.php/city/ -d '{"city_name":"HTB_City", "country_name":"HTB"}' -H 'Content-Type: application/json'
# Update a data - UPDATE
# This will delete the city london and it will be named as New_HTB_City
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 a data - DELETE
curl -X DELETE http://<SERVER_IP>:<PORT>/api.php/city/New_HTB_City
Copy as curl
# To see the possible HTTP methods that we could execute
# We could also bypass the 401 authorization
curl -i -X OPTIONS http://SERVER_IP:PORT/
Last updated