Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Requesting help with an April Fools joke
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Off the Wall
View previous topic :: View next topic  
Author Message
Lews_Therin
l33t
l33t


Joined: 03 Oct 2003
Posts: 657
Location: Banned

PostPosted: Fri Apr 01, 2005 1:26 am    Post subject: Requesting help with an April Fools joke Reply with quote

I want to mess with my brother for April Fools. To do so, I need a few things and would like to ask for your help:

1) A site or server-side script that will translate a normal site into a JeffK-like site. Eg, "like" into "liek", "the" to "teh". If it's a site, I have to be able to pass it the URL of the original site in the GET request. For example, getting http://sometranslator.com/www.realsite.com will return the translated version of www.realsite.com. If it's a server-side script, it needs to be able to run on PHP/Linux and meet the above critiria. I would really, really prefer to use somebody else's site because my webserver is having occasional hardware-related crashes.

2) A way to replace a specific image on the original site with one of my choosing (eg, www.realsite.com/someimage.jpg becomes www.mysite.com/someimage.jpg). If a server-side script of customizable website can do this AND #1, then that's doubleplus cool.


Anybody know where I could find #1 or #2?
Back to top
View user's profile Send private message
yaneurabeya
Veteran
Veteran


Joined: 13 May 2004
Posts: 1754
Location: Seattle

PostPosted: Fri Apr 01, 2005 4:15 am    Post subject: Reply with quote

#1: CGI replacing with regex is quite simple e.g. 'r/the/teh/'. See my post related to your other April Fool's idea for the right manpage ;).

#2: Uhm, where exactly would the server side script be? Sounds like you're trying to hijack the browser :D (and for that you need CGI or PHP or something :P).
Back to top
View user's profile Send private message
Lews_Therin
l33t
l33t


Joined: 03 Oct 2003
Posts: 657
Location: Banned

PostPosted: Fri Apr 01, 2005 4:17 am    Post subject: Reply with quote

I've found #1 and can sort of do #2, but I'm stumped on part of it.

If I request
Code:
http://somesite.com/filename

I want it to ask for
Code:
http://somesite.com/index.php?url=http://somesite.com/filename


The problem is, I don't know what 'filename' will be ahead of time. I'm guessing that I'll need to use mod_rewrite in some fashion, but I just don't know how - this is literally the first time I've done anything other than helloworld type stuff in Apache/PHP.
Back to top
View user's profile Send private message
yaneurabeya
Veteran
Veteran


Joined: 13 May 2004
Posts: 1754
Location: Seattle

PostPosted: Fri Apr 01, 2005 4:59 am    Post subject: Reply with quote

Yeah, that's Apache rewrite. Not sure how to do it though >_<.
Back to top
View user's profile Send private message
Lews_Therin
l33t
l33t


Joined: 03 Oct 2003
Posts: 657
Location: Banned

PostPosted: Fri Apr 01, 2005 5:01 am    Post subject: Reply with quote

To be honest, I am trying to hijack the browser for certain sites. Instead of being normal, they'll have been run through a normal -> l337 translator :twisted:

I found a way around using mod_rewrite. I made a custom 404 page that will grab the correct stuff from the real server, l337-ize it, and deliver it to the user.
Back to top
View user's profile Send private message
yaneurabeya
Veteran
Veteran


Joined: 13 May 2004
Posts: 1754
Location: Seattle

PostPosted: Fri Apr 01, 2005 7:37 am    Post subject: Reply with quote

Lews_Therin wrote:
To be honest, I am trying to hijack the browser for certain sites. Instead of being normal, they'll have been run through a normal -> l337 translator :twisted:

I found a way around using mod_rewrite. I made a custom 404 page that will grab the correct stuff from the real server, l337-ize it, and deliver it to the user.


Hehe. I'd like to see the result :).
Back to top
View user's profile Send private message
Lews_Therin
l33t
l33t


Joined: 03 Oct 2003
Posts: 657
Location: Banned

PostPosted: Fri Apr 01, 2005 7:57 am    Post subject: Reply with quote

OK, I'm going to go to sleep now. In the morning I'll take a screenshot of the results and post it.
Back to top
View user's profile Send private message
Anior
Guru
Guru


Joined: 17 Apr 2003
Posts: 317
Location: European Union (Stockholm / Sweden)

PostPosted: Fri Apr 01, 2005 8:35 am    Post subject: Reply with quote

Make an alias for ls that has a 3% chance of printing "can not read from [hs]d[a-z]" instead of working normaly.
Back to top
View user's profile Send private message
Lews_Therin
l33t
l33t


Joined: 03 Oct 2003
Posts: 657
Location: Banned

PostPosted: Fri Apr 01, 2005 4:49 pm    Post subject: Reply with quote

Well, he's at school now, so I have a few more hours to work on it...

Here's what it currently looks like (He's a big fan of WoW):

Clicky
Back to top
View user's profile Send private message
kimchi_sg
Advocate
Advocate


Joined: 26 Nov 2004
Posts: 2915
Location: Singapore

PostPosted: Fri Apr 01, 2005 5:02 pm    Post subject: Reply with quote

It looks quite convincing already...
_________________
Murphy's Law of Gentoo installation: If a compile can fail, it will.

MacGillicuddy's Corollary: At the most inopportune time.

Please search and read the FAQs before posting.
Back to top
View user's profile Send private message
Lews_Therin
l33t
l33t


Joined: 03 Oct 2003
Posts: 657
Location: Banned

PostPosted: Fri Apr 01, 2005 5:23 pm    Post subject: Reply with quote

kimchi_sg wrote:
It looks quite convincing already...


There are several problems with stylesheets and images, and it only works that well because I've DLed some images to the translation server.

But, if I can get this working, I will redirect even more URLs to my server. Can't wait to see the look on his face.
Back to top
View user's profile Send private message
yaneurabeya
Veteran
Veteran


Joined: 13 May 2004
Posts: 1754
Location: Seattle

PostPosted: Fri Apr 01, 2005 6:57 pm    Post subject: Reply with quote

Wow, that even hurts the eyes to read it :(...

Nicely done Lews :).
Back to top
View user's profile Send private message
Drooling Iguana
Tux's lil' helper
Tux's lil' helper


Joined: 07 Apr 2004
Posts: 94
Location: Sector ZZ9 Plural Z Alpha

PostPosted: Fri Apr 01, 2005 7:17 pm    Post subject: Reply with quote

Be sure to post the sources and instructions on how to use them when you're done.
Back to top
View user's profile Send private message
Lews_Therin
l33t
l33t


Joined: 03 Oct 2003
Posts: 657
Location: Banned

PostPosted: Fri Apr 01, 2005 7:31 pm    Post subject: Reply with quote

Drooling Iguana wrote:
Be sure to post the sources and instructions on how to use them when you're done.


I got images working, and stylesheets + javascript mostly working.

Here's how to do it:

First, set up the host file on the target. For my brother, it was C:\WINNT\system32\drivers\etc\hosts. For *nix, it will be just /etc/hosts. Any websites you want to 1337-ify should be pointed to your server.

Second, you need Apache installed with PHP on another computer (it must be another computer). Make sure it's a fast computer - a page that loads about instantly unprocessed takes 3-4 seconds when run through my Athlon 3400+. This is the computer to point the websites to.

This is the contents of the .htaccess file. Put it in the apache server root. It will send all requests except /favicon.ico (don't ask, long story) and /make-31337.php (our script) to the translation script.

Code:
RewriteEngine On
RewriteCond %{REQUEST_URI} !/make-31337.php.*
RewriteCond %{REQUEST_URI} !/favicon.ico$
RewriteRule   ^(.*)$  /make-31337.php?url=http://%{HTTP_HOST}%{REQUEST_URI}\?%{QUERY_STRING}


Next, create a make-31337.php script in your server's root directory. Here's the contents of it:

Code:
<?     $nameHead = '31337';
    $nameDisp = '31337n355 g3n3r4t0r';
    $dateCrea = '2001-01-13 06:25:59 (Tuesday)';
    $metaDesc = 'Th15 p4g3 \\/\\/111 /\\/\\4k3 j00 5up3r 3133t!!@#$!!@#$';
    $metaKywd = '31337, leet, 1337, eleet, elite, 31337 h4x0r, 2600';


$l33tArray = array(

    ### "Special" words and fragments:
    'cker' => 'xor',
    'loser' => 'lewsar',
    'stupid' => 'stewpid',
    'you' => 'joo',

    ### Single letters:
    'a' => '4',
    'e' => '3',
    'f' => 'ph',
    'i' => '1',
    'l' => '1',
    'm' => '/\\/\\',
    'o' => '0',
    's' => '5',
    'w' => '\\/\\/',
    'z' => '2',

    ### These must be escaped for regex processing:
    '\\!' => '!!@#$',
    '\\?' => '!?@#$',
);

function elitize ($ourStr) {
    reset($GLOBALS[l33tArray]);
    while( list($key, $val) = each($GLOBALS[l33tArray]) ) {
        $ourStr = preg_replace("/$key/i", $val, $ourStr);
    };
    return $ourStr;
};

function isHtml($inputURL){
   if (! preg_match('/http:\/\//i', $inputURL)) {
      return FALSE;
   }

   if (preg_match('/\.gif.*/', $inputURL)){
      return FALSE;
   }

   if (preg_match('/\.jpg.*/', $inputURL)){
      return FALSE;
   }

   if (preg_match('/\.js.*/', $inputURL)){
      return FALSE;
   }

   if (preg_match('/\.css.*/', $inputURL)){
      return FALSE;
   }

   return TRUE;
};

# Move from a $_SERVER[QUERY_STRING] to a URL
function toURL($query){
        $url = preg_replace('/^url=/', '', $query);
#   echo "<!--PHP Debug: query_string url = $url--><br>\n";
   return $url;
}

if ($HTTP_GET_VARS[url]):

#   echo "<!--PHP Debug: original URL = $HTTP_GET_VARS[url]--><br>\n";
#   echo "<!--PHP Debug: query_string = $_SERVER[QUERY_STRING]--><br>\n";
#    $inputURL = stripslashes( $HTTP_GET_VARS[url] );
   $inputURL = toURL($_SERVER[QUERY_STRING]);

    ### Only allow "http://" URLs:
    if (isHtml( $inputURL)) {
        $rawData = @file($inputURL);
#   echo "<!--PHP Debug: inputURL = $inputURL-->";
    };

    ### And something was wrong with the download:
    if (! $rawData) {
#        include("$GLOBALS[DOCUMENT_ROOT]/sys/incl/header.php");
#        echo "<p>Th4t \/\/3b51t3 d1dn't \/\/0rk!!@#$!!@#$</p>\n\n";
#        echo '<p>' . ahref($GLOBALS[SCRIPT_NAME], '4g41n!?@#$') . "</p>\n\n";
#        include("$GLOBALS[DOCUMENT_ROOT]/sys/incl/footer.php");

# Fail gracefully. Return the original
   $rawData = @file($inputURL);
   if ( $rawData ){
      $theData = join('', $rawData);
      echo $theData;
   }
        exit;
    };

    $theData = join('', $rawData);

    ### Script strip:   
# Strips <script> tags
#    $theData = preg_replace('/<script\s+[\x00-\xFF]*?<\/script>/i', '', $theData);

    echo "<base href=\"$inputURL\" />\n\n\n";

    ### Algorithm: First split the data on every "<" symbol. This results in a
    ### string composed of the contents of an HTML tag, a ">" symbol, then text.
    ### Iterate over each of these "TAG>TEXT" strings, splitting on the ">" so
    ### "TAG" and "TEXT" are now isolated. Print out the "TAG", then goto work on
    ### the "TEXT" portion:

    $in_css_mode = FALSE;
    $in_script_mode = FALSE;
    $dataArray = split('<', $theData);
    while( list($key, $val) = each($dataArray) ) {
        list($aTag, $aBlurb) = split('>', $val);
   
   # match <style> tag
        if (preg_match('/^style.*/', $aTag)){
      $in_css_mode = TRUE;
      
   }

   # match </style> tag
        else if (preg_match('/^\/style*/', $aTag)){
      $in_css_mode = FALSE;
   }

   # match <script> tag
        if (preg_match('/^script.*/', $aTag)){
      $in_css_mode = TRUE;
      
   }

   # match </script> tag
        else if (preg_match('/^\/script*/', $aTag)){
      $in_css_mode = FALSE;
   }
   
   if (! preg_match('/^\s*$/', $aTag)){
      echo "<$aTag>";
   }

        $aBlurb = preg_replace('/\&[#a-z0-9]+\;/i', '', $aBlurb); # FIX THIS!
   if (! $in_css_mode){
           echo elitize($aBlurb);
   }

   else {
      echo $aBlurb;
   }
    };


else:

#    include("$GLOBALS[DOCUMENT_ROOT]/sys/incl/header.php");


    if ($HTTP_POST_VARS[str]) {
        $inputStr = stripslashes($HTTP_POST_VARS[str]);
        echo "<p>j00r 1337 53nt3nc3:</p><p class=\"outlined strong\">" . elitize($inputStr) . "</p>\n";
    };
?>


<p>H4v3 j00 3v3r \/\/0nd3r3d \/\/h4t 1t'5 11k3 t0 b3 133t!?@#$ H4v3 j00 3v3r \/\/4nt3d t0 kn0\/\/ h0\/\/ t0 5p33k 11k3 4 133t h4x0r!?@#$ \/\/311, kn0\/\/'5 j00r ch4nc3 t0 134rn!!@#$ \/\/1th1n /\/\1nut35, j00'11 b3 133t h4x0r1ng 11k3 4 pr0!!@#$</p>

<p class="em">100% gu4r4nt33d, 0r j00r /\/\0n3y b4ck!!@#$</p>

<form method="get" action="<? echo $GLOBALS[docPath]; ?>"><table width="100%"><tr valign="top">
    <td>m4ke 4 w3b51t3 1337:</td>
    <td><input type="text" class="text" name="url" size="65" value="<? if ($inputURL) echo $inputURL; ?>" /></td>
</tr><tr>
    <td>&nbsp;</td>
    <td>
        <input type="submit" class="button" value="m4k3 1t 31337!!" /> &nbsp;
        <input type="reset" class="button" value="R353t j00!!" />
    </td>
</tr></table></form>

<form method="post" action="<? echo $GLOBALS[docPath]; ?>"><table width="100%"><tr valign="top">
    <td>0r, m4k3 4 31337 53nt3nc3:</td>
    <td><textarea name="str" rows="6" cols="65"><? if ($inputStr) echo $inputStr; ?></textarea></td>
</tr><tr>
    <td>&nbsp;</td>
    <td>
        <input type="submit" class="button" value="m4k3 1t 31337!!" /> &nbsp;
        <input type="reset" class="button" value="R353t j00!!" />
    </td>
</tr></table></form>


<p class="small">* N0 h4x0r5 \/\/3r3 h4r/\/\3d 1n th3 pr0duct10n 0f th15 \/\/3bp4g3.</p>


<? #include("$GLOBALS[DOCUMENT_ROOT]/sys/incl/footer.php");

endif; ?>


I took the original script off of some random google-search, and modified it to my needs. Some of the original is still tacked on and can probably be removed safely if you want.

Also, PHP is the ugliest language. Ever. It's even worse than perl, from what I can tell.
Back to top
View user's profile Send private message
Lews_Therin
l33t
l33t


Joined: 03 Oct 2003
Posts: 657
Location: Banned

PostPosted: Fri Apr 01, 2005 10:56 pm    Post subject: Reply with quote

He thought a bunch of websites had decided to be 1337 at once as a joke :(
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Off the Wall All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum