Example #1
0
def autorun_module(file_hash):
    if not file_hash:
        return

    if not __sessions__.is_set():
        __sessions__.new(get_sample_path(file_hash))

    for cmd_line in cfg.autorun.commands.split(','):
        split_commands = cmd_line.split(';')

        for split_command in split_commands:
            split_command = split_command.strip()

            if not split_command:
                continue

            root, args = parse_commands(split_command)

            try:
                if root in __modules__:
                    print_info("Running command \"{0}\"".format(split_command))

                    module = __modules__[root]['obj']()
                    module.set_commandline(args)
                    module.run()

                    if cfg.modules.store_output and __sessions__.is_set():
                        Database().add_analysis(file_hash, split_command,
                                                module.output)

                    if cfg.autorun.verbose:
                        print_output(module.output)

                    del (module.output[:])
                else:
                    print_error(
                        "\"{0}\" is not a valid command. Please check your viper.conf file."
                        .format(cmd_line))
            except:
                print_error(
                    "Viper was unable to complete the command {0}".format(
                        cmd_line))
Example #2
0
def autorun_module(file_hash):
    if not file_hash:
        return

    if not __sessions__.is_set():
        __sessions__.new(get_sample_path(file_hash))

    for cmd_line in cfg.autorun.commands.split(','):
        split_commands = cmd_line.split(';')

        for split_command in split_commands:
            split_command = split_command.strip()

            if not split_command:
                continue

            root, args = parse_commands(split_command)

            try:
                if root in __modules__:
                    print_info("Running command \"{0}\"".format(split_command))

                    module = __modules__[root]['obj']()
                    module.set_commandline(args)
                    module.run()
                    
                    if cfg.modules.store_output and __sessions__.is_set():
                        Database().add_analysis(file_hash, split_command, module.output)
                    
                    if cfg.autorun.verbose:
                        print_output(module.output)

                    del(module.output[:])
                else:
                    print_error("\"{0}\" is not a valid command. Please check your viper.conf file.".format(cmd_line))
            except:
                print_error("Viper was unable to complete the command {0}".format(cmd_line))
Example #3
0
 def log(self, event_type, event_data):
     self.output.append(dict(type=event_type, data=event_data))
     out.print_output([{
         'type': event_type,
         'data': event_data
     }], console_output['filename'])
Example #4
0
 def log(self, event_type, event_data):
     self.output.append(dict(
         type=event_type,
         data=event_data
     ))
     out.print_output([{'type': event_type, 'data': event_data}], console_output['filename'])