예제 #1
0
def setupProject(project):
    orig_filename = project.application().getInputFilename("OGG/Vorbis file")
    mangle = OggMangle(project, orig_filename)
    if not INCR_MANGLE:
        mangle.hard_min_op = 1
        mangle.hard_max_op = 100
    else:
        from fusil.incr_mangle_op import InverseBit, Increment
        mangle.operations = (InverseBit, Increment)
    mangle.max_filesize = FILESIZE

    process = OggProcess(project, COMMAND, timeout=60.0)
    process.env.copy('HOME')

    if COMMAND[0] == 'ogg123':
        WatchProcess(process, exitcode_score=-0.25)
    else:
        WatchProcess(process, exitcode_score=0)
    stdout = WatchStdout(process)
    if True:
        #    stdout.max_nb_line = (5000, 1.0)
        stdout.show_matching = True
        stdout.show_not_matching = True
        stdout.addRegex(r"The file may be corrupted", -0.50)
        stdout.addRegex(r"Corrupted ogg", -0.50)
        stdout.addRegex(r"Could not decode vorbis header packet", -0.50)
        #    stdout.ignoreRegex('^Warning: Could not decode vorbis header packet')
        stdout.ignoreRegex('^Warning: sequence number gap')
        stdout.ignoreRegex('^New logical stream.*: type invalid$')
예제 #2
0
def setupProject(project):
    process = MyProcess(project, ['/usr/bin/at'], timeout=5.0)
    WatchProcess(process, exitcode_score=0.15)
    stdout = WatchStdout(process)
    stdout.ignoreRegex(r'Bug reports to')
    stdout.words['error'] = 0.10
    stdout.words['usage'] = 0.10
예제 #3
0
def setupProject(project):
    orig_filename = project.application().getInputFilename("OGG/Vorbis file")
    mangle = OggMangle(project, orig_filename)
    if not INCR_MANGLE:
        mangle.hard_min_op = 1
        mangle.hard_max_op = 100
    else:
        from fusil.incr_mangle_op import InverseBit, Increment
        mangle.operations = (InverseBit, Increment)
    mangle.max_filesize = FILESIZE

    process = OggProcess(project, COMMAND, timeout=60.0)
    process.env.copy('HOME')

    if COMMAND[0] == 'ogg123':
        WatchProcess(process, exitcode_score=-0.25)
    else:
        WatchProcess(process, exitcode_score=0)
    stdout = WatchStdout(process)
    if True:
    #    stdout.max_nb_line = (5000, 1.0)
        stdout.show_matching = True
        stdout.show_not_matching = True
        stdout.addRegex(r"The file may be corrupted", -0.50)
        stdout.addRegex(r"Corrupted ogg", -0.50)
        stdout.addRegex(r"Could not decode vorbis header packet", -0.50)
    #    stdout.ignoreRegex('^Warning: Could not decode vorbis header packet')
        stdout.ignoreRegex('^Warning: sequence number gap')
        stdout.ignoreRegex('^New logical stream.*: type invalid$')
예제 #4
0
    def setupProject(self):
        self.project.debugger.enabled = False
        FuzzedHttpServer(self.project, 8898)

        process = ProjectProcess(
            self.project,
            [
                'python3',
                '-m',
                'wpull',
                '127.0.0.1:8898',
                '--timeout',
                '2.0',
                '--tries',
                '1',
            ],
        )

        process.max_memory = 500000000

        process.env.set(
            'PYTHONPATH',
            os.path.join(os.path.abspath(os.path.dirname(__file__)), '..',
                         '..'))

        WatchProcess(process, exitcode_score=0.45)
        stdout_watcher = WatchStdout(process)
        stdout_watcher.ignoreRegex(r'Read timed out', )
        stdout_watcher.ignoreRegex(r'Error parsing status line', )
        stdout_watcher.ignoreRegex(
            r'WARNING Invalid content length: invalid literal for int')
        stdout_watcher.ignoreRegex(r'encountered an error: zlib error: ')
예제 #5
0
파일: runner.py 프로젝트: DanielOaks/wpull
    def setupProject(self):
        self.project.debugger.enabled = False
        FuzzedHttpServer(self.project, 8898)

        process = ProjectProcess(
            self.project,
            ['python3', '-m', 'wpull',
                '127.0.0.1:8898',
                '--timeout', '2.0',
                '--tries', '1',
            ],
        )

        process.max_memory = 500000000

        process.env.set(
            'PYTHONPATH',
            os.path.join(
                os.path.abspath(os.path.dirname(__file__)), '..', '..')
        )

        WatchProcess(process, exitcode_score=0.45)
        stdout_watcher = WatchStdout(process)
        stdout_watcher.ignoreRegex(
            r'Read timed out',
        )
        stdout_watcher.ignoreRegex(
            r'Error parsing status line',
        )
        stdout_watcher.ignoreRegex(
            r'WARNING Invalid content length: invalid literal for int'
        )
        stdout_watcher.ignoreRegex(
            r'encountered an error: zlib error: '
        )
예제 #6
0
def setupProject(project):
    # Some options
    DEBUG = False
    USE_STDOUT = DEBUG
    sql = GenerateSQL(project, "sql")
    if DEBUG:
        sql.max_nb_instr = 1

    # Watch mysqld process
    mysqld = AttachProcess(project, 'mysqld')
    mysqld.max_memory = 300*1024*1024
    if USE_STDOUT:
        stdout = 'file'
    else:
        stdout = 'null'

    # MySQL client used to send fuzzy SQL
    process = MysqlProcess(project, ['/usr/bin/mysql'], stdout)
    WatchProcess(process, exitcode_score=0.15, timeout_score=0.15)
    if USE_STDOUT:
        stdout = WatchStdout(process)
        stdout.ignoreRegex('You have an error in your SQL syntax; check the manual')
        if not DEBUG:
            stdout.words['error'] = 0.10
        else:
            stdout.words['error'] = 1.0

    # Watch logs
    syslog = Syslog(project)
    mysql_log = FileWatch(project, open('/var/log/mysql/mysql.log'),
        'mysql.log', start="end")
    # FileWatch(project, open('/var/log/mysql/mysql.err'), 'mysql.err', start="end"),
    logs = [
        syslog.syslog, syslog.messages,
        mysql_log,
    ]
    for log in logs:
        log.words['mysqld'] = 1.0
예제 #7
0
파일: runner.py 프로젝트: woodenphone/wpull
    def setupProject(self):
        self.project.debugger.enabled = False
        self.config.process_max_user_process = 50

        FuzzedHttpServer(self.project, 8898)

        process = ProjectProcess(
            self.project,
            [
                'python3',
                '-X',
                'faulthandler',
                '-m',
                'wpull',
                '127.0.0.1:8898',
                '--timeout',
                '2.0',
                '--tries',
                '1',
            ],
        )

        process.env.set(
            'PYTHONPATH',
            os.path.join(os.path.abspath(os.path.dirname(__file__)), '..',
                         '..'))

        WatchProcessSpecificStatusCode(process)
        stdout_watcher = WatchStdout(process)
        stdout_watcher.ignoreRegex(
            r'WARNING Invalid content length: invalid literal for int')
        stdout_watcher.ignoreRegex(r'WARNING Unable to parse URL ')
        stdout_watcher.ignoreRegex(r'WARNING Failed to read document at ')
        stdout_watcher.ignoreRegex(r'WARNING Content overrun')
        stdout_watcher.ignoreRegex(r'ERROR Fetching ')
        stdout_watcher.ignoreRegex(r'DEBUG ')
        stdout_watcher.ignoreRegex(r'INFO Fetch(ed|ing) ')
예제 #8
0
파일: runner.py 프로젝트: Super-Rad/wpull
    def setupProject(self):
        self.project.debugger.enabled = False
        self.config.process_max_user_process = 50

        FuzzedHttpServer(self.project, 8898)

        process = ProjectProcess(
            self.project,
            ['python3', '-X', 'faulthandler', '-m', 'wpull',
                '127.0.0.1:8898',
                '--timeout', '2.0',
                '--tries', '1',
            ],
        )

        process.env.set(
            'PYTHONPATH',
            os.path.join(
                os.path.abspath(os.path.dirname(__file__)), '..', '..')
        )

        WatchProcessSpecificStatusCode(process)
        stdout_watcher = WatchStdout(process)
        stdout_watcher.ignoreRegex(
            r'WARNING Invalid content length: invalid literal for int'
        )
        stdout_watcher.ignoreRegex(
            r'WARNING Unable to parse URL '
        )
        stdout_watcher.ignoreRegex(
            r'WARNING Failed to read document at '
        )
        stdout_watcher.ignoreRegex(
            r'WARNING Content overrun'
        )
        stdout_watcher.ignoreRegex(
            r'ERROR Fetching '
        )
        stdout_watcher.ignoreRegex(
            r'DEBUG '
        )
        stdout_watcher.ignoreRegex(
            r'INFO Fetch(ed|ing) '
        )
예제 #9
0
def setupProject(project):
    # Command line
    MAX_FILESIZE = 1*1024*1024
    ARGUMENTS = ['-quiet']
    MPLAYER_BIN = 'mplayer'
    NULL_VIDEO = True
    if NULL_VIDEO:
        ARGUMENTS.extend(['-vo', 'null', '-ao', 'null'])
    if True:
        SECONDS = 5
        TIMEOUT = SECONDS + 1.0
        ARGUMENTS.extend(['-endpos', str(SECONDS)])
    else:
        TIMEOUT = 7.0

    # Create buggy input file
    orig_filename = project.application().getInputFilename("Audio or video file")
    mangle = AutoMangle(project, orig_filename)
    mangle.max_size = MAX_FILESIZE

    process = MplayerProcess(project,
        [MPLAYER_BIN] + ARGUMENTS + ["<movie_filename>"],
        timeout=TIMEOUT)
    if not NULL_VIDEO:
        setupX11Process(process)
    else:
        process.env.copy('HOME')
    watch = WatchProcess(process, timeout_score=0)
    if watch.cpu:
        watch.cpu.weight = 0.20
        watch.cpu.max_load = 0.50
        watch.cpu.max_duration = min(3, TIMEOUT-0.5)
        watch.cpu.max_score = 0.50

    stdout = WatchStdout(process)

    # Ignore input errors
    stdout.ignoreRegex('^Failed to open LIRC support')
    stdout.ignoreRegex("^Can't init input joystick$")
    stdout.ignoreRegex("^Can't open joystick device ")

    # Ignore codec loading errors
    stdout.ignoreRegex('^Failed to create DirectShow filter$')
    stdout.ignoreRegex('^Win32 LoadLibrary failed')
    stdout.ignoreRegex('^Error loading dll$')
    stdout.ignoreRegex('^ERROR: Could not open required DirectShow codec ')
    stdout.ignoreRegex("could not open DirectShow")

    # Ignore other errors
    stdout.ignoreRegex("^Terminal type `unknown' is not defined.$")
    stdout.ignoreRegex('^VDecoder init failed')
    stdout.ignoreRegex("Read error at pos\. [0-9]+")
    stdout.ignoreRegex("could not connect to socket")
    stdout.ignoreRegex('^ADecoder init failed')
    stdout.ignoreRegex('^error while decoding block:')
    stdout.ignoreRegex('^Error while decoding frame!$')
    stdout.ignoreRegex('^\[(mpeg4|msmpeg4|wmv1|h264|NULL) @ ')

    stdout.patterns['overflow'] = 0.10
#    stdout.words['error'] = 0.10
#    stdout.words["can't"] = 0
    stdout.addRegex('MPlayer interrupted by signal', 1.0)
    stdout.addRegex('AVI: Missing video stream', -0.50)
    stdout.max_nb_line = None

    # Restore terminal state
    TerminalEcho(project)
예제 #10
0
    def setupProject(self):
        self.project.debugger.enabled = False
        self.config.use_cpu_probe = False
        self.config.process_max_user_process = 50

        port = 8848
        seed = random.randint(0, 60000)
        timeout = 60 * 60

        server_process = ProjectProcess(self.project, [
            'python3',
            '-m',
            'huhhttp',
            '--port',
            str(port),
            '--seed',
            str(seed),
            '--fuzz-period',
            '500',
            '--restart-interval',
            '250',
        ],
                                        timeout=timeout)
        WatchProcess(server_process)

        process = ProjectProcess(self.project, [
            'python3',
            '-X',
            'faulthandler',
            '-m',
            'wpull',
            '127.0.0.1:{0}'.format(port),
            '--timeout',
            '5',
            '--warc-file',
            'fusil-test',
            '-r',
            '--debug',
            '--page-requisites',
            '--delete-after',
            '--tries',
            '2',
            '--retry-connrefused',
            '--database',
            'wpull.db',
            '--span-hosts-allow',
            'page-requisites,linked-pages',
            '--no-check-certificate',
            '--concurrent',
            str(random.randint(1, 10)),
        ],
                                 timeout=timeout)

        process.env.set(
            'PYTHONPATH',
            os.path.join(os.path.abspath(os.path.dirname(__file__)), '..',
                         '..'))
        process.env.set('OBJGRAPH_DEBUG', '1')
        process.env.set('FILE_LEAK_DEBUG', '1')

        WatchProcessSpecificStatusCode(process)
        stdout_watcher = WatchStdout(process)
        stdout_watcher.max_nb_line = None
        stdout_watcher.ignoreRegex(
            r'WARNING Invalid content length: invalid literal for int')
        stdout_watcher.ignoreRegex(r'WARNING Unable to parse URL ')
        stdout_watcher.ignoreRegex(r'WARNING Failed to read document at ')
        stdout_watcher.ignoreRegex(r'WARNING Content overrun')
        stdout_watcher.ignoreRegex(r'ERROR Fetching ')
        stdout_watcher.ignoreRegex(r'DEBUG ')
        stdout_watcher.ignoreRegex(r'INFO Fetch(ed|ing) ')
        stdout_watcher.ignoreRegex(r'lsof: WARNING: ')
예제 #11
0
def setupProject(project):
    # Command line
    MAX_FILESIZE = 1 * 1024 * 1024
    ARGUMENTS = ['-quiet']
    MPLAYER_BIN = 'mplayer'
    NULL_VIDEO = True
    if NULL_VIDEO:
        ARGUMENTS.extend(['-vo', 'null', '-ao', 'null'])
    if True:
        SECONDS = 5
        TIMEOUT = SECONDS + 1.0
        ARGUMENTS.extend(['-endpos', str(SECONDS)])
    else:
        TIMEOUT = 7.0

    # Create buggy input file
    orig_filename = project.application().getInputFilename(
        "Audio or video file")
    mangle = AutoMangle(project, orig_filename)
    mangle.max_size = MAX_FILESIZE

    process = MplayerProcess(project,
                             [MPLAYER_BIN] + ARGUMENTS + ["<movie_filename>"],
                             timeout=TIMEOUT)
    if not NULL_VIDEO:
        setupX11Process(process)
    else:
        process.env.copy('HOME')
    watch = WatchProcess(process, timeout_score=0)
    if watch.cpu:
        watch.cpu.weight = 0.20
        watch.cpu.max_load = 0.50
        watch.cpu.max_duration = min(3, TIMEOUT - 0.5)
        watch.cpu.max_score = 0.50

    stdout = WatchStdout(process)

    # Ignore input errors
    stdout.ignoreRegex('^Failed to open LIRC support')
    stdout.ignoreRegex("^Can't init input joystick$")
    stdout.ignoreRegex("^Can't open joystick device ")

    # Ignore codec loading errors
    stdout.ignoreRegex('^Failed to create DirectShow filter$')
    stdout.ignoreRegex('^Win32 LoadLibrary failed')
    stdout.ignoreRegex('^Error loading dll$')
    stdout.ignoreRegex('^ERROR: Could not open required DirectShow codec ')
    stdout.ignoreRegex("could not open DirectShow")

    # Ignore other errors
    stdout.ignoreRegex("^Terminal type `unknown' is not defined.$")
    stdout.ignoreRegex('^VDecoder init failed')
    stdout.ignoreRegex("Read error at pos\. [0-9]+")
    stdout.ignoreRegex("could not connect to socket")
    stdout.ignoreRegex('^ADecoder init failed')
    stdout.ignoreRegex('^error while decoding block:')
    stdout.ignoreRegex('^Error while decoding frame!$')
    stdout.ignoreRegex('^\[(mpeg4|msmpeg4|wmv1|h264|NULL) @ ')

    stdout.patterns['overflow'] = 0.10
    #    stdout.words['error'] = 0.10
    #    stdout.words["can't"] = 0
    stdout.addRegex('MPlayer interrupted by signal', 1.0)
    stdout.addRegex('AVI: Missing video stream', -0.50)
    stdout.max_nb_line = None

    # Restore terminal state
    TerminalEcho(project)
예제 #12
0
파일: runner.py 프로젝트: Super-Rad/wpull
    def setupProject(self):
        self.project.debugger.enabled = False
        self.config.use_cpu_probe = False
        self.config.process_max_user_process = 50

        port = 8848
        seed = random.randint(0, 60000)
        timeout = 60 * 60

        server_process = ProjectProcess(
            self.project,
            [
                'python3', '-m', 'huhhttp',
                '--port', str(port),
                '--seed', str(seed),
                '--fuzz-period', '500',
                '--restart-interval', '250',
            ],
            timeout=timeout
        )
        WatchProcess(server_process)

        process = ProjectProcess(
            self.project,
            [
                'python3', '-X', 'faulthandler', '-m', 'wpull',
                '127.0.0.1:{0}'.format(port),
                '--timeout', '5',
                '--warc-file', 'fusil-test',
                '-r',
                '--debug',
                '--page-requisites',
                '--delete-after',
                '--tries', '2',
                '--retry-connrefused',
                '--database', 'wpull.db',
                '--span-hosts-allow', 'page-requisites,linked-pages',
                '--no-check-certificate',
                '--concurrent', str(random.randint(1, 10)),
            ],
            timeout=timeout
        )

        process.env.set(
            'PYTHONPATH',
            os.path.join(
                os.path.abspath(os.path.dirname(__file__)), '..', '..')
            )
        process.env.set('OBJGRAPH_DEBUG', '1')
        process.env.set('FILE_LEAK_DEBUG', '1')

        WatchProcessSpecificStatusCode(process)
        stdout_watcher = WatchStdout(process)
        stdout_watcher.max_nb_line = None
        stdout_watcher.ignoreRegex(
            r'WARNING Invalid content length: invalid literal for int'
        )
        stdout_watcher.ignoreRegex(
            r'WARNING Unable to parse URL '
        )
        stdout_watcher.ignoreRegex(
            r'WARNING Failed to read document at '
        )
        stdout_watcher.ignoreRegex(
            r'WARNING Content overrun'
        )
        stdout_watcher.ignoreRegex(
            r'ERROR Fetching '
        )
        stdout_watcher.ignoreRegex(
            r'DEBUG '
        )
        stdout_watcher.ignoreRegex(
            r'INFO Fetch(ed|ing) '
        )
        stdout_watcher.ignoreRegex(
            r'lsof: WARNING: '
        )