def main(servers, proxyPorts, uiPort, launchUI): """Runs the proxy forever or until a 'KILL' command is received or someone hits Ctrl+Break.""" _createProxies(servers, proxyPorts) httpServer = UserInterfaceServer(uiPort) proxyUI = ProxyUserInterface(state, _recreateState) httpServer.register(proxyUI) Dibbler.run(launchBrowser=launchUI)
def runUIAndProxy(): httpServer = UserInterfaceServer(8881) proxyUI = ProxyUserInterface(state, _recreateState) httpServer.register(proxyUI) BayesProxyListener('localhost', 8110, ('', 8111)) state.bayes.learn(tokenizer.tokenize(spam1), True) state.bayes.learn(tokenizer.tokenize(good1), False) proxyReady.set() Dibbler.run()
def main(state): """Runs the core server forever or until a 'KILL' command is received or someone hits Ctrl+Break.""" http_server = UserInterfaceServer(state.ui_port) http_server.register(CoreUserInterface(state)) Dibbler.run(launchBrowser=state.launch_ui)
def runProxy(): global bayes bayes = Classifier() trainer = SMTPTrainer(bayes, state) BayesSMTPProxyListener('localhost', 8025, ('', 8026), trainer) Dibbler.run()
def runProxy(): trainer = SMTPTrainer(Classifier(), state) BayesSMTPProxyListener('localhost', 8025, ('', 8026), trainer) Dibbler.run()
def change_db(): classifier = storage.open_storage(*storage.database_type(opts)) message.Message.message_info_db = message_db imap_filter = IMAPFilter(classifier, message_db) httpServer = UserInterfaceServer(options["html_ui", "port"]) pwds = [ x[2] for x in servers_data ] httpServer.register(IMAPUserInterface(classifier, imaps, pwds, IMAPSession, stats=stats, close_db=close_db, change_db=change_db)) launchBrowser = launchUI or options["html_ui", "launch_browser"] if sleepTime: thread.start_new_thread(Dibbler.run, (), {"launchBrowser":launchBrowser}) else: Dibbler.run(launchBrowser=launchBrowser) if doClassify or doTrain: imaps = [] for server, username, password in servers_data: imaps.append(((server, imapDebug, doExpunge), username, password)) options.set_restore_point() while True: for (server, imapDebug, doExpunge), username, password in imaps: imap = IMAPSession(server, imapDebug, doExpunge) if options["globals", "verbose"]: print "Account: %s:%s" % (imap.server, imap.port) if imap.connected: basedir = os.path.dirname(optionsPathname) fn1 = os.path.join(basedir, imap.server + ".ini") fn2 = os.path.join(basedir,
def runProxy(): trainer = None BayesSMTPProxyListener('localhost', 8025, ('', 8026), trainer) proxyReady.set() Dibbler.run()
else: if options["imap", "use_ssl"]: port = 993 else: port = 143 imap_filter = IMAPFilter(classifier) # Web interface if not (doClassify or doTrain): if server != "": imap = IMAPSession(server, port, imapDebug, doExpunge) httpServer = UserInterfaceServer(options["html_ui", "port"]) httpServer.register(IMAPUserInterface(classifier, imap, pwd, IMAPSession)) Dibbler.run(launchBrowser=launchUI or options["html_ui", "launch_browser"]) else: while True: imap = IMAPSession(server, port, imapDebug, doExpunge) imap.login(username, pwd) if doTrain: if options["globals", "verbose"]: print "Training" imap_filter.Train() if doClassify: if options["globals", "verbose"]: print "Classifying" imap_filter.Filter() imap.logout()