예제 #1
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: '
        )
예제 #2
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: ')
예제 #3
0
 def __init__(self, project, arguments, **kw):
     ProjectProcess.__init__(self, project, arguments, **kw)
     self.options = 'Vqfldbv'
     VALUE_SET = DECIMAL_DIGITS | set('.:-/ ')
     self.stdin_generator = BytesGenerator(1, 5000)
     self.value_generator = BytesGenerator(1, 30, VALUE_SET)
     self.queue_generator = BytesGenerator(1, 1, ASCII0)
     self.filename_generator = UnixPathGenerator(100)
     self.min_opt = 0
     self.max_opt = 2
예제 #4
0
def setupProject(project):
    process = ProjectProcess(project, ['xterm', 'ls'], timeout=1.0)
    setupX11Process(process)
    process.env.add(EnvVarLength('PATH', max_length=1000))

    WatchProcess(process, timeout_score=0)
    WatchStdout(process)
예제 #5
0
def setupProject(project):
    VIM = EnvVarLength(['VIM', 'VIMRUNTIME'], max_length=10000)

    process = ProjectProcess(project, ['vim', '--version'])
    process.env.add(VIM)
    WatchProcess(process)
    WatchStdout(process)
예제 #6
0
def setupProject(project):
    # Use non trival program to make sure that libc uses many environment variables
    #    COMMAND = ['/bin/bash', '-c', 'echo "Hello World!"']
    COMMAND = ['python', '-c', 'print "Hello World!"']
    MAX_COUNT = 5

    # Run program with fuzzed environment variables
    vars = list(LIBC_VARIABLES)
    if False:
        # AVOID libc bugs
        vars.remove('LD_HWCAP_MASK')
        vars.remove('MALLOC_TOP_PAD_')
    if False:
        var = EnvVarInteger(vars, max_count=MAX_COUNT)
    elif False:
        var = EnvVarLength(vars, max_count=MAX_COUNT)
    elif False:
        var = EnvVarRandom(vars, max_length=200, max_count=MAX_COUNT)
        var.characters = LETTERS | PUNCTUATION
    else:
        var = EnvVarRandom(vars, max_length=2000, max_count=MAX_COUNT)
    process = ProjectProcess(project, COMMAND)
    process.env.add(var)

    # Watch process failure with its PID
    WatchProcess(process)

    # Watch process failure with its text output
    stdout = WatchStdout(process)
    stdout.words['failed'] = 0
예제 #7
0
def setupProject(project):
    #    project.session_timeout = 1.0
    process = ProjectProcess(project, ['/bin/bash'], timeout=5.0)
    AttackProc(project)
    WatchProcess(process, timeout_score=0)
    WatchStdout(process)
    syslog = Syslog(project)
    for watch in syslog:
        watch.ignoreRegex('info="invalid command"')
        watch.show_not_matching = True
예제 #8
0
파일: zzuf.py 프로젝트: zhuyue1314/segvault
    def __init__(self, project, arguments, library_path=None, **options):
        ProjectProcess.__init__(self, project, arguments, **options)

        # Options
        self.use_debug_file = True
        self.setRatio(DEFAULT_RATIO, DEFAULT_RATIO)

        # Locate libzzuf library
        if not library_path:
            for path in LIBRARY_PATHS:
                if not exists(path):
                    continue
                library_path = path
                break
            if not library_path:
                raise ValueError("Unable to find zzuf library (try %s)" % ", ".join(LIBRARY_PATHS))

        # Load zzuf using LD_PRELOAD
        self.env.set("LD_PRELOAD", library_path)
예제 #9
0
    def __init__(self, project, arguments, library_path=None, **options):
        ProjectProcess.__init__(self, project, arguments, **options)

        # Options
        self.use_debug_file = True
        self.setRatio(DEFAULT_RATIO, DEFAULT_RATIO)

        # Locate libzzuf library
        if not library_path:
            for path in LIBRARY_PATHS:
                if not exists(path):
                    continue
                library_path = path
                break
            if not library_path:
                raise ValueError("Unable to find zzuf library (try %s)" %
                                 ', '.join(LIBRARY_PATHS))

        # Load zzuf using LD_PRELOAD
        self.env.set('LD_PRELOAD', library_path)
예제 #10
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) ')
예제 #11
0
 def setupProject(self):
     ProjectProcess(self, ['echo', 'Hello World!'])
예제 #12
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: ')
예제 #13
0
 def createProcess(self):
     if self.use_debug_file:
         filename = self.session().createFilename('zzuf.dbg')
         self.zzuf_file = open(filename, 'w')
         self.env.set("ZZUF_DEBUG", str(self.zzuf_file.fileno()))
     ProjectProcess.createProcess(self)
예제 #14
0
 def closeStreams(self):
     ProjectProcess.closeStreams(self)
     if self.zzuf_file:
         self.zzuf_file.close()
         self.zzuf_file = None
예제 #15
0
 def init(self):
     ProjectProcess.init(self)
     self.zzuf_file = None
 def setupProject(self):
     # Create an agent: don't store the object, it's already done
     # in the agent constructor
     ProjectProcess(self.project, ['echo', 'Hello World!'])
예제 #17
0
파일: zzuf.py 프로젝트: zhuyue1314/segvault
 def createProcess(self):
     if self.use_debug_file:
         filename = self.session().createFilename("zzuf.dbg")
         self.zzuf_file = open(filename, "w")
         self.env.set("ZZUF_DEBUG", str(self.zzuf_file.fileno()))
     ProjectProcess.createProcess(self)
예제 #18
0
파일: zzuf.py 프로젝트: zhuyue1314/segvault
 def closeStreams(self):
     ProjectProcess.closeStreams(self)
     if self.zzuf_file:
         self.zzuf_file.close()
         self.zzuf_file = None
예제 #19
0
파일: zzuf.py 프로젝트: zhuyue1314/segvault
 def init(self):
     ProjectProcess.init(self)
     self.zzuf_file = None