blackjack

[historical] Password bruteforce script
git clone git://mcdim.xyz/blackjack21.git
Log | Files | Refs | LICENSE

blackjack.py (19424B)


      1 # BlackJack v0.4
      2 # Password cracking software
      3 # MD - Greece
      4 # Password cracking & penetration testing software
      5 # You may not use this for illegal and/or malicious purposes
      6 # License:
      7 # GNU GPL v0.3
      8 
      9 #    LIBRARIES    #
     10 from __future__ import print_function
     11 import hashlib
     12 import time
     13 import argparse
     14 
     15 # GLOBAL VARIABLES #
     16 skip_termination = False
     17 
     18 #     VERSION     #
     19 version = "0.4"
     20 
     21 #    INTERFACE    #
     22 def logo():
     23 	print("""______ _            _      ___            _
     24 | ___ \ |          | |    |_  |          | |
     25 | |_/ / | __ _  ___| | __   | | __ _  ___| | __
     26 | ___ \ |/ _` |/ __| |/ /   | |/ _` |/ __| |/ /
     27 | |_/ / | (_| | (__|   </\__/ / (_| | (__|   <
     28 \____/|_|\__,_|\___|_|\_\____/ \__,_|\___|_|\_\\
     29 
     30 	BlackJack v%s By MCD 2017-2018""" % version)
     31 
     32 def options():
     33 	print("""              __
     34         _..-''--'----_.
     35       ,''.-''| .---/ _`-._           Black Jack v%s
     36     ,' \ \  ;| | ,/ / `-._`-.
     37   ,' ,',\ \( | |// /,-._  / /     Password Cracker
     38   ;.`. `,\ \`| |/ / |   )/ /           By MichaelDim02
     39  / /`_`.\_\ \| /_.-.'-''/ /
     40 / /_|_:.`. \ |;'`..')  / /          BlackJack 21
     41 `-._`-._`.`.;`.\  ,'  / /   github.com/MichaelDim02/BlackJack21
     42     `-._`.`/    ,'-._/ /
     43       : `-/     \`-.._/  Hashes included:
     44       |  :      ;._ (		     --md5
     45       :  |      \  ` \		     --sha1
     46        \         \   |		     --sha256
     47         :        :   ;               --sha512
     48         |           /
     49         ;         ,'     Arguments:
     50        /         /                   -p	--pswd  Hashed Pass
     51       /         /                    -d --dict  Dictionary
     52                / SSt		     -v --verb  Verbose opt
     53 				     -i --info  Information
     54 Bruteforce:
     55 	--brf
     56 	--md5 --sha1 --sha256 --sha512
     57 	--digits 	Number of digits (Up to 10, 0 = all)
     58 	--list (Number of list)
     59 		1 = numbers
     60 		2 = lowercase letters
     61 		3 = lowercase letters, numbers
     62 		4 = upper case
     63 		5 = upper case, lower case
     64 		6 = upper case, numbers
     65 		7 = upper case, lower case, numbers
     66 
     67 Usage: python blackjack.py --md5 -p [HASH] -d [DICT] -v""" % version)
     68 
     69 # PASSWORD CRACKING #
     70 def crack():
     71 	if md5_opt:
     72 		print("Hash: MD5")
     73 	elif sha1_opt:
     74 		print("Hash: SHA1")
     75 	elif sha256_opt:
     76 		print("Hash: SHA256")
     77 	elif sha512_opt:
     78 		print("Hash: SHA512")
     79 	print("Method: Dictionary attack")
     80 	print("Dictionary: %s" % (str(dict)))
     81 	print("Cracking..")
     82 	start = time.time()
     83 	tries = 0
     84 	try:
     85 		file = open(dict, "r").read().split('\n')
     86 	except:
     87 		print("File could not be found")
     88 		exit()
     89 	for password in file:
     90 		tries = tries + 1
     91 		if md5_opt:
     92 			hashed_attempt = hashlib.md5(password).hexdigest()
     93 		elif sha1_opt:
     94 			hashed_attempt = hashlib.sha1(password).hexdigest()
     95 		elif sha256_opt:
     96 			hashed_attempt = hashlib.sha256(password).hexdigest()
     97 		elif sha512_opt:
     98 			hashed_attempt = hashlib.sha512(password).hexdigest()
     99 		if hashed_attempt == hash:
    100 			print("\n[%d] - PASSWORD FOUND - %s\n" % (tries,password))
    101 			end = time.time()
    102 			time_elapsed = end - start;
    103 			print("[!] Time elapsed: %d seconds" % (time_elapsed))
    104 			print("[!] Session complete")
    105 			exit()
    106 		else:
    107 			if verb == True:
    108 				print("[%d] - FAILED ATTEMPT - %s" % (tries,password))
    109 	print("[!] Session complete")
    110 # Bruteforce method #
    111 def digit1():
    112 	tries = 0
    113 	start = time.time
    114         for item in plist:
    115 		tries = tries + 1
    116                 password = item
    117                 password = "".join(password)
    118 		if md5_opt:
    119 			hashed_attempt = hashlib.md5(password).hexdigest()
    120 		elif sha1_opt:
    121 			hashed_attempt = hashlib.sha1(password).hexdigest()
    122 		elif sha256_opt:
    123 			hashed_attempt = hashlib.sha256(password).hexdigest()
    124 		elif sha512_opt:
    125 			hashed_attempt = hashlib.sha512(password).hexdigest()
    126 		if hashed_attempt == hash:
    127 			print("\n[%d] - PASSWORD FOUND - %s\n" % (tries,password))
    128 			end = time.time()
    129 			time_elapsed = end - start;
    130 			print("[!] Time elapsed: %d seconds" % (time_elapsed))
    131 			print("[!] Session complete")
    132 			exit()
    133 	if skip_termination == False:
    134 		print("[!] Session complete")
    135 		exit()
    136 def digit2():
    137 	tries = 0
    138 	start = time.time()
    139         for item in plist:
    140                 for item2 in plist:
    141 			tries = tries + 1
    142                         password = item + item2
    143                         password = "".join(password)
    144 			if md5_opt:
    145 				hashed_attempt = hashlib.md5(password).hexdigest()
    146 			elif sha1_opt:
    147 				hashed_attempt = hashlib.sha1(password).hexdigest()
    148 			elif sha256_opt:
    149 				hashed_attempt = hashlib.sha256(password).hexdigest()
    150 			elif sha512_opt:
    151 				hashed_attempt = hashlib.sha512(password).hexdigest()
    152 			if hashed_attempt == hash:
    153 				print("\n[%d] - PASSWORD FOUND - %s\n" % (tries,password))
    154 				end = time.time()
    155 				time_elapsed = end - start;
    156 				print("[!] Time elapsed: %d seconds" % (time_elapsed))
    157 				print("[!] Session complete")
    158 				exit()
    159 	if skip_termination == False:
    160 		print("[!] Session complete")
    161 		exit()
    162 def digit3():
    163 	tries = 0
    164 	start = time.time()
    165         for item in plist:
    166                 for item2 in plist:
    167                         for item3 in plist:
    168 				tries = tries + 1
    169                                 password = item + item2 + item3
    170                                 password = "".join(password)
    171 				if md5_opt:
    172 					hashed_attempt = hashlib.md5(password).hexdigest()
    173 				elif sha1_opt:
    174 					hashed_attempt = hashlib.sha1(password).hexdigest()
    175 				elif sha256_opt:
    176 					hashed_attempt = hashlib.sha256(password).hexdigest()
    177 				elif sha512_opt:
    178 					hashed_attempt = hashlib.sha512(password).hexdigest()
    179 				if hashed_attempt == hash:
    180 					print("\n[%d] - PASSWORD FOUND - %s\n" % (tries,password))
    181 					end = time.time()
    182 					time_elapsed = end - start;
    183 					print("[!] Time elapsed: %d seconds" % (time_elapsed))
    184 					print("[!] Session complete")
    185 					exit()
    186 	if skip_termination == False:
    187 		print("[!] Session complete")
    188 		exit()
    189 def digit4():
    190 	tries = 0
    191 	start = time.time()
    192         for item in plist:
    193                 for item2 in plist:
    194                         for item3 in plist:
    195                                 for item4 in plist:
    196 					tries = tries + 1
    197                                         password = item + item2 + item3 + item4
    198                                         password = "".join(password)
    199 					if md5_opt:
    200 						hashed_attempt = hashlib.md5(password).hexdigest()
    201 					elif sha1_opt:
    202 						hashed_attempt = hashlib.sha1(password).hexdigest()
    203 					elif sha256_opt:
    204 						hashed_attempt = hashlib.sha256(password).hexdigest()
    205 					elif sha512_opt:
    206 						hashed_attempt = hashlib.sha512(password).hexdigest()
    207 					if hashed_attempt == hash:
    208 						print("\n[%d] - PASSWORD FOUND - %s\n" % (tries,password))
    209 						end = time.time()
    210 						time_elapsed = end - start;
    211 						print("[!] Time elapsed: %d seconds" % (time_elapsed))
    212 						print("[!] Session complete")
    213 						exit()
    214 	if skip_termination == False:
    215 		print("[!] Session complete")
    216 		exit()
    217 def digit5():
    218 	tries = 0
    219 	start = time.time()
    220         for item in plist:
    221                 for item2 in plist:
    222                         for item3 in plist:
    223                                 for item4 in plist:
    224                                         for item5 in plist:
    225 						tries = tries + 1
    226                                                 password = item + item2 + item3 + item4 + item5
    227                                                 password = "".join(password)
    228 						if md5_opt:
    229 							hashed_attempt = hashlib.md5(password).hexdigest()
    230 						elif sha1_opt:
    231 							hashed_attempt = hashlib.sha1(password).hexdigest()
    232 						elif sha256_opt:
    233 							hashed_attempt = hashlib.sha256(password).hexdigest()
    234 						elif sha512_opt:
    235 							hashed_attempt = hashlib.sha512(password).hexdigest()
    236 						if hashed_attempt == hash:
    237 							print("\n[%d] - PASSWORD FOUND - %s\n" % (tries,password))
    238 							end = time.time()
    239 							time_elapsed = end - start;
    240 							print("[!] Time elapsed: %d seconds" % (time_elapsed))
    241 							print("[!] Session complete")
    242 							exit()
    243 	if skip_termination == False:
    244 		print("[!] Session complete")
    245 		exit()
    246 def digit6():
    247 	tries = 0
    248 	start = time.time()
    249         for item in plist:
    250                 for item2 in plist:
    251                         for item3 in plist:
    252                                 for item4 in plist:
    253                                         for item5 in plist:
    254                                                 for item6 in plist:
    255 							tries = tries + 1
    256                                                         password = item + item2 + item3 + item4 + item5 + item6
    257                                                         password = "".join(password)
    258 							if md5_opt:
    259 								hashed_attempt = hashlib.md5(password).hexdigest()
    260 							elif sha1_opt:
    261 								hashed_attempt = hashlib.sha1(password).hexdigest()
    262 							elif sha256_opt:
    263 								hashed_attempt = hashlib.sha256(password).hexdigest()
    264 							elif sha512_opt:
    265 								hashed_attempt = hashlib.sha512(password).hexdigest()
    266 							if hashed_attempt == hash:
    267 								print("\n[%d] - PASSWORD FOUND - %s\n" % (tries,password))
    268 								end = time.time()
    269 								time_elapsed = end - start;
    270 								print("[!] Time elapsed: %d seconds" % (time_elapsed))
    271 								print("[!] Session complete")
    272 								exit()
    273 	if skip_termination == False:
    274 		print("[!] Session complete")
    275 		exit()
    276 def digit7():
    277 	tries = 0
    278 	start = time.time()
    279         for item in plist:
    280                 for item2 in plist:
    281                         for item3 in plist:
    282                                 for item4 in plist:
    283                                         for item5 in plist:
    284                                                 for item6 in plist:
    285 							for item7 in plist:
    286 								tries = tries + 1
    287                                                         	password = item + item2 + item3 + item4 + item5 + item6 + item7
    288                                                         	password = "".join(password)
    289 								if md5_opt:
    290 									hashed_attempt = hashlib.md5(password).hexdigest()
    291 								elif sha1_opt:
    292 									hashed_attempt = hashlib.sha1(password).hexdigest()
    293 								elif sha256_opt:
    294 									hashed_attempt = hashlib.sha256(password).hexdigest()
    295 								elif sha512_opt:
    296 									hashed_attempt = hashlib.sha512(password).hexdigest()
    297 								if hashed_attempt == hash:
    298 									print("\n[%d] - PASSWORD FOUND - %s\n" % (tries,password))
    299 									end = time.time()
    300 									time_elapsed = end - start;
    301 									print("[!] Time elapsed: %d seconds" % (time_elapsed))
    302 									print("[!] Session complete")
    303 									exit()
    304 	if skip_termination == False:
    305 		print("[!] Session complete")
    306 		exit()
    307 def digit8():
    308 	tries = 0
    309 	start = time.time()
    310         for item in plist:
    311                 for item2 in plist:
    312                         for item3 in plist:
    313                                 for item4 in plist:
    314                                         for item5 in plist:
    315                                                 for item6 in plist:
    316                                                         for item7 in plist:
    317                                                                 for item8 in plist:
    318 									tries = tries + 1
    319                                                                         password = item + item2 + item3 + item4 + item5 + item6 + item7 + item8
    320                                                                         password = "".join(password)
    321 									if md5_opt:
    322 										hashed_attempt = hashlib.md5(password).hexdigest()
    323 									elif sha1_opt:
    324 										hashed_attempt = hashlib.sha1(password).hexdigest()
    325 									elif sha256_opt:
    326 										hashed_attempt = hashlib.sha256(password).hexdigest()
    327 									elif sha512_opt:
    328 										hashed_attempt = hashlib.sha512(password).hexdigest()
    329 									if hashed_attempt == hash:
    330 										print("\n[%d] - PASSWORD FOUND - %s\n" % (tries,password))
    331 										end = time.time()
    332 										time_elapsed = end - start;
    333 										print("[!] Time elapsed: %d seconds" % (time_elapsed))
    334 										print("[!] Session complete")
    335 										exit()
    336 	if skip_termination == False:
    337 		print("[!] Session complete")
    338 		exit()
    339 def digit9():
    340 	tries = 0
    341 	start = time.time()
    342         for item in plist:
    343                 for item2 in plist:
    344                         for item3 in plist:
    345                                 for item4 in plist:
    346                                         for item5 in plist:
    347                                                 for item6 in plist:
    348                                                         for item7 in plist:
    349                                                                 for item8 in plist:
    350                                                                         for item9 in plist:
    351 										tries = tries + 1
    352                                                                                 password = item+item2+item3+item4+item5+item6+item7+item8
    353                                                                                 password = "".join(password)
    354 										if md5_opt:
    355 											hashed_attempt = hashlib.md5(password).hexdigest()
    356 										elif sha1_opt:
    357 											hashed_attempt = hashlib.sha1(password).hexdigest()
    358 										elif sha256_opt:
    359 											hashed_attempt = hashlib.sha256(password).hexdigest()
    360 										elif sha512_opt:
    361 											hashed_attempt = hashlib.sha512(password).hexdigest()
    362 										if hashed_attempt == hash:
    363 											print("\n[%d] - PASSWORD FOUND - %s\n" % (tries,password))
    364 											end = time.time()
    365 											time_elapsed = end - start;
    366 											print("[!] Time elapsed: %d seconds" % (time_elapsed))
    367 											print("[!] Session complete")
    368 											exit()
    369 	if skip_termination == False:
    370 		print("[!] Session complete")
    371 		exit()
    372 def digit10():
    373 	tries = 0
    374 	start = time.time()
    375         for item in plist:
    376                 for item2 in plist:
    377                         for item3 in plist:
    378                                 for item4 in plist:
    379                                         for item5 in plist:
    380                                                 for item6 in plist:
    381                                                         for item7 in plist:
    382                                                                 for item8 in plist:
    383                                                                         for item9 in plist:
    384                                                                                 for item10 in plist:
    385 											tries = tries + 1
    386                                                                                         password = item+item2+item3+item4+item5+item6+item7+item8+item9+item10
    387                                                                                         password = "".join(password)
    388 										if md5_opt:
    389 											hashed_attempt = hashlib.md5(password).hexdigest()
    390 										elif sha1_opt:
    391 											hashed_attempt = hashlib.sha1(password).hexdigest()
    392 										elif sha256_opt:
    393 											hashed_attempt = hashlib.sha256(password).hexdigest()
    394 										elif sha512_opt:
    395 											hashed_attempt = hashlib.sha512(password).hexdigest()
    396 										if hashed_attempt == hash:
    397 											print("\n[%d] - PASSWORD FOUND - %s\n" % (tries,password))
    398 											end = time.time()
    399 											time_elapsed = end - start;
    400 											print("[!] Time elapsed: %d seconds" % (time_elapsed))
    401 											print("[!] Session complete")
    402 											exit()	
    403 	print("[!] Session complete")
    404 	exit()
    405 # INFORMATION #
    406 def information():
    407 	logo()
    408 	print("\nBlack Jack %s" % version)
    409 	print("Version: %s" % version)
    410 	print("License: GNU GPL v0.3 (2007)")
    411 	print("Use for legal purposes only. The developer has no responsibility for")
    412 	print("any damage caused by this program. By using this program users agree that")
    413 	print("all the responsibility of any misuse of the software is theirs.")
    414 	print("ASCII art by SSt (2006)")
    415 	print("By MCD - Thessaloniki, Greece 2017-2018")
    416 
    417 # ARGUMENT PARSING #
    418 parser = argparse.ArgumentParser()
    419 # Hashes #
    420 parser.add_argument("--md5", action="store_true")
    421 parser.add_argument("--sha1", action="store_true")
    422 parser.add_argument("--sha256", action="store_true")
    423 parser.add_argument("--sha512", action="store_true")
    424 # Options & Arguments #
    425 parser.add_argument("-p", "--pswd", help="Hashed Pass")
    426 parser.add_argument("-d", "--dict", help="Dictionary")
    427 parser.add_argument("-v", "--verb", action="store_true", help="Verbose opt")
    428 parser.add_argument("-i", "--info", action="store_true", help="Information")
    429 # Bruteforce #
    430 parser.add_argument("--brf", help="Bruteforce mode", action="store_true")
    431 parser.add_argument("--digits", help="Digits (Up to 10, 0 = all)")
    432 parser.add_argument("--list", help="List of characters")
    433 # hashes vars #
    434 args = parser.parse_args()
    435 md5_opt = args.md5
    436 sha1_opt = args.sha1
    437 sha256_opt = args.sha256
    438 sha512_opt = args.sha512
    439 # bruteforce #
    440 brf = args.brf
    441 dig = args.digits
    442 lst = args.list
    443 # opts vars #
    444 hash = args.pswd
    445 dict = args.dict
    446 verb = args.verb
    447 info = args.info
    448 logo()
    449 if info == True:
    450 	information()
    451 	exit()
    452 elif md5_opt or sha1_opt or sha256_opt or sha512_opt:
    453 	if brf:
    454 		print("Method: Bruteforce")
    455 		if md5_opt:
    456 			print("Hash: MD5")
    457 		elif sha1_opt:
    458 			print("Hash: SHA1")
    459 		elif sha256_opt:
    460 			print("Hash: SHA256")
    461 		elif sha512_opt:
    462 			print("Hash: SHA512")
    463  		if dig != "0":
    464 			print("Digits:", dig)
    465 		else:
    466 			print("Digits:", dig, "(all)")
    467 		if lst == "1":
    468 			lst_name = "1 - Numbers"
    469 		elif lst == "2":
    470 			lst_name = "2 - Lower case letters"
    471 		elif lst == "3":
    472 			lst_name = "3 - Lower case letters, numbers"
    473 		elif lst == "4":
    474 			lst_name = "4 - Upper case letters"
    475 		elif lst == "5":
    476 			lst_name = "5 - Upper case letters, lower case letters"
    477 		elif lst == "6":
    478 			lst_name = "6 - Upper case letters, numbers"
    479 		elif lst == "7":
    480 			lst_name = "7 - Upper case letters, lower case letters, numbers"
    481 		print("List:", lst_name)
    482 		print("Cracking...")
    483 		if lst == "1":
    484 			plist = ['0','1','2','3','4','5','6','7','8','9']
    485 		elif lst == "2":
    486 			plist= ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
    487 		elif lst == "3":
    488 			plist = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','0','1','2','3','4','5','6','7','8','9']
    489 		elif lst == "4":
    490 			plist = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']
    491 		elif lst == "5":
    492 			plist = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
    493 		elif lst == "6":
    494 			plist = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','0','1','2','3','4','5','6','7','8','9']
    495 		elif lst == "7":
    496 			plist = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','0','1','2','3','4','5','6','7','8','9']
    497 		else:
    498 			print("[+] List not found")
    499 			exit()
    500 		if dig == "0":
    501 			skip_termination = True
    502 			digit1()
    503 			digit2()
    504 			digit3()
    505 			digit4()
    506 			digit5()
    507 			digit6()
    508 			digit7()
    509 			digit8()
    510 			digit9()
    511 			digit10()
    512 		elif dig == "1":
    513 			digit1()
    514 		elif dig == "2":
    515 			digit2()
    516 		elif dig == "3":
    517 			digit3()
    518 		elif dig == "4":
    519 			digit4()
    520 		elif dig == "5":
    521 			digit5()
    522 		elif dig == "6":
    523 			digit6()
    524 		elif dig == "7":
    525 			digit7()
    526 		elif dig == "8":
    527 			digit8()
    528 		elif dig == "9":
    529 			digit9()
    530 		elif dig == "10":
    531 			digit10()
    532 		else:
    533 			print("[!] Blackjack supports digits 0-10 (0 = all)")
    534 	else:
    535 		crack()
    536 else:
    537 	options()