Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

ELECTRO SHOCKER!

Name: Sgt. KABUTERIMON 2013-04-06 18:22

I will be executed in the morning, for crimes against The Board. The exact details as to why are not important. But what is important is that whomever is reading this letter knows that the legendary /prog/ spammer really exists.

(use srfi-1 srfi-13 srfi-18 tcp)

(define sleep thread-sleep!)

(define (stake s token)
 ((lambda (index)
   (if (not index) s (string-take s index)))
  (string-contains s token)))

(define (sdrop s token)
 ((lambda (index)
   (if (not index) ""
    (string-drop s (+ index (string-length token)))))
  (string-contains s token)))

(define (tokenise s token)
 (unfold string-null?
  (lambda (x) (stake x token))
  (lambda (x) (sdrop x token)) s))

(define (send host port message)
 (apply
  (lambda (reader writer)
   (display message writer)
   (string-unfold eof-object? values
    (lambda (x) (read-char reader))
    (read-char reader)))
  (call-with-values
   (lambda () (tcp-connect host 80)) list)))

; -----------------------------------------------------------------------------

(define (post thread-id name email comment)
 (send "dis.4chan.org" 80
  ((lambda (body)
    (string-append
     "POST /post HTTP/1.1\r\n"
     "Host: dis.4chan.org\r\n"
     "Connection: close\r\n"
     "Content-Type: application/x-www-form-urlencoded\r\n"
     "Content-Length: " (number->string (string-length body)) "\r\n\r\n"
     body))
   (string-append "bbs=prog&"
    "id=" thread-id "&"
    " lol what 2&"
    "kotehan=" name "&"
    "meiru=" email "&"
    "com=" comment "&"
    "email=%27"))))

(define (get page)
 (send "dis.4chan.org" 80
  (string-append
   "GET " page " HTTP/1.1\r\n"
   "Host: dis.4chan.org\r\n"
   "Connection: close\r\n\r\n")))

(define (electro-shocker! thread-list)
 (post (fourth (list-ref thread-list (random (length thread-list))))
  "James+Gosling" "" "GAWWWWWWWWZMACSSSSSS+FLABBERGASTS+MY+AUDIENCE")
 (sleep 5)
 (electro-shocker! thread-list))

(electro-shocker!
 (filter-map
  (lambda (x)
   ((lambda (tokens)
     (if (= (length tokens) 7) tokens #f))
    (tokenise x "<>")))
  (string-tokenize (get "/prog/subject.txt")
   (lambda (x) (not (char=? x #\newline))))))


Go now, and beware, others now know of the /prog/spammer too. ELECTRO SHOCKER!!!!

Name: Anonymous 2013-04-07 5:18

AVAILABLE IN DA LANGUAGE DAT DEANIS RICKY LOVED
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

#include <netdb.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <unistd.h>

enum {
    NPOSTS = 2,
    TIMEOUT = 5
};

char *nth_token(char *to, size_t n, const char *s, const char *delim, size_t i)
{
    size_t dsize;
    char *save;

    for (dsize = strlen(delim); i--; s += dsize)
        if (!(s = strstr(s, delim)))
            return 0;
    for (save = to; --n && (*to = *s) && strncmp(s++, delim, dsize); to++)
        ;
    *to = '\0';
    return save;
}

size_t count_tokens(const char *s, const char *delim)
{
    size_t dsize = strlen(delim), n;

    for (n = 1; (s = strstr(s, delim)); n++)
        s += dsize;
    return n;
}

char **make_tokens(char **to, size_t n, char *s, const char *delim)
{
    char **save, **end = to + n - 1;
    size_t dsize = strlen(delim);

    for (save = to; to < end && (s = strstr(*to++ = s, delim)); s += dsize)
        *s = '\0';
    *to = 0;
    return save;
}

char **tokenise(const char *s, const char *delim)
{
    size_t n = count_tokens(s, delim) + 1;
    char **r;

    if (!(r = malloc((n + 1) * sizeof *r)))
        return 0;
    if (!(*r = malloc(strlen(s) + 1))) {
        free(r);
        return 0;
    }
    return make_tokens(r + 1, n, strcpy(*r, s), delim);
}

FILE *dial(const char *host, const char *port)
{
    struct addrinfo hints;
    struct addrinfo *info, *ip;
    int fd;

    memset(&hints, 0, sizeof hints);
    hints.ai_socktype = SOCK_STREAM;
    hints.ai_family = AF_UNSPEC;
    if (getaddrinfo(host, port, &hints, &info))
        return 0;
    for (ip = info; ip; ip = ip->ai_next) {
        if ((fd = socket(ip->ai_family, ip->ai_socktype,
                 ip->ai_protocol)) == -1)
            continue;
        if (!connect(fd, ip->ai_addr, ip->ai_addrlen))
            break;
        close(fd);
    }
    freeaddrinfo(info);
    return !ip ? 0 : fdopen(fd, "r+");
}

/* -------------------------------------------------------------------------- */

static char buffer[2000000];

FILE *con(void)
{
    FILE *r;

    if (!(r = dial("dis.4chan.org", "80"))) {
        fputs("error: unable to connect to server\n", stderr);
        exit(EXIT_FAILURE);
    }
    return r;
}

void post(const char *thread, const char *name, const char *email,
      const char *comment)
{
    FILE *iop = con();

    sprintf(buffer, "bbs=prog&id=%s&shii" "chan=proper2&"
        "kotehan=%s&meiru=%s&com=%s&email=%%27", thread, name, email,
        comment);
    fprintf(iop,
        "POST /post HTTP/1.1\r\n"
        "Host: dis.4chan.org\r\n"
        "Connection: close\r\n"
        "Content-Type: application/x-www-form-urlencoded\r\n"
        "Content-Length: %lu\r\n\r\n%s",
        (unsigned long int) strlen(buffer), buffer);
    fflush(iop);
    getc(iop);    /* This is necessary for the post to take effect. */
    fclose(iop);
    puts(thread);
}

char *get(const char *page)
{
    FILE *iop = con();
    size_t n;

    fprintf(iop,
        "GET %s HTTP/1.1\r\n"
        "Host: dis.4chan.org\r\n"
        "Connection: close\r\n\r\n", page);
    fflush(iop);
    puts("downloading thread list ...");
    n = fread(buffer, 1, sizeof buffer, iop);
    buffer[n] = '\0';
    fclose(iop);
    return buffer;
}

int main(int argc, char *argv[])
{
    size_t nmemb, i;
    char id[1024];
    char **a;

    srand(time(0));
    puts("connecting to server... ");
    if (!(a = tokenise(get("/prog/subject.txt"), "\n"))) {
        fputs("memory error\n", stderr);
        return EXIT_FAILURE;
    }
    for (nmemb = i = 0; (a[nmemb] = a[i]); i++)
        nmemb += count_tokens(a[i], "<>") == 7;
    puts("starting ...");
    for (i = 0;;) {
        post(nth_token(id, sizeof id, a[rand() % nmemb], "<>", 3),
             "James+Gosling", "", "GAWWZMACS+FLABBERGASTS+MY+AUDIENCE");
        if (++i == NPOSTS)
            break;
        sleep(TIMEOUT);
    }
    return 0;
}

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List