Index: trollforge/lenny/slashdot_fp.tcl
===================================================================
--- trollforge/lenny/slashdot_fp.tcl	(revision 39)
+++ trollforge/lenny/slashdot_fp.tcl	(revision 39)
@@ -0,0 +1,301 @@
+#!/usr/local/bin/tclsh
+
+package require http
+
+# Parameters
+
+set username "USERNAME"
+set password "PASSWORD"
+set subject "GNAA unveils new 2005 product line"
+set comment {<b>GNAA unveils new 2005 product line</b><br />
+
+<p>The Gay Nigger Incestual Average rose fifteen points today in a sudden
+upswing Wall Street investors are crediting to GNAA-ANUS's unveiling of what's
+to come in the new year.</p>
+
+<p>Development has continued on what is perhaps GNAA's best-known product, the
+popular Internet application Lastmeasure.  New features and functionality will
+help to ensure that users will be able to enjoy Lastmeasure, even with the most
+modern of browsers.</p>
+
+<p>Gay Nigger musos eagerly await the release of YHBT, the upcomming GNAA album
+that promises to be the new standard in trolling music.  The album will include
+cuts such as the Ripper-inspired "<i>S~H~O~A</i>" and the stirring ballad,
+"<i>Zionist Oppressors and You</i>".</p>
+
+<p>Perhaps the most impressive of the new products is known only as the
+"Drilldo."</p>
+
+<p>Described by GNAA president timecop as "Six barrels of sixteen-inch
+niggercock fury", the device is mounted on a small set of tank treads -
+mobility technology licensed from the US Army robotics program.</p>
+
+<p>"We've found the Drilldo to be effective in a number of uses," said GNAA
+researcher Turkback.  "Both Goatse and Mr. Hands were found to be adequately
+fulfilled.  Our special Ass-Sabot rounds are designed to directly pentrate deep
+into the rectal core."</p>
+
+<p>GNAA researchers expect to see battlefield testing of the Drilldo as early
+as Febuary, with insertion into OSDN headquarters.  Military experts are
+predicting these real-world tests to go "catastrophically erotic."</p>
+
+<p>GNAA has also announced plans to sponsor a Bug Chasing team in 2005,
+supporting the Montrose Area Chasing Team in their goal to infect themselves
+with as many different strains of AIDS as possible.  </p>
+
+<p>The Montrose team has generally lost to bigger cities such as San Francisco
+and New York, but have high hopes for taking the lead in 2005 with their new
+GNAA backing.  "With GNAA behind us, we'll be able to achieve our goal by
+engaging in reckless cocaine use and unprotected anal sex with anonymous
+partners in bookstore bathrooms," said an unnamed representative of the
+Montrose team.</p>
+
+<p>In other news, The spiritual leader of the ANUS collective, Prozak/gasjews,
+announced Friday that he would be leading his team of Neitzchian uber-trolls on
+a quest to find the Holy Asshole.  No word has yet been recieved on his
+progress, as immediately after this announcement the leader climbed to the top
+of Mount St. Helens in Washington State.</p>
+
+<p>"He's been up there for days," stated ANUS operative Iconoclast.  "We can't
+really make out what he's yelling from up there, but we think it's something
+about 'infinite return'.  He's probably not comming down until he manages to
+set the damn thing off."</p>
+
+<p>Authorities say that no resolution has been reached, but that regular
+shipments of burritos, ammunition and weapons-grade marajuana continue to be
+brought to the peak of the volcano.</p>
+
+<br />
+<br />
+<b>About GNAA</b>:<br />
+<b>GNAA</b> (<i>GAY NIGGER ASSOCIATION OF AMERICA</i>) is the first
+organization which gathers GAY NIGGERS from all over America and abroad for one
+common goal - being GAY NIGGERS.<br />
+<br />
+Are you <a href="http://klerck.org/spin.gif"><b>GAY</b></a>?<br />
+Are you a <a href="http://www.mugshots.org/sports/oj-simpson.jpg"><b>NIGGER</b></a>?<br />
+Are you a <a href="http://www.gay-sex-access.com/gay-black-sex.jpg"><b>GAY NIGGER</b></a>?<br />
+<br />
+If you answered "Yes" to all of the above questions, then <b>GNAA</b> (<i>GAY NIGGER
+ASSOCIATION OF AMERICA</i>) might be exactly what you've been looking for!<br />
+Join <b>GNAA</b> (<i>GAY NIGGER ASSOCIATION OF AMERICA</i>) today, and enjoy
+all the benefits of being a full-time <b>GNAA</b> member.<br />
+<b>GNAA</b> (<i>GAY NIGGER ASSOCIATION OF AMERICA</i>) is the fastest-growing
+GAY NIGGER community with THOUSANDS of members all over United States of
+America and the World! You, too, can be a part of <b>GNAA</b> if you join
+today!<br />
+<br />
+Why not? It's quick and easy - <b>only 3 simple steps!</b><br />
+<ul>
+<li>First, you have to obtain a copy of <a href="http://us.imdb.com/Title?0274518"><i>GAYNIGGERS FROM OUTER SPACE THE MOVIE</i></a> and watch it. You can <a href="http://pepper.idge.net/gnaa/gnfos_dr.torrent">download the movie</a> (~130mb) using BitTorrent.</li>
+<li>Second, you need to succeed in posting a <b>GNAA</b> <a href="http://en.wikipedia.org/wiki/First_Post"><i>First Post</i></a> on <a href="http://slashdot.org">slashdot.org</a>, a popular "news for trolls" website.</li>
+<li>Third, you need to join the official <b>GNAA</b> irc channel #GNAA on irc.gnaa.us, and apply for membership.</li>
+</ul>
+Talk to one of the ops or any of the other members in the channel to <b>sign up
+today</b>! Upon submitting your application, you will be required to submit
+links to your successful <i>First Post</i>, and you <b>will</b> be tested on
+your knowledge of <i>GAYNIGGERS FROM OUTER SPACE</i>.<br />
+
+<br />
+If you are having trouble locating <b>#GNAA</b>, the official <i>GAY NIGGER
+ASSOCIATION OF AMERICA</i> irc channel, you might be on a wrong irc network.
+The correct network is <b>NiggerNET</b>, and you can connect to
+<b>irc.gnaa.us</b> as our official server. Follow <a href="irc://irc.gnaa.us/gnaa">this link</a> if you are using an irc client such as mIRC.
+<br />
+<br />
+If you have <b>mod points</b> and would like to support <b>GNAA</b>, please <b>moderate this post up</b>.<br />
+<br />
+<tt>
+.________________________________________________.<br />
+| ______________________________________._a,____ | <b>Press contact:</b><br />
+| _______a_._______a_______aj#0s_____aWY!400.___ | Gary Niger<br />
+| __ad#7!!*P____a.d#0a____#!-_#0i___.#!__W#0#___ | <i><a href="mailto:gary_niger@gnaa.us">gary_niger@gnaa.us</a></i><br />
+| _j#'_.00#,___4#dP_"#,__j#,__0#Wi___*00P!_"#L,_ | GNAA Corporate Headquarters<br />
+| _"#ga#9!01___"#01__40,_"4Lj#!_4#g_________"01_ | 143 Rolloffle Avenue<br />
+| ________"#,___*@`__-N#____`___-!^_____________ | Tarzana, California 91356<br />
+| _________#1__________?________________________ |<br />
+| _________j1___________________________________ | <b>All other inquiries:</b><br />
+| ____a,___jk_GAY_NIGGER_ASSOCIATION_OF_AMERICA_ | Enid Al-Punjabi<br />
+| ____!4yaa#l___________________________________ | <i><a href="mailto:enid_indian@gnaa.us">enid_indian@gnaa.us</a></i><br />
+| ______-"!^____________________________________ | GNAA World Headquarters<br />
+` _______________________________________________' 160-0023 Japan Tokyo-to Shinjuku-ku Nishi-Shinjuku 3-20-2<br />
+</tt>
+<br />
+Copyright (c) 2003-2004 <a href="http://www.gnaa.us">Gay Nigger Association of America</a><br />
+<br />
+}
+
+# ----
+
+set base_url "http://slashdot.org/"
+set login_url "$base_url/login.pl"
+set article_url "$base_url/article.pl"
+set comments_url "$base_url/comments.pl"
+
+proc update_cookies {q} {
+
+	global cookies
+
+	foreach {k v} [set [set q](meta)] {
+
+		if {[string equal -nocase $k Set-Cookie]} {
+
+			regexp -nocase -- {([^=]+)=([^;]+);} $v m k2 v2
+
+			array set cookies [list $k2 $v2]
+		}
+	}
+}
+
+proc format_cookies {} {
+
+	global cookies
+	set r ""
+
+	foreach {k v} [array get cookies] {
+	
+		append r "$k=$v; "
+	}
+
+	regsub {; $} $r {} r
+
+	return [list Cookie $r]
+}
+
+proc getSid {} {
+
+	global base_url
+
+	set q [::http::geturl $base_url -headers [format_cookies]]
+	set p [::http::data $q]
+	::http::cleanup $q
+
+	regexp -nocase -- \
+		{<a href="[^?]+\?sid=([0-9/]+)[^"]+"><b>Read More...</b></a>} \
+		$p m sid
+
+	return $sid
+}
+
+proc getSid2 {sid} {
+
+	global article_url
+
+	set q [::http::geturl "$article_url?sid=$sid" -headers [format_cookies]]
+	set p [::http::data $q]
+	::http::cleanup $q
+
+	regexp -nocase -- \
+		{<input type="hidden" name="sid" value="([0-9]+)">} \
+		$p m sid
+
+	return $sid
+}
+
+proc getFormKey {sid} {
+
+	global comments_url
+
+	set q [::http::geturl "$comments_url?sid=$sid&op=Reply" -headers [format_cookies]]
+	set p [::http::data $q]
+	::http::cleanup $q
+
+	set fk ""
+
+	regexp -nocase -- \
+		{<input type="hidden" name="formkey"[ \t\r\n]*value="([0-9a-zA-Z_]+)">} \
+		$p m fk
+
+	return $fk
+}
+
+proc postPost {sid fk} {
+
+	global comments_url subject comment
+
+	set query [::http::formatQuery \
+		sid $sid \
+		pid 0 \
+		mode thread \
+		startat "" \
+		threshold -1 \
+		commentsort 0 \
+		formkey $fk \
+		postersubj  $subject \
+		postercomment $comment \
+		op Submit \
+		posttype 2 \
+	]
+
+	set q [::http::geturl $comments_url -query $query -headers [format_cookies]]
+	set p [::http::data $q]
+	::http::cleanup $q
+
+	return $p
+}
+
+# Get login cookies
+set login_query [::http::formatQuery \
+	op userlogin \
+	unickname $username\
+	upasswd $password \
+	userlogin "Log in" \
+]
+
+set q [::http::geturl $login_url -query $login_query -timeout 30000]
+update_cookies $q
+::http::cleanup $q
+# #
+
+# Wait for a new article
+set csid [getSid]
+
+while {1} {
+
+	after 30000
+
+	set nsid [getSid]
+
+	if {[string compare $csid $nsid]} break
+
+	puts -nonewline ":"
+	flush stdout
+}
+# #
+
+# Wait for comments sid
+while {1} {
+
+	after 10000
+
+	set nsid [getSid2 $nsid]
+
+	if {[string first / $nsid] < 0} break
+
+	puts -nonewline ";"
+	flush stdout
+}
+# #
+
+# Wait for formkey
+while {1} {
+
+	after 10000
+
+	set fk [getFormKey $nsid]
+
+	if {[string length $fk]} break
+
+	puts -nonewline "!"
+	flush stdout
+}
+# #
+
+puts "Frist post attempt!"
+puts "nsid: $nsid, fk: $fk"
+
+after 20000
+
+puts "----"
+puts [postPost $nsid $fk]
+puts "----"
