Skip to content

Instantly share code, notes, and snippets.

@herewithme
Last active July 28, 2021 10:28
Show Gist options
  • Save herewithme/084d9501867e2c6eb495 to your computer and use it in GitHub Desktop.
Save herewithme/084d9501867e2c6eb495 to your computer and use it in GitHub Desktop.
Search files with PHP Script - Help for find malware in uploads folder
<?php
$base_dir = dirname(__FILE__);
$extension_restriction = array(
'js',
'php'
);
$it = new RecursiveDirectoryIterator($base_dir);
foreach (new RecursiveIteratorIterator($it) as $file) {
if (in_array(strtolower(pathinfo( $file, PATHINFO_EXTENSION )), $extension_restriction)) {
echo $file . "<br/> \n";
}
}
@JulioPotier
Copy link

pathinfo( $file, PATHINFO_EXTENSION ); // better perf pour lire chaque extension dans une boucle mon ami.```

http://3v4l.org/n90I7/perf#tabs

@herewithme
Copy link
Author

Et voila chef !

@benoitmercusot
Copy link

Sympa le snippet !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment