Working http and https clients on non standard ports
parent
68cdc2c90c
commit
8524c3717e
|
@ -14,6 +14,10 @@ class Client:
|
||||||
self.data_to_transmit = ''
|
self.data_to_transmit = ''
|
||||||
self.remote_server = cli_object.ip
|
self.remote_server = cli_object.ip
|
||||||
self.protocol = "http"
|
self.protocol = "http"
|
||||||
|
if cli_object.client_port is None:
|
||||||
|
self.port = 80
|
||||||
|
else:
|
||||||
|
self.port = cli_object.client_port
|
||||||
if cli_object.file is None:
|
if cli_object.file is None:
|
||||||
self.file_transfer = False
|
self.file_transfer = False
|
||||||
else:
|
else:
|
||||||
|
@ -25,7 +29,7 @@ class Client:
|
||||||
def transmit(self, data_to_transmit):
|
def transmit(self, data_to_transmit):
|
||||||
|
|
||||||
if not self.file_transfer:
|
if not self.file_transfer:
|
||||||
url = "http://" + self.remote_server + ":" + self.port + "/post_data.php"
|
url = "http://" + self.remote_server + ":" + str(self.port) + "/post_data.php"
|
||||||
|
|
||||||
# Post the data to the web server at the specified URL
|
# Post the data to the web server at the specified URL
|
||||||
try:
|
try:
|
||||||
|
@ -37,7 +41,7 @@ class Client:
|
||||||
print "[*] Error: Please check server to make sure it is active!"
|
print "[*] Error: Please check server to make sure it is active!"
|
||||||
sys.exit()
|
sys.exit()
|
||||||
else:
|
else:
|
||||||
url = "http://" + self.remote_server + "/post_file.php"
|
url = "http://" + self.remote_server + ":" + str(self.port) + "/post_file.php"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
data_to_transmit = self.file_transfer + ".:::-989-:::." + data_to_transmit
|
data_to_transmit = self.file_transfer + ".:::-989-:::." + data_to_transmit
|
||||||
|
|
|
@ -4,6 +4,7 @@ This is the web client code
|
||||||
|
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
import ssl
|
||||||
import sys
|
import sys
|
||||||
import urllib2
|
import urllib2
|
||||||
|
|
||||||
|
@ -14,6 +15,10 @@ class Client:
|
||||||
self.data_to_transmit = ''
|
self.data_to_transmit = ''
|
||||||
self.remote_server = cli_object.ip
|
self.remote_server = cli_object.ip
|
||||||
self.protocol = "https"
|
self.protocol = "https"
|
||||||
|
if cli_object.client_port is None:
|
||||||
|
self.port = 443
|
||||||
|
else:
|
||||||
|
self.port = cli_object.client_port
|
||||||
if cli_object.file is None:
|
if cli_object.file is None:
|
||||||
self.file_transfer = False
|
self.file_transfer = False
|
||||||
else:
|
else:
|
||||||
|
@ -23,8 +28,10 @@ class Client:
|
||||||
self.file_transfer = cli_object.file
|
self.file_transfer = cli_object.file
|
||||||
|
|
||||||
def transmit(self, data_to_transmit):
|
def transmit(self, data_to_transmit):
|
||||||
|
|
||||||
|
ssl._create_default_https_context = ssl._create_unverified_context
|
||||||
if not self.file_transfer:
|
if not self.file_transfer:
|
||||||
url = "https://" + self.remote_server + ":" + self.port + "/post_data.php"
|
url = "https://" + self.remote_server + ":" + str(self.port) + "/post_data.php"
|
||||||
|
|
||||||
# Post the data to the web server at the specified URL
|
# Post the data to the web server at the specified URL
|
||||||
try:
|
try:
|
||||||
|
@ -36,7 +43,7 @@ class Client:
|
||||||
print "[*] Error: Please check server to make sure it is active!"
|
print "[*] Error: Please check server to make sure it is active!"
|
||||||
sys.exit()
|
sys.exit()
|
||||||
else:
|
else:
|
||||||
url = "https://" + self.remote_server + "/post_file.php"
|
url = "https://" + self.remote_server + ":" + str(self.port) + "/post_file.php"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
data_to_transmit = self.file_transfer + ".:::-989-:::." + data_to_transmit
|
data_to_transmit = self.file_transfer + ".:::-989-:::." + data_to_transmit
|
||||||
|
|
Loading…
Reference in New Issue