Skip to content

Commit

Permalink
Merge pull request #10 from Morgan-Phoenix/passlib_addition
Browse files Browse the repository at this point in the history
  • Loading branch information
metamorphic-spyware authored May 24, 2022
2 parents 42cc05f + f054472 commit de500d7
Show file tree
Hide file tree
Showing 4 changed files with 171 additions and 17 deletions.
15 changes: 8 additions & 7 deletions enrocrypt/core.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from typing import Any
from enrocrypt.hashing import Hashing
from enrocrypt.encryption import Encryption
from enrocrypt.basic import Basic
Expand All @@ -13,9 +12,9 @@ class Core(Hashing,Encryption,Basic):
}'''
def __init__(self) -> None:
self.salt = ''
def set_config(self,*args: Any):
'''Sets The Configuration For This Class And All Other Classes'''
configs = (args[0]['configs']['salt_file'])
self.byt = 512
def set_config(self,con:dict):
configs = (con['salt_file'])
value = self.__Set_Salt(configs)
return value
def __str__(self) -> str:
Expand All @@ -27,11 +26,13 @@ def __Set_Salt(self,salt:list):
self.salt = bytes(salts.encode())
return True
except FileNotFoundError:
return Warning("No Salt File Found At The Given Location Using Random Salt")
return print(Warning("No Salt File Found At The Given Location Using Random Salt"))
else:
return False
def get_hash_object(self):
'''Returns A Hashing Class Object That Is Pre-Configured To Use Custom Salt If Any'''
hashing = Hashing()
hashing(bytes(self.salt.encode()))
return hashing
if self.salt == "":
print(print(Warning("No Personalized Salt Loaded In The Memory, Using Random Salt")))
hashing(bytes(self.salt.encode()),self.byt)
return hashing
26 changes: 16 additions & 10 deletions enrocrypt/hashing.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
from cryptography.hazmat.primitives import hashes
from typing import Any
class Hashing():
def __init__(self) -> None:
def __init__(self):
self.salt = None
self.byt = 512
def __call__(self, *args:Any):
self.salt = args[0]
def __str__(self) -> str:
def __str__(self):
return "Hashing Funcitions In Here"

def __Salt(self,data,salt:bytes = None):
Expand All @@ -19,7 +20,10 @@ def __Salt(self,data,salt:bytes = None):
salts.append(str(data).split("'")[1])
salts.append(str(data).split("'")[1])
salts.append(str(hashlib.sha256(uuid.uuid4().bytes).digest()).split("'")[1])
return base64.standard_b64encode(bytes((str(base64.urlsafe_b64encode(bytes(''.join(salts).encode()))).split("'")[1]+str(base64.urlsafe_b64encode(base64.standard_b64encode((bytes(''.join(salts).encode()))))).split("'")[1]).encode()))
salting = base64.standard_b64encode(bytes((str(base64.urlsafe_b64encode(bytes(''.join(salts).encode()))).split("'")[1]+str(base64.urlsafe_b64encode(base64.standard_b64encode((bytes(''.join(salts).encode()))))).split("'")[1]).encode()))
if len(salting) > self.byt:
salting = salting.decode()[0:self.byt]
return salting
if salt:
salts = []
salts.append(str(hashlib.sha256(salt).digest()).split("'")[1])
Expand All @@ -29,8 +33,11 @@ def __Salt(self,data,salt:bytes = None):
salts.append(str(data).split("'")[1])
salts.append(str(data).split("'")[1])
salts.append(str(hashlib.sha256(salt).digest()).split("'")[1])
return base64.standard_b64encode(bytes((str(base64.urlsafe_b64encode(bytes(''.join(salts).encode()))).split("'")[1]+str(base64.urlsafe_b64encode(base64.standard_b64encode((bytes(''.join(salts).encode()))))).split("'")[1]).encode()))

salting2 = base64.standard_b64encode(bytes((str(base64.urlsafe_b64encode(bytes(''.join(salts).encode()))).split("'")[1]+str(base64.urlsafe_b64encode(base64.standard_b64encode((bytes(''.join(salts).encode()))))).split("'")[1]).encode()))
if salting2 > self.byt:
salting2 = salting2.decode()[0:self.byt]
return salting2

def Standard_Multi_Hash(self,Data:str):
'''Inreversable Salted Hash Function Don't Use If U Want To Get The Content Back'''
a = hashlib.sha256(); a.update(bytes(Data.encode())); b = []
Expand All @@ -46,7 +53,7 @@ def Standard_Multi_Hash(self,Data:str):
d[0] = self.__Salt(c,salt=self.salt)
final = self.BLAKE2(bytes(str(d[0]).encode()))
return(final)

def SHA256(self,data:str):
sha = hashlib.sha256(bytes(data.encode()))
Hash = sha.digest()
Expand All @@ -59,9 +66,9 @@ def SHA512(self,data:str):

def SHA244(self,data:str):
sha = hashlib.sha224(bytes(data.encode()))
Hash = str(sha.digest())
return self.__Salt(Hash,salt=self.salt)
hash = str(sha.digest())
return self.__Salt(hash,salt=self.salt)

def SHA384(self,data:str):
sha = hashlib.sha384(bytes(data.encode()))
Hash = str(sha.digest())
Expand All @@ -71,4 +78,3 @@ def BLAKE2(self,data:bytes):
a = hashes.Hash(hashes.BLAKE2s(32))
a.update(data)
return self.__Salt(a.finalize(),salt=self.salt)

73 changes: 73 additions & 0 deletions map/disection.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
BREAKING

pbkdf2-sha256$29000$C8F4r/U.5/yfM2ZszVnr3Q$7obwOw/4aZ.hYnhme9Zxqr4KgPIZ4EhRBnLKR6K9WeY (happiness)

Step -> 1

pbkdf2-sha256$29000$C8F4r
/
U.5
/
yfM2ZszVnr3Q$7obwOw
/
4aZ.hYnhme9Zxqr4KgPIZ4EhRBnLKR6K9WeY

Step -> 2

pbkdf2-sha256 NO
$ NO
29000 NO
$ NO
C8F4r YES
/ NO
U.5 YES
/ NO
yfM2ZszVnr3Q YES
$ NO
7obwOw YES
/ NO
4aZ.hYnhme9Zxqr4KgPIZ4EhRBnLKR6K9WeY YES



TILL NOW RESULT

C8F4rU.5yfM2ZszVnr3Q4aZ.hYnhme9Zxqr4KgPIZ4EhRBnLKR6K9WeY


SALTING

will use basic SHA256 to hash some random text and then add it randomly (i.e. in any order)
to the original text. As everything is hashed it will be very hard to find out the original
text and the Salt

BASIC SALT MODLE

salts = []
salts.append(str(hashlib.sha256(uuid.uuid4().bytes).digest()).split("'")[1])
salts.append(str(data).split("'")[1])
salts.append(str(hashlib.sha256(uuid.uuid4().bytes).digest()).split("'")[1])
salts.append(str(hashlib.sha256(uuid.uuid4().bytes).digest()).split("'")[1])
salts.append(str(data).split("'")[1])
salts.append(str(data).split("'")[1])
salts.append(str(hashlib.sha256(uuid.uuid4().bytes).digest()).split("'")[1])
return base64.standard_b64encode(bytes((str(base64.urlsafe_b64encode(bytes(''.join(salts).encode()))).split("'")[1]+str(base64.urlsafe_b64encode(base64.standard_b64encode((bytes(''.join(salts).encode()))))).split("'")[1]).encode()))

EDITED SALT MODLE (random mode)

salts = []
dataset = [] # len([]) == 7 TRUE
count = 0
salts.append(str(hashlib.sha256(uuid.uuid4().bytes).digest()).split("'")[1])
data = str(data).split("/") #len([]) == 4 TRUE
for i in data:
dataset.append(str(i).split("$"))
count+=1
dataset.pop(0)
dataset.pop(1)
for i in range(count):
salts.append(str(hashlib.sha256(uuid.uuid4().bytes).digest()).split("'")[1])
salts.append(str(hashlib.sha256(uuid.uuid4().bytes).digest()).split("'")[1])
salts.append(str(dataset[i]))
salts.append(str(hashlib.sha256(uuid.uuid4().bytes).digest()).split("'")[1])
return base64.standard_b64encode(bytes((str(base64.urlsafe_b64encode(bytes(''.join(salts).encode()))).split("'")[1]+str(base64.urlsafe_b64encode(base64.standard_b64encode((bytes(''.join(salts).encode()))))).split("'")[1]).encode()))
74 changes: 74 additions & 0 deletions map/passlib_functions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{
"passlib":{
"pbkdf2":{
"1":"pbkdf2_sha1",
"2":"pbkdf2_sha256",
"3":"pbkdf2_sha512",
"4": "cta_pbkdf2_sha1",
"5":"dlitz_pbkdf2_sha1",
"6":"grub_pbkdf2_sha512"
},
"argon2":{
"1":"argon2"
},
"bcrypt":{
"1":"bcrypt"
},
"cisco":{
"1":"cisco_pix",
"2":"cisco_asa",
"3":"cisco_type7"
},
"des_crypt":{
"1":"des_crypt",
"2":"bsdi_crypt",
"3":"bigcrypt",
"4":"crypt16"
},
"digests":{
"1":"create_hex_hash",
"2":"hex_md4",
"3":"hex_md5",
"4":"hex_sha1",
"5":"hex_sha256",
"6":"hex_sha512"
},
"django":{
"1":"django_salted_sha1",
"2":"django_salted_md5",
"3":"django_bcrypt",
"4":"django_pbkdf2_sha1",
"5":"django_pbkdf2_sha256",
"6":"django_argon2",
"7":"django_des_crypt",
"8":"django_disabled"
},
"fshp":{
"1":"fshp"
},
"ldap_digest":{
"1":"ldap_plaintext",
"2":"ldap_md5",
"3":"ldap_sha1",
"4":"ldap_salted_md5",
"5": "ldap_salted_sha1",
"6":"ldap_salted_sha256",
"7":"ldap_salted_sha512"
},
"mysql":{
"1":"mysql323",
"2":"mysq41"
},
"oracle":{
"1":"oracle10g",
"2":"oracle11g"
},
"windows":{
"1":"lmhash",
"2": "nthash",
"3":"bsd_nthash",
"4":"msdcc",
"5":"msdcc2"
}
}
}

0 comments on commit de500d7

Please sign in to comment.