eisenmp_examples.utils_exa package
Submodules
eisenmp_examples.utils_exa.eisenmp_download module
- class eisenmp_examples.utils_exa.eisenmp_download.DownLoad
Bases:
objectIf we have the response, we can read it at once or as a stream.
- load_url()
- save(file_name)
Save response on file system with OS buf size. Dotted output in one line.
- store_mem()
- unzip_fs()
- unzip_mem()
Extract zip in memory to avoid unwanted files from archive on file system.
eisenmp_examples.utils_exa.eisenmp_search module
- class eisenmp_examples.utils_exa.eisenmp_search.SearchStr
Bases:
objectHosts the dict to compare, and a ‘search string shaker’ generator.
el cheapo goes brute force, but it shows the basics go further with ‘create_key_digest_val_word_dict’ and load later a rainbow table with the ‘mp_tools_q’ into each process
- create_key_digest_val_word_dict(*args, lower=None)
{‘83c54220e5f2c521819cb6d80163858dd6def3c5a9ed37281a532284b342104a’: ‘aal’,} Creates a
realsha256 hash dict for pwd bruteforce.- Params:
args: OS paths to word lists
- Params:
lower: can convert to lower string
- create_key_word_val_none_dict(*args, lowercase=True)
{‘aal’: None, …} Create a dict from wordlists (procs mem inflates to 10 x word_list_size in mb). Faster reading vs list. - Dict. Each process gets a copy of the dict vs Multiprocess shared manager dict, which is utter slow. - Merged List. Add as many as you like.
- Params:
args: OS paths to word lists
- Params:
lower: can convert to lower string
- generator(lowercase=True)
STRING generator with all permutations of init_str. Itertools creates duplicates of a string permutation. We could redirect output to dict, key val, but 15! is a Terabyte string thingy. Needs custom, paid ;), solution. - Permutation list generator. 15! is 1,307,674,368,000; ‘AEEFFGILNNOPRTT’ not solved yet 1.3 Trillion x 10 byte (guess for a list); 12,770,257,500 kb is 12,7702575 Terabyte list size A 16 core XEON will need approximately 20 days for a 15! string, to generate and test all permutations. Looks like linear Ordnung to calculate for other core counts. See ‘ProcInfo’ how to calc ETA.
- Params:
init_str: string to shuffle and shake ‘DIKKLOOR’ -> results in german KROKODIL
- word_dict_size(shrink=None, lowercase=True)
Optimized ‘create_key_word_val_none_dict’. Half of the time. Shrink dict to match only search str length.
- Params:
args: OS paths to word lists
- Params:
lower: can convert to lower string
eisenmp_examples.utils_exa.eisenmp_utils module
- class eisenmp_examples.utils_exa.eisenmp_utils.Result
Bases:
objectFinest results only here. Can save number stuff, not response chunks, or we crash
- property result_dict
- result_dict_update(key, value)
- eisenmp_examples.utils_exa.eisenmp_utils.condense_list_from_fs(search_str, words_dict)
- eisenmp_examples.utils_exa.eisenmp_utils.consecutive_number()
Want a stamp on each list header. Used for Queue messages get() and put in box_dict[num] = msg Can rebuild original order if worker puts result in a list with same num as order list.
- eisenmp_examples.utils_exa.eisenmp_utils.create_hash(word)
Inputs a string and returns the sha256 digest
- Params:
word: to hash
- eisenmp_examples.utils_exa.eisenmp_utils.empty_db_from_schema(db_name='db_exa.db', schema_file='db_exa_schema.sql')
Initial for bruteforce, instances return not sequential, Caller exit is possible if last instance writes code word, to identify database.db in root is from SQLAlchemy template package
- eisenmp_examples.utils_exa.eisenmp_utils.get_db_connection()
- eisenmp_examples.utils_exa.eisenmp_utils.get_db_path(db_name='db_exa.db')
- eisenmp_examples.utils_exa.eisenmp_utils.load_url(url, user_agent=None)
Get server response.
- Params:
url: url
- Params:
user_agent: override python ua of urllib (we are a browser)
- Exception:
Timeout recursive call
- Returns:
http server response
- Return type:
http response
- eisenmp_examples.utils_exa.eisenmp_utils.merge_list(*list_paths, lowercase=True)
WORD LISTS. We create a dict with word as key or hash digest, for speed.
- Params:
args: tuple of OS paths word list(s)
- Params:
lower: True is all lowercase
- eisenmp_examples.utils_exa.eisenmp_utils.replace_special_char(word)
German so far.
- Params:
word: string to check
- eisenmp_examples.utils_exa.eisenmp_utils.split_list(lst, chunk_size)
Needs a companion loop. for chunk in split_list(word_list, chunk_size): print(chunk)
- Params:
lst: the list to split
- Params:
chunk_size: row count of lst for one consumer
- eisenmp_examples.utils_exa.eisenmp_utils.str_with_len_get(word, str_to_comp)
- eisenmp_examples.utils_exa.eisenmp_utils.table_insert(sql_statement, *args)
- eisenmp_examples.utils_exa.eisenmp_utils.table_select_column(table, col)
- eisenmp_examples.utils_exa.eisenmp_utils.thread_shutdown_wait(*threads)
We return if none of the thread names are listed anymore. Blocks!
- Params:
threads: arbitrary list of thread names
- eisenmp_examples.utils_exa.eisenmp_utils.unzip(file_path)
Extractor.
- Params:
file_path: to zipped file