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

Qwiklabs: Notes

Qwiklabs was launched in 2012, and was acquired by Google in November 2016. It is a hands-on lab platform for learning GCP and AWS.

Fedora Workstation: Install snapd

[tuyen@g73jh ~]$ sudo dnf -y install snapd Last metadata expiration check: 0:20:17 ago on Tue 01 Oct 2019 11:31:30 AM +07. Dependencies resolved. ================================================================================ Package Architecture Version Repository Size ================================================================================ Installing: snapd x86_64 2.41-1.fc30 updates 17 M Installing dependencies: snap-confine x86_64 2.41-1.fc30 updates 2.8 M snapd-glib x86_64 1.49-1.fc30 updates 133 k snapd-selinux noarch 2.41-1.fc30 updates 234 k Installing weak dependencies: gnome-software-snap x86_64 3.32.4-2.fc30 updates 86 k Transaction Summary ================================================================================ Install 5 Packages Total download size...

Apache Airflow: Notes

Apache Airflow is used to programmatically author, schedule and monitor workflows.