Skip to content

.zip-file: try a list of passwords out automated

Removed before it was archived.

10 points28 comments
Open on Reddit
About this post
Posted
Archived
Deleted on
Score
10 · 74% up
Kind
Text
ID
10o7czb

28 comments

You can get all words with a simple shell script using poppler and grep.

pdftotext ~/sample.pdf - | grep -P -o "(\p{L}|\w|\d)+" | sort -u

Then use it as a dictionary for fcrackzip

6 points

do u know if that syntax is correct?

fcrackzip -v -u -D -p /path/to/wordlist.txt /path/to/targetfile.zip
1 points

first:pdftotext ~/sample.pdf - | grep -P -o "(\p{L}|\w|\d)+" | sort -u > ~/wordlist.txt

Then:fcrackzip -v -u -D -p ~/wordlist.txt [insert your path to targetzip here]

your issue seems to be that you aren't clarifying in the command where the files are located. I did half the work by helping you put the words list in your user home directory, and then calling it in the second command. Now you just need to get the path to the zipfile and it *should* do its thing.

Things to note, the '~' symbol is short for /home/{your username} and the '>' symbol redirects the terminal output of a command and sends it to a file in this case.

EDIT: didnt see your update comment.

3 points

when I use it as described I always get:

/path/to/wordlist.: No such file or directory

any idea whats wrong with the .txt file/path? I just dont get it...

1 points

pdftotext ~/sample.pdf - | grep -P -o "(\p{L}|\w|\d)+" | sort -u

that worked pretty well! But the output words are listed directly in the terminal, how can I let all that output into a .txt-file, or whatever is needed to feed fcrackzip with?

1 points

Python script that extracts all unique character combinations (excluding spaces) from the pdf and then tries them out, printing the result if successful. Depending on the length of the book that'll take a while

6 points

Okay, the book is about 180 pages.. so there is no such tool on github or so, that lets me do this? I have no scripting creation experience..

1 points

when I look at page 111

Daft question, but you are looking at page 111 of the book and not page 111 of the PDF?

3 points

Yes, to make sure I checked the page of the book (111 printed in right bottom corner) as well as the page 111 of the pdf… 😞

1 points

I'd be tempted to see if you can find an earlier revision of that book, and see if it differs.

3 points

Only as a side note and since we are dealing with academia. A quite similar approach using pdfgrep in a bunch of articles searching for a DOI (digital object identifier), building a list of words / DOI can be used to feed into a scihub terminal application.

3 points

I see the post is deleted now, does that mean you found a solution, /u/rado_sphere? If not, I hope this Python script will help:

#!/usr/bin/env python

import sys
from zipfile import ZipFile


if len(sys.argv) != 3:
    print(f'Usage: {sys.argv[0]} zip-file wordlist-file')
    sys.exit()
f_zip = sys.argv[1]
f_words = sys.argv[2]

candidates = []
with open(f_words, 'r') as f:
    for l in f.readlines():
        candidates.append(l.strip())

with ZipFile(f_zip, 'r') as zf:
    print(f'Trying {len(candidates)} candidates...')
    first_file = zf.namelist()[0]
    for c in candidates:
        try:
            zf.read(first_file, pwd=c.encode())
            print(f'Found potential password: {c}')
            resp = input('Keep searching? [Y/n]: ')
            if resp.lower() in ['n', 'no']:
                break
        except:
            continue
print('Exiting')

In case you haven't used Python scripts much before, you need to save it to a file (let's call it script.py) and then do chmod +x script.py to make it executable. Then you can run it with:

 ./script.py zipFile.zip possiblePasswords.txt

I haven't tested the script extensively, but it did work with the sample .zip file provided by that fcrackzip repo.

2 points

Thanks so much for the answer, I deleted the post because it wasnt at all the problem that I thought… It wasnt a password problem, i was just using the wrong extractor because the zip file was packed with winzip, which xarchiver was unable to handle. So to avoid confusion I deleted the post ❤️

1 points

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.