[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
anonymous poster software
-----BEGIN PGP SIGNED MESSAGE-----
I hacked this up in a little under an hour (with distractions), so it's not
the absolute best software - it could stand some improvement - but it works.
It could, with very minor hacking, do as an anonymous mailer. I wrote it
in response to someone asking me if I could write such a thing for them in
C. Yes, there are lots of itty-bitty remailers and posters out there, but
this serves the bill for being totally anonymous and it's pretty quick, being
written in C.
Besides, I didn't want to learn perl or any of that grotesque stuff - I'm a
purist at heart ;)
- ---------------------------------- cut here --------------------------------
/*
* anonpost - strip headers from incoming message, preserving Subject:, then
* pass the rest of stdin to inews argv[].
*
* Copyright 1994 by Ed Carp ([email protected]). All rights reserved.
*/
/*
* How to set this up:
*
* 0. Change "#define INEWS" and "#define SIG"
*
* 1. cc -s -o anonpost anonpost.c -O
*
* 2. mv anonpost /usr/local/bin # or wherever
*
* 3. echo "* * * * * su <whoever> -c '/usr/local/bin/anonpost -n alt.sexual.abuse.recovery -f [email protected] -r [email protected] < /usr/spool/mail/anonasar;rm /usr/spool/mail/anonasar'" >> /usr/lib/crontab
*
*/
#define INEWS "/usr/lib/news/inews "
#define SIG "/home/anon-asar/.signature"
#include <stdio.h>
#undef NULL
#define NULL (0)
main (argc, argv)
int argc;
char **argv;
{
char inews[1024];
char subject[128];
char line[1024];
FILE *in, *p;
int i;
*subject = NULL;
while (1)
{
/*
* read header
*/
while (fgets (line, 1022, stdin) != (char *) NULL)
{
line[strlen (line) - 1] = NULL;
if (strlen (line) < 2)
break;
if (strncmp (line, "Subject: ", 9) == 0)
strcpy (subject, line + 9);
}
if (*subject == NULL)
strcpy (subject, "<no subject>");
strcpy (inews, INEWS);
for (i = 1; i < argc; i++)
{
strcat (inews, argv[i]);
strcat (inews, " ");
}
strcat (inews, "-t '");
strcat (inews, subject);
strcat (inews, "'");
if ((p = popen (inews, "w")) == (FILE *) NULL)
{
perror (INEWS);
exit (1);
}
/*
* read the rest of the article, passing it to inews
*/
while (fgets (line, 1022, stdin) != (char *) NULL)
{
line[strlen (line) - 1] = NULL;
if ((strcmp (line, "--") == 0) || (strcmp (line, "-- ") == 0))
{
while (fgets (line, 1022, stdin) != (char *) NULL)
if (strncmp (line, "From", 4) == 0)
{
*subject = NULL;
break;
}
}
if (strncmp (line, "From", 4) == 0)
{
*subject = NULL;
break;
}
fprintf (p, "%s\n", line);
}
/*
* append the .signature file in the current directory
*/
if ((in = fopen (SIG, "r")) != (FILE *) NULL)
{
fprintf (p, "--\n");
while (fgets (line, 1022, in) != (char *) NULL)
fprintf (p, "%s", line);
fclose (in);
}
/*
* post
*/
pclose (p);
/*
* make sure we didn't get an EOF
*/
if (*subject != NULL)
break;
}
}
- --
Ed Carp, N7EKG [email protected], [email protected]
Finger [email protected] for PGP 2.5 public key [email protected]
** PGP encrypted email preferred! **
"What's the use of distant travel if only to discover - you're homeless in
your heart." --Basia, "Yearning"
-----BEGIN PGP SIGNATURE-----
Version: 2.6
iQCVAwUBLoEldCS9AwzY9LDxAQFEDgP/a0OeUQ//m7KO1dUZhLb3wlI4IzYl70JR
PcYL/x2nf+XaskdrWN0YqXqeeV6jaPk7e1xOT/bvKgYs1MADuaUgEgcd0XynYvOl
wOFYAxYN+qWi8+rC0DTxUSysOYGUH3hgMyaN5/dqCINC8pOYIz5iO+BEQC8yN9U3
H1GMiexO04w=
=371T
-----END PGP SIGNATURE-----