Exemple #1
0
def init(module_data):
    module_options = { 'proto': 'udp' }
    parser = OptionParser()

    parser.add_option("-M", "--mongo", action="store_true", dest="mongo",
        default=False, help="Send output to mongodb")
    parser.add_option("-H", "--host", action="store", dest="host",
        default="localhost", help="Host to connect to")
    parser.add_option("-P", "--port", action="store", dest="port",
        default=27017, help="Port to connect to")
    parser.add_option("-D", "--db", action="store", dest="db",
        default='pcaps', help="Database to use")
    parser.add_option("-C", "--collection", action="store", dest="col",
        default='dns', help="Collection to use")

    (options,lo) = parser.parse_args(module_data['args'])

    module_data['mongo'] = options.mongo

    if module_data['mongo']:
        try:
            from dbtools import mongo_connector
        except ImportError, e:
            module_options['error'] = str(e)
            return module_options

        module_data['db'] = mongo_connector(options.host, options.port, options.db, options.col)
Exemple #2
0
def init(module_data):
    module_options = {'proto': [{'dns': ''}]}
    parser = OptionParser()

    parser.add_option("-M",
                      "--mongo",
                      action="store_true",
                      dest="mongo",
                      default=False,
                      help="Send output to mongodb")
    parser.add_option("-H",
                      "--host",
                      action="store",
                      dest="host",
                      default="localhost",
                      help="Host to connect to")
    parser.add_option("-P",
                      "--port",
                      action="store",
                      dest="port",
                      default=27017,
                      help="Port to connect to")
    parser.add_option("-D",
                      "--db",
                      action="store",
                      dest="db",
                      default='pcaps',
                      help="Database to use")
    parser.add_option("-C",
                      "--collection",
                      action="store",
                      dest="col",
                      default='dns',
                      help="Collection to use")

    (options, lo) = parser.parse_args(module_data['args'])

    module_data['mongo'] = options.mongo

    if module_data['mongo']:
        try:
            from dbtools import mongo_connector
        except ImportError, e:
            module_options['error'] = str(e)
            return module_options

        module_data['db'] = mongo_connector(options.host, options.port,
                                            options.db, options.col)
Exemple #3
0
def init(module_data):
    module_options = { 'proto': 'tcp' }
    parser = OptionParser()

    parser.add_option("-s", "--carve_response_body", action="store_true",
        dest="carve_response", default=False, help="Save response body")
    parser.add_option("-S", "--carve_request_body", action="store_true",
        dest="carve_request", default=False, help="Save request body")
    parser.add_option("-f", "--fields", action="store", dest="fields",
        default=[], help="Comma separated list of fields to extract")
    parser.add_option("-p", "--print", action="store_true", dest="prnt",
        default=False, help="Send output to stdout")
    parser.add_option("-M", "--mongo", action="store_true", dest="mongo",
        default=False, help="Send output to mongodb")
    parser.add_option("-J", "--json", action="store_true", dest="json",
        default=False, help="Send output to json file (use -J to chosphop)")
    parser.add_option("-H", "--host", action="store", dest="host",
        default="localhost", help="Host to connect to")
    parser.add_option("-P", "--port", action="store", dest="port",
        default=27017, help="Port to connect to")
    parser.add_option("-D", "--db", action="store", dest="db",
        default='pcaps', help="Database to use")
    parser.add_option("-C", "--collection", action="store", dest="col",
        default='http', help="Collection to use")
    parser.add_option("-v", "--verbose", action="store_true", dest="verbose",
        default=False, help="Be verbose about incoming packets")

    (options,lo) = parser.parse_args(module_data['args'])

    module_data['counter'] = 0
    module_data['prnt'] = options.prnt
    module_data['mongo'] = options.mongo
    module_data['json'] = options.json
    module_data['carve_request'] = options.carve_request
    module_data['carve_response'] = options.carve_response
    module_data['verbose'] = options.verbose

    if not options.prnt and not options.mongo and not options.json:
        chop.prnt("WARNING: No output method selected.")

    if module_data['mongo']:
        try:
            from dbtools import mongo_connector
        except ImportException, e:
            module_options['error'] = str(e)
            return module_options
        module_data['db'] = mongo_connector(options.host, options.port, options.db, options.col)
def init(module_data):
    module_options = { 'proto': 'tcp' }
    parser = OptionParser()

    parser.add_option("-s", "--carve_response_body", action="store_true",
        dest="carve_response", default=False, help="Save response body")
    parser.add_option("-S", "--carve_request_body", action="store_true",
        dest="carve_request", default=False, help="Save request body")
    parser.add_option("-f", "--fields", action="store", dest="fields",
        default=[], help="Comma separated list of fields to extract")
    parser.add_option("-m", "--md5_body", action="store_true", dest="md5_body",
        default=False, help="Generate MD5 of body, and throw contents away")
    parser.add_option("-M", "--mongo", action="store_true", dest="mongo",
        default=False, help="Send output to mongodb")
    parser.add_option("-H", "--host", action="store", dest="host",
        default="localhost", help="Host to connect to")
    parser.add_option("-P", "--port", action="store", dest="port",
        default=27017, help="Port to connect to")
    parser.add_option("-D", "--db", action="store", dest="db",
        default='pcaps', help="Database to use")
    parser.add_option("-C", "--collection", action="store", dest="col",
        default='http', help="Collection to use")
    parser.add_option("-v", "--verbose", action="store_true", dest="verbose",
        default=False, help="Be verbose about incoming packets")

    (options,lo) = parser.parse_args(module_data['args'])

    module_data['counter'] = 0
    module_data['mongo'] = options.mongo
    module_data['carve_request'] = options.carve_request
    module_data['carve_response'] = options.carve_response
    module_data['verbose'] = options.verbose
    module_data['md5_body'] = options.md5_body

    if module_data['mongo']:
        try:
            from dbtools import mongo_connector
        except ImportException, e:
            module_options['error'] = str(e)
            return module_options
        module_data['db'] = mongo_connector(options.host, options.port, options.db, options.col)
Exemple #5
0
def init(module_data):
    module_options = { 'proto': 'tcp' }
    parser = OptionParser()

    parser.add_option("-f", "--fields", action="store", dest="fields",
        default=None, help="Comma separated list of fields to extract")
    parser.add_option("-p", "--print", action="store_true", dest="prnt",
        default=False, help="Send output to stdout")
    parser.add_option("-M", "--mongo", action="store_true", dest="mongo",
        default=False, help="Send output to mongodb")
    parser.add_option("-J", "--json", action="store_true", dest="json",
        default=False, help="Send output to json file (use -J to chosphop)")
    parser.add_option("-H", "--host", action="store", dest="host",
        default="localhost", help="Host to connect to")
    parser.add_option("-P", "--port", action="store", dest="port",
        default=27017, help="Port to connect to")
    parser.add_option("-D", "--db", action="store", dest="db",
        default='pcaps', help="Database to use")
    parser.add_option("-C", "--collection", action="store", dest="col",
        default='http', help="Collection to use")

    (options,lo) = parser.parse_args(module_data['args'])

    module_data['prnt'] = options.prnt
    module_data['mongo'] = options.mongo
    module_data['json'] = options.json

    if not options.prnt and not options.mongo and not options.json:
        module_options['error'] = "Select one output method."
        return module_options

    if module_data['mongo']:
        try:
            from dbtools import mongo_connector
        except ImportException, e:
            module_options['error'] = str(e)
            return module_options
        module_data['db'] = mongo_connector(options.host, options.port, options.db, options.col)
def init(module_data):
    module_options = {'proto': 'tcp'}
    parser = OptionParser()

    parser.add_option("-s",
                      "--carve_response_body",
                      action="store_true",
                      dest="carve_response",
                      default=False,
                      help="Save response body")
    parser.add_option("-S",
                      "--carve_request_body",
                      action="store_true",
                      dest="carve_request",
                      default=False,
                      help="Save request body")
    parser.add_option("-f",
                      "--fields",
                      action="store",
                      dest="fields",
                      default=[],
                      help="Comma separated list of fields to extract")
    parser.add_option("-m",
                      "--md5_body",
                      action="store_true",
                      dest="md5_body",
                      default=False,
                      help="Generate MD5 of body, and throw contents away")
    parser.add_option("-M",
                      "--mongo",
                      action="store_true",
                      dest="mongo",
                      default=False,
                      help="Send output to mongodb")
    parser.add_option("-H",
                      "--host",
                      action="store",
                      dest="host",
                      default="localhost",
                      help="Host to connect to")
    parser.add_option("-P",
                      "--port",
                      action="store",
                      dest="port",
                      default=27017,
                      help="Port to connect to")
    parser.add_option("-D",
                      "--db",
                      action="store",
                      dest="db",
                      default='pcaps',
                      help="Database to use")
    parser.add_option("-C",
                      "--collection",
                      action="store",
                      dest="col",
                      default='http',
                      help="Collection to use")
    parser.add_option("-v",
                      "--verbose",
                      action="store_true",
                      dest="verbose",
                      default=False,
                      help="Be verbose about incoming packets")

    (options, lo) = parser.parse_args(module_data['args'])

    module_data['counter'] = 0
    module_data['mongo'] = options.mongo
    module_data['carve_request'] = options.carve_request
    module_data['carve_response'] = options.carve_response
    module_data['verbose'] = options.verbose
    module_data['md5_body'] = options.md5_body

    if module_data['mongo']:
        try:
            from dbtools import mongo_connector
        except ImportException, e:
            module_options['error'] = str(e)
            return module_options
        module_data['db'] = mongo_connector(options.host, options.port,
                                            options.db, options.col)