Skip to content
Extraits de code Groupes Projets
Valider 326572ba rédigé par Sylvain "Cloud" MARET's avatar Sylvain "Cloud" MARET
Parcourir les fichiers

initial commit

parent
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
#!/usr/bin/env python
# coding: utf-8
from iptools.ipv4 import long2ip as lip
import sys
def main(argv):
country = sys.argv[1]
ips = country+'.ips'
csv = country+'.csv'
input_file = open(csv,"r")
output_file = open(ips,"w")
for line in input_file:
temp = line.replace('"',' ')
temp = temp.replace(","," ")
target = temp.split()
for i in range(int(target[0]), int(target[1])):
ip=lip(i)
output_file.write(ip+"\n")
input_file.close()
output_file.close()
print(csv+" created")
if __name__ == "__main__":
main(sys.argv[1:])
#!/bin/bash
# test if there is a country as 1st argument
if [ $# -ne 1 ]
then
echo "incorrect number of argument"
echo "example : ./get_country_csv.sh France"
exit
fi
# download and extract database if missing
if [ ! -f "IP2LOCATION-LITE-DB1.CSV" ]
then
wget https://download.ip2location.com/lite/IP2LOCATION-LITE-DB1.CSV.ZIP
unzip IP2LOCATION-LITE-DB1.CSV.ZIP
rm IP2LOCATION-LITE-DB1.CSV.ZIP
fi
# generate csv
echo "[INFO] generate csv"
grep $1 IP2LOCATION-LITE-DB1.CSV > $1.csv
echo "[INFO] generate IPs"
python conversion.py $1
echo "[INFO] scanning port 445 for exposed windows machines"
sudo masscan -p445 -iL $1.ips -oG $1.445.scan && cat $1.445.scan | wc -l
echo "[INFO] scanning port 53 udp to find exposed DNS"
sudo masscan -pU:53 -iL $1.ips -oG $1.53.scan && cat $1.53.scan | wc -l
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter