Name: Anonymous 2015-05-25 10:11
Can we fucking wake up here sheeple? We need a SchemeBBS. We need to restore all of prog.db in it. This regex crap the admin does is no good right now for the job.
_____ __ ____ ____ _____
/ ___/_____/ /_ ___ ____ ___ ___ / __ )/ __ ) ___/
\__ \/ ___/ __ \/ _ \/ __ `__ \/ _ \/ __ / __ \__ \
___/ / /__/ / / / __/ / / / / / __/ /_/ / /_/ /__/ /
/____/\___/_/ /_/\___/_/ /_/ /_/\___/_____/_____/____/
;; torsocks guile this.scm
(use-modules (web client)
(web response)
(ice-9 receive))
(define (print p) (write p) (newline))
(define schemebbs-endpoint "http://hz27w5o3zlhptx7v.onion/schemebbs")
(define (schemebbs query)
(let ((query-string (with-output-to-string (lambda () (write query)))))
(receive (response body)
(http-post schemebbs-endpoint #:body query-string)
(unless (= 200 (response-code response))
(error "bad http response code" (response-code response)))
(with-input-from-string body read))))
(let ((v (schemebbs '(version))))
(unless (>= v 2)
(error "I only work with version 2 or higher" v)))
(print (schemebbs '(version)))
(print (schemebbs '(get 0)))
;;(print (schemebbs '(posts> 0)))
(define db-max 0)
(define db #f)
(when (access? "db.scm" F_OK)
(with-input-from-file "db.scm"
(lambda ()
(set! db-max (read))
(set! db '())
(let loop ((thing (read)))
(if (eof-object? thing)
#t
(begin (set! db (cons thing db))
(loop (read))))))))
(print `(reading in the new posts since ,db-max))
(define newest-posts (schemebbs `(posts>= ,(+ 1 db-max))))
(print newest-posts)
(for-each (lambda (new)
(let ((new-id (cdr (assoc 'id new))))
(when (> new-id db-max)
(set! db-max new-id))))
newest-posts)
(print `(got new posts up to ,db-max saving...))
(with-output-to-file "db.scm"
(lambda ()
(print db-max)
(when db
(for-each print db))
(for-each print newest-posts)))
(print 'done)
<?php
$post = 0;
$reply = $post;
$l = true;
$index = fopen("index.html", "w") or die("unable to open file");
fwrite($index, "<html> \n <head> \n <title>Its okay I guess...</title> \n");
fwrite($index, "<link rel='stylesheet' type='text/css' href=style.css> \n </head> \n <body id='index'> \n");
fwrite($index, "<div class='shell'>");
fwrite($index, "<div><h2 style='margin: 15px 0 15px 0; font-weight: normal; text-align: center;'>");
fwrite($index, "<a href='http://www.geti2p.net'><img src='i2plogo.png' style='vertical-align: middle'>");
fwrite($index, "</img></a><br><br><span class='spoiler'>/prog/</span> SchemeBBS I2P node</h2></div>");
fwrite($index, "<div id='threadlist' class='shell'><div><h1>Thread List</h2><form method='post' action='main.php'><input type='submit' name='refresh' value='Refresh'></form>");
while ($l == true)
{
$get = system("torsocks curl --data \"(get $post)\" http://hz27w5o3zlhptx7v.onion/schemebbs");
//I couldnt get php curl to work, so this is just a workaround
if ($get == "#f")
$l = false;
$get = str_replace("(", "", $get); //turns the s-expression into an array
$get = str_replace(")", "", $get);
$get = str_replace(". ", "fuckfucklolololasdfghjkl", $get);
$get = str_replace("id ", "", $get);
$get = str_replace("date ", "", $get);
$get = str_replace("reply ", "", $get);
$get = str_replace("post ", "", $get);
$sexp = explode("fuckfucklolololasdfghjkl", $get);
array_shift($sexp);
$sexp[0] = trim($sexp[0]);
$sexp[1] = system("date -u -d @$sexp[1]");
$sexp[3] = str_replace("\"", "", $sexp[3]);
if ($sexp[2] == "#f ")
{
fwrite($index, "<span class='thread'>\n");
fwrite($index, "<a href='/prog/res/$sexp[0].html'>$sexp[0]. $sexp[3]</a> </span>\n");
chdir("/var/lib/i2p/i2p-config/eepsite/docroot/prog/res");
if (file_exists("$sexp[0].html" == false)) //generates an html file for each thread. contains only a button to call get.php
{
$reply = fopen("$sexp[0].html", "w");
fwrite($reply, "<html><head><title>Its okay I guess...</title>\n");
fwrite($reply, "<link rel='stylesheet' type='text/css' href=style.css></head>\n");
fwrite($reply, "<body id='threadpage'><a href='/prog/'>Return</a> <br><br><div class='post'>\n");
fwrite($reply, "<form method='post' action='/prog/get.php'>\n");
fwrite($reply, "<input type='hidden' name=thread value='$sexp[0]'><input type='submit' value='Get Thread' name=thread-get>\n");
fwrite($reply, "</form></body></html>");
fclose($reply);
chdir("/var/lib/i2p/i2p-config/eepsite/docroot/prog");
}
}
$post = $post + 1;
}
fwrite($index, "</div></div></div>\n");
fwrite($index, "<div id='threadform' class='shell'><div>\n");
fwrite($index, "<h2>New Thread</h2>\n");
fwrite($index, "<form method='post' action='post.php'>\n");
fwrite($index, "<input type='hidden' name='thread' value='#f'>\n");
fwrite($index, "<textarea name='message' rows='5' cols='64'></textarea><br>\n");
fwrite($index, "<input type='submit' name='read' value='Submit'></form></div></div>\n");
fwrite($index, "</body> \n </html>");
fclose($index);
?>
<?php
$post = 0;//$_POST["thread"];
$op = $post;
$l = true;
echo "That was PHP Quality!<br><br>";
chdir("/var/www/html/prog/res/"); //opens one of the html files generated by main.php.
$reply = fopen("$post.html", "w") or die("unable to open file");
fwrite($reply, "<html> \n <head> \n <title>Its okay I guess...</title> \n");
fwrite($reply, "<link rel=\"stylesheet\" type=\"text/css\" href=/prog/style.css> \n </head> \n <body id='threadpage'> \n");
fwrite($reply, "<a href='/prog/'>Return</a> <br><br><hr>");
while ($l == true)
{
$get = system("torsocks curl --data \"(get $post)\" http://hz27w5o3zlhptx7v.onion/schemebbs");
if ($get == "#f")
$l = false;
$get = str_replace("(", "", $get); //all this shit is the same in all three files. I'm sure theres a better way to do it, but I don't know how
$get = str_replace(")", "", $get);
$get = str_replace(". ", "fuckfucklolololasdfghjkl", $get);
$get = str_replace("id ", "", $get);
$get = str_replace("date ", "", $get);
$get = str_replace("reply ", "", $get);
$get = str_replace("post ", "", $get);
$sexp = explode("fuckfucklolololasdfghjkl", $get);
array_shift($sexp);
$sexp[1] = system("date -u -d @$sexp[1]");
$sexp[3] = str_replace("\"", "", $sexp[3]);
if ($sexp[2] != "#f " and $sexp[2] == $op or $sexp[0] == $op and $sexp[2] == "#f ") //this checks if the post is a reply to the thread that its loading
{
if ($sexp[0] == $op)
fwrite($reply, "<div class='subject'><h2>$sexp[3]<h2></div>");
fwrite($reply, "<div class='post'>\n");
fwrite($reply, "<div class='posthead'> \n");
fwrite($reply, "<span class='num'>$sexp[0]</span> Name: <span class='name'>Anonymous</span> : $sexp[1]\n");
fwrite($reply, "</div>");
fwrite($reply, "<div class='postbody'>$sexp[3]</div>\n");
fwrite($reply, "</div> \n");
}
$post = $post + 1;
}
fwrite($reply, "<hr><a href='/prog/'>Return</a>\n");
fwrite($reply, "<form method='post' action='/prog/post.php'>\n");
fwrite($reply, "<input type='hidden' name='thread' value='$op'>\n");
fwrite($reply, "<textarea name='message' rows='5' cols='64'></textarea><br>\n");
fwrite($reply, "<input type='submit' name='read' value='Submit'></form>\n");
fwrite($reply, "<form method='post' action='/prog/get.php'>\n");
fwrite($reply, "<hr><input type='hidden' name='thread' value='$op'><input type='submit' name='refresh' value='Refresh'>\n");
fwrite($reply, "</body> \n </html>");
fclose($reply);
?>
<?php
$reply = $_POST["reply"]; //this one is pretty simple
$message = $_POST["message"];
if ($reply == "")
{
$reply = "#f";
}
system("torsocks curl --data \"(post ((reply . $reply) (post . \"$message\")))\" http://hz27w5o3zlhptx7v.onion/schemebbs");
?>