Skip to content

Instantly share code, notes, and snippets.

@nknskn
Created June 1, 2020 12:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nknskn/9de287999ae52fe730fdbc0aa7ae0083 to your computer and use it in GitHub Desktop.
Save nknskn/9de287999ae52fe730fdbc0aa7ae0083 to your computer and use it in GitHub Desktop.
AutoRecon wrapper for OSCP lab
#!/bin/bash
function Usage () {
echo "Usage: $(basename $0) -f <IP list file>"
echo
echo "Depends on : autorecon.py"
echo " If you have not cloned, clone autorecon repository."
echo " git clone https://github.com/Tib3rius/AutoRecon"
exit 1
}
TOOLPATH=$(locate autorecon.py)
MONITORINGNAME="autorecon"
MAXPROCESSES=4
if echo "${TOOLPATH}" | grep -s -q ${MONITORINGNAME} ; then
echo -e "[I] ${MONITORINGNAME} is installed, Scanning will be started.\n"
else
echo -e "[!] ${MONITORINGNAME} is not installed!"
echo -e "[-] Error."
echo
Usage
fi
while getopts ":f:h" OPT
do
case ${OPT} in
f) IFS=$IFS_SAVE
IFS=$'\n'
IPLIST=(`cat "${OPTARG}"`) ;;
h) Usage ;;
:) echo "[!] Undefined option."; Usage ;;
\?) echo "[!] Undefined option."; Usage ;;
esac
done
for line in ${IPLIST[@]}
do
echo "[I] Scan start: ${line}"
${TOOLPATH} ${line} &
while [ $(ps -ef | grep -v grep | grep ${MONITORINGNAME} | rev | cut -d" " -f1 | rev | sort -u | wc -l) -gt ${MAXPROCESSES} ]
do
sleep 60
echo "============================================"
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment