本文整理匯總了Python中glastopf.glastopf.GlastopfHoneypot.stop_background_workers方法的典型用法代碼示例。如果您正苦於以下問題:Python GlastopfHoneypot.stop_background_workers方法的具體用法?Python GlastopfHoneypot.stop_background_workers怎麽用?Python GlastopfHoneypot.stop_background_workers使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類glastopf.glastopf.GlastopfHoneypot
的用法示例。
在下文中一共展示了GlastopfHoneypot.stop_background_workers方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: len
# 需要導入模塊: from glastopf.glastopf import GlastopfHoneypot [as 別名]
# 或者: from glastopf.glastopf.GlastopfHoneypot import stop_background_workers [as 別名]
args = parser.parse_args()
#prepare directory if workdir directory contains no files or if we are asked to do it.
if args.prepare or len(os.listdir(args.workdir)) == 0:
GlastopfHoneypot.prepare_environment(args.workdir)
conf_parser = ConfigParser()
if not os.path.isfile("glastopf.cfg"):
sys.exit("Could not find configuration file: glastopf.cfg")
conf_parser.read("glastopf.cfg")
if conf_parser.getboolean("logging", "filelog_enabled"):
logfile = conf_parser.get("logging", "logfile")
else:
logfile = None
logconsole = conf_parser.getboolean("logging", "consolelog_enabled")
logger = logging.getLogger()
setup_logging(logconsole, logfile)
host = conf_parser.get("webserver", "host")
port = conf_parser.getint("webserver", "port")
honeypot = GlastopfHoneypot(work_dir=args.workdir)
honeypot.start_background_workers()
wsgi_wrapper = GlastopfWSGI(honeypot)
try:
WSGIServer((host, port), wsgi_wrapper.application, log=None).serve_forever()
except KeyboardInterrupt as ex:
honeypot.stop_background_workers()