Gubed PHP Debugger Forum Index Gubed PHP Debugger
Support forum for Gubed PHP Debugger
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

modifications to the link rewrite

 
Post new topic   Reply to topic    Gubed PHP Debugger Forum Index -> Hacking
View previous topic :: View next topic  
Author Message
flz



Joined: 06 Jul 2005
Posts: 6

PostPosted: 2005-07-07, 12:08    Post subject: modifications to the link rewrite Reply with quote

Hi,
a couple of days ago i stumbled over the gubed debugger, and i think it's a very handy piece of software. After i figured out i didn't need all that stuff i downloaded because there is a windows installer gubed worked right out of the box. I almost couldn't believe it!
But when i went on to make the test to debug my own app, it didn't work. The login screen (of my app) always kept returning, and i couldn't get into the main app. After looking at the server-side code, i realized some of the tricks to get from one page to another weren't supported by the link rewrite part of gubed, so i tried to make some changes.
Some things that didn't seem to work:

- use of $PHP_SELF in links and forms
- in forms a hidden parameter led to the running script itself. jumping to another script via "action" wasn't possible.
- a relative path already contained in links was duplicated

to make $PHP_SELF working i inserted:

Code:
$PHP_SELF = $GLOBALS['gbd']['Script'];

after:
Code:
$_SERVER['PHP_SELF'] = $GLOBALS['gbd']['Script'];

in line 171 of StartSession.php.

and the link rewrite section in GubedFunctions.php:
Code:

      // Replace all relative links and actions in $output
      if(strpos(strtolower($output), '<html')) {
         preg_match_all("/<!--.*-->|<(\\/?[\\w]+)[^>]*>([^<]*)/", $output, $matches, PREG_PATTERN_ORDER);
         
   //     print_r($matches);
         $attributes = Array('href', 'usemap', 'src', 'action', 'background', 'cite', 'classid', 'codebase', 'data', 'longdesc', 'profile');
   //       echo "<pre>";
   
         for($cnt = 0; $cnt < count($matches[0]); $cnt++) {
   //          echo htmlentities("{$matches[0][$cnt]}");
            foreach($attributes as $attribute) {
               $attribute = strtolower($attribute);
               preg_match_all("/(.*?){$attribute}\\s*=\\s*(\".*?\"|'.*?'|[^\"\'].+?\\s)(.*)/si", $matches[0][$cnt], $submatches, PREG_PATTERN_ORDER);
               if(count($submatches[0]) > 0) {
               
                  for($cnt2 = 0; $cnt2 < count($submatches[0]); $cnt2++) {
                     if(substr($submatches[2][$cnt2], 0, 1) == '"') {
                        $submatches[2][$cnt2] = substr($submatches[2][$cnt2], 1, strlen($submatches[2][$cnt2]) - 2);
                        $quote = '"';
                     } elseif(substr($submatches[2][$cnt2], 0, 1) == "'") {
                        $submatches[2][$cnt2] = substr($submatches[2][$cnt2], 1, strlen($submatches[2][$cnt2]) - 2);
                        $quote = "'";
                     } else
                        $quote = '';
                     
                     if(!preg_match("/^.+:\\/\\//", $submatches[2][$cnt2]) ) {
                        $locallink = false;    //if true no parsing
                        $relink = "";      //name and path of the target
                        if(substr($submatches[2][$cnt2], 0, 1) == '?') {
                           $submatches[2][$cnt2]  = '&' . substr($submatches[2][$cnt2], 1);
                           $relink = $GLOBALS['gbd']['Script'] . $submatches[2][$cnt2];
                        } elseif(preg_match("/.*\\.ph.{0,5}.*/i", $submatches[2][$cnt2])) {
                           if (strpos($submatches[2][$cnt2],'/')!==false) $relink = str_replace('?', '&', $submatches[2][$cnt2]);
                             else $relink =  $GLOBALS['gbd']['BaseURL'] .str_replace('?', '&', $submatches[2][$cnt2]);
                        } elseif (trim($submatches[2][$cnt2])!="") {
                           $locallink = true;
                           $submatches[0][$cnt2] = "{$attribute}={$quote}http://" . $_SERVER['HTTP_HOST'] . $GLOBALS['gbd']['BaseURL'] . $submatches[2][$cnt2] . $quote;
                        }
                        if (!$locallink) $submatches[0][$cnt2] = "{$attribute}={$quote}http://" . $_SERVER['HTTP_HOST'] . $GLOBALS['gbd']['StartSession'] . $relink . $quote;
                        $submatches[0][$cnt2] = $submatches[1][$cnt2] . $submatches[0][$cnt2] . $submatches[3][$cnt2];
                     }
                     $matches[0][$cnt] = join('', $submatches[0]);
                     if($attribute == 'action') {
                        if (trim($submatches[2][$cnt2])=="") $relink = $GLOBALS['gbd']['Script'];
                        if ((strpos($relink,'&'))!==false) $relink = substr_replace($relink,'?',(strpos($relink,'&')),1);
                        $matches[0][$cnt]  .= "<input type=\"hidden\" name=\"gbdScript\" value=\"$relink\" />";
                     }
                  }
   //                 $submatches = print_r($submatches, true);
   //                 echo htmlentities($submatches);
               }
            }
         
         }
      
//       echo htmlentities($output);
//       echo htmlentities(join("", $matches[0]));
//       print_r(headers_sent());
         echo join("", $matches[0]);
      } else
         echo $output;       


what i tried to get with these changes:
- always add a hidden parameter to forms to support method get.
- place the actual targetscript in this parameter
- check if there is already a path contained in links to php-scripts

please let me know what you think, ciao,
Frank
Back to top
View user's profile Send private message
Guest






PostPosted: 2005-07-07, 16:51    Post subject: Re: modifications to the link rewrite Reply with quote

Quote:
But when i went on to make the test to debug my own app, it didn't work. The login screen (of my app) always kept returning, and i couldn't get into the main app. After looking at the server-side code, i realized some of the tricks to get from one page to another weren't supported by the link rewrite part of gubed, so i tried to make some changes.


I think perhaps this is a bug that was fixed after 0.2.0. Could you try with 0.2.1, there's a preview version of it at http://x.mccabe.nu/public/Gubed/0.2.1 (it will be released in a day or so if I dont get any complaints bout it)

Quote:
- use of $PHP_SELF in links and forms


Yeah, ok.. I've forgotten about those auto registered globals, I always use $_SERVER[] etc...
Quote:

Code:
$PHP_SELF = $GLOBALS['gbd']['Script'];


Ill add this, except I think it needs to be done only if $PHP_SELF is already set.

Quote:

- in forms a hidden parameter led to the running script itself. jumping to another script via "action" wasn't possible.

I think this is fixed by above mentioned bugfix, let me know otherwise

Quote:

- a relative path already contained in links was duplicated


I dont understand, can you give an example?

Quote:

and the link rewrite section in GubedFunctions.php:
Code:

      // Replace all relative links and actions in $output
...
         echo $output;       



Ill have to take a closer look at the diffs :] ...

It would be great if you could let me know what problems persists with 0.2.1,

thanks!!

/Linus
Back to top
flz



Joined: 06 Jul 2005
Posts: 6

PostPosted: 2005-07-08, 8:05    Post subject: Reply with quote

Hi Linus,
thanks for your reply,

Quote:
I think perhaps this is a bug that was fixed after 0.2.0. Could you try with 0.2.1,

I'll have a look at it

Quote:
Yeah, ok.. I've forgotten about those auto registered globals, I always use $_SERVER[] etc...

i know they shouldn't be used Wink Sometime we'll rewrite the stuff...

Quote:
Ill add this, except I think it needs to be done only if $PHP_SELF is already set.

i'm not sure what you mean, i think it's needed with register globals on.

Quote:

Quote:
- in forms a hidden parameter led to the running script itself. ...

think this is fixed by above mentioned bugfix, let me know otherwise



yes

Quote:

Quote:
- a relative path already contained in links was duplicated

I dont understand, can you give an example?


well eg.
Code:
<form action="<?=$_SERVER['PHP_SELF']?>" method="post">

rewrites to
Code:
<form action="http://maia/gub/serverscripts/StartSession.php?gbdScript=/debugtest//debugtest/start.php" method="post">
<input type="hidden" name="gbdScript" value="/debugtest//debugtest/start.php" />

which won't work, because the $GLOBALS['gbd']['BaseURL'] part is already present in the target. i made a mistake here, i look for a slash anywhere in the original link, but only a slash at the beginning indicates the link is already relative to root directory.

ciao, Frank
Back to top
View user's profile Send private message
flz



Joined: 06 Jul 2005
Posts: 6

PostPosted: 2005-07-08, 11:41    Post subject: Reply with quote

Hi Linus,
i've looked at the version 0.2.1 now. The bug where always the same script was inserted into the hidden input is gone, but now empty actions won't work anymore. In the hidden input $GLOBALS['gbd']['LocalSettings'] is used which gives me an error because it's not set.

things i noticed:
- a path relative to root could be used with any link
- the hidden input is needed whenever StartSession is called, because it won't work without when method is "get".
Code:
<form action="?param=test" method="get">

will not work without the hidden input.
- the value needed in the hidden imput is basically the same as the scriptname in the link to StartSession, but without the ? changed to &.

I tried to do the following now:

- introduce $seslink, this is the rewritten link with path from root on. When $seslink is filled, StartSession is called and the hidden input is added and $seslink is inserted in the hidden input. (That way the link for the hidden input doesn't have to be created from scratch again)

- check for a slash at the beginning of the link and do not insert BaseUrl when present.

Code:

                     if(!preg_match("/^.+:\\/\\//", $submatches[2][$cnt2]) ) {
                        $seslink = false;
                        if($attribute == 'action' && $submatches[2][$cnt2] == '') {
                           $seslink = $GLOBALS['gbd']['Script'];
                        } elseif(substr($submatches[2][$cnt2], 0, 1) == '?') {
                           $submatches[2][$cnt2]  = '&' . substr($submatches[2][$cnt2], 1);
                           $seslink = $GLOBALS['gbd']['Script'] . '&' . substr($submatches[2][$cnt2], 1);
                        } elseif(preg_match("/.*\\.(html|php|phtml|htm|php.).*/i", $submatches[2][$cnt2])) {
                           if (substr($submatches[2][$cnt2],0,1)=='/')
                              $seslink = str_replace('?', '&', $submatches[2][$cnt2]);
                           else
                              $seslink = $GLOBALS['gbd']['BaseURL'] .str_replace('?', '&', $submatches[2][$cnt2]);
                        } elseif(preg_match("/javascript:.*/i", $submatches[2][$cnt2])) {
                           $submatches[0][$cnt2] = "{$attribute}= " . $quote . $submatches[2][$cnt2] . $quote;
                        } else {
                           if (substr($submatches[2][$cnt2],0,1)=='/')
                              $submatches[0][$cnt2] = "{$attribute}={$quote}{$protocol}" . $_SERVER['HTTP_HOST'] . $submatches[2][$cnt2] . $quote;
                           else
                              $submatches[0][$cnt2] = "{$attribute}={$quote}{$protocol}" . $_SERVER['HTTP_HOST'] . $GLOBALS['gbd']['BaseURL'] . $submatches[2][$cnt2] . $quote;
                        }
                        if ($seslink) $submatches[0][$cnt2] = "{$attribute}={$quote}http://" . $_SERVER['HTTP_HOST'] . $GLOBALS['gbd']['StartSession'] . $seslink . $quote;
                        $submatches[0][$cnt2] = $submatches[1][$cnt2] . $submatches[0][$cnt2] . $submatches[3][$cnt2];
                     }
                     $matches[0][$cnt] = join('', $submatches[0]);
                     
                     if($attribute == 'action') {
                        if ((strpos($seslink,'&'))!==false) $seslink = substr_replace($seslink,'?',(strpos($seslink,'&')),1);
                        if ($seslink) $matches[0][$cnt]  .= "<input type=\"hidden\" name=\"gbdScript\" value=\"$seslink\" />";
                     }


ciao,
Frank
Back to top
View user's profile Send private message
Simboo



Joined: 12 Jul 2006
Posts: 1

PostPosted: 2006-07-12, 14:03    Post subject: Reply with quote

The Real EXTREME links! Test yourself:
index
scat
scat-sex
scat-girl
gay-scat
scat-porn
scat-man
scat-movie
scat-video
lesbian-scat
scat-shit
scat-pic
asian-scat
scat-fetish
free-scat
japanese-scat
free-scat-movie
scat-lover
scat-mat
scat-eating
scat-brazil
scat-and-in-and-brazil
scat-clip
scat-story
kv-scat
free-scat-video
scat-woman
jap-scat
scat-forum
japan-scat
teen-scat
fetish-scat-shitting-woman
scat-piss
scat-play
german-scat
bear-scat
groupsmsncom-scat-site
scat-eater
scat-crank
scat-pantie
scat-eat
scat-crankshafts
scat-gallery
free-scat-pic
scat-mistress
scat-domination
shitting-scat
scat-slave
scat-tgp
scat-babes
scat-pee
animal-scat
scat-site
scat-party
vomit-scat
scat-xxx
scat-cat
free-scat-porn
scat-personals
free-scat-clip
hentai-scat
french-and-scat
brazilian-scat
extreme-scat
fem-dom-scat
free-scat-gallery
black-scat
scat-singing
scat-hovercraft
scat-boy
scat-enema
scat-toilet
scat-crankshaft
scat-sluts
love-scat
gay-scat-video
ebony-scat
scat-vw
scat-mpeg
scat-photo
anal-scat
scat-fuck
scat-dvd
asian-scat-picture
scat-enterprise
shemale-scat
amateur-scat
bizarre-scat
scat-bbw
female-scat
scat-rods
scat-fucking
male-scat
pissing-scat
free-scat-sex
scat-shit-photo
asian-scat-movie
scat-kaviar
scat-world
free-scat-picture
scat-and-track
anal-sex-scat
gay-scat-sex
scat-sex-story
scat-shit-sex
scat-sex-movie
scat-sex-video
free-scat-sex-movie
scat-sex-pic
free-scat-sex-pic
scat-japan-sex
free-scat-sex-gallery
free-scat-sex-video
scat-shitting-sex
japanese-scat-sex
asian-scat-sex
scat-eating-shit-sex
scat-sex-site
scat-sex-com
scat-sex-picture
free-picscom-scat-sex
lesbian-scat-girl
girl-eating-scat
japanese-scat-girl
black-girl-scat
girl-doing-scat
scat-shitting-girl
scat-girl-video
japan-girl-scat
scat-shit-girl
free-scat-girl
blak-girl-scat
asian-scat-girl
girl-scat-pic
girl-scat-yuong
girl-scat-movie
scat-school-girl
brazilian-scat-girl
free-gay-scat
gay-male-scat
gay-scat-story
gay-scat-pic
gay-man-scat
gay-scat-porn
gay-scat-movie
gay-redright-scat
black-gay-scat
gay-scat-personals
gay-scat-shit
gay-scat-site
gay-scat-picture
gay-scat-xxx
gay-scat-fetish
scat-gay-boy
gay-golden-scat-shower
gay-scat-clip
gay-scat-eater
free-gay-scat-movie
gay-scat-tgp
scat-gallery-gay
piss-scat-gay
gay-scat-mpeg
scat-shit-gay-porn
gay-bear-scat
farting-porn-scat
scat-porn-movie
scat-porn-gallery
pic-porn-scat
asian-scat-porn
japanese-scat-porn
black-scat-porn
free-scat-porn-movie
scat-porn-video
mature-porn-scat
free-porn-scat-video
german-scat-porn
scat-man-john
im-man-scat
scat-man-lyric
im-a-scat-man
scatman-john-scat-man
man-scat-shit
scat-man-song
black-man-scat
im-a-scat-man-lyric
scat-movie-clip
japanese-scat-movie
scat-movie-gallery
lesbian-scat-movie
scat-movie-sample
scat-shit-movie
free-scat-movie-clip
free-lesbian-scat-movie
scat-free-movie-gallery
scat-movie-tgp
scat-movie-download
grauzone-movie-scat
shit-scat-free-movie
lesbian-scat-story
scat-eating-lesbian
lesbian-scat-video
free-lesbian-scat
scat-shit-and-piss
scat-shit-eating
scat-shit-poop
scat-shit-video
free-scat-shit-video
scat-shit-free
scat-eat-shit
licking-picture-scat-shit
bizarre-scat-shit
picture-scat
asian-picture-scat
free-picture-scat
free-picture-scat-woman
gay-picture-scat
eating-picture-scat
animal-picture-scat
picture-scat-sex
free-asian-scat
asian-scat-video
scat-fetish-index
fetish-free-mpeg-sample-scat
scat-fetish-video
free-scat-story
free-scat-site
free-scat-mpeg
enama-free-pic-scat
free-peeing-scat-video
free-scat-vids
scat-free-trailer
free-scat-moviescom
scat-picture-free-woman
free-scat-tgp
free-scat-video-clip
free-scat-sample
free-japanese-scat
japanese-scat-video
japanese-scat-dvd
japanese-scat-clip
japanese-puke-scat
cat-scat-mat
dog-scat-mat
pet-scat-mat
scat-eating-picture
scat-eating-story
clip-scat
clip-free-scat
clip-movie-scat
clip-scat-video
clip-free-scat-video
clip-free-movie-scat
clip-gay-scat
clip-japanese-scat
dom-fem-scat-story
eating-scat-story
brown-kv-scat-shower
scat-woman-gallery
black-woman-scat
japan-scat-woman
woman-scat-pic
forum-scat
forum-pervert-scat
k9-piss-scat
egg-noodle-piss-scat
black-bear-scat
drinker-eater-scat-squirt
crank-scat
pantie-hose-scat
eat-scat
eat-scat-shit
scat-crankhafts
mistress-pee-scat
delilah-mistress-scat
scat-female-domination
golden-pissing-scat-shitting-shower
kid-pee-rapidshare-scat
wild-animal-scat
picture-of-animal-scat
scat-site-web
blogmyspacecom-scat-site
sickest-scat-site
scat-fem-dom-story
enema-scat-video
big-fat-scat-slut
scat-vw-part
scat-vw-engine
anal-scat-fist
dvd-scat
dvd-japanese-scat
amateur-scat-video
scat-connecting-rods
kaviar-pissen-scat-scheissen
[URL=http://scat1.realextreme.net/][/URL]
_________________
Ahtung!
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Gubed PHP Debugger Forum Index -> Hacking 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


Powered by phpBB © 2001, 2005 phpBB Group