🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.privacy.anon-server
Article #251646

Rooster's Method of batch decryption

#251646
From: Rooster
Date: Sun, 30 Oct 2011 05:54
175 lines
9854 bytes
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

As I have explained here on a few occassions now, I have found a method of
finding and decrypting messages from 'a.a.m.' without having to depend on the
use of message subjects at all.  Neither hsub nor esub is necessary in this
method because all of the messages that are downloaded will undergo the process
for decryption automatically by using gpg on each of them with its built-in
functionality for batch processing.

The fundamental command for batch processing using a shell prompt in Windows is
this:

for %G in (*.asc) do echo <passphrase>|gpg --batch --passphrase-fd 0 --decrypt-files %G

And in Linux it is this:

for k in *.asc; do echo <passphrase>|gpg --batch --passphrase-fd 0 --decrypt-files ${k}; done


Yet, the procedure for either one of these would require a separate pass for
each separate password.  For most of us, we may very well have only one password
for our messages in 'a.a.m.', and the task of deciphering them would be
straightforward and quick.  It would suffice simply to use one or the other of
these two commands.

On the other hand, it has been brought to my attention that a few persons may
have messages with more than one password, and perhaps even many of them.  For
such persons the task of manually entering multiple passwords, one for each
passing, could become tedious and inconvenient.  Therefore, in support of the
need for efficiency, I have devised another little script to help the anonymous
message mongers among us.

It is not difficult to understand the batch file, which, for sake of clarity, I
have written and tested using only the native Windows command shell.  In order
to use it correctly, you will need to download a group of messages from 'a.a.m.'
and save them unaltered as individual text files with a '.txt' suffix (*.txt)
into one folder, just as you would have to do if you were using one of the above-
mentioned commands by themselves.

This batch file will also require you to have your list of passwords in a text
file, which in the batch I have named "password-file"; and you will then put
this 'password-file' into the same folder as you put the group of downloaded
messages, together with the batch file itself.  (You should notice in my batch
file that I chose not to give the password-file a txt suffix.)  Only these three
things need be in your folder. Here is the batch file, which you can copy and
paste into a batch file with a '.bat' suffix, and name it anything you like.
Frankly, I prefer "rooster-file.bat":

- ------------------------
@ECHO.
@ECHO Beginning Rooster's Method for batch decryption:
@ECHO.
RENAME *.txt *.asc
@ECHO off
IF errorlevel 1 GOTO EOF
SET "pword="
:variable
SET /p pword=<password-file
IF NOT DEFINED pword GOTO endprocess ELSE GOTO decipher
:decipher
FOR %%G IN (*.asc) DO echo %pword%|gpg --batch --passphrase-fd 0 --decrypt-files
%%G
FOR /F "skip=1" %%A IN (password-file) DO @echo %%A>>password-file2
IF NOT EXIST password-file2 GOTO endprocess
ATTRIB -R password-file
MOVE /y password-file2 password-file
GOTO variable
:endprocess
ERASE /f password-file
ECHO There are no more passwords in the password-file.
SET "pword="
ECHO Your messages, if any, have been deciphered.
ECHO Removing undeciphered messages...
ERASE /f *.asc
:EOF
ECHO The batch processing has finished.
- -----------------------

During the batch process, here is what happens basically:

1.	your *.txt messages are renamed *.asc so that gpg can work on them correctly.
2.	if you completely failed to put the messages into the folder, the batch
process will end promptly.
3.	if you failed to put your password-file into the folder, the batch process
will complain and also end promptly.
4.	if you did get those two things done (yahoo!), the procedure will look at
your first password, assign it to the variable "pword" and pass it on to the
main gpg batch processing function on line number nine.
5.	your password will be applied to each and every message one by one, checking
to see whether it "works" on each of the messages.  this happens for
symmetrically encrypted messages or public key encrypted messages; but you must
have you system set up with your public keys accessible to the gpg program. this
usually means it is on your PATH.
6.	if it finds a match and deciphers one of your messages, it will automatically
create a decrypted copy it by simply removing the '.asc' suffix; it will place
this one in the same folder, and it will resume the process on the remaining
messages in the group.
7.	after the first password has been tried on all the messages, the process will
create a temporary file in the same folder called 'password-file2' comprised of
all the remaining passwords in your original file; then it will rename this file
to your original file's name again 'password-file', overwriting it without
prompting.  this removes the file named 'password-file2' immediately.
8.	this same loop of trying each password against each message and discarding
the individual passwords after each complete pass will resume until all the
passwords are gone.  Actually it moves fairly quickly, just depending on how
many messages you have and how many passwords are in your list.
9.	when the passwords are all gone, the password-file will be deleted too, as
will all the remaining undecrypted messages.	if you had any messages decrypted,
only they and the batch file will remain in the folder. You are finished.


A few important points are worth mentioning.  First, when I download messages, I
have a procedure that saves them as text files named with the same subject as
they have in 'a.a.m.' because I find it convenient to keep up with what I have
done so far and where I have left off in the group of messages.  Even so, I do
this for convenience only: it is not necessary to have these messages' subjects
for purposes of decrypting them.  Even messages with no subjects are
successfully decrypted using this batch process.

Secondly, you will notice that the batch process uses the command "ERASE /f" on
two instances.  The "/f" option forces it to work on read only files, but it is
hardly more secure than that. If you really want to use a secure deletion
process, it can be achieved easily by using the SDELETE command. It is simple,
small and effective, and it can be downloaded here:
http://technet.microsoft.com/en-us/sysinternals/bb897443.  I would use it, for
example, with these options:

"sdelete -a -p 5 password-file"

If you have sdelete and prefer to use it, as I would recommend, you can modify
the batch file by simply replacing the two lines that have "ERASE /f filename",
for example, with this: "SDELETE -a -p 5 filename".

Thirdly, when you create your password-file, make sure that the first line IS
NOT blank.  Put any kind of password you have, with spaces or characters, each
on its own line. Accidentally putting a blank line in the middle or end would
not be a problem, but if you have a blank line as the first line, the process
will go to the end right away because of the way that the command "SET /p
pword=<password-file" requires there to be a password at the beginning of the
file to give definition to the variable "pword".  So, if the process ends
quickly and you still see your password-file in the folder, it means you had a
blank line at the beginning.  Edit the file and remove the blank; then start
over.  Aside from that caveat, I have seen no issues, and I may try to fix it in
the future.

I do not believe that there is anything else exceedingly difficult to understand
about this batch file, and I will leave it to the linux guys to do their own
translating of these commands to their operating systems.  They do, after all,
like to fiddle with that sort of thing. I am not a programmer, and I do not
presume to think that this is a work of art; but I did test it and it works
well. I tried it with several alterations, and it did not fail me. If anyone has
any questions about the batch process or what not, please feel free to ask.

-----BEGIN PGP SIGNATURE-----
Version: N/A

iQGcBAEBAgAGBQJOrOB6AAoJEO3Co03SMUtBNhYL/A8G+a0W8eZVjRESiLxY/8XO
sxgNTGocFufnvQn1WeRQWfp3wqXGDtmz407l8FGhUrx78NyZNN5DIlzDieMFXESX
2mdnQ+DalPm4y6vpXh6E5yMLYaJMIJ1OnI3RMp25fHS3a3weWddnN1B0MEDUpHX5
F2Awgv9lvPV6sZJpHxaMe1GJfvPdPnPyBSVDcEXnGshxL4qQkHE59I3eehezyzKt
uxtil+FQJoePB7SMFifk2avUdIAB8CY0etl6q+gqwqyiC9Mo7VjdG0S1ybU7ZcgX
EK1KZcE2rgnez73BnlDAbdUux5ujiCODohlLSsAeueZpkAdvCjfI6shJO43bTc0F
/0xBX4ffxQHhLdFyIY148J9xQUL5+oZb7KXhSczZHT4I/JVnRQtBduxR12ogqqBx
2d1yDQbq61CUalU4WLE3AiMHRN0KG3vBuSGct+3UZFER/uPB3wU3ljFclVhbuluB
d607j5onucS6ErDJAmBTBqzW56ztWnl5r/SHBtC34Q==
=PgAi
-----END PGP SIGNATURE-----

-- 

rooster@thechickencoop.net


Technical Details
Message-ID: <PH9ADIIW40846.5791666667@reece.net.au>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-alt.privacy.anon-server.20141023.mbox.gz!num2.nntp.dca.giganews.com!num1.nntp.dca.giganews.com!number.nntp.dca.giganews.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!goblin2!goblin.stu.neva.ru!feeder2.cambriumusenet.nl!feed.tweaknews.nl!81.171.88.15.MISMATCH!lightspeed.eweka.nl!81.171.88.16.MISMATCH!eweka.nl!hq-usenetpeers.eweka.nl!188.40.76.149.MISMATCH!mail2news.mixmin.net!not-for-mail

Show Full Headers
Complete Article Headers
Message-ID: <PH9ADIIW40846.5791666667@reece.net.au>
Subject: Rooster's Method of batch decryption
Date: Sun, 30 Oct 2011 05:54:00 +0000
From: Rooster <remailer@reece.net.au>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-alt.privacy.anon-server.20141023.mbox.gz!num2.nntp.dca.giganews.com!num1.nntp.dca.giganews.com!number.nntp.dca.giganews.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!goblin2!goblin.stu.neva.ru!feeder2.cambriumusenet.nl!feed.tweaknews.nl!81.171.88.15.MISMATCH!lightspeed.eweka.nl!81.171.88.16.MISMATCH!eweka.nl!hq-usenetpeers.eweka.nl!188.40.76.149.MISMATCH!mail2news.mixmin.net!not-for-mail
X-Remailer-Contact: abuse@reece.net.au (English Only Please)
Newsgroups: alt.privacy.anon-server
Lines: 176
Injection-Info: mail2news.mixmin.net; mail-complaints-to=abuse@mixmin.net