🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: New Hsub Finder Procedure

#252392
From: Rooster
Date: Fri, 16 Dec 2011 08:39
371 lines
17459 bytes
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I noticed that a couple of lines of the batch file in my previous post got wrapped, but I am not
sure why that happened because I expected to have my settings sufficiently enabled to avoid its
doing so.  Anyway, I have extended the settings again, and I want to clarify any misperception
related to the wrapping lines so that no one has issues when running the program.  Therefore, I am
reposting it here now to correct that problem and to eliminate any doubt:

- --------------------
@echo off
echo.
echo  Beginning Rooster's hsub searching procedure.
echo.
echo.

if not exist hsubpw (
echo  There is no password file named hsubpw. Aborting procedure.
goto EOF
)
if not exist *.txt (
dir/b & echo  There is no message file with '.txt' suffix. Aborting procedure.
goto EOF
)
rem: removing file names that suck

echo  Checking for files with problematic names...
dir/b |findstr /i "[!\&^]">>badnames1
md badnames
FOR /f "tokens=* eol=\" %%G in (badnames1) do (
move "%%G" .\badnames\"%%G"
)
FOR /f "tokens=* eol=\" %%H in ('dir/b *.txt') do (
echo %%H|find " ">>badnames2
)
FOR /f "tokens=* eol=\" %%I in (badnames2) do (
move "%%I" .\badnames\"%%I"
)

rem: removing spaces from file names
setlocal EnableDelayedExpansion
FOR %%f in (*.txt) do SET filename=%%f & CALL:sub1 %%f
GOTO jump1

:sub1
set nospace=%filename: =%
rename "%*" %nospace%
GOTO :eof

:jump1

rem: continue removing files with non-conformant names
echo.
echo  Sorting data files to create message digest...
echo.
for %%A in (*.txt) do @(
set ending=%%A
if /i !ending:~48! NEQ .txt (
move "%%A" .\badnames\"%%A"
) else (
call:sub2 %%A
))
goto jump2

rem: creating list of first 16 hex characters of files' names
:sub2
set z=%1
echo:%z:~0,16%>>hex16list
goto :eof

:jump2

rem: creating temporary binary file from 8 bytes of hex

echo  Generating binary data from hsubs...
echo.
setlocal
for /f "" %%X in (hex16list) do (
echo %%X|c:\cygwin\bin\xxd.exe -r -p - randnum-out
for /f "tokens=*" %%P in ('type hsubpw') do call:sub3 %%P
)
goto jump3

rem:concatenating passwords to end of ascii code in temp file; and making sha256 hash
:sub3
echo  Creating hash digest. This can take a while depending on number of files...
echo.
copy randnum-out combined >nul
<nul set/p z2=%1>>combined
java -jar c:\progra~1\jacksum\jacksum.jar -a sha256 -g 16 -O outfile -F #CHECKSUM combined
for /f "" %%R in (outfile) do echo %%R>>hex32list
goto:eof

:jump3

rem: copying matches into validate folder and creating log of the result of search.

echo.
echo  Comparing file names to digest for valid matches...
echo.
for /f "" %%K in (hex32list) do (
dir/b |find /i "%%K">>result.log
)
for /f "" %%B in (result.log) do (
xcopy %%B .\validate\ /v/I
erase /f/q %%B
)
echo.
echo  Cleaning up...
erase /f/q badnames? hex16list randnum-out hex32list outfile
type nul>hsubpw
type nul>combined
erase /f/q hsubpw combined
echo.
if exist validate (
(echo: There are files ready for validation)
) else (
(echo: There are no files for validation)
)
echo.
echo  Finished processing. Check the result.log for any matches.
echo.
:EOF
- --------------------------------------

I also mentioned in my previous post that I had written another procedure related to decrypting
the messages in 'a.a.m.'.  That one was not for finding hsubs, but it was, and still is, useful
for attempting to decipher all of the messages in that group.  Just to reiterate briefly, the
approach I took in that procedure was to have all of the messages to be searched through
individually one right after another by using the batch process of gpg so that it would attempt to
decipher every message based on a list of passwords you provided in a text file.  The procedure
can be used easlily with symmetrically encrypted or asymmetrically encrypted messages. With that
procedure one can decide to have the batch decryption process run on either group of messages,
symmetric or asymmetric, which it will correctly identify and separate; or it can be run on both
of them at once. It works nicely, and quickly, so long as you have put your passwords into a
single text file and individually on separate lines. If you are wanting it to do the asymmetric
messages based on your public key passphrases in the file, it would of course be necessary to have
the gpg program able to access your key ring.  Most of us probably have it set up that way
already.  It starts out just like this present procedure in that, first, you need to put all the
messages for searching into one folder, individually saved as text files such as 'file1.txt',
'file2.txt', etc.; then you put a file with the passwords for your symmetrically and
asymmetrically encrypted messages into that same folder; then you add the batch file.  That is all
you need. It runs in the Windows command shell, and no other programs besided gpg itself would be
required.  As the script proceeds, it prompts you with a couple of easy questions about whether
you want to search symmetric or asymmetric only, or both.  It verifies that you have the proper
files (messages, passwords) in the folder, and, once you answer those questions, it proceeds with
the batch processing.  When finished, your messages, if any, will have been decrypted and left in
the folder for you to do what you will with them.  It then deletes everything else except for the
batch file itself. No fuss, simple-simon stuff. It still works effectively to decipher your
messages all by itself.

Nevertheless, I can see now that it also may be used in a more efficient way in conjunction with
this current procedure.  As I see it, if you like, you could use this new procedure first in order
to hone in on your hsub messages, or for that matter you could use any other procedure available
to you for identifying your hsub; then, once found, since you would still need to decrypt them,
you could use my first procedure to automatically decipher the exact messages you seek.  This sort
of approach is especially beneficial to someone who gets a lot of messages or who has a lot of
separate nyms or passwords.  Rather than having to take the time to cross reference which hsub
belongs with which symmetric password and with which asymmetically encrypted key, one would only
need to run the messages through my first process along with the single file of passwords in order
to have it decipher the whole group automatically and quickly.  What could be better than that?

Additionally, I have made a couple of improvements to the first script in order to eliminate a few potentially problematic items that have come to my attention since then.  First, I found while writing this procedure some issues related to the characters used in filenames that can disrupt the batch processing; these issues relate to the unusual characters that abberant message subjects sometimes contain.  (Most of them, if indeed not all of them, are merely troll droppings.)    As I was not concerned with subjects previously, they were inconsequential.  Now that I have taken them into account and modified the script to eliminate them accordingly, they are no longer a concern. If any of the messages contain one or more of these characters, the procedure would move it into a folder called 'badnames', and you can decide what to do with them yourself. Secondly, and more importantly, it has come to my attention that one quirky behavior of Windows that I previously overlooked relates to certain characters that can occur in a password.  These are the command characters of special concern, the four between these quotes: "< > | &".  If your passwords contain one of these characters, then you will need to escape them in the password file with this character, "^".  However, not only that, because in my procedure, the first procedure only, not only do you have to escape them, due to the characteristics of Windows commands, because I pipe the passwords to another command, it is actually necessary for you to use this escape character three times before any one of those four command characters.  For example, suppose you have a password like this: My&pa33w<d.  Then you would have to put that password into the password file escaped like this: My^^^&pa33w^^^<d.  This is only relevant and applicable to the password file for my first script, the one I am posting below.  It does not apply to the new procedure, in which you need not make any such modifications to the password in the 'hsubpw' file.  If you follow this instruction, you will have no problem.

I have done several tests confident that you should be able to copy these scripts and understand
my instructions sufficiently.  I also think that I have eliminated the potential for problems as
much as possible.  Even so, if you should have any questions, need clarification on anything or if
you run in to some unforseen circumstance that causes a problem, please feel free to ask me.  I
would like to think that I am not the only one who enjoys using these, and I do believe that they
will help you enjoy what you are doing with this whole anonymity thing too.  We should not be
working terribly hard just to find our messages and to decrypt them; we should only be working
hard to keep them secure and private. I believe that this effort contributes to that end.  Here is
the first procedure, newly improved:

- -------------------------

SETLOCAL
CLS
@ECHO off
ECHO : The folder where you execute this batch file
ECHO : should have ONLY this batch file, the
ECHO : password-file, and the messages for decrypting.
ECHO.
ECHO Beginning Rooster's Method for batch decryption:
ECHO.
ECHO.
(@ECHO    Now renaming *.txt to *.asc for gpg processing...)
REN *.txt *.asc
IF NOT errorlevel 0 GOTO EOF

ECHO.
(ECHO    Moving files with problematic names into 'badnames' folder...)
DIR/b |findstr /i "[!\&^]">>badnames1
MD badnames
FOR /f "tokens=* eol=\" %%G in (badnames1) do (
MOVE "%%G" .\badnames\"%%G")
IF EXIST badnames1 ERASE /f/q badnames1

rem: This block routine removes spaces from erratic filenames
SET "filename="
FOR %%F in (*.asc) do SET filename=%%F & CALL:sub1 %%F
GOTO :jump

:sub1
SET filename=%filename: =%
RENAME "%*" %filename%
GOTO :eof
:jump
rem: end routine to remove spaces from filenames

SET counter=0
:startnow
IF %counter%==2 GOTO core
SET /a counter+=1
IF %counter%==2 ECHO    This block allows the user to choose whether to attempt deciphering
IF %counter%==2 ECHO    on both symmetric and asymmetric encrypted messages, or to attempt
IF %counter%==2 ECHO    on only one of these two types of encrytion. Unless you choose either
IF %counter%==2 ECHO    "Y" or "N", both types of message will be attempted.
IF %counter%==2 ECHO    You get one more try to answer correctly.
SET "choice="
ECHO.
ECHO    Do you want to search both types of message?
ECHO    You must type Y or N and hit enter.
SET /p choice=   Please make your choice now:  ^(Y or ^N)?
@ECHO.
IF NOT DEFINED choice GOTO startnow
IF /i %choice%==Y GOTO core
IF /i NOT %choice%==N GOTO startnow

rem: This block routine allows you to remove all
rem: messages not having outer symmetric encryption
CLS
SET counter=0
:option1
IF %counter%==2 GOTO EOF
IF %counter%==1 (
(ECHO    You will get only 2 tries to answer correctly.))
IF %counter%==1 (
(ECHO    Unless you choose "Y" or "N", batch processing will cease.))
SET /a counter+=1
SET "decision="
ECHO.
ECHO    You have chosen "not" to do both types of message.
ECHO    Do you want to search only files with an outer layer
ECHO    of symmetric encryption^? If you know that all of your
ECHO    messages have an outer layer of symmetric encryption,
ECHO    then you should select "yes." If you do select "yes,"
ECHO    then all files having only asymmetric encryption
ECHO    will be deleted first, before decryption begins.
ECHO    This can save a lot of time.
ECHO    You must type Y or N and hit enter.
ECHO.
ECHO    This is try # %counter%.
ECHO.
SET /p decision=  Please make your decision now:  ^(Y or ^N)?
ECHO.
IF NOT DEFINED decision GOTO option1
IF /i %decision%==N GOTO option2
IF /i NOT %decision%==Y GOTO option1
FOR %%G in (*.asc) do (
gpg --list-only --status-fd 1 %%G | find /i "enc_to" && del %%G
)
ECHO.
ECHO    Deleting messages not having an outer layer of symmetric encryption...
GOTO core
rem: end routine for removing messages without outer symmetric encryption

rem: this block routine allows you to remove all
rem: messages with outer layer of symmetric encryption
CLS
:option2
SET "decision2="
ECHO.
ECHO    You have chosen to attempt deciphering of messages
ECHO    with no outer layer of symmetric encryption. Only
ECHO    those with asymmetric (public key) encryption will be
ECHO    searched. This means that for any of the messages with
ECHO    hidden-recipients, all of the secret keys on your key-
ECHO    ring will be tried until a match is made, if any.
ECHO.
ECHO    If you want to search only these messages, you should
ECHO    answer "yes" below.  If you prefer to abort the decryption
ECHO    process, you should answer "no" below. If you do answer
ECHO    "no", the messages will "not" be deleted and the batch
ECHO    processing will end.
ECHO.
SET counter=0
:lasttry
IF %counter%==2 (
(ECHO    You have not chosen to search any messages) & GOTO EOF)
SET /a counter+=1
ECHO.
ECHO	   Do you want to search only messages with asmmetric encryption?
SET /p decision2=   Please make your decision now:  ^(Y or ^N)?
ECHO.
IF NOT DEFINED decision2 (
(ECHO   You have answered incorrectly.) & GOTO lasttry)
IF /i %decision2%==N GOTO EOF
IF /i NOT %decision2%==Y (
(ECHO   You have answered incorrectly.) & GOTO EOF)
FOR %%K in (*.asc) do (
gpg --list-only --status-fd 1 %%K | FIND /i "enc_to" && DIR /b %%K>>filelist)
IF NOT EXIST filelist (
(ECHO There are no messages that indicate having asymmetric encryption on its outer layer!)
& GOTO endprocess)
ECHO.
ECHO    Removing messages with symmetric encryption...
FOR %%A in (*.asc) do @FINDSTR /c:%%A filelist || ERASE /f /q %%A

:core
SET "pword="
:variable
SET /p pword=<password-file
rem: IMPORTANT NOTE: If your password contains any of these command characters
rem: (between the quotation marks) "& < > |", which take precedence over ECHO,
rem: then you should precede the character with this symbol "^" in the password
rem: file, not only once but THREE TIMES, like this for example: ^^^& ; for
rem: each time one of those command characters appears in your password.
IF NOT DEFINED pword GOTO endprocess ELSE GOTO decipher
:decipher
ECHO    Beginning the decryption process....
ECHO.
ECHO    You may see error messages during the decryption process
ECHO    related to those messages with IDEA cipher unless you
ECHO    have the IDEA extension capability. This is normal, and
ECHO    has no effect on your valid messages.
ECHO.
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
IF EXIST filelist ERASE /f filelist
TYPE nul>password-file
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 has finished processing.
ENDLOCAL

- ----------------------------------------------

 :)

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

iQGcBAEBAgAGBQJO6vVEAAoJEO3Co03SMUtBetYL+wYCkJnvOZzszKmNh82xp0oD
/NAGZx84CT62Tl/KelX46tGZ7/d/a3kV1/rNY2RAQQpW1/za3gYC9SOa2Tb+tmQa
Q5LxPyi0zCb5Sl6woBHCP8PHxyW+ADRBa+bKtMmDSQBOE9AgW2eJ78FoqRYovhKd
P4rUpInMk/1wUsRIeZlv9map28Kal7w6OeOGci/3zszYsq30UdL/UWMugFCl7Tnd
6OU2EJ4XG2YFc1qFw8X6SDWFqNev/eVAFssT2DxU1+NFaJVs6ZK/BCn+Wi8KUwhR
7Dk5ULIr+jk8dLKUXN+UJyhBNClWG4mS7SeDfekUCFcp6SbXGH+CqY93ihSqph81
/y1a7n6sZsMl5Ury80bJwRs/o/GdR/YxJ/mOPN9d8HuIreCjmr/fw7tLBw0Fc1UL
SA8M1Zxod91WHg1/y0l1CYi6U08JRnEiP4FO9pjsHqerwpccervkntevP3LB4vsq
+MgEOHKwAtbVqNf+zzdhVFziyt1giFGuycp0eEy89Q==
=Omd/
-----END PGP SIGNATURE-----

-- 
Rooster@thechickencoop.net

Technical Details
Message-ID: <G99AA5SC40893.6938773148@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!goblin1!goblin.stu.neva.ru!news.astraweb.com!border5.a.newsrouter.astraweb.com!eweka.nl!hq-usenetpeers.eweka.nl!188.40.76.149.MISMATCH!mail2news.mixmin.net!not-for-mail
References: <GE2BSOK140893.2355092593@reece.net.au>

Show Full Headers
Complete Article Headers
Message-ID: <G99AA5SC40893.6938773148@reece.net.au>
Subject: Re: New Hsub Finder Procedure
Date: Fri, 16 Dec 2011 08:39:11 +0000
From: Anonymous-Remailer@See.Comment.Header (Rooster)
References: <GE2BSOK140893.2355092593@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!goblin1!goblin.stu.neva.ru!news.astraweb.com!border5.a.newsrouter.astraweb.com!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: 372
Injection-Info: mail2news.mixmin.net; mail-complaints-to=abuse@mixmin.net