Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #a test script to test how the api call to get badgeback emails for the given email list handles shitload of parameters
- #(a kinda bruteforce test because the api should split dabase queries into multiple parts when there are enough #parameters)
- function help {
- echo "USAGE: ./test1.sh or ./test1.sh help for showing help message. example: ./test1.sh > results.json to redirect output to another file"
- exit 0
- }
- if [ $# -eq 1 ]
- then
- if [ $1 == "help" ]
- then
- help
- fi
- fi
- api_url="<enkerro>"
- authorization="<enkerro>"
- #parameters for the api call, a list of emails
- #file containing thousands of fake and non-fake email addresses
- file="emails.txt"
- #how many parameters
- mail_count=$(cat $file | wc -l)
- #convert to integer by adding 0:p
- mail_count=$(($mail_count+0))
- #echo $mail_count
- #form the json array for the emails
- json_arr="["
- i=1
- quote="\""
- #kinda like "join" call in another languages, forms a comma separated list in the form of ["mail1","mail2","mail3",...."mailn"]
- while read line
- do
- json_arr+=$quote
- json_arr+=$line
- json_arr+=$quote
- if [ $i -ne $mail_count ]
- then
- json_arr+=","
- fi
- i=$((i + 1))
- done <$file
- json_arr+="]"
- json_data="{\"mails\":$json_arr}"
- #echo $json_data
- curl -X POST -H 'Content-Type: application/json' -d $json_data $api_url --user $authorization
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement