def init(config): """Do module-wide initialization according to config.""" # if BE was imported successfully, now try and load its library global be_available if be_available: try: bulkextractor.lib_init(config['bulk.lib']) except OSError as e: config.debug_print("failed to load bulk_extractor:", str(e)) be_available = False
# handle is opaque to python module for simplicity and loose coupling BeHandle = c_void_p BeCallback = CFUNCTYPE( c_int, # return type c_void_p, # arbitrary user data c_uint32, # callback type code c_uint64, # multi-use callback argument c_char_p, # feature recorder name or other c_char_p, # feature forensic path c_char_p, # feature data c_size_t, # feature length c_char_p, # feature context data c_size_t, # context length ) if __name__=="__main__": print("Program to demonstrate the python module") import bulkextractor bulkextractor.lib_init('libbulkextractor.so') bulkextractor.soft_init(['email','accts']) be = bulkextractor.Session() be.analyze_buffer(b" [email protected] 617-555-1212 ") be.finalize() histograms = be.histograms() print(histograms)
DISABLE_ALL = 7 FEATURE_LIST = 8 SCANNER_LIST = 9 # handle is opaque to python module for simplicity and loose coupling BeHandle = c_void_p BeCallback = CFUNCTYPE( c_int, # return type c_void_p, # arbitrary user data c_uint32, # callback type code c_uint64, # multi-use callback argument c_char_p, # feature recorder name or other c_char_p, # feature forensic path c_char_p, # feature data c_size_t, # feature length c_char_p, # feature context data c_size_t, # context length ) if __name__ == "__main__": print("Program to demonstrate the python module") import bulkextractor bulkextractor.lib_init('libbulkextractor.so') bulkextractor.soft_init(['email', 'accts']) be = bulkextractor.Session() be.analyze_buffer(b" [email protected] 617-555-1212 ") be.finalize() histograms = be.histograms() print(histograms)