Skip to content

Instantly share code, notes, and snippets.

@CodeBrauer
Created April 27, 2015 21:56
Show Gist options
  • Select an option

  • Save CodeBrauer/fbd66ff7b1bfcd4f897e to your computer and use it in GitHub Desktop.

Select an option

Save CodeBrauer/fbd66ff7b1bfcd4f897e to your computer and use it in GitHub Desktop.
check what plugins a wordpress site has installed via http
# prepare before running:
# 1. create folder "plugin_db/"
# 2. chdir to this folder and run this command: `svn list http://plugins.svn.wordpress.org > plugins.txt`
# 3. split plugin.txt in to multiple chunks:
# plugin.txt: ~50000 lines => 50000/10=5000 => split with 5000 lines. Command: `split -l 5000 plugins.txt`
# every chunk of the file is a worker
import subprocess, glob, os
os.chdir("plugin_db/")
for file in glob.glob("*"):
if file == 'plugins.txt': # ignore src file
continue
command = "python /Users/gabriel/tmp/wordpress-plugin-finder/worker.py " + file
print command
subprocess.Popen(command, shell=True)
import urllib2, sys
pluginDBfile = "/Users/gabriel/tmp/wordpress-plugin-finder/plugin_db/" + sys.argv[1]
with open(pluginDBfile, "r") as f:
for line in f:
plugin = line.replace("\n", '')
url = 'http://a-wordpress-site.cc/wp-content/plugins/' + plugin
try:
connection = urllib2.urlopen(url)
print connection.getcode()
connection.close()
except urllib2.HTTPError, e:
if e.getcode() == 404:
print "> NOT FOUND: " + plugin
else:
print "FOUND: HTTP(" + str(e.getcode()) + ") | Plugin: " + plugin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment