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

Linux command: Check Current Shell

What is your current shell ?

Java: Free Online Courses

The Java™ Tutorials by Oracle The Java Tutorials are practical guides for programmers who want to use the Java programming language to create applications. They include hundreds of complete, working examples, and dozens of lessons. Groups of related lessons are organized into "trails". https://docs.oracle.com/javase/tutorial/ Learn to Program in Java at edX.ogr Get started on the path to becoming a software engineer by learning core coding skills in Java—one of the most popular programming languages. https://www.edx.org/course/learn-to-program-in-java-0 Java Tutorial by javapoint.com https://www.javatpoint.com/java-tutorial Java Tutorial by SoloLearn.com I love SoloLearn because I can learn Java - and other popular programming languages - anywhere, any time on your mobile devices. https://www.sololearn.com/Course/Java/ Java on Azure https://docs.microsoft.com/en-us/learn/paths/java-on-azure/

Powershell: Get-ChildItem

List, search/find files and directories with Get-ChildItem cmdlet.