top of page
  • aldern00b

Using cURL for web enumeration

A lot of information can be obtained through Dev Tools in the browser, this will help you build out your cURL statements. You can also create the orginal web request and then copy > copy as cURL and modify it as needed.


curl -X POST -d '{"search":"flag"}' -b 'PHPSESSID=2kbq5l9atp3ulual5h9h80v2k4' -H 'Content-Type: application/json'  http://64.227.36.254:31121/search.php 

-X [REQUEST METHOD] e.g. POST,GET

-d [HTTP POST DATA] e.g. json data or strings

-b '[SESSION COOKIE] e.g. name=value pairs

-H [HEADER] e.g. pass custom headers (Content-Type, User-Agent, etc...)


API's

Retrieving items from an API (looking for a city called "HTB_City")

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

Adding a new item to an existing table as json (POST)

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

Using Browser Dev Tools with a fetch command (POST):

fetch('http://68.183.36.105:32166/api.php/city/', {
  method: 'POST',
  body: JSON.stringify({
    city_name: 'HTB',
    country_name: 'HTB'
  }),
  headers: {
    'Content-type': 'application/json; charset=UTF-8'
  }
})

We can use OPTIONS to see what options can use.


PUT is used to update/overwrite 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'

PATCH is used to update partial data in an entry

DELETE is used to remove an entry

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

Recent Posts

See All

Comments


bottom of page