Created
October 29, 2018 23:11
-
-
Save dwisiswant0/c88817b5b27c0d03d448f3055142220d to your computer and use it in GitHub Desktop.
Mass cURL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Mass cURL | |
# i made it for Sublist3r purposes | |
# -- | |
# dw1, 2018 | |
FILE=$1 | |
RESULT_RESPONSE="" | |
PROTO="http" | |
function _help() { | |
echo -e "Usage: bash $0 domain_lists.txt -o=domain_results.txt [--verbose] [-F]..." | |
echo -e "Options:" | |
echo -e " -F, --follow-redirect Follow redirects" | |
echo -e " -S, --ssl Request with HTTPS protocol" | |
echo -e " -o, --output=FILE Write to FILE instead of all responses" | |
echo -e " -v, --verbose Show exception" | |
echo -e " --timeout=SECOND Maximum time allowed for request" | |
exit | |
} | |
for i in "$@" | |
do | |
case $i in | |
-h|--help) | |
_help | |
;; | |
-F|--follow-redirect) | |
OPT_FOLLOW="1" | |
shift | |
;; | |
-S|--ssl) | |
OPT_SSL="1" | |
shift | |
;; | |
-v|--verbose) | |
OPT_VERBOSE="1" | |
shift | |
;; | |
-o=*|--output=*) | |
OPT_OUTPUT="${i#*=}" | |
shift | |
;; | |
--timeout=*) | |
OPT_TIMEOUT="${i#*=}" | |
if [[ ! $OPT_TIMEOUT =~ ^-?[0-9]+$ ]]; then | |
_help | |
fi | |
shift | |
;; | |
esac | |
done | |
if [[ -z "${OPT_SSL}" ]]; then | |
PROTO="https" | |
fi | |
if [[ ! -z "${OPT_TIMEOUT}" ]]; then | |
OPT_TIMEOUT="--connect-timeout ${OPT_TIMEOUT}" | |
else | |
OPT_TIMEOUT="--connect-timeout 5" | |
fi | |
if [[ ! -z "${OPT_SSL}" ]]; then | |
OPT_SSL="-L" | |
fi | |
if [[ -z "$1" ]]; then | |
_help | |
else | |
while IFS='' read -r LINE || [[ -n "$LINE" ]]; do | |
head="-------------------- $LINE --------------------" | |
curl=`curl -sD - ${OPT_SSL} "${PROTO}://$LINE" ${OPT_TIMEOUT} -o /dev/null` | |
response="$head\n$curl" | |
if [[ ! -z "$curl" ]]; then | |
echo -e "$response" | |
RESULT_RESPONSE="${RESULT_RESPONSE}${response}" | |
else | |
if [[ ! -z "${OPT_VERBOSE}" ]]; then | |
echo -e "$response" | |
RESULT_RESPONSE="${RESULT_RESPONSE}${response}" | |
fi | |
fi | |
done < $FILE | |
if [[ ! -z "${OPT_OUTPUT}" ]]; then | |
echo -e "$RESULT_RESPONSE" > $OPT_OUTPUT | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment