def _run(self, logger): PingScan(self.__args.destination, self._output_dir, self.__args.nmap_optimize, "PingScan")._run(self.__ip_file_to_scan, logger) if self.__args.is_alive else self.__ip_file_to_scan.write("\n".join([ip.strip() for ip in self.__args.destination.split(",")])) self.__ip_file_to_scan.seek(0) logger._logging("START: Active Scan Against: {0}".format(", ".join([ip.rstrip() for ip in self.__ip_file_to_scan]))) port_scan = PortScan(self.__args.config_file, self._output_dir, self.__ip_file_to_scan, self.__args.nmap_optimize, "PortScan") os_scan = OsScan(self._output_dir, self.__ip_file_to_scan, self.__args.nmap_optimize, "OsScan") script_scan = ScriptScan(self.__args.config_file, self._output_dir, self.__ip_file_to_scan, self.__args.nmap_optimize, "ScriptScan") thread_list = [] try: for counter, func in enumerate(( port_scan, os_scan, script_scan)): thread_number = "t_{0}".format(counter) thread_number = Thread(target = func._run, args = (logger,)) thread_number.start() thread_list.append(thread_number) for t in thread_list: t.join() logger._logging("Finished Active Scan. Results saved in {0} folder".format(self._output_dir)) except Exception, err: Core.print_error(err)
def get_sentence(id, words): response.content_type = 'application/json' c = Core() c.makeAnswer(words) return json.dumps({ "msg": c.getAnswer(), "cacheTime": 10000, "waitResponce": False, "understand": False, "users_ids": [id], })
def _run(self, logger): PingScan(self.__args.destination, self._output_dir, self.__args.nmap_optimize, "PingScan")._run( self.__ip_file_to_scan, logger ) if self.__args.is_alive else self.__ip_file_to_scan.write( "\n".join([ ip.strip() for ip in self.__args.destination.split(",") ])) self.__ip_file_to_scan.seek(0) logger._logging("START: Active Scan Against: {0}".format(", ".join( [ip.rstrip() for ip in self.__ip_file_to_scan]))) port_scan = PortScan(self.__args.config_file, self._output_dir, self.__ip_file_to_scan, self.__args.nmap_optimize, "PortScan") os_scan = OsScan(self._output_dir, self.__ip_file_to_scan, self.__args.nmap_optimize, "OsScan") script_scan = ScriptScan(self.__args.config_file, self._output_dir, self.__ip_file_to_scan, self.__args.nmap_optimize, "ScriptScan") thread_list = [] try: for counter, func in enumerate((port_scan, os_scan, script_scan)): thread_number = "t_{0}".format(counter) thread_number = Thread(target=func._run, args=(logger, )) thread_number.start() thread_list.append(thread_number) for t in thread_list: t.join() logger._logging( "Finished Active Scan. Results saved in {0} folder".format( self._output_dir)) except Exception, err: Core.print_error(err)
class Main(object): def __init__(self): usage = "usage for --help for further information" description = "use winose for sniffing application layer network packets" parser = argparse.ArgumentParser(description=description, usage=usage) parser.add_argument( '-p', '--process', dest='process', action='store', help= 'Must enter specific process with .exe name example="iexplorer.exe" ', required=True) parser.add_argument('-l', '--log', dest='log_file', action='store', help='Log File', metavar='FILE', default="winose.log") parser.add_argument('-v', '--verbose', dest='verbose', action='store_true', help='Verbose Output', default=None) try: self.args = parser.parse_args() except Exception, err: err try: self.__logger = Logger(self.args.log_file, self.args.verbose) except Exception, err: Core.print_error(err)
try: import tempfile from lib.core.core import Core, InitDirFile from lib.core.config_parser import ConfigParser except ImportError, err: from lib.core.core import Core Core.print_error(err) class WebScan(InitDirFile): def __init__(self, args): self._scan_options = ConfigParser.get_screen_ports(args.config_file) core_options = "-n -Pn -T5 --open -p T:{0}".format( self._scan_options ) if self._scan_options else "-n -Pn -T5 --open -p T:80,443" self._result_file = tempfile.NamedTemporaryFile(mode='w+t') InitDirFile.__init__(self, [ Core._commands_path["phantomjs"], Core._commands_path["nmap"], args.rasterize ], args, "screen") if args.destination: __destination = " ".join( [ip.strip() for ip in args.destination.split(",")]) self._nmap_options = "{0} {1} -oG {2} {3}".format( core_options, Core._nmap_optimize, self._result_file.name, __destination ) if args.nmap_optimize else "{0} -oG {1} {2}".format( core_options, self._result_file.name, __destination)
try: import re import shlex import datetime import subprocess from lib.core.core import Core from lib.screen.webscan import WebScan from lib.core.threadpool import Worker,ThreadPool except ImportError, err: from lib.core.core import Core Core.print_error(err) class ScreenScan(WebScan): def __init__(self, args): self.__urls = [] self.__args = args WebScan.__init__(self, self.__args) def _run(self, logger): cmd = "{0} {1}".format(Core._commands_path["nmap"], self._nmap_options) logger._logging("START: Nmap Screen Scan: {0}".format(cmd)) cmd_list = shlex.split(cmd) proc = subprocess.Popen(cmd_list, stdout = subprocess.PIPE, stderr = subprocess.PIPE,).communicate()
def _run(self): try: WinoseManager.Manager(self.args.process) except Exception, err: Core.print_error(err)