Beispiel #1
0
def setupProject(project):
    # Command line
    TIMEOUT = 0.7

    # Create buggy input file
    orig_filename = project.application().getInputFilename("Xml Conf File")
    mangle = AutoMangle(project, orig_filename)
    mangle.max_size = 10*1024*1024
    mangle.config.max_op = 100
    mangle.config.change_size = True
    mangle.config.bit = True

    process = AppProcess(project,
        ['/home/safchain/dev/next/src/service/next', '--df', '--nb', '0', '--cf'] + ["<conf_filename>"],
        timeout=TIMEOUT)
    watch = WatchProcess(process, timeout_score=0, exitcode_score=0)
    watch.cpu.max_load = 0.50
    watch.cpu.max_duration = 1.0
    watch.cpu.max_score = 0.50

    stdout = WatchStdout(process)

    # Ignore input errors
    #stdout.ignoreRegex('^Failed to open')

    # Restore terminal state
    TerminalEcho(project)
Beispiel #2
0
def setupProject(project):
    USE_STDOUT = True

    time = ProcessTimeWatch(
        project,
        too_slow=3.0,
        too_slow_score=0.10,
        too_fast=0.100,
        too_fast_score=-0.80,
    )

    orig_filename = project.application().getInputFilename("PDF document")
    if AUTO_MANGLE:
        mangle = AutoMangle(project, orig_filename)
        mangle.hard_max_op = 1000
    else:
        mangle = MangleFile(project, orig_filename)
        mangle.config.max_op = 1000

    options = {'timeout': 5.0}
    if not USE_STDOUT:
        options['stdout'] = 'null'
    process = PopplerProcess(project, ['pdftotext'], **options)
    WatchProcess(process, exitcode_score=-0.10)

    if USE_STDOUT:
        stdout = WatchStdout(process)

        def cleanupLine(line):
            match = re.match(r"Error(?: \([0-9]+\))?: (.*)", line)
            if match:
                line = match.group(1)
            return line

        stdout.cleanup_func = cleanupLine
        del stdout.words['unknown']
        #        stdout.show_not_matching = True
        #        stdout.ignoreRegex(r"Unknown operator 'allocate'$")
        #        stdout.ignoreRegex(r" operator is wrong type \(error\)$")
        #        stdout.ignoreRegex(r'^No current point in lineto$')
        #        stdout.ignoreRegex(r'^No current point in lineto')
        #        stdout.ignoreRegex(r'^Unknown operator ')
        #        stdout.ignoreRegex(r"^Couldn't open 'nameToUnicode' file ")
        #        stdout.ignoreRegex(r"^Illegal character ")
        #        stdout.ignoreRegex(r"^No font in show$")
        #        stdout.ignoreRegex(r"^Element of show/space array must be number or string$")
        #        stdout.ignoreRegex(r"^No current point in curveto$")
        #        stdout.ignoreRegex(r"^Badly formatted number$")
        #        stdout.ignoreRegex(r"^Dictionary key must be a name object$")
        #        stdout.ignoreRegex(r"^End of file inside array$")
        #        stdout.ignoreRegex(r"^Too few \([0-9]+\) args to .* operator$")
        #        stdout.ignoreRegex(r"Too many args in content stream")
        stdout.max_nb_line = (100, 0.20)
Beispiel #3
0
def setupProject(project):
    USE_STDOUT = True

    time = ProcessTimeWatch(project,
        too_slow=3.0, too_slow_score=0.10,
        too_fast=0.100, too_fast_score=-0.80,
    )

    orig_filename = project.application().getInputFilename("PDF document")
    if AUTO_MANGLE:
        mangle = AutoMangle(project, orig_filename)
        mangle.hard_max_op = 1000
    else:
        mangle = MangleFile(project, orig_filename)
        mangle.config.max_op = 1000

    options = {'timeout': 5.0}
    if not USE_STDOUT:
        options['stdout'] = 'null'
    process = PopplerProcess(project, ['pdftotext'], **options)
    WatchProcess(process, exitcode_score=-0.10)

    if USE_STDOUT:
        stdout = WatchStdout(process)
        def cleanupLine(line):
            match = re.match(r"Error(?: \([0-9]+\))?: (.*)", line)
            if match:
                line = match.group(1)
            return line
        stdout.cleanup_func = cleanupLine
        del stdout.words['unknown']
#        stdout.show_not_matching = True
#        stdout.ignoreRegex(r"Unknown operator 'allocate'$")
#        stdout.ignoreRegex(r" operator is wrong type \(error\)$")
#        stdout.ignoreRegex(r'^No current point in lineto$')
#        stdout.ignoreRegex(r'^No current point in lineto')
#        stdout.ignoreRegex(r'^Unknown operator ')
#        stdout.ignoreRegex(r"^Couldn't open 'nameToUnicode' file ")
#        stdout.ignoreRegex(r"^Illegal character ")
#        stdout.ignoreRegex(r"^No font in show$")
#        stdout.ignoreRegex(r"^Element of show/space array must be number or string$")
#        stdout.ignoreRegex(r"^No current point in curveto$")
#        stdout.ignoreRegex(r"^Badly formatted number$")
#        stdout.ignoreRegex(r"^Dictionary key must be a name object$")
#        stdout.ignoreRegex(r"^End of file inside array$")
#        stdout.ignoreRegex(r"^Too few \([0-9]+\) args to .* operator$")
#        stdout.ignoreRegex(r"Too many args in content stream")
        stdout.max_nb_line = (100, 0.20)
Beispiel #4
0
def setupProject(project):
    orig_filename = project.application().getInputFilename("JPEG picture")
    if INCR_MANGLE:
        mangle = IncrMangle(project, orig_filename)
        mangle.operation_per_version = 25
        mangle.max_version = 50
#        mangle.min_offset = 2
#        mangle.max_offset = 555
    else:
        AutoMangle(project, orig_filename)

    process = IdentifyProcess(project,
        ['exif', "<picture>"])
    WatchProcess(process,
#        exitcode_score=-0.50,
        exitcode_score=0,
    )

    stdout = WatchStdout(process)
    stdout.min_nb_line = (3, -0.5)
    stdout.words['error'] = 0.10
    # "Color Space         |Internal error (unknown value 4097)." is not a fatal error
#    stdout.ignoreRegex(r'Internal error \(unknown value')
#    stdout.addRegex(r'^Corrupt data', -1.0)
#    stdout.addRegex(r'does not contain EXIF data!$', -1.0)
    stdout.addRegex(r'The data supplied does not seem to contain EXIF data.$', -1.0)
    stdout.addRegex(r'does not contain EXIF data!$', -1.0)
    stdout.addRegex(r'^Unknown encoding\.$', -1.0)
    if DEBUG:
        stdout.show_not_matching = True
Beispiel #5
0
    def setupProject(self):
	project = self.project

	raw = self.arguments[0]

        # Create buggy input file
        mangle = AutoMangle(project, raw)
        mangle.max_size = MAX_FILESIZE

        process = MangleProcess(project,
            ['./lookup', '--cf', '/home/vmplanet/Nnodes/docs/db.xml', '--rf', "<raw>"],
	    "<raw>",
            timeout=2)
        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, 2 - 0.5)
            watch.cpu.max_score = 0.50

        #stdout = WatchStdout(process)

        # Restore terminal state
        TerminalEcho(project)
Beispiel #6
0
    def setupProject(self):
	project = self.project

	conf = self.arguments[0]

        # Create buggy input file
        mangle = AutoMangle(project, conf)
        mangle.max_size = MAX_FILESIZE

        process = MangleProcess(project,
            ['./config', '--cf', "<conf>"],
	    "<conf>",
            timeout=2)
        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, 2 - 0.5)
            watch.cpu.max_score = 0.50

        #stdout = WatchStdout(process)

        # Restore terminal state
        TerminalEcho(project)
Beispiel #7
0
def setupProject(project):
    MAX_MEMORY = 200 * 1024 * 1024

    if True:
        firefox = FirefoxProcess(project,
                                 ["firefox", '-safe-mode', HOMEPAGE_URL],
                                 timeout=None)
        setupX11Process(firefox)
        firefox.max_memory = MAX_MEMORY
        WatchProcess(firefox)
    else:
        fireboxbin = AttachProcess(project, 'firefox-bin')
        fireboxbin.max_memory = MAX_MEMORY

    orig_filename = project.application().getInputFilename(
        "JPEG image filename")
    filename_ext = filenameExtension(orig_filename)
    AutoMangle(project, orig_filename, nb_file=NB_FILES)
    FuzzyHttpServer(project, PORT, filename_ext, rows=ROWS)
    FirefoxWindow(project)
Beispiel #8
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)
Beispiel #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)
def setupProject(project):
    TIMEOUT = 4
    GST_LAUNCH_BIN = 'gst-launch-0.10'
    USE_DECODEBIN = True
    NO_AUDIO = True
    NO_VIDEO = True

    # Profile parameters
    AUDIO_SINK = "alsasink"
    VIDEO_SINK = "xvimagesink"
    if NO_AUDIO:
        AUDIO_SINK = "fakesink"
    if NO_VIDEO:
        VIDEO_SINK = "fakesink"

    # Create buggy input file
    orig_filename = project.application().getInputFilename("Audio or video file")
    if INCR_MANGLE:
        mangle = IncrMangle(project, orig_filename)
        mangle.max_size = 50*1024
        # OGG
        #mangle.operation_per_version = 10
        #mangle.max_version = 100
        # WAVE
        #mangle.operation_per_version = 100
        #mangle.max_version = 30
        # AVI
        mangle.operation_per_version = 500
        mangle.max_version = 50
    else:
        mangle = AutoMangle(project, orig_filename)
        mangle.hard_max_op = 500
        mangle.max_size = 10*1024*1024

    if USE_DECODEBIN:
        # -f option: Do not install a fault handler
        arguments = [GST_LAUNCH_BIN, '-f',
            "filesrc", "location=<filename>", "!", "decodebin", "name=decoder",
            "decoder.", "!", "queue", "!", "audioconvert", "!", "audioresample", "!", AUDIO_SINK]
        if isVideo(orig_filename):
            arguments.extend(["decoder.", "!", "ffmpegcolorspace", "!", VIDEO_SINK])

        class GstreamerProcess(CreateProcess):
            def on_mangle_filenames(self, movie_filenames):
                self.cmdline.arguments[3] = 'location=' + movie_filenames[0]
                self.createProcess()
    else:
        arguments = [GST_LAUNCH_BIN, '-f', 'playbin', 'uri=file://<playbin_uri>']

        class GstreamerProcess(CreateProcess):
            def on_mangle_filenames(self, movie_filenames):
                self.cmdline.arguments[3] = 'uri=file://%s' % movie_filenames[0]
                self.createProcess()

    process = GstreamerProcess(project, arguments, timeout=TIMEOUT)

    WatchProcess(process, exitcode_score=0.20, timeout_score=0.20)
    #, timeout_score=0)
    setupX11Process(process)

    stdout = WatchStdout(process)
    stdout.words['error'] = 0.10
    stdout.words['critical'] = 0.30
    del stdout.words['assertion']
    stdout.addRegex(r'Could not decode stream\.$', -1.0)
    stdout.addRegex(r'Could not (?:decode stream|determine type of stream|demultiplex stream)\.$', -1.0)
    stdout.addRegex(r'The stream is of a different type than handled by this element\.$', -1.0)
    stdout.addRegex(r'You might need to install the necessary plugins', 1.0)
    stdout.score_weight = 0.40