Created
November 4, 2014 16:07
-
-
Save mubix/5e3de0abb3e7e2cf8f3b to your computer and use it in GitHub Desktop.
7zip Cracking on the cheap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Need some help with this cracking script. | |
# Problems: | |
# 1) Slow, going through a large list like Rockyou takes forever | |
# 2) If there is no header encryption, 7z extracts to the target location | |
# then tries to decrypt, so threading would be painful | |
# 3) I need to know when the correct password is used and due to #2 | |
# with threading that would be very difficult. | |
require 'shellwords' | |
wordlist = File.open('/usr/share/wordlists/rockyou.txt','r') | |
wordlist.each_line do |line| | |
puts "Testing #{line.strip.inspect}" | |
result = %x[7z e -p#{Shellwords.escape(line.chomp!)} -w/tmp/zip/temp/ -o/tmp/zip/ -y Secret.7z] | |
if result =~ /CRC\ Failed/ | |
puts result | |
elsif result =~ /Wrong\ password/ | |
puts result | |
else | |
puts "Success with #{line}" | |
exit | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment