0

my marketing department wanted from me detect our domains for that if they use Wordpress. I have our huge list of domains, but I can't find proper cms detector which will just save which domain has wordpress into output file.

I would be very thankful for advice.

1 Answer 1

0

You can check website index page and grep for "WordPress" or better "wp-content" sub-string.

For example, I check few websites for "wp-content/themes" sub-string, one liner:

DOMAINS="enjoyyourcooking.com yabloko.studio academyselfdefense.com cnn.com middlechildphilly.com"; for i in ${DOMAINS}; do wget --timeout=5 -qO- ${i}|grep 'wp-content/themes' >/dev/null 2>&1 && echo "+++ Domain ${i}: wordpress detected" || echo "--- Domain ${i}: wordpress NOT detected"; done

Output:

+++ Domain enjoyyourcooking.com: wordpress detected
+++ Domain yabloko.studio: wordpress detected
+++ Domain academyselfdefense.com: wordpress detected
--- Domain cnn.com: wordpress NOT detected
+++ Domain middlechildphilly.com: wordpress detected

Readable code version:

DOMAINS="enjoyyourcooking.com yabloko.studio academyselfdefense.com cnn.com middlechildphilly.com";
for i in ${DOMAINS}; do
  wget --timeout=5 -qO- ${i}|grep 'wp-content/themes' >/dev/null 2>&1 && 
    echo "+++ Domain ${i}: wordpress detected" || 
    echo "--- Domain ${i}: wordpress NOT detected";
done

Of course there is no warranty that searched sub-strings was not changed, when wordpress was modified for a particular website... but I cannot help with it.

5
  • thanks for this..and how to add list which is in file? Can I simply do DOMAINS="cat list.txt" ? Commented Jan 31, 2020 at 11:55
  • Instead defining a variable DOMAINS, you can simply read data directly from a file ... for i in $(cat list.txt); do ... Commented Feb 3, 2020 at 14:17
  • or yes, you can do DOMAINS="$(cat list.txt|xargs)" (at the end |xargs added to make content of the variable one long string without new lines, it works without it too, but if you do more operations with variable - it may cause unexpected behavior) Commented Feb 3, 2020 at 14:25
  • I just little "upgraged it" with output to files. Thanks for help. DOMAINS="$(cat domains.txt|xargs)" for i in ${DOMAINS}; do wget --timeout=5 -qO- ${i}|grep 'wp-content/themes' >/dev/null 2>&1 && echo "+++ Domain ${i}: wordpress detected" >> detected.txt || echo "--- Domain ${i}: wordpress NOT detected" >> undetected.txt; done Commented Feb 4, 2020 at 14:44
  • in you line it looks like you missed ; before for. Commented Feb 4, 2020 at 14:49

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.