/* hp.c: generate honeypot for spambot * H.Tsukamoto (h1r.org) */ #include #include "buffer.h" #include "env.h" #include "fmt.h" #include "tai.h" #include "mycgi.h" /* define if your httpd is shttpd or skahttpd */ #define SHTTPD /* mail address for honeypot */ #define LOCAL "hp" #define DOMAIN "example.com" #define out(s) buffer_puts(buffer_1,s) const char *st = \ "Content-Type: text/html;charset=EUC-JP\n\n" \ "\n\nロボット用わな\n" \ "\n" \ "\n\n"; const char *bd1 = \ "

ロボット用わな

\n
\n" \ "注意:このメールアドレスはspammerのメールアドレス収集ロボットに\n" \ "食べていただくために用意したものなので、人間の皆さんは送らないで\n" \ "ください。アクセス制限等を受けてしまいます。\n" \ "(送らなければなにも起きません)

\n" \ "CAUTION: Do not send any emails to following address \n" \ "or your access to networks under my control will " \ "be restricted.

\n" \ "this address is only for spam robot.
\n" \ "Hey, eat me! yam yam...


\n" \ "abuse (" \ "2\n" \ "3)
\n" \ "root (" \ "2\n" \ "3)
\n" \ "postmaster (" \ "2\n" \ "3)
\n" \ "webmaster (" \ "2\n" \ "3)
\n" \ "info (" \ "2\n" \ "3)
\n" \ "support (" \ "2\n" \ "3)
\n" \ "
script by H.Tsukamoto
Powered by djblib.\n"; const char *en = "\n\n"; const char *er = \ "

can not get environment variables\n" \ "maybe configration error.

"; const char i2h[] = "0123456789ABCDEF"; char *ip2hexstr(char *ip) { static char hx[9]; register char *s; register unsigned int dec; int i; s=hx; for (i = 0; i < 4; i++) { dec = 0; while (*ip >= '0' && *ip <= '9') { dec = dec * 10 + *ip++ - '0'; } *s++ = i2h[dec >> 4]; *s++ = i2h[dec & 0x0f]; ip++; } *s = 0; return (hx); } static struct tai tainow; /* return unix time */ char *now (void) { static char s[16]; fmt_ulong(s,(unsigned long)tainow.x); return s; } int main(void) { char *s; tai_now(&tainow); #if defined(SHTTPD) mycgi_header(&tainow); #endif out(st); if (s = env_get("REMOTE_ADDR")) { out(bd1); out(ip2hexstr(s)); out(now()); out(bd2); } else { out(er); buffer_puts(buffer_2,"hp: can not get REMOTE_ADDR\n"); buffer_flush(buffer_2); } out(en); buffer_flush(buffer_1); _exit(0); }