# Path: haystack/argparse_utils.py
# def readable(f):
# def writeable(f):
# def int16(s):
# 
# Path: haystack/basicmodel.py
# def get_field_type(record, fieldname):
# def get_fields(record):
# def get_record_type_fields(record_type):
#     def __init__(self, memory_handler, my_constraints, target_ctypes=None):
#     def _get_constraints_for(self, record):
#     def _get_dynamic_constraints_for(self, record):
#     def get_orig_addr(self, record):
#     def is_valid(self, record):
#     def _is_valid_dynamic_constraints(self, record):
#     def _is_valid(self, record, record_constraints):
#     def _is_valid_attr(self, attr, attrname, attrtype, record_constraints):
#     def _is_loadable_member(self, attr, attrname, attrtype):
#     def load_members(self, record, max_depth):
#     def _load_member(self, record, attr, attrname, attrtype, record_constraints, max_depth):
#     def is_valid_address(self, obj, structType=None):
#     def is_valid_address_value(self, addr, structType=None):
#     def __str__(self):
# class CTypesRecordConstraintValidator(interfaces.IRecordConstraintsValidator):
#     MAX_CSTRING_SIZE = 1024
# 
# Path: haystack/constraints.py
# class ConstraintsConfigHandler(interfaces.IConstraintsConfigHandler):
# class ModuleConstraints(interfaces.IModuleConstraints):
# class RecordConstraints(interfaces.IRecordConstraints, dict):
# class IgnoreMember(interfaces.IConstraint):
# class ListLimitDepthValidation(interfaces.IConstraint):
# class RangeValue(interfaces.IConstraint):
# class NotValue(interfaces.IConstraint):
# class NotNullComparable(interfaces.IConstraint):
# class BytesComparable(interfaces.IConstraint):
#     def read(self, filename):
#     def _parse(self, value):
#     def _parse_c(self, value):
#     def _try_numbers(self, _arg):
#     def __init__(self):
#     def get_constraints(self):
#     def set_constraints(self, record_type_name, record_constraints):
#     def get_dynamic_constraints(self):
#     def set_dynamic_constraints(self, record_type_name, record_constraints):
#     def get_fields(self):
#     def get_constraints_for_field(self, field_name):
#     def __contains__(self, obj):
#     def __init__(self, max_depth):
#     def __contains__(self, obj):
#     def __init__(self, low, high):
#     def __contains__(self, obj):
#     def __eq__(self, obj):
#     def __init__(self, not_value):
#     def __contains__(self, obj):
#     def __eq__(self, obj):
#     def __contains__(self, obj):
#     def __eq__(self, obj):
#     def __init__(self, seq):
#     def __contains__(self, obj):
#     def __cmp__(self, obj):
# 
# Path: haystack/search/api.py
# class HaystackError(Exception):
# def search_record(memory_handler, record_type, search_constraints=None, extended_search=False):
# def search_record_hint(memory_handler, record_type, hint, search_constraints=None, extended_search=False):
# def output_to_string(memory_handler, results):
# def output_to_python(memory_handler, results):
# def output_to_json(memory_handler, results):
# def output_to_pickle(memory_handler, results):
# def load_record(memory_handler, struct_type, memory_address, load_constraints=None):
# def validate_record(memory_handler, instance, record_constraints=None, max_depth=10):


import argparse
import logging
import os
import sys
import time
import pkg_resources
            import code
            import code
    from urllib.parse import urlparse
    from urlparse import urlparse
from haystack import argparse_utils
from haystack import basicmodel
from haystack import constraints
from haystack.search import api
        from haystack.mappings import rek
        # output handling
        output = api.output_to_python(memory_handler, results)
        py_obj = output[0][0]


def base_argparser(program_name, description):
    """ Base options shared by all console scripts """
    rootparser = argparse.ArgumentParser(prog=program_name, description=description)
    verbosity = rootparser.add_mutually_exclusive_group(required=False)
    verbosity.add_argument('--debug', dest='debug', action='store_true', help='Set verbosity to DEBUG')
    verbosity.add_argument('--quiet', dest='quiet', action='store_true', help='Set verbosity to ERROR only')
    rootparser.add_argument('--interactive', dest='interactive', action='store_true',
                            help='drop to python command line after action')
    rootparser.add_argument('--nommap', dest='mmap', action='store_false', help='disable mmap()-ing')
    rootparser.add_argument('--osname', '-n', action='store', default=None, choices=['linux', 'winxp', 'win7'], help='Force a specific OS')
    rootparser.add_argument('--bits', '-b', type=int, action='store', default=None, choices=[32, 64], help='Force a specific word size')
    text = '://, '.join(sorted(SUPPORTED_DUMP_URI.keys())) + '://'
    help_desc = 'target file or process. Supported URL types: %s' % text
    rootparser.add_argument('target', type=url, help=help_desc)
    return rootparser


def search_argparser(search_parser):
    """ Search function options argument parser """
    search_parser.add_argument('record_type_name', type=str,
                               help='Python record type name. Module must be in Python path')
    search_parser.add_argument('--constraints_file', type=argparse.FileType('r'),
                               help='Filename that contains Constraints for the record types in the module')
    search_parser.add_argument('--extended', action='store_true',
                               help='Do not restrict the search to allocated chunks')

# Path: haystack/argparse_utils.py
# def readable(f):
# def writeable(f):
# def int16(s):
# 
# Path: haystack/basicmodel.py
# def get_field_type(record, fieldname):
# def get_fields(record):
# def get_record_type_fields(record_type):
#     def __init__(self, memory_handler, my_constraints, target_ctypes=None):
#     def _get_constraints_for(self, record):
#     def _get_dynamic_constraints_for(self, record):
#     def get_orig_addr(self, record):
#     def is_valid(self, record):
#     def _is_valid_dynamic_constraints(self, record):
#     def _is_valid(self, record, record_constraints):
#     def _is_valid_attr(self, attr, attrname, attrtype, record_constraints):
#     def _is_loadable_member(self, attr, attrname, attrtype):
#     def load_members(self, record, max_depth):
#     def _load_member(self, record, attr, attrname, attrtype, record_constraints, max_depth):
#     def is_valid_address(self, obj, structType=None):
#     def is_valid_address_value(self, addr, structType=None):
#     def __str__(self):
# class CTypesRecordConstraintValidator(interfaces.IRecordConstraintsValidator):
#     MAX_CSTRING_SIZE = 1024
# 
# Path: haystack/constraints.py
# class ConstraintsConfigHandler(interfaces.IConstraintsConfigHandler):
# class ModuleConstraints(interfaces.IModuleConstraints):
# class RecordConstraints(interfaces.IRecordConstraints, dict):
# class IgnoreMember(interfaces.IConstraint):
# class ListLimitDepthValidation(interfaces.IConstraint):
# class RangeValue(interfaces.IConstraint):
# class NotValue(interfaces.IConstraint):
# class NotNullComparable(interfaces.IConstraint):
# class BytesComparable(interfaces.IConstraint):
#     def read(self, filename):
#     def _parse(self, value):
#     def _parse_c(self, value):
#     def _try_numbers(self, _arg):
#     def __init__(self):
#     def get_constraints(self):
#     def set_constraints(self, record_type_name, record_constraints):
#     def get_dynamic_constraints(self):
#     def set_dynamic_constraints(self, record_type_name, record_constraints):
#     def get_fields(self):
#     def get_constraints_for_field(self, field_name):
#     def __contains__(self, obj):
#     def __init__(self, max_depth):
#     def __contains__(self, obj):
#     def __init__(self, low, high):
#     def __contains__(self, obj):
#     def __eq__(self, obj):
#     def __init__(self, not_value):
#     def __contains__(self, obj):
#     def __eq__(self, obj):
#     def __contains__(self, obj):
#     def __eq__(self, obj):
#     def __init__(self, seq):
#     def __contains__(self, obj):
#     def __cmp__(self, obj):
# 
# Path: haystack/search/api.py
# class HaystackError(Exception):
# def search_record(memory_handler, record_type, search_constraints=None, extended_search=False):
# def search_record_hint(memory_handler, record_type, hint, search_constraints=None, extended_search=False):
# def output_to_string(memory_handler, results):
# def output_to_python(memory_handler, results):
# def output_to_json(memory_handler, results):
# def output_to_pickle(memory_handler, results):
# def load_record(memory_handler, struct_type, memory_address, load_constraints=None):
# def validate_record(memory_handler, instance, record_constraints=None, max_depth=10):


# Path: haystack/cli.py
import argparse
import logging
import os
import sys
import time
import pkg_resources
            import code
            import code
    from urllib.parse import urlparse
    from urlparse import urlparse
from haystack import argparse_utils
from haystack import basicmodel
from haystack import constraints
from haystack.search import api
        from haystack.mappings import rek

        # output handling
        output = api.output_to_python(memory_handler, results)
        py_obj = output[0][0]


def base_argparser(program_name, description):
    """ Base options shared by all console scripts """
    rootparser = argparse.ArgumentParser(prog=program_name, description=description)
    verbosity = rootparser.add_mutually_exclusive_group(required=False)
    verbosity.add_argument('--debug', dest='debug', action='store_true', help='Set verbosity to DEBUG')
    verbosity.add_argument('--quiet', dest='quiet', action='store_true', help='Set verbosity to ERROR only')
    rootparser.add_argument('--interactive', dest='interactive', action='store_true',
                            help='drop to python command line after action')
    rootparser.add_argument('--nommap', dest='mmap', action='store_false', help='disable mmap()-ing')
    rootparser.add_argument('--osname', '-n', action='store', default=None, choices=['linux', 'winxp', 'win7'], help='Force a specific OS')
    rootparser.add_argument('--bits', '-b', type=int, action='store', default=None, choices=[32, 64], help='Force a specific word size')
    text = '://, '.join(sorted(SUPPORTED_DUMP_URI.keys())) + '://'
    help_desc = 'target file or process. Supported URL types: %s' % text
    rootparser.add_argument('target', type=url, help=help_desc)
    return rootparser


def search_argparser(search_parser):
    """ Search function options argument parser """
    search_parser.add_argument('record_type_name', type=str,
                               help='Python record type name. Module must be in Python path')
    search_parser.add_argument('--constraints_file', type=argparse.FileType('r'),
                               help='Filename that contains Constraints for the record types in the module')
    search_parser.add_argument('--extended', action='store_true',
                               help='Do not restrict the search to allocated chunks')

    search_parser.add_argument('--hint', type=argparse_utils.int16,