Scanning for Outdated Scripts

DDuval

New Member
if I wanted to go about scanning my server for outdated scripts such as older versions of jQuery and Tiny MCE and the like, is there an easy way to do that?
 

phpAddict

Active Member
You could SSH into your server and run some searches. There may be some tool out there, but I'm not aware of any. Some of the below commands will run faster or slower depending on the number of accounts and files to search. Keep in mind that this is no guarantee. For example, I can develop a website and use jquery and rename the jquery file to be something out of the norm, like "php.Addict", it'll still work on the site but would exclude it from all of the below searches. If you want a 100% guarantee of finding ALL instances, this isn't the solution.

After SSHing into your server go into home directory (where all your accounts/sites are located) to search there:
Bash:
cd ../home
Find Filenames Matching tinymce*.js or jquery*.js (this will run relatively quickly since it's only searching filenames):
Bash:
find . -type f -name "tinymce*.js"
find . -type f -name "jquery*.js"
Search within tinymce*.js or jquery*.js files for the word "Version" to output the line of code within these files (will run slower than the find command since it's searching within files, but shouldn't be too bad since it's restricted to files matching tinymcs*.js or jquery*.js):
Bash:
grep -roP --include=\tinymce*.js ".{0,25}Version.{0,25}"
grep -roP --include=\jquery*.js ".{0,25}Version.{0,25}"
Search within ALL files to find possible references to CDNs (This will be slow because it will search in every file type including compressed backups so I'd recommend restricting filetypes if possible):
Bash:
grep -roP ".{0,25}tinymce*.js.{0,25}"
grep -roP ".{0,25}jquery*.js.{0,25}"
To restrict the above command to specific file types it would look something like this:
Bash:
grep -roP --include=*.js --include=*.html --include=*.php ".{0,25}tinymce*.js.{0,25}"
grep -roP --include=*.js --include=*.html --include=*.php ".{0,25}jquery*.js.{0,25}"
 

DDuval

New Member
You could SSH into your server and run some searches. There may be some tool out there, but I'm not aware of any. Some of the below commands will run faster or slower depending on the number of accounts and files to search. Keep in mind that this is no guarantee. For example, I can develop a website and use jquery and rename the jquery file to be something out of the norm, like "php.Addict", it'll still work on the site but would exclude it from all of the below searches. If you want a 100% guarantee of finding ALL instances, this isn't the solution.

After SSHing into your server go into home directory (where all your accounts/sites are located) to search there:
Bash:
cd ../home
Find Filenames Matching tinymce*.js or jquery*.js (this will run relatively quickly since it's only searching filenames):
Bash:
find . -type f -name "tinymce*.js"
find . -type f -name "jquery*.js"
Search within tinymce*.js or jquery*.js files for the word "Version" to output the line of code within these files (will run slower than the find command since it's searching within files, but shouldn't be too bad since it's restricted to files matching tinymcs*.js or jquery*.js):
Bash:
grep -roP --include=\tinymce*.js ".{0,25}Version.{0,25}"
grep -roP --include=\jquery*.js ".{0,25}Version.{0,25}"
Search within ALL files to find possible references to CDNs (This will be slow because it will search in every file type including compressed backups so I'd recommend restricting filetypes if possible):
Bash:
grep -roP ".{0,25}tinymce*.js.{0,25}"
grep -roP ".{0,25}jquery*.js.{0,25}"
To restrict the above command to specific file types it would look something like this:
Bash:
grep -roP --include=*.js --include=*.html --include=*.php ".{0,25}tinymce*.js.{0,25}"
grep -roP --include=*.js --include=*.html --include=*.php ".{0,25}jquery*.js.{0,25}"
Thank you. I will ask one of our developers to have a look at this.
 
Top