-
Notifications
You must be signed in to change notification settings - Fork 8
Add support for python 2.x, 3.x/ more user friendly #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
kal179
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just made it more easy to use and fixed python 2.x, 3.x versions support ad also fixed more errors and exceptions
|
Hey :) Thanks for your contribution. I'll review your changes and notify you once I'm ready to merge them. |
B3n3
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The README looks good to me.
Please go through the comments I added and fix them, so that I can merge your changes.
Further it would be nice if you could stick to the line indention I used, cause now the git history would look like you rewrote the whole file just because of the different indention :)
Thanks for you contribution, good job.
crack_pw.py
Outdated
| sys.exit(0) | ||
| else: | ||
| tmp = ''.join(passw) | ||
| print("Trying with password {} :".format(tmp)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this line, as the output would be too verbose and flood the console.
crack_pw.py
Outdated
| except Exception as e: | ||
| print("Error opening/operating zipfile\n") | ||
|
|
||
| print("No passwords were found...\n") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The is just one password. Please use singular.
crack_pw.py
Outdated
| zipFile = zipfile.ZipFile(filename, "r") | ||
| except IOError: | ||
| # rather than raise() we'll simple print it to screen because we dont't want to scare the user | ||
| print("IOError: \nFile you entered was not found!\nTry again!") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd name it like this:
"The file could not be opened."
crack_pw.py
Outdated
| #characters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890" | ||
| characters = "abcdefghijklmnopqrstuvwxyz" | ||
| zipFile = zipfile.ZipFile(filename, "r") | ||
| print("The filename is not a valid string!") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably here the usage of the script would be nice :)
|
Thanks for reviewing my changes buddy! I will soon make necessary changes but i think the
using string module is more precise and makes code look smaller also fits in pep rule of 120 chars per line except that i think other changes make sense to me!
…On Fri, Jul 21, 2017 at 1:44 PM, Benedikt ***@***.***> wrote:
***@***.**** commented on this pull request.
The README looks good to me.
Please go through the comments I added and fix them, so that I can merge
your changes.
Further it would be nice if you could stick to the line indention I used,
cause now the git history would look like you rewrote the whole file just
because of the different indention :)
Thanks for you contribution, good job.
------------------------------
In crack_pw.py
<#1 (comment)>:
> - except Exception as e:
- pass
-
-print "no pw found..."
+ print("Length of password: ", leng)
+
+ #create an iterator over the cartesian product of all possible permuations
+ opts = itertools.product(characters, repeat=leng)
+
+ #iterate all created permutations
+ for passw in opts:
+ if found:
+ sys.exit(0)
+ else:
+ tmp = ''.join(passw)
+ print("Trying with password {} :".format(tmp))
Please remove this line, as the output would be too verbose and flood the
console.
------------------------------
In crack_pw.py
<#1 (comment)>:
> +
+ """
+ try to extract the files from the file
+ if the password is wrong, an exception is thrown,
+ (RuntimeError), which is caught in the except part
+ """
+ zipFile.extractall()
+
+ print("Password Found\n Password is ->" + str(passwd))
+ found = True
+ except RuntimeError:
+ print("Failed for test {}\n".format(tmp))
+ except Exception as e:
+ print("Error opening/operating zipfile\n")
+
+print("No passwords were found...\n")
The is just one password. Please use singular.
------------------------------
In crack_pw.py
<#1 (comment)>:
> - print "The filename was not a valid string"
- exit(1)
-
-#characters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"
-characters = "abcdefghijklmnopqrstuvwxyz"
-zipFile = zipfile.ZipFile(filename, "r")
+ print("The filename is not a valid string!")
+ sys.exit(1)
+
+#characters = string.ascii_letters
+characters = string.ascii_lowercase
+try:
+ zipFile = zipfile.ZipFile(filename, "r")
+except IOError:
+ # rather than raise() we'll simple print it to screen because we dont't want to scare the user
+ print("IOError: \nFile you entered was not found!\nTry again!")
I'd name it like this:
"The file could not be opened."
------------------------------
In crack_pw.py
<#1 (comment)>:
> except:
- print "The filename was not a valid string"
- exit(1)
-
-#characters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"
-characters = "abcdefghijklmnopqrstuvwxyz"
-zipFile = zipfile.ZipFile(filename, "r")
+ print("The filename is not a valid string!")
Probably here the usage of the script would be nice :)
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AT1ksQB4yX-mMmCc1qp1aaZ3dlA5cFtVks5sQF3YgaJpZM4OMWw->
.
|
Made more user friendly and added support for both python 2.x, 3.x versions, Before the program would cause error because of parenthesis