http.py
import tornado.ioloop,os
import tornado.web
import unit,socket
user='yk'
passwd='123'
class MainHandler(tornado.web.RequestHandler):
def get(self):
self.write('''
<form id="form1" name="form1" method="post" action="">
<table width="276" border="0" align="center">
<tr>
<th width="266" scope="col">目标: <input name="ip" type="text" value="www.google.com" /></th>
</tr>
<tr>
<th scope="row">
<input type="submit" value="提交" />
</th>
</tr>
</table>
</form>
''')
def post(self):
tar=self.get_argument("ip")
self.set_secure_cookie("tar", tar)
self.redirect("/post")
class ScanHandler(tornado.web.RequestHandler):
def get(self):
tar=self.get_secure_cookie("tar").decode().strip()
ip=socket.gethostbyname(tar)
#print(act)
#显示cookie
#self.write(self.get_secure_cookie("user_id"))
#self.render("template.html", title="My title", items=items)
try:
act=self.get_argument("act")
if act=='port':
port=unit.scanport(tar)
print(port)
self.render("dict.html", name='端口',value='结果',tar=tar,ip=ip,items=port)
elif act=='http':
head=unit.gethead(tar)
self.render("dict.html", name='头',value='值',tar=tar,ip=ip,items=head)
elif act=='whois':
#ipwhois=unit.ipwhois(tar)
whois=unit.whois(tar)
print(whois)
whoisdb={}
whoisdb['内容']=whois
self.render("dict.html", name='名称',value='whois内容',tar=tar,ip=ip,items=whoisdb)
elif act=='trac':
tra=unit.trac(tar)
self.render("list.html", name='途径IP',ip&#