hashit.detection | index /Users/javad/Dropbox/udvikling/projekter/hashit/hashit/hashit/detection.py |
Copyrigth (c) 2020-present Javad Shafique
this module using length and connections to find a match
for an hashing algorithem. It's basicly a matching algorigtem
it can be used for almost any pure function in this case for hashes.
# Copyright (c) 2020-present Javad Shafique
# This 'Software' can't be used without permission
# from Javad Shafique.
# this module using length and connections to find a match
# for an hashing algorithem. It's basicly a matching algorigtem
# it can be used for almost any pure function in this case for hashes.
# basic template:
def generate_some_dataset(datatoworkon = "some data"):
dict_for_storing_set = dict()
for each_element in a_list_of_something_to_compare_with:
data = function_that_uses_data_to_generate_something(each_element, datatoworkon)
dict_for_storing_set.update({each_element:{"data":data, "size":len(data), "size-as":list(), "connection":list()}})
#find connection and size
for each_element in dict_for_storing_set:
elements_data = dict_for_storing_set[each_element]["data"]
elements_size = dict_for_storing_set[each_element]["size"]
for second_element in dict_for_storing_set:
if dict_for_storing_set[second_element]["size"] == elements_size:
if elements_data == dict_for_storing_set["data"]:
dict_for_storing_set[each_element]["connection"].append(second_element)
else:
dict_for_storing_set[each_element]["size-as"].append(second_element)
else:
continue
# return finished dataset
return dict_for_storing_set
# and for parsing that infomation
# you can use the detect function
# as here:
def detect(string, table, maybe = True):
if not (type(string) == str):
return None
so = list()
so_far = list()
length = len(string)
for key in table:
dat = table[key]
if dat["size"] == length:
for i in dat["connection"]:
if i not in so_far:
so_far.append(i)
for i in so_far:
dat = table[i]["connection"]
for j in so_far:
if not j in dat:
so_far.remove(j)
if maybe:
for key in table:
dat = table[key]
if dat["size"] == length:
so.append(key)
if len(so_far) >= 0 and len(so) == 1:
# if there only is one option then use it
return tup(certain=so, maybe=[])
else:
return tup(certain=so_far, maybe=so)
# compare hashes for hash-detection
# it can generate data that can compare
# diffrences between the results
# if works by categorizing the hashes into
# two categorizes. one for thoose who look alike
# and one for thoose who generates the same output
# given the same input. And with it a sorted result
# is outputted and is ready to be used be the user.
# list of which algorithms is most likly used (WIP)
PRIORITY = {
"md5":["md5"],
"sha1":["dsaEncryption", "DSA", "ecdsa-with-SHA1", "dsaWithSHA", "DSA-SHA"]
}
Modules | ||||||
|
Classes | ||||||||||
|
Functions | ||
|