Closed .drama security hole

This commit is contained in:
melonhead 2010-03-04 03:18:32 +00:00
parent 4881b96df4
commit 98d939ace4
1 changed files with 2 additions and 1 deletions

3
plugins/drama.py Normal file → Executable file
View File

@ -1,6 +1,7 @@
'''Searches Encyclopedia Dramatica and returns the first paragraph of the
article'''
from ast import literal_eval
import urllib2
from util import hook
from util import BeautifulSoup
@ -17,7 +18,7 @@ def get_article_name(query):
request.add_header(*ua_header)
opener = urllib2.build_opener()
try:
results = eval(opener.open(request).read())
results = literal_eval(opener.open(request).read())
if isinstance(results,list) and len(results[1]):
return results[1][0].replace(' ','_')
except: