curl
most important parameters according to chatGPT
- -X, –request: To specify the HTTP request method (GET, POST, PUT, DELETE).
- -H, –header: For including custom headers in the request.
- -d, –data: Used for sending data with POST requests, commonly for form data or JSON.
- -o, –output: To save the response content to a local file.
- -L, –location: For automatically following HTTP redirects.
- -u, –user: To provide HTTP authentication credentials (username:password).
- -k, –insecure: For bypassing SSL certificate verification.
- -I, –head: To retrieve and display only the response headers.
Files
- You can Download or Upload files
# download
curl -O https://example.com/file.zip
# upload
curl -F "file=@localfile.txt" https://example.com/upload
sending E-Mails
Send an email through curl:
# Mail template
From: from@steh.de
To: to@steh.de
Subject: curl E-Mail
Hey,
this is an email sent using curl.
# Send mail
curl -vk smtp://mailserver.de --mail-from from@steh.de --mail-rcpt to@steh.de --ssl --upload-file mail.txt
send requests to webapps
# Find values for request
curl -X GET http://XX.XX.XX.XX/admin.php
# specify user agent
curl -A "My User Agent" https://example.com
# Send data
curl -X POST -d "username=admin" -d "password=admin" http://XX.XX.XX.XX/admin.php