-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
ssh2john.py doesn't extract all keys from a keyfile #4993
Comments
That keyfile holds four keys. The last two are identical. If I save them to separate files, the first one isn't recognized by john, the third (and fourth) are cracked as |
Also, diffing the second keyfile against the third, they're identical except the second is missing 15 lines. So I take it that key is just damaged and thus uncrackable. The first file appears to be the same key as well, with less linefeeds. I recall ssh2john has problems reading multiple keys from a single file. Don't we have an issue for that? |
john
not accepting std-in
or wordlist to crack password
I confirmed that when given the OP file, ssh2john only extracts the second (damaged) key and silently ignores the others |
Thank you. I'll work out extracting all keys and validating with If there's a separate bug, is this slated for future release? To support multiple key extractions "automatically" would be a useful feature. |
In short, I realize what I did. I was using various methods to extract the key from linpeas output, and continuously appended keys. This was my fault, and if a output a single key, Thank you! |
Thanks for reporting back. Still, we should fix ssh2john so it doesn't just extract the first valid key - at least not without even warning. So I'll reopen this issue for that (I can't find any old issue... perhaps we discussed it at some point but forgot opening one). |
Hello, is this issue still open? I am new to the project and willing to give this one a go, happy to get some guidance. |
@pradkrish Yes, the issue is still open as per @magnumripper's comment above, and we'd appreciate contributions to the project. Please feel free to work on this one - which I guess means implementing support for processing many keys at once or at least printing a warning when multiple keys are seen. We also have many other open issues where we'd appreciate help. |
Thanks. I would like to discuss the solution before beginning to work on it. I am assuming we need to create one hash per key. After emitting a warning, shall we prompt the user to provide multiple hash filenames so we can save one hash per file. Or, If the user has provided only one hash file, we create as many hash files as the number of keys? Do you have any suggestions? |
We generally output the hashes to stdout - not explicitly to files - and this implies just outputting all hashes in one stream. The user of the script will generally have redirected stdout to a file. If so, they'll get all the hashes in one file, one hash per line. That's fine. Also, if we do correctly process multiple keys and output multiple hashes, there's no need to print any warning - I only mentioned printing a warning if we somehow did not do the full thing right. |
is it safe to assume that the key file may contain multiple key types, that is, one could be RSA, another could be DSA etc.? |
@pradkrish Yes, I guess we should support arbitrary combinations of key types. FWIW, @mbrownnycnyc's |
Perhaps it'd be a good idea to prefix the output hash(es) with a virtual login field? For a single hash output, it could be just the input filename as in |
Prefixing with |
I am also refactoring the file |
Please keep any refactoring in its own commit(s), separate from functional changes. Unfortunately, we don't automatically test the |
Hello folks,
I'm having an issue where I can't crack a
format=ssh
rsa key... in fact, it's one grabbed from the vuln machine from basic pentesting room on tryhackme.I'm running kali on WSL2 on Windows 10.
I've built the latest from the repo:
I've verified that the passphrase is
beeswax
, which is located in rockyou, by using the key for auth withssh -i
.However, i can't crack using
john
as follows:I came across an old issue and none of the suggestions (like arg order, or using single versus double arg declarations) solve this issue. Things seem to work fine... the wordlist is loading,
john
recognizes theformat
of the target, etc.I feel like this is a bug, however, if I should post to the userlist let me know.
Thanks
kay_id_rsa.txt
kay_id_rsa_john_hash.txt
The text was updated successfully, but these errors were encountered: