mirror of
https://github.com/swisskyrepo/PayloadsAllTheThings.git
synced 2024-12-04 18:40:41 +00:00
Use print() function in both Python 2 and Python 3
Legacy __print__ statements are syntax errors in Python 3 but __print()__ function works as expected in both Python 2 and Python 3.
This commit is contained in:
parent
bd861e304f
commit
a458cb397d
1 changed files with 6 additions and 5 deletions
|
@ -1,4 +1,5 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
from __future__ import print_function
|
||||||
import socket,ssl
|
import socket,ssl
|
||||||
from BaseHTTPServer import BaseHTTPRequestHandler,HTTPServer
|
from BaseHTTPServer import BaseHTTPRequestHandler,HTTPServer
|
||||||
from websocket import create_connection, WebSocket
|
from websocket import create_connection, WebSocket
|
||||||
|
@ -9,7 +10,7 @@ import os
|
||||||
LOOP_BACK_PORT_NUMBER = 8000
|
LOOP_BACK_PORT_NUMBER = 8000
|
||||||
|
|
||||||
def FuzzWebSocket(fuzz_value):
|
def FuzzWebSocket(fuzz_value):
|
||||||
print fuzz_value
|
print(fuzz_value)
|
||||||
ws.send(ws_message.replace("[FUZZ]", str(fuzz_value[0])))
|
ws.send(ws_message.replace("[FUZZ]", str(fuzz_value[0])))
|
||||||
result = ws.recv()
|
result = ws.recv()
|
||||||
return result
|
return result
|
||||||
|
@ -22,7 +23,7 @@ def LoadMessage(file):
|
||||||
file_contents = f.read()
|
file_contents = f.read()
|
||||||
f.close()
|
f.close()
|
||||||
except:
|
except:
|
||||||
print ("Error reading file: %s" % file)
|
print("Error reading file: %s" % file)
|
||||||
exit()
|
exit()
|
||||||
return file_contents
|
return file_contents
|
||||||
|
|
||||||
|
@ -52,12 +53,12 @@ try:
|
||||||
#Create a web server and define the handler to manage the
|
#Create a web server and define the handler to manage the
|
||||||
#incoming request
|
#incoming request
|
||||||
server = HTTPServer(('', LOOP_BACK_PORT_NUMBER), myWebServer)
|
server = HTTPServer(('', LOOP_BACK_PORT_NUMBER), myWebServer)
|
||||||
print 'Started httpserver on port ' , LOOP_BACK_PORT_NUMBER
|
print('Started httpserver on port ' , LOOP_BACK_PORT_NUMBER)
|
||||||
|
|
||||||
#Wait forever for incoming http requests
|
#Wait forever for incoming http requests
|
||||||
server.serve_forever()
|
server.serve_forever()
|
||||||
|
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print '^C received, shutting down the web server'
|
print('^C received, shutting down the web server')
|
||||||
server.socket.close()
|
server.socket.close()
|
||||||
ws.close()
|
ws.close()
|
||||||
|
|
Loading…
Reference in a new issue