Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
48 lines (39 sloc) 1.84 KB
#WordPress Captcha Plugin use fixed key & salt for code & decode captcha until version 3.8.1
#This script gives you all the version;key;salt tuple.
#This script use wget, you need to use LINUX or Cygwin
import urllib
import os
import zipfile
#Get an array with all versions
changelog_page=urllib.urlopen('http://wordpress.org/plugins/captcha/changelog/').read()
temp = changelog_page.partition('<div id="plugin-info" class="block changelog">')[2]
temp = temp.partition('<div id="ajax-response">')[0]
temp = temp.partition('<div class="block-content">')[2].partition('</div>')[0]
tab_temp = temp.split('</h4><ul>')
versions_list = []
for elmt in tab_temp:
if elmt.partition('<h4>')[1] == '<h4>':
#the partition(' -') eliminates the date, if existe
version = elmt.partition('<h4>V')[2].partition(' -')[0]
versions_list.append(version)
#Download all version
for plugin_version in reversed(versions_list):
#Since version 3.8.2, plugin is nor more vulnerable
if plugin_version == '3.8.2':
break
plugin_filename = "captcha." + plugin_version + ".zip"
url = "http://downloads.wordpress.org/plugin/" + plugin_filename
os.system("wget " + url)
#Get key and salt
folder_content = os.listdir("./")
for zip_filename in folder_content:
zip_path = "./" + zip_filename
if os.path.isfile(zip_path) and zip_path.split('.')[-1] == 'zip':
zfile = zipfile.ZipFile(zip_path,'r')
for filename in zfile.namelist():
if filename.split('/')[-1] == 'captcha.php':
data = zfile.read(filename)
version = zip_filename.partition(".zip")[0].partition('captcha.')[2]
key = data.partition('$str_key = "')[2].partition('";')[0]
salt = data.partition('$Salt')[2].partition("= '")[2].partition("';")[0]
print version + ";" + key + ";" + salt