🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

hsub for windows?

#254740
From: rooster
Date: Fri, 02 Mar 2012 06:59
259 lines
11387 bytes
This is the first I have heard of someone being unable to use hsub on 
Windows, but nothing surprises me these days.  I can use it on Windows. But 
who knows, maybe your system is "special".  In any case, the answer is 
definitely "yes", there is an easier way. I wrote a script that will search 
through the messages and find yours based on the symmetric password.  There 
is no need for hsub, esub or even any subject whatsoever. The instructions 
are easy, but I can answer any questions you may have about them. If you 
later on want to start using hsub on your messages, I also wrote a script for 
that. There are also some other methods for finding hsub because some others 
here have written some scripts too.  the choice is yours, but at least you 
have some choices.

Let me give you the brief version of this procedure to see if that helps. 
Here are the steps.

1. 	download the messages you want to search through, and save them into a 
folder in your local directory.  Save them as individual, separate text 
files, and make sure that the files have an ".txt" ending, such as this: 
file1.txt, file2.txt, file3.txt, etc. It does not matter what you name them 
so long as it is valid name for Windows files, but you may find it helpful if 
you name them with the same name as their subjects, like this:  subject1.txt, 
subject2.txt, etc.

2.	assuming you have your messages made with symmetric encryption around 
them, put each of the passwords on separate lines into one single text file 
and name it "password-file". you should name it just like this exactly and 
nothing else. make sure when you save it in Notepad that it is not saved with 
a ".txt" on the end of it because the procedure will not work otherwise. Put 
this file into the same folder where you put the messages.

3.	copy the following batch script into a text file, and save it with any 
name so long as you give it an ending that is ".bat".  for example, name it 
"rooster1.bat" if you like.  :)  then put this batch file into that same 
folder as well.

4. 	only these three things should be in the folder.  now open the Windows 
shell and cd into this same folder.  then run the batch file by typing 
"rooster.bat" at the prompt.  it will ask you a couple of questions at the 
beginning, which you will need to answer by typing Y or N, for yes or no.  it 
will then proceed to check all your messages and, if it finds a match, it 
will decipher it (or them if you have several) and leave a copy of the 
deciphered file with the same name in that folder, but it will remove the 
suffix ending of the message.  So the name will be changed from "file1.txt" 
to "file1".

5.	 if you have gpg asymmetric encryption on the message beneath the 
symmetric encryption, then you can run the same procedure a second time with 
a second password file, or you can simply decipher the file manually using 
your normal gpg decryption process at the command line or with a click in the 
GUI.  when the procedure finished for the first time through, it will delete 
any of the leftover messages that were not decrypted and it will delete your 
password file. All that would be left is the batch file and the deciphered 
message file, if any.

6.	during the decryption procedure, you may see some warning messages appear 
on the screen if you encounter any messages that were encrypted with IDEA 
cipher and you do not have this capability in your gpg settings.  This is 
normal and it will have no effect on your messages or on the outcome.  you 
will not need to respond to the warnings.  it is advisement warnings that 
come from the gpg program itself. disregard them.  the length of time needed 
for this procedure is brief, but it will depend mostly on how many messages 
you have and how many passwords.

7..	here is the batch file to copy and let me know if you have any more 
questions.  read the little notes i put inside of it. let me know if you need 
more explanation.  thanks.


--------------- rooster1.bat ----------------------

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 nospace=%filename: =%
RENAME "%*" %nospace%
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

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

-- 
 Enjoy the ride!

rooster@thechickencoop.net
gallus gallus domesticus
"A happy member of Kingdom Animalia"
~~
Technical Details
Message-ID: <20120302070150.ECq3i3DlJ9c5@mail2news.mixmin.net>
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!border1.nntp.ams3.giganews.com!border1.nntp.ams2.giganews.com!border3.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!weretis.net!feeder1.news.weretis.net!feeder.erje.net!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
References: <RW1MZF0040970.5818055556@reece.net.au>

Show Full Headers
Complete Article Headers
Message-ID: <20120302070150.ECq3i3DlJ9c5@mail2news.mixmin.net>
Subject: hsub for windows?
Date: Fri, 2 Mar 2012 00:59:54 -0600
From: rooster@thechickencoop.net
References: <RW1MZF0040970.5818055556@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!border1.nntp.ams3.giganews.com!border1.nntp.ams2.giganews.com!border3.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!weretis.net!feeder1.news.weretis.net!feeder.erje.net!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
Newsgroups: alt.privacy.anon-server
Lines: 260
Injection-Info: mail2news.mixmin.net; mail-complaints-to=abuse@mixmin.net
X-Original-Bytes: 11102