Search code examples
linuxwget

WGET search files for string


I'm currently trying to work out a way to use the wget to find a string within the html files of a site without downloading it locally. For example I am looking for any passwords that may be stored in a html file, how would I use wget to find that.

At present the only way I have been able to search is to do the following

Download the site

wget - r *sitename*

Use Find to located the text in the files

find . -type f -exec grep -H "stingvalue" {} ;

I have tried merging the commands but cannot get it to work.


Solution

  • Thanks to Barmar for the assist.

    This will download the content of the required html file, without downloading the rest of the site. From there you can grep the file for the data you need:

    wget -r -O log.log *webaddress* -nv -nd | grep -r -e *string*