Opera, or FireFox)
- cURL command line tool.
cURL (Client URL) is a command-line utility and library that primarily supports HTTP along with many other protocols such as HTTPS, IMAP, POP3, SCP, SFTP, FTP and Many More.
Due to this compatibility to communicate with a vast number of essential protocols, it makes a good choice for scripts as well as automation, making it easier to send various types of web requests from the command line.
$ curl example.com
Perform a basic **HTTP Request** to 'example.com' by passing the URL as an **argument** to the **cURL** command.
Unlike a web browser, cURL does not render the HTML/JavaScript/CSS code. Instead, it prints the output in its raw format. This allows penetration testers, primarily interested in the request and response context, to send requests more quickly and conveniently than with a web browser.
We can also use cURL to download a page or file and output the content into a file.
$ curl -O http://example.com/index.html
-O (Output)
flag.As mentioned earlier, when accessing the root path (/
), the server typically returns a default index page (200 OK) (e.g., index.html
or index.php
). Then the ls
command is executed successfully, the index.html
file should be downloaded on the system.
$ curl -o file.txt http://example.com/
-o [Name] (output)
flag $ curl -O example.com/index.html
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1256 100 1256 0 0 4250 0 --:--:-- --:--:-- --:--:-- 4243
cURL still processed some of the status into the terminal while processing the HTTP request. We can silent the status with the -s
flag.
Finally cURL's help parameter -h
which is available to show what options we may use with cURL.
$ curl -h
Usage: curl [options...] <url>
-d, --data <data> HTTP POST data
-h, --help <category> Get help for commands
-i, --include Include protocol response headers in the output
-o, --output <file> Write to file instead of stdout
-O, --remote-name Write output to a file named as the remote file
-s, --silent Silent mode
-u, --user <user:password> Server user and password
-A, --user-agent <name> Send User-Agent <name> to server
-v, --verbose Make the operation more talkative
$ curl --help-all
$ curl --help category (e.g http)
$ man curl
Q: To get the flag, start the above exercise, then use cURL to download the file returned by '/download.php' in the server shown above.
A: HTB{64$!c_cURL_u$3r}