Skip to main content

Linux command: curl

curl - Transfer a URL

cURL source code on GitHub:

For Windows, head to curl for windows

curl: see url, or Client for URLs

curl --help
curl -O url
curl -o filename url
curl -I url : Get HEADERS

GET request

$ curl https://api.ipify.org
123.20.185.131

Get HEADERS

$ curl -i https://api.ipify.org
HTTP/1.1 200 OK
Server: Cowboy
Connection: keep-alive
Content-Type: text/plain
Vary: Origin
Date: Mon, 16 Dec 2019 10:13:37 GMT
Content-Length: 13
Via: 1.1 vegur

171.250.70.42

-i vs. -I

# curl -i http://10.10.164.134/info
HTTP/1.1 200 OK
Server: nginx/1.14.1
Date: Sat, 01 May 2021 05:21:23 GMT
Content-Type: application/json
Content-Length: 160
Connection: keep-alive
Build Number: 1.3.4-dev
Server Name: Vincent

"The login API needs to be called with the username and password form fields fields.  It has not been fully tested yet so may not be full developed and secure"

# curl -I http://10.10.164.134/info
HTTP/1.1 200 OK
Server: nginx/1.14.1
Date: Sat, 01 May 2021 05:21:34 GMT
Content-Type: application/json
Content-Length: 148
Connection: keep-alive
Build Number: 1.3.6-final
Server Name: Julias

#

POST request

$ curl https://www.hackthebox.eu/api/invite/how/to/generate -X POST
{"success":1,"data":{"data":"Va beqre gb trarengr gur vaivgr pbqr, znxr n CBFG erdhrfg gb \/ncv\/vaivgr\/trarengr","enctype":"ROT13"},"0":200}          

Login form with username and password

curl -X POST -F 'username=bob' -F 'password=d1ff3r3ntP@55w0rd' http://10.10.226.201:8080/login

Grep all email addresses on web page

curl windcorp.thm | grep -E -o "\b[a-zA-Z0-9.-]+@[a-zA-Z0-9.-]+[a-zA-Z0-9.-]+\b"

References

Daniel Stenberg on LinkedIn.

Popular posts from this blog

Microsoft Windows Server 2012 R2 Standard Evaluation Product Key

Microsoft Windows Server 2012 R2 Standard Evaluation D2N9P-3P6X9-2R39C-7RTCD-MDVJX DBGBW-NPF86-BJVTX-K3WKJ-MTB6V

ManageEngine ServiceDesk Plus - Reset password

Let's reset the default administrator's password to 'admin'

hmailserver: Notes from the field

hmailserver is one of free open source mail servers running on Microsoft Windows operating system.