php scanner

Started on the old forum in July 2012 · view the original in the archive · old links redirect here

6 replies · 560 views · started 14 years ago · 1 min read

2 participants
ozziemale31 Lead · 861 posts #1

hi guys im wondern if anyone has or is willing to share a php script that will do the following.... 1)scan sub folders for rogue pages or file extenstions 2)have an exclude list so these files dont show in the scan 3)must be in php format

ie so if i use the script to scan images folder it will return any extensions showing .txt .html .php in that folder i think if it can be modded to suit lava it will be good to modify such a script to run on a server to check for rogue files hackers try uploading ...................... any input on this will be appreciated i been googlen but not found much

Added after 58 minutes:

dont worry i found the answer i needed it works 🙂

External image (may be gone) External image (may be gone)

External image (may be gone)

*****

**Dont Ask Me Dumb Questions.Or you'l get a Dumb Answer.. Want A Profesional Logo or Theme For Your wap site Pm Me.If I Have The Time Ill Make It For Free ***

Ghost Senior · 366 posts #2

sounds interesting. care to share your findings?

<?php include ('Ghost'); if ($Post == true) { echo ' ![](http://destrukt.dk/ico/phpdeveloper.jpg) alt='coding-talk.com!!' />'; echo 'Sharing Is Caring!'; } else { echo ' ![](http://img98.imageshack.us/img98/6476/av3ro4.jpg) alt='the username GHOST has been comprimised!' />'; echo 'OMG SOMEBODY HELP ME!!'; } ?>
ozziemale31 Lead · 861 posts #3

re

Ghost wrote: sounds interesting. care to share your findings?

i was looking at modifyn the scanner code used in johncms440 script it pics up rogue php and html files while using an exclude list at same time im studying the scandir function to see if can make myown

External image (may be gone) External image (may be gone)

External image (may be gone)

*****

**Dont Ask Me Dumb Questions.Or you'l get a Dumb Answer.. Want A Profesional Logo or Theme For Your wap site Pm Me.If I Have The Time Ill Make It For Free ***

Ghost Senior · 366 posts #4

cool. may look into this at some point when i get some spare time. its interesting.

<?php include ('Ghost'); if ($Post == true) { echo ' ![](http://destrukt.dk/ico/phpdeveloper.jpg) alt='coding-talk.com!!' />'; echo 'Sharing Is Caring!'; } else { echo ' ![](http://img98.imageshack.us/img98/6476/av3ro4.jpg) alt='the username GHOST has been comprimised!' />'; echo 'OMG SOMEBODY HELP ME!!'; } ?>
ozziemale31 Lead · 861 posts #5

re

Shannon388 wrote: sounds interesting. care to share your findings?

hi mate i got a soloution for that code

[PHP]<?php
$dir = "images/"; //You could add a $_GET to change the directory
$files = scandir($dir);
echo "<list>";
foreach($files as $key => $value){

//////// Add File Extensions To Be Displayed
if(strpos($value, ".php") > 0) {
/////// Return results
echo "".$value."<br/>";
}
echo "</list>";
}
?>

Added after 17 minutes:

i also found by using

<?php
$dir = "images/"; //You could add a $_GET to change the directory
$files = scandir($dir);
echo "<list>";
foreach($files as $key => $value){
if(strpos($value, ".png") > 0) {
echo "".$value."<br/>";
}
if(strpos($value, ".php") > 0) {
echo "".$value."<br/>";
}
if(strpos($value, ".txt") > 0) {
echo "".$value."<br/>";
}
echo "</list>";
}
?>

will return a list in alphabetical order

like eg: 11.php acdc.txt bank.png blueribbon.png book.png forum.png greenribbon.png news.png pokes.png poll.png reputation.png search.png test.txt wall_icon.png warning.png yellowribbon.png

Added after 15 minutes:

External image (may be gone) External image (may be gone)

External image (may be gone)

*****

**Dont Ask Me Dumb Questions.Or you'l get a Dumb Answer.. Want A Profesional Logo or Theme For Your wap site Pm Me.If I Have The Time Ill Make It For Free ***

ozziemale31 Lead · 861 posts #6

another version ive done using style sheet

<?php
/*
--------------------------------------
   Shell Scanner Script
          By Ozziemale
--------------------------------------
*/
header("Content-type: text/html; charset=ISO-8859-1");
echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>";
echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
?>
<meta name="description" content="www.m-zonez.net" />
<meta name="keywords" content="free downloads and more for your phone " />
<link rel="shortcut icon" href="images/favicon.ico" />
<link rel="icon" href="images/favicon.gif" type="image/gif" />
<?php
  echo "<head>";
    echo "<title>Error!!!</title>";
       echo "<style type=\"text/css\">

* {
 	margin: 0;
	padding: 0;
}
/*
Css Style by
Rampage
Default Theme
*/

body {
color : #FFFFFF;
font-size : 12px;
font-family : arial;
background-color : #000000;
max-width : 640px;
max-height : 75px;
margin : auto;
}
   <!-- Script By Rampage -->
</style>";
  echo "<head>";
  echo "<title>Data Base Error!</title>";
  echo "</head>";
  echo "<body>";
  ?>
  <?php

$dir = "images/"; //You could add a $_GET to change the directory
$files = scandir($dir);
echo "<font color=\"#00CC00\">------------------------------------------------<br /></font>";
echo "<font color=\"#00CC00\">Shell Scanner V.1 By Ozziemale31<br /></font>";
echo "<font color=\"#00CC00\">------------------------------------------------<br /></font>";
echo "<list><center>";
foreach($files as $key => $value){

if(strpos($value, ".php") > 0) {
echo "<font color=\"#00CC00\"><strong>Possible Shell Script:</strong> </font><font color=\"#FF0000\">".$value."</font><br/>";
}
if(strpos($value, ".php4") > 0) {
echo "<font color=\"#00CC00\"><strong>Possible Shell Script:</strong> </font><font color=\"#FF0000\">".$value."</font><br/>";
}
if(strpos($value, ".php5") > 0) {
echo "<font color=\"#00CC00\"><strong>Possible Shell Script:</strong> </font><font color=\"#FF0000\">".$value."</font><br/>";
}
if(strpos($value, ".asp") > 0) {
echo "<font color=\"#00CC00\"><strong>Possible Shell Script:</strong> </font><font color=\"#FF0000\">".$value."</font><br/>";
}
if(strpos($value, "php.jpg") > 0) {
echo "<font color=\"#00CC00\"><strong>Possible Shell Script:</strong> </font><font color=\"#FF0000\">".$value."</font><br/>";
}
if(strpos($value, "php.gif") > 0) {
echo "<font color=\"#00CC00\"><strong>Possible Shell Script:</strong> </font><font color=\"#FF0000\">".$value."</font><br/>";
}
if(strpos($value, ".xhtml") > 0) {
echo "<font color=\"#00CC00\"><strong>Possible Shell Script:</strong> </font><font color=\"#FF0000\">".$value."</font><br/>";
}
if(strpos($value, ".cgi") > 0) {
echo "<font color=\"#00CC00\"><strong>Possible Shell Script:</strong> </font><font color=\"#FF0000\">".$value."</font><br/>";
}
if(strpos($value, ".wml") > 0) {
echo "<font color=\"#00CC00\"><strong>Possible Shell Script:</strong> </font><font color=\"#FF0000\">".$value."</font><br/>";
}
if(strpos($value, ".txt") > 0) {
echo "<font color=\"#00CC00\"><strong>Possible Shell Script:</strong> </font><font color=\"#FF0000\">".$value."</font><br/>";
}
echo "</list></center>";

}
echo "<font color=\"#00CC00\">------------------------------------------------<br /></font>";
echo "<font color=\"#00CC00\">www.m-zonez.net<br />© copyright 2012 ©<br />All Rights Reserved</font>";
echo "</body>";
    echo "</html>";
?>

External image (may be gone) External image (may be gone)

External image (may be gone)

*****

**Dont Ask Me Dumb Questions.Or you'l get a Dumb Answer.. Want A Profesional Logo or Theme For Your wap site Pm Me.If I Have The Time Ill Make It For Free ***

Ghost Senior · 366 posts #7

nice work bud, with a little change in it to "know" what files should exist first and this will be a very handy tools indeed. 🙂

<?php include ('Ghost'); if ($Post == true) { echo ' ![](http://destrukt.dk/ico/phpdeveloper.jpg) alt='coding-talk.com!!' />'; echo 'Sharing Is Caring!'; } else { echo ' ![](http://img98.imageshack.us/img98/6476/av3ro4.jpg) alt='the username GHOST has been comprimised!' />'; echo 'OMG SOMEBODY HELP ME!!'; } ?>

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close