Jump to content

[SOLVED] preg_match problems


newbtophp

Recommended Posts

I've got some code like:

 

$_F=__FILE__;$_X="STRING1";$_D=strrev('edoced_46esab');eval($_D("STRING2"));

 

Note: The code always is the same, except its not allways like the above, sometimes it may contain other phpcode surrounding the above line.

 

How would i grab and echo the two strings using regex?. Im only looking to get the 2 strings,

 

the strings are base64 (letters [some with caps and some not], numbers and plus signs)

 

 

I'm new to regex and I've come up with:

 

 

if (preg_match('/="[^"]+"/Umis', $string1)) { 

echo $string1[1]

 

 

if (preg_match('/="([^"]+)"/Umis', $string2)) { 

echo $string2[1]

 

 

But still no luck  :-\

 

 

Link to comment
Share on other sites

Maybe this may give you a better understanding of what im trying to do:

 

<form method="post" action="<?php echo $PHP_SELF; ?>" enctype="multipart/form-data">
<input type="file" name="Upload" value="Upload" /> 
<input type="submit" name="submit" value="Upload" />
<br />

</form>
<br>
<?php
if (isset($_FILES['Upload'])) {
$file = file_get_contents($_FILES['Upload']['tmp_name']);
$submit = $_POST['submit'];
if($file == "") echo "";
else {
    if($submit == "Upload") {
if (preg_match('~"([^"]+)"~', $file, $match)) { 

//The first string gets echo'd here
echo "<textarea>$match[1]</textarea>";

if (preg_match('/="([^"]+)"/Umis', $file, $match)) {

//Second strings get echo'd here
echo "<textarea>$match2[1]</textarea>";

        
}
}
}
}
}
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.