index.py

来自「honeyd1.0的源代码 希望对大家有用」· Python 代码 · 共 54 行

PY
54
字号
import honeydimport timeimport supportfrom htmltmpl import TemplateManager, TemplateProcessorglobal counterself.send_response(200)self.send_header("Content-Type", "text/html")self.send_nocache()self.end_headers()# Compile or load already precompiled template.template = TemplateManager().prepare(self.root+"/templates/index.tmpl")tproc = TemplateProcessor(0)# Process commands given to usmessage = support.parse_query(self.query)# Set the title.tproc.set("title", "Honeyd Administration Interface")# Testtry:    counter += 1except:    counter = 1greeting = ("Welcome to the Honeyd Administration Interface."            "You are visitor %d.<p>") % countercontent = support.interface_table()content += "<p>" + support.stats_table(self.root) + "</p>\n"content += "<p>" + support.status_connections(self.root, "tcp") + "</p>\n"content += "<p>" + support.status_connections(self.root, "udp") + "</p>\n"side_content = ("<div class=graphs>"                "<img height=155 width=484 src=/graphs/traffic_hourly.gif><br>"                "<img height=155 width=484 src=/graphs/traffic_daily.gif>"                "</div>")support.security_check(tproc)if message:    tproc.set("message", message)tproc.set("greeting", greeting)tproc.set("content", content)tproc.set("side_content", side_content)tproc.set("uptime", support.uptime())# Print the processed template.self.wfile.write(tproc.process(template))

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?