Ejemplo n.º 1
0
    def __init__(self, verbose, interface, exclude_ips, clean, output_dir, frontend, address):
        self.verbose = verbose
        self.exclude_ips = exclude_ips
        
        if frontend and address:
            output_dir, frontend_command = self.arrange_frontend(frontend, address)
        else:
            self.db_path = os.path.join(output_dir, 'database.db')
        
        self.output_dir = output_dir 
        self.raw_dir = os.path.join(output_dir, 'raw')
        self.images_dir = os.path.join(output_dir, 'images')

        if clean: self.clean_workspace()

        self.init_directories()
        self.init_sqlite_db()
        self.start_output_dir_listener()

        if frontend:
            print 'Starting the %s frontend at http://%s.' % (frontend, address)
            utils.start_subprocess(frontend_command, True) # needs db

        self.start_threads(True)

        self.tcpflow = TcpflowWrapper(verbose)
        self.xml_report_path = os.path.join(self.raw_dir, 'report.xml')
        self.tcpflow.as_main_process(interface, self.raw_dir)
Ejemplo n.º 2
0
    def as_main_process(self, interface, output_dir):
        tcpflow = 'tcpflow -i ' + interface + ' -e http -o ' + output_dir
        try:
            proc = utils.start_subprocess(tcpflow, self.verbose)

            while proc.poll() is None:
                if self.verbose: print proc.stdout.readline()

        except KeyboardInterrupt:
            print 'Got Keyboard interrupt. Stopping..'