Author Topic: [Python] Hash Algorithm Identifier v3.3  (Read 3923 times)

0 Members and 1 Guest are viewing this topic.

Offline Psycho_Coder

  • Knight
  • **
  • Posts: 166
  • Cookies: 84
  • Programmer, Forensic Analyst
    • View Profile
    • Code Hackers Blog
[Python] Hash Algorithm Identifier v3.3
« on: February 23, 2014, 09:16:18 pm »

Hello EZ,


I have made a Hash Identifier which can be used to identify login hash or cookie hash etc. This app. can detect the password hash algorithms used to encrypt passwords of various forums like MyBB, phpBB3, Drupal, Joomla, wordpress, oracle 10g,11g etc etc.


I had made earlier a tutorial on how to identify the different types of hashes on another forum, I can post it here after you tell me which section is most suitable for it.


If you don't know what a Hash Function is then I recommend you to read about it here :- http://en.wikipedia.org/wiki/Hash_function





Anyone who have used Kali Linux, they may know that you have a tool named hash-identifier and the link to the source of the tool has already been posted in a reply in the tutorial link given above. However I will provide the link again :-


Quote
https://code.google.com/p/hash-identifier/


But the code is bad and has a huge if-else-if and method construct and also some of them are not correct.





Here's my version of HashIdentifier. (# of lines of code : 165)


Screenshot





You can get the code from the link below :-


Quote
https://github.com/PsychoCoderHC/Hash-Algorithm-Identifier


The style and design of the code has been kept same as the original hash-identifier in the Google-code project link given above.


How to Use ?


To use this simply run the following in a terminal ( & the app will start):-


Code: [Select]
python HashIdentifier.py

To make it executable as well run :-


Code: [Select]
chmod +x HashIdentifier.py

and then starting it by executing (One's the executable is made you can start it by typing the following text only):-


Code: [Select]
./HashIdentifier.py

If you don't understand the steps above then don't worry, in the github link posted above where the code is hosted you will find a file start.sh (for linux users) or use start.cmd (for windows users), just execute it and it will start running.


To execute the start.sh, type the following in the terminal :-


Code: [Select]
sh start.sh

For windows users I have made an executable of this tool using py2exe, you will get everything on the github project link.


About the Code


As it is evident from the code that I have used regular expressions to identify the hashes. The hashes are being identified because they have certain characteristics and when the regex expressions are written correctly they match properly with the hash, and will give the correct results. Using regular expressions to identify the hash makes the code neat and easy to understand only if you have a proper understanding of Regular Expressions.


To understand the regex expressions used in the code anf test them by yourself, VISIT THIS SITE and paste the Regex Expression in its proper place and thereby you get the explanation about the regex.


Here's a sample :-


Quote
http://regex101.com/r/qE2tM2


Specifications :-


Name :- Hash Algorithm Identifier.
Version :- 3.3 (New Version, Read Changelog in the quick link below)
Encryption formats supported :- 160 Hashes (Listed below)


Code: [Select]
* Adler32
* Apache MD5
* Blowfish crypt
* Blowfish(Eggdrop)
* Blowfish(OpenBSD)
* CRC-16
* CRC-16-CCITT
* CRC-32
* CRC-32B
* CRC-64
* CRC-96(ZIP)
* Cisco IOS SHA256
* Cisco-IOS MD5
* DES crypt
* DES hash(Traditional)
* DES(Oracle)
* DES(Unix)
* Domain Cached Credentials 2(DCC2)
* Domain Cached Credentials(DCC)
* ELF-32
* EPi hash
* EPiServer 6.x < v4
* EPiServer 6.x >= v4
* FCS-16
* FCS-32
* FNV-164
* FNV-32
* Fletcher-32
* Fortigate (FortiOS)
* FreeBSD MD5
* GHash-32-3
* GHash-32-5
* GOST R 34.11-94
* HAVAL-128
* HAVAL-128(HMAC)
* HAVAL-160
* HAVAL-192
* HAVAL-224
* HAVAL-256
* Joaat
* Juniper Netscreen/SSG (ScreenOS)
* Keccak-224
* Keccak-256
* Keccak-512
* LDAP {SSHA512}
* LM
* Lineage II C4
* Lotus Domino
* MD2
* MD2(HMAC)
* MD4
* MD4(HMAC)
* MD5
* MD5 apache crypt
* MD5 crypt
* MD5(APR)
* MD5(Chap)
* MD5(Cisco PIX)
* MD5(HMAC(Wordpress))
* MD5(HMAC)
* MD5(IP.Board)
* MD5(Joomla)
* MD5(MyBB)
* MD5(Palshop)
* MD5(Unix)
* MD5(Wordpress)
* MD5(ZipMonster)
* MD5(osCommerce)
* MD5(phpBB3)
* MSCASH2
* MSSQL(2000)
* MSSQL(2005)
* MSSQL(2008)
* MSSQL(2012)
* Minecraft(Authme)
* MySQL 3.x
* MySQL 4.x
* MySQL 5.x
* NSLDAP
* NSLDAPS
* NT crypt
* NTLM
* Netscape LDAP SHA
* Netscape LDAP SSHA
* OSX v10.4, v10.5, v10.6
* OSX v10.7
* OSX v10.8
* Oracle 11g
* RAdmin v2.x
* RIPEMD-128
* RIPEMD-128(HMAC)
* RIPEMD-160
* RIPEMD-160(HMAC)
* RIPEMD-256
* RIPEMD-256(HMAC)
* RIPEMD-320
* RIPEMD-320(HMAC)
* SALSA-10
* SALSA-20
* SAM(LM_Hash:NT_Hash)
* SHA-1
* SHA-1 crypt
* SHA-1(Django)
* SHA-1(Hex)
* SHA-1(LDAP) Base64
* SHA-1(LDAP) Base64 + salt
* SHA-1(MaNGOS)
* SHA-1(MaNGOS2)
* SHA-1(Oracle)
* SHA-224
* SHA-224(HMAC)
* SHA-256
* SHA-256 crypt
* SHA-256(Django)
* SHA-256(HMAC)
* SHA-256(Unix)
* SHA-3(Keccak)
* SHA-384
* SHA-384(Django)
* SHA-512
* SHA-512 crypt
* SHA-512(Drupal)
* SHA-512(HMAC)
* SHA-512(Unix)
* SHA3-384
* SHA3-512
* SMF >= v1.1
* SSHA-1
* SSHA-1(Base64)
* SSHA-512(Base64)
* Skein-1024
* Skein-1024(384)
* Skein-1024(512)
* Skein-256
* Skein-256(128)
* Skein-256(160)
* Skein-256(224)
* Skein-512
* Skein-512(128)
* Skein-512(160)
* Skein-512(224)
* Skein-512(256)
* Skein-512(384)
* Snefru-128
* Snefru-128(HMAC)
* Snefru-256
* Snefru-256(HMAC)
* TIGER-160
* TIGER-160(HMAC)
* TIGER-192(HMAC)
* Tiger-128
* Tiger-128(HMAC)
* Tiger-192
* VNC
* Whirlpool
* XOR-32
* substr(md5($pass),0,16)
* substr(md5($pass),16,16)
* substr(md5($pass),8,16)
* xt:Commerce


If you wish to compile the code from scratch by yourself (If you are one of these guys then I like you) then you can use the function code below to print the hashes. Just use the function the in the main code and then call this function's name from the function main()


Code: [Select]

#Function to print all the hashes supported.
def printAllHashSupported():
ress = []
for item in HASHES:
ress += [item[0]] if ( type(item[0]) is str ) else item[0]
ress.sort()
for i in range(int(len(ress))):
print("* " + ress[i])
print("Total number of Hash algorithms supported: " + str(len(ress)))




This Tool will be updated soon again to support several other Hashes, its still in its alpha stage. There are several features which I plan to implement. At least more 120 hashes types will be added inclusive of the PHP hashes schemes.


Suggestion and feedback are welcome. I am not very fluent with python and I am still learning. I am good and comfortable with java so code optimization for the improvement of this tool is heartily welcomed.


Quick Links


1. Project Site : http://psychocoderhc.github.io/Hash-Algorithm-Identifier/
2. Github Project Page : https://github.com/PsychoCoderHC/Hash-Algorithm-Identifier
3. Project Wiki : https://github.com/PsychoCoderHC/Hash-Algorithm-Identifier/wiki
4. Read Changelog from Version 2.2 to Version 3.2 : https://github.com/PsychoCoderHC/Hash-Algorithm-Identifier/blob/master/CHANGELOG.md


Thanks to Deque for encouragement. You're awesome.


Thank you,
Sincerely,
Psycho_Coder.
"Don't do anything by half. If you love someone, love them with all your soul. When you hate someone, hate them until it hurts."--- Henry Rollins

Offline Deque

  • P.I.N.N.
  • Global Moderator
  • Overlord
  • *
  • Posts: 1203
  • Cookies: 518
  • Programmer, Malware Analyst
    • View Profile
Re: [Python] Hash Algorithm Identifier v3.3
« Reply #1 on: February 23, 2014, 09:25:47 pm »
This is a great improvement. One cookie for this.
And thanks, you are welcome.  :)

Offline Psycho_Coder

  • Knight
  • **
  • Posts: 166
  • Cookies: 84
  • Programmer, Forensic Analyst
    • View Profile
    • Code Hackers Blog
Re: [Python] Hash Algorithm Identifier v3.3
« Reply #2 on: February 23, 2014, 09:34:28 pm »
This is a great improvement. One cookie for this.
And thanks, you are welcome.  :)


Thanks  but I didn't get the cookie to eat and today was my birthday as well  ;D 
BTW: this cookie system is very funny. hahaha
"Don't do anything by half. If you love someone, love them with all your soul. When you hate someone, hate them until it hurts."--- Henry Rollins

Offline GreyPhantom

  • NULL
  • Posts: 4
  • Cookies: 0
  • ~GP X
    • View Profile
Re: [Python] Hash Algorithm Identifier v3.3
« Reply #3 on: April 24, 2014, 01:18:40 am »
I saw first the Hash Identifier and now I see this, I am not a good Python Programmer that's why I can't identify the bugs in the code. XD
Anyways, thanks for this bro. :)
I'm gonna share it!

Offline Deque

  • P.I.N.N.
  • Global Moderator
  • Overlord
  • *
  • Posts: 1203
  • Cookies: 518
  • Programmer, Malware Analyst
    • View Profile
Re: [Python] Hash Algorithm Identifier v3.3
« Reply #4 on: April 24, 2014, 11:36:43 am »
I saw first the Hash Identifier and now I see this, I am not a good Python Programmer that's why I can't identify the bugs in the code. XD
Anyways, thanks for this bro. :)
I'm gonna share it!

The original Hash ID didn't had bugs I know of, but the code was just ugly. So we came to the idea to make it better and that is the result. I think Psycho_Coder did a very good job here.

@Psycho_Coder: I am sorry that I oversaw your answer and your birthday. Congrats (much too late).