Py Rar Crack
Py Rar Crack
optional arguments:
-h, --help show this help message and exit
--start START Number of characters of the initial string [1 -> "a", 2-> "aa"]
--stop STOP Number of characters of the final string [3 -> "ßßß"]
--verbose VERBOSE Show combintations
--alphabet ALPHABET alternative chars to combinations
--file FILE .rar file [file.rar]
```
Example
$ python pyrarcrack.py --start 10 --stop 10 --file example_path.rar --alphabet 1234567890
Time: 0.06715750694274902
```
Pyrarcrack.py
"""
Based on:
http://stackoverflow.com/questions/11747254/python-brute-force-algorithm
http://www.enigmagroup.org/code/view/python/168-Rar-password-cracker
http://rarcrack.sourceforge.net/
"""
chars = (
printable
+ 'ÁáÂâàÀÃãÅåÄ䯿ÉéÊêÈèËëÐðÍíÎîÌìÏïÓóÒòÔôØøÕõÖöÚúÛûÙùÜüÇçÑñÝý®©Þþß'
special_chars = "();<>`|~\"&\'}]"
parser.add_argument(
'--start',
type=int,
)
parser.add_argument(
'--stop',
type=int,
parser.add_argument(
parser.add_argument(
'--alphabet',
default=chars,
required=False,
args = parser.parse_args()
yield from (
''.join(string)
def format(string):
formated = map(
return ''.join(formated)
if __name__ == '__main__':
if not exists(args.file):
raise FileNotFoundError(args.file)
start_time = time()
):
formated_combination = format(combination)
if args.verbose:
print(f'Trying: {combination}')
cmd = Popen(
f'unrar t -p{formated_combination} {args.file}'.split(),
stdout=PIPE,
stderr=PIPE,
exit()
Tests.py
from unittest import TestCase, main
class TestCombination(TestCase):
def test_should_generate_minimal_combination(self):
self.assertEqual(
list(generate_combinations('a', 1)),
['a']
if __name__ == '__main__':
main()
gitignore
__pycache__
*.rar