1

I have folder that contains the source code files of a website (tons of html, css and php files). I would like to find an automatic method (preferably with command line tools) to scan this folder recursively and get a list of URLs that are included in these files.

I guess it's possible with find and grep and some regular expressions, but my knowledge is limited about combining these commands.

Basically it'd be a good way to find out if there are any "hidden" URL calls (data leaks, backdoors or secret download functions) in the code of the CME or installed plug-ins.

2 Answers 2

1

Use grep command and search recursively for http in a documment.

Syntax

(If I can remember well)

grep -r http ./var/html/index.php

Where grep -r will force a recursive search, altought you can use other methods too, type grep --help to see them.
http is the string you are searching for, and /var/html/index.php is the directory where the file is located.

1
  • Thank you. Just to avoid confusion about folder naming... grep -r MySearchedString ./MyFolder
    – user14188
    Feb 22, 2016 at 9:19
0

Notepad++ can accomplish this job with one button press: search for http in given folder including subfolder, and Notepad++ creates a list of all findings.

Surely there are many methods to do this, which are more and much more byzantine as this one.

3
  • Thank you, Evgeniy. I think your idea is good and I marked it as useful. However I use Linux and that's why I am interested in some geeky command line solutions too. You know, native command line tools are faster than Notepad++ on Wine.
    – user14188
    Feb 21, 2016 at 15:03
  • i'm pretty sure, that any text editor, which is natively working on Linux has same function, so you don't need to run Wine.
    – Evgeniy
    Feb 21, 2016 at 15:12
  • Sure, you are right! Maybe I will wait for a few hours for an answer... and if I get none, I will turn it into an Emacs question. I'm 100% sure there is a crazy keyboard shortcut for this in Emacs. :)
    – user14188
    Feb 21, 2016 at 16:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.