Skip to content

Instantly share code, notes, and snippets.

@mistermarco
Created July 12, 2016 23:49
Show Gist options
  • Save mistermarco/935af5923c83f6ec031c8711d4bc376f to your computer and use it in GitHub Desktop.
Save mistermarco/935af5923c83f6ec031c8711d4bc376f to your computer and use it in GitHub Desktop.
Compares Drupal modules on your site with those that report being used between 1,000 to 10,000 times on Drupal.org
# create a set of links for the Drupal project page usage from page 5 to 22 (the ones containing modules
# that are installed on 1,000-10,000 websites
# See https://www.drupal.org/node/2764899
# Drupal contrib - Highly Critical - Remote code execution PSA-2016-001
seq -f "https://www.drupal.org/project/usage?page=%02g" 5 22 >> urls.txt
# Download the content from all the pages
wget -i urls.txt
# Search for project URL which in most cases (all?) is the same as the directory in which the module is installed
# and place them in a file called trouble.txt
# e.g. /project/usage/views and /sites/all/modules/views
grep -oh "/project/usage/[^\"]*" usage\?page\=* | sed -e 's/\/project\/usage\///g' >> trouble.txt
# sites_modules.txt is a list of your site's contrib modules
# compare the two files to see common items
grep -F -x -f sites_modules.txt trouble.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment