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

Ansible on Fedora Workstation 30

RedHat acquired Ansible in 2015 .

MSSQL: Fix error 'Consistency validation for SQL Server registry keys'

While installing Microsof SQL Server 2012, I ran into the following error. "The SQL Server registry keys from a prior installation cannot be modified. To continue, see SQL Server Setup documentation about how to fix registry keys." How to fix Replace the D:\x64\FixSqlRegistryKey_x86.exe file with the original file from the ENU\SQLFULL_ENU.iso file downloading from Microsoft Download Center. This ISO file is 4.2GB. So you can click FixSqlRegistryKey_x86.exe to download this file only. After replacing that file, press Re-run to check. All rules are passed.

Install Microsoft .NET Core SDK

.NET Core Software Development Kit (SDK) is a set of libraries and tools that allow developers to create .NET Core applications and libraries.