Skip to content

Instantly share code, notes, and snippets.

@vzool
Last active May 27, 2024 14:22
Show Gist options
  • Save vzool/adc3eba2af39b0db50e6 to your computer and use it in GitHub Desktop.
Save vzool/adc3eba2af39b0db50e6 to your computer and use it in GitHub Desktop.
cURL Penetration Test

cURL Penetration Test

Get Cookie
curl -v --cookie "USER_TOKEN=Yes" http://127.0.0.1:5000/
Send data with fields
curl --data "param1=value1&param2=value2" https://example.com/resource.cgi
Send Multipart
curl --form "fileupload=@my-file.txt" https://example.com/resource.cgi
Multipart file with fields
curl --form "fileupload=@my-file.txt;filename=desired-filename.txt" --form param1=value1 --form param2=value2 https://example.com/resource.cgi
Send data to Service with Cookies
curl -b "ci_session=8ad6dfbc383e069acfbf392d217314bdc9f07957" "USER_TOKEN=Yes" --data "title=اختبار من سطر الأوامر&title_en=Data from terminal" http://127.0.0.1/
Without any data
curl --data '' https://example.com/resource.cgi

curl -X POST https://example.com/resource.cgi

curl --request POST https://example.com/resource.cgi
Shell For Loop #1 from 1 to 100
#!/bin/ksh
# Tested with ksh version JM 93t+ 2010-03-05
for i in {1..100}
do
 # your-unix-command-here
 echo $i
done
Shell For Loop #2 from 1 to 100
#!/bin/bash
# Tested using bash version 4.1.5
for ((i=1;i<=100;i++));
do
   # your-unix-command-here
   echo $i
done
Dealing With Older KSH88 or Bash shell
#!/usr/bin/ksh
c=1
while [[ $c -le 100 ]]
do
  # your-unix-command-here
   echo "$c"
   let c=c+1
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment