Skip to content

Commit f90fa8b

Browse files
committed
Hot fixes for GET and POST request escape issues
1 parent ae663fa commit f90fa8b

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# FireURL (v.0.3)
1+
# FireURL (v.0.3.1)
22
Open url from a POST request. Simple Python script that fires a URL from a POST request to the server computer.
33

44
## Requirements

fireURL.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@
1919
from socket import gethostname, gethostbyname
2020
from subprocess import call
2121
import urlparse
22-
from urlparse import urljoin, parse_qs
23-
import cgi, platform, sys
22+
from urlparse import urljoin
23+
import cgi, platform, sys, re
2424

2525
LISTENPORT=8000
2626

2727
class GetHandler(BaseHTTPRequestHandler):
2828
def fireURL(self, url):
29-
url = urljoin('http://', url[0])
29+
url = urljoin('http://', url)
3030

3131
system = platform.system()
3232
commands = []
@@ -52,8 +52,9 @@ def post_get_handler(self, url):
5252

5353
def do_GET(self):
5454
o = urlparse.urlparse(self.path)
55-
quries = urlparse.parse_qs(o.query)
56-
url = quries['url'] or ""
55+
url = re.match('\Aurl=(.*)', o.query)
56+
url = url.group(1) if url else ""
57+
5758
self.post_get_handler(url)
5859

5960
def do_POST(self):
@@ -67,14 +68,15 @@ def do_POST(self):
6768
postvars = cgi.parse_qs(self.rfile.read(length), keep_blank_values=1)
6869
else:
6970
postvars = {}
70-
self.post_get_handler(postvars['url'])
71+
print postvars['url']
72+
self.post_get_handler(postvars['url'][0])
7173

7274
def log_info(msg):
7375
print '\033[94m\033[1m' + "INFO: " + '\033[0m\033[94m' + msg + '\033[0m'
7476

7577
def print_info():
7678
print '\033[1m' + ' )\n ) \\\n / ) (\n \(_)/' + '\033[0m'
77-
print '\033[95m\033[1m' + 'FireURL v.0.3 (c) PrankyMat 2015' + '\033[0m'
79+
print '\033[95m\033[1m' + 'FireURL v.0.3.1 (c) PrankyMat 2015' + '\033[0m'
7880
log_info('FireURL is listening on '+str(ip)+':'+str(LISTENPORT)+'. POST a url to fire it!')
7981

8082

0 commit comments

Comments
 (0)