1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
| #!/usr/bin/python
#-*- coding:UTF8 -*-#
import cherrypy
from pierky.ipdetailscache import IPDetailsCache
import geocoder, os, socket, dns, dns.resolver, os.path
class MonSiteWeb:
def index(self):
return '<!DOCTYPE html>' \
'<html>' \
'<head>' \
'<title>' \
'</title>' \
'</head>' \
'<style type="text/css">' \
'body {' \
'margin: auto;' \
'padding: 10px;' \
'text-align: center;' \
'}' \
'.centre {' \
'margin-top: 140px;' \
'position: center;' \
'}' \
'input[type="text"]{' \
'height: 30px;' \
'width: 400px;' \
'font-size: 19px;' \
'border-radius: : 2px solid gray;' \
'margin-left: 20px;' \
'box-shadow:1px 1px 1px gray;' \
'}' \
'input[type="submit"]{' \
'height: 40px;' \
'width: 100px;' \
'font-size: 17px;' \
'font-weight: bolder;' \
'background: lightblue;' \
'box-shadow:1px 1px 1px gray;' \
'cursor:pointer;' \
'}' \
'.audit{' \
'font-family: Georgia;' \
'font-size: 50px;' \
'font-weight: bolder' \
'}' \
'</style>' \
'<body>' \
'<form class = centre action ="resultat" method = "GET">' \
'<form action ="whois" method = "GET">' \
'<span class="audit"> Audit Site Web </span>' \
'<p>' \
'<input type="text" name="name" placeholder="Entrer URL">' \
'<input type="submit" value="Scan">' \
'</p>' \
'</form>' \
'</form>' \
'</body>' \
'</html>'
index.exposed = True
def resultat(self, name=None):
if name:
vari = socket.gethostbyname(name)
self.val = name
output=('''<a href = "whois"><br>Whois</a><br>'''
'''<a href = "mail">Mail</a><br>'''
'''<a href = "dns">Dns</a><br>'''
'''<a href = "localisation">Localisation</a><br>'''
'''<a href = "asn">Asn</a><br>'''
'''<a href = "transfert_zone">Transfert zone</a><br>''')
return (vari,output)
else:
return 'Veuillez fournir une URL <a href="/">ici</a> SVP!.'
resultat.exposed = True
def whois(self, name=None):
if name:
command = "whois" + " " + name
process = os.popen(command)
results = str(process.read())
else:
results = 'Erreur de collection de données'
return results
whois.exposed = True
def mail(self, name = None):
rpnse = dns.resolver.query(name, 'MX') # the variable 'reponse' contains the value MX of dns server
for rdata in rpnse:
return("mail server:", rdata.exchange) # show the server mail
mail.exposed = True
def dns(self, reponse):
contenu = dns.resolver.query(reponse, 'NS') # the variable 'contenu' contains the value NS of dns server
for resultat in contenu:
return("seveurs DNS:", resultat) # show all name servers dns
dns.exposed = True
def localisation(self, reponse):
i = geocoder.maxmind(socket.gethostbyname(reponse))
a = i.json
for local, loac in a.items():
return local, ":", loac
localisation.exposed = True
def asn(self, reponse):
cache = IPDetailsCache() # call the Class 'IPDetailsCache()'
r = cache.GetIPInformation(socket.gethostbyname(reponse)) # use the 'GetIPInformation()' methods
for cle, valeur in r.items(): # select the items methods for show 'cle and valeur' values in boucle
return cle, ":", valeur
asn.exposed = True
def transfert_zone(self, reponse):
command1 = "dnsmap" + " " + reponse
process1 = os.popen(command1) # appel d'un commande systeme "popen" ppur executer la commande au dessus
results1 = str(process1.read()) # convertion du resultat en chaine de caractere et stockage dans une variable
return results1
transfert_zone.exposed = True
settings = os.path.join(os.path.dirname(__file__), 'server_config')
if __name__ == '__main__':
cherrypy.quickstart(MonSiteWeb(),config= settings ) |
Partager