🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Stealth, General Software

#182624
From: StealthMonger
Date: Wed, 09 Mar 2005 05:50
231 lines
7811 bytes
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Last modified: Wed Mar  9 02:16:12 UTC 2005

[For documentation, see STEALTH essay of 2005 March 8.]

PROGRAMS USEFUL IN EITHER SCENARIO

esubbf.c                   C program generates a random Subject: from
                           a given key and subject.

esubbft.c                  C program detects whether a Subject: might
                           have been generated by esubbf using a given
                           key and subject.

esubbft-arthdr             Shell script feeds the Subject: of a news
                           article to esubbft.

random-key                 Gives a strong random key in base64.

pull_aam                   Pulls a full feed of alt.anonymous.messaages
                           from a news server.

formail-procmail app       Feeds a.a.m articles to procmail.

possible .procmailrc       Detects our stealth mail.

To whatever extent I am free to do so, I declare this software to be
under GPL.  Here it is:

- ----------------------------8<----------------------- esubbf.c
#if 0/*
exec gcc -g -o `basename $0 .c` $0 -lcrypto -lc;*/
#endif
/* Note:  Because of the foregoing, an executable can be built
   simply by issuing the command ``sh esubbf.c'' to the shell.

SYNOPSIS
        esubbf <key> <subject>

DESCRIPTION

        Write to stdout the 48 digit hexadecimal code of a number
        derived according to the esubbf algorithm from the given <key>
        and <subject>.  Functions like mixmaster.ren1.c.t1_esub except
        that it uses Blowfish instead of IDEA, avoiding patent issues.
        The fields of the number can be pictured as follows:

                ______________________________________________
                |               |                             |
                |   random iv   |   encrypt(subject,key,iv)   |
                |    64 bits    |          128 bits           |
                |_______________|_____________________________|


        where "subject" and "key" refer to the 128-bit MD5 hashes of
        the given <key> and <subject>, and encryption is computed by
        BF_cfb64_encrypt(3).

SEE ALSO
        esubbft

*/

#include <stdio.h>
#include <stdlib.h>
#include <openssl/md5.h>
#include <openssl/blowfish.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

void print8(unsigned char id[])
{
  printf
    ("%02x%02x%02x%02x%02x%02x%02x%02x",
     id[0], id[1], id[2], id[3], id[4], id[5], id[6], id[7]);
}

int main(int argc, char **argv)
{
  BF_KEY ks;
  int n=0, randfd;
  char keyd[16], subd[16], tsvd[16], iv[8];
  if ( argc != 3 ) return 1;
  MD5(argv[1],strlen(argv[1]),keyd);
  BF_set_key(&ks, 16, keyd);
  MD5(argv[2],strlen(argv[2]),subd);
  randfd = open("/dev/random", O_RDONLY);
  read(randfd, iv, 8);
  print8(iv);
  BF_cfb64_encrypt(subd, tsvd, 16, &ks, iv, &n, BF_ENCRYPT);
  print8(tsvd);
  print8(&tsvd[8]);
  return 0;
}

- ---------------------------->8------------------------------------------
- ----------------------------8<----------------------- esubbft.c
#if 0/*
exec gcc -g -o `basename $0 .c` $0 -lcrypto -lc;*/
#endif
/* Note:  Because of the foregoing, an executable can be built
   simply by issuing the command ``sh esubbft.c'' to the shell.

SYNOPSIS
        esubbft <key> <subject> <test>

DESCRIPTION
        Return 0 if <test> might have been the result of running
        "esubbf <key> <subject>", else 1.  A succinct statement of the
        functionality is that

          esubbft <key> <subject> $(esubbf <key> <subject>) ; echo $?

        gives 0.

SEE ALSO
        esubbf

*/

#include <stdio.h>
#include <stdlib.h>
#include <openssl/md5.h>
#include <openssl/blowfish.h>


int scanbytes(const char* buf, unsigned char* bytes, const int count)
{
  int i;
  char s[]="0xxx" , *eptr;

  for (i = 0; i < count; i++) {
    s[2] = *(buf + 2*i) ;
    s[3] = *(buf + 2*i + 1) ;
    eptr = &s[0];
    *(bytes + i) = (unsigned char) strtol(s, &eptr, 16);
    if ( eptr == &s[0] ) return 1;
  };
  return 0;
}

int main(int argc, char **argv)
{
  BF_KEY ks;
  int n=0;
  char keyd[16], subd[16], tsu[24], tsvd[16];
  if ( argc != 4 || strlen(argv[3]) != 48 ) return 1;
  if ( scanbytes(argv[3],tsu,24)) return 1;
  MD5(argv[1],strlen(argv[1]),keyd);
  BF_set_key(&ks, 16, keyd);
  BF_cfb64_encrypt(&tsu[8], tsvd, 16, &ks, tsu, &n, BF_DECRYPT);
  MD5(argv[2],strlen(argv[2]),subd);
  return (memcmp(subd, tsvd, 16) == 0 ? 0 : 1);
}

- ---------------------------->8------------------------------------------
- ----------------------------8<----------------------- esubbft-arthdr
#!/bin/sh

# SYNOPSIS
#          esubbft-arthdr key sub

# DESCRIPTION
#          Returns the result of calling esubbft key sub test, where
#          test is a ^Subject: field found on standard input.  Useful
#          as a procmail test when fed the header of a candidate
#          article.
esubbft $1 $2 $(sed -n 's/^Subject: //Ip')

- ---------------------------->8------------------------------------------
- ----------------------------8<----------------------- random-key
#!/bin/sh

# Make a 144-bit strong random key

dd if=/dev/random bs=1 count=18 2>/dev/null | openssl base64

- ---------------------------->8------------------------------------------
- ----------------------------8<----------------------- pull-aam
#!/bin/sh

# Pull new alt.anonymous.messages from news.banansplit.info

cd /var/lib/suck/banana-aam
suck news.bananasplit.info -dd dd -dt dt -c > $(date +%Y%m%d%H%M%S) 2>>suck.log
poff-if pull-aam

- ---------------------------->8------------------------------------------
- ----------------------------8<----------------------- formail-app
#!/bin/sh

# Hand the articles of a news batch to procmail for sorting

formail -s procmail

- ---------------------------->8------------------------------------------
- ----------------------------8<----------------------- A possible .procmailrc
DEFAULT=$HOME/Maildir/
#LOGFILE=$HOME/procmail.log
LOCKFILE=/var/lock/procmail.lock

# Add more conditions to the following after test phase, like path:
:0
* newsgroups:.*alt.anonymous.messages
{

   :0
   * ? /usr/local/bin/esubbft-arthdr <key> <subject>
   stealth-mail/

   :0 E
   /dev/null

}

# The rest goes to the default $HOME/Maildir/

- ---------------------------->8------------------------------------------

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.6 <http://mailcrypt.sourceforge.net/>

iD8DBQFCLlzXDkU5rhlDCl4RAk4JAJ9L0U4q/cRlRfJBkFu3suOK4beaygCgtEXk
i7AYwe6d4CEwYQGEBASF23Q=
=AqW8
-----END PGP SIGNATURE-----
Technical Details
Message-ID: <200503090550.j295orER019519@marco.aarg.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!number1.nntp.ams.giganews.com!number1.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newshosting.com!nx01.iad01.newshosting.com!fr.ip.ndsoftware.net!feeder.enertel.nl!nntpfeed-01.ops.asmr-01.energis-idc.net!217.19.16.136.MISMATCH!feeder1.cambrium.nl!feed.tweaknews.nl!news.wiretrip.org!news.dizum.com!sewer-output!mail2news

Show Full Headers
Complete Article Headers
Message-ID: <200503090550.j295orER019519@marco.aarg.net>
Subject: Stealth, General Software
Date: Tue, 8 Mar 2005 21:50:53 -0800
From: StealthMonger <Use-Author-Supplied-Address-Header@[127.1]>
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!number1.nntp.ams.giganews.com!number1.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newshosting.com!nx01.iad01.newshosting.com!fr.ip.ndsoftware.net!feeder.enertel.nl!nntpfeed-01.ops.asmr-01.energis-idc.net!217.19.16.136.MISMATCH!feeder1.cambrium.nl!feed.tweaknews.nl!news.wiretrip.org!news.dizum.com!sewer-output!mail2news
Author-Supplied-Address: StealthMonger <AT> hod <DOT> aarg <DOT> net
Newsgroups: alt.privacy.anon-server
X-Virus-Status: Clean
Mail-To-News-Contact: abuse@dizum.com
Organization: mail2news@dizum.com