├── core ├── __init__.py ├── exceptions.py ├── options.py ├── runner.py └── pzma.py ├── test ├── pwd.7z └── psw.lst ├── .editorconfig ├── main.py ├── setup.py └── README.md /core/__init__.py: -------------------------------------------------------------------------------- 1 | pass 2 | -------------------------------------------------------------------------------- /test/pwd.7z: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seyptoo/7z-BruteForce/HEAD/test/pwd.7z -------------------------------------------------------------------------------- /test/psw.lst: -------------------------------------------------------------------------------- 1 | facebook 2 | gmail 3 | password123 4 | 123456 5 | 123456789 6 | bruteforce 7 | testing 8 | test 9 | twitter 10 | check 11 | password 12 | highschool 13 | college 14 | 15 | -------------------------------------------------------------------------------- /core/exceptions.py: -------------------------------------------------------------------------------- 1 | #/usr/bin/env python 2 | #coding:utf-8 3 | 4 | class SevenZipIncorrect(Exception): 5 | def __init__(self, error_zip): 6 | self.error_zip = error_zip 7 | 8 | class SevenZipNoInstall(Exception): 9 | def __init__(self, error_dls): 10 | self.error_dls = error_dls 11 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | end_of_line = lf 5 | insert_final_newline = true 6 | 7 | # Matches multiple files with brace expansion notation 8 | [*.{py,js,jsx,html,sass}] 9 | charset = utf-8 10 | indent_style = tab 11 | indent_size = 2 12 | trim_trailing_whitespace = true 13 | 14 | [*.md] 15 | trim_trailing_whitespace = false 16 | -------------------------------------------------------------------------------- /core/options.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | #coding:utf-8 3 | 4 | from optparse import * 5 | 6 | parser = OptionParser() 7 | parser.add_option("-f", "--files", dest="files", help="The 7z file to crack.") 8 | parser.add_option("-w", "--wordlist", dest="wordlist", help="The wordlist for crack.") 9 | (options, args) = parser.parse_args() 10 | files = options.files 11 | wordlist = options.wordlist 12 | -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | #coding:utf-8 3 | 4 | import sys 5 | import os as return_n 6 | 7 | from core import exceptions 8 | from core import options 9 | from core import runner 10 | from core import pzma 11 | 12 | class call(object): 13 | def __init__(self): 14 | if(options.files == None or options.wordlist == None): 15 | sys.exit(return_n.system("python %s -h" %(sys.argv[0]))) 16 | sys.exit(runner.runner().start()) 17 | 18 | if __name__ == "__main__": 19 | call().__init__() 20 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | import setuptools 5 | import platform 6 | import os as return_p 7 | 8 | __version__ = "1.0.0.0" 9 | __authors__ = "Seyptoo" 10 | __description__ = "Crack archive 7zip" 11 | __name__ = "7z-BruteForce" 12 | 13 | ''' 14 | This function allows you to install 15 | the necessary packages and run the program __setup__tools()__. 16 | ''' 17 | 18 | if(platform.dist()[0] == "Ubuntu" or platform.dist()[0] == "Debian"): 19 | bash_command = """ 20 | apt-get install p7zip-full 21 | """ 22 | else: 23 | bash_command = """ 24 | pacman -S p7zip 25 | """ 26 | 27 | return_p.system(bash_command) 28 | setuptools.setup ( 29 | name = __name__, 30 | author = __authors__, 31 | version = __version__, 32 | description = __description__ 33 | ) 34 | 35 | if __name__ == "__main__": 36 | pass 37 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 7z-BruteForce 2 | 3 | [![forthebadge made-with-python](http://ForTheBadge.com/images/badges/made-with-python.svg)](https://www.python.org/) 4 | 5 | Options 6 | ---- 7 | There are two options available in the program, --files and --wordlist. 8 | 9 | Usage: latex.py [options] 10 | 11 | Options: 12 | -h, --help show this help message and exit 13 | -f FILES, --files=FILES 14 | The 7z file to crack. 15 | -w WORDLIST, --wordlist=WORDLIST 16 | The wordlist for crack. 17 | 18 | Development 19 | ---- 20 | 21 | This program was developed under linux, because the file 7z is already installed by default on Linux but the program can work very well under Windows if you manage a little alone. 22 | 23 | Linux 24 | 25 | Use : 26 | ---- 27 | 28 | As you can see, you have to use 2 functions to run the program. The --files option for the 7z file name and finally --wordlist for the file list that will test the passwords. 29 | 30 | root@Computer:/home/Computer/Desktop# python server.py --files backup.7z --wordlist lists.txt 31 | Copyright (c) 2019 by Seyptoo. 32 | 7z-Bruteforce cracker password, version 1.0.0.0-7z-1 467/220563. 33 | [SUCCESS] Password cracked with success : password 34 | -------------------------------------------------------------------------------- /core/runner.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | #coding:utf-8 3 | 4 | import sys 5 | import threading 6 | 7 | from core import pzma 8 | from core import options 9 | from core import exceptions 10 | 11 | class runner(threading.Thread): 12 | def __init__(self, error_condition=None, output_threading=100, nb_check=0): 13 | threading.Thread.__init__(self) 14 | ''' 15 | create function for call after 16 | the variable __init__(). 17 | ''' 18 | self.error_condition = error_condition 19 | self.output_threading = output_threading 20 | self.nb_check = nb_check 21 | 22 | def __str__(self): 23 | ''' 24 | This function is used to 25 | manage program errors __str__() 26 | ''' 27 | if(pzma.pzma_br().seven_which_exist() == False): 28 | raise exceptions.SevenZipNoInstall("7z is not installed in your computer.") 29 | 30 | if(pzma.pzma_br().seven_archive_exist(options.files) == False): 31 | raise exceptions.SevenZipNoFound("7z files is not found in your computer.") 32 | 33 | if(pzma.pzma_br().seven_check_file(options.files) == False): 34 | raise exceptions.SevenZipIncorrect("7z, please select archive file .7z.") 35 | 36 | def eqs(self, q): 37 | ''' 38 | Concretely this function will 39 | manage the attack of the archive __eqs__(). 40 | ''' 41 | while True: 42 | qs = q.get() 43 | if(pzma.pzma_br().seven_decompress_data(options.files, qs) == True): 44 | print("\n[SUCESS] Password archive cracked : %s" %(qs)) 45 | sys.exit(0) 46 | 47 | else: 48 | self.nb_check = self.nb_check + 1 49 | read_file_count = len(open(options.wordlist, "r").readlines()) 50 | read_line_count = "\r7z-Bruteforce cracker password, version 1.0.0.0-7z-1 %d/%d." %(self.nb_check, read_file_count) 51 | 52 | # This condition will allow attacking the archive. 53 | # in function __eqs__(). 54 | 55 | sys.stdout.write(read_line_count) 56 | sys.stdout.flush() 57 | 58 | def run(self): 59 | ''' 60 | This system makes it possible to 61 | accelerate bruteforce __run__() 62 | ''' 63 | if(sys.version_info >= (2, 0)): 64 | import queue 65 | q = queue.Queue() 66 | 67 | elif(sys.version_info <= (3, 0)): 68 | import Queue 69 | q = Queue.Queue() 70 | 71 | # So concretely the system of threads that passes here in this function. 72 | # The default thread is 100 to handle the GPU __run__(). 73 | 74 | with open(options.wordlist, "r") as bert_model: 75 | for queue_reverse in bert_model: 76 | q.put(queue_reverse.rstrip("\n\r")) 77 | self.eqs(q) 78 | 79 | for i in range(int(self.output_threading)): 80 | wrapper = threading.Thread(target=self.eqs(), args=(i, q)) 81 | wrapper.setDaemon(True) 82 | wrapper.start() 83 | wrapper.join(600) 84 | 85 | q.join() 86 | -------------------------------------------------------------------------------- /core/pzma.py: -------------------------------------------------------------------------------- 1 | #/usr/bin/env python 2 | #coding:utf-8 3 | 4 | __all__ = ["DECOMPRESS", "COMPRESS", "DECOMPRESS_PASSWORD", "COMPRESS_PASSWORD", 5 | "BINARY_STRINGS", "SPEED_BRUTEFORCE", "NEGATIVE_OUTPUT", "DIRECT_NULL"] 6 | 7 | __name__ = { 8 | __all__[0]:"7z", 9 | __all__[1]:"x", 10 | __all__[2]:"-p", 11 | __all__[3]:"-aoa", 12 | __all__[4]:">/dev/null" 13 | } 14 | 15 | ''' 16 | This module will do a lot of things to 17 | manage the attacks and do a lot of manipulation. 18 | ''' 19 | 20 | import os as return_p 21 | import re 22 | import sys 23 | import shutil 24 | import platform 25 | 26 | from core import options 27 | from core import exceptions 28 | 29 | class pzma_br(object): 30 | def __init__(self, section_one=None, section_two=None, section_four=" ", 31 | section_five=None, section_six=None): 32 | ''' 33 | I have created some options for the object for the care of the 34 | program __pzma_br()__. 35 | ''' 36 | self.section_one = section_one 37 | self.section_two = section_two 38 | self.section_four = section_four 39 | self.section_five = section_five 40 | self.section_six = section_six 41 | 42 | def seven_which_exist(self): 43 | ''' 44 | This function will test if the 45 | 7z program exists in the computer system __seven_which_exist()__. 46 | ''' 47 | if(sys.version_info >= (2, 0) and sys.version_info <= (3, 0)): 48 | if(return_p.system("which 7z >/dev/null") != 0): 49 | self.section_six = False 50 | 51 | elif(return_p.system("which 7z >/dev/null") == 0): 52 | self.section_six = True 53 | 54 | # the return value in function __seven_which_exist__(). 55 | # if 7z in the path return true or return false. 56 | 57 | return self.section_six 58 | 59 | def seven_archive_exist(self, seven_archive): 60 | ''' 61 | Lets you test if the 7z file exists in the computer system 62 | in function for check __check_filenames__(). 63 | ''' 64 | try: 65 | with open(seven_archive, "rb") as self.section_one: 66 | self.section_one = True 67 | except IOError as error_file_output: 68 | self.section_one = False 69 | 70 | # The return value in function __seven_archive_exist()__, 71 | # is exactly here my friends for calling after function(). 72 | 73 | return self.section_one 74 | 75 | def seven_decompress_data(self, seven_filename, seven_password): 76 | ''' 77 | This function is used to decrypt 78 | the file __decompress_data()__. 79 | ''' 80 | section_three = " " 81 | section_two = __name__["DECOMPRESS"] + section_three 82 | section_two += __name__["COMPRESS"] + section_three 83 | section_two += __name__["DECOMPRESS_PASSWORD"] + seven_password + section_three + options.files + section_three 84 | section_two += __name__["COMPRESS_PASSWORD"] + section_three 85 | section_two += __name__["BINARY_STRINGS"] 86 | 87 | if(return_p.system(section_two) == 0): 88 | self.section_four = True 89 | 90 | elif(return_p.system(section_two) != 0): 91 | self.section_four = False 92 | 93 | # So concretely it will return true or 94 | # false if the password is wrong or not decompress_data() 95 | 96 | return self.section_four 97 | 98 | def seven_check_file(self, seven_check): 99 | ''' 100 | This function is used to test if 101 | the file is a 7zip file __pzma_file()__. 102 | ''' 103 | if(seven_check.endswith(".7z") == False): 104 | self.section_five = False 105 | 106 | elif(seven_check.endswith(".7z") == True): 107 | self.section_five = True 108 | 109 | # So this function allows to test if the program is a 7z file. 110 | # the function name is pzma_br().pzma_file(). 111 | 112 | return self.section_five 113 | 114 | if __name__ == "__main__": 115 | pass 116 | --------------------------------------------------------------------------------