data_to_forward = Helper().Parse(command)
                        Helper.send_msg(connection, data_to_forward)

                        data_from_implant = Helper.recv_msg(connection)

                        if command == 'exec admin/ls::':
                            dir_entry = []
                            for line in data_from_implant.split(';;;;'):
                                try:
                                    buffer_row = []
                                    name, typ, siz, lastmodify = line.split(
                                        '::')
                                    buffer_row.append(name)
                                    buffer_row.append(typ)
                                    buffer_row.append(
                                        tools.sizeof_fmt(int(siz)))
                                    buffer_row.append(lastmodify)
                                    dir_entry.append(buffer_row)
                                except ValueError:
                                    pass
                            data_from_implant = "\n" + color.ReturnTabulate(
                                dir_entry,
                                ['Name', 'Type', 'Size', 'Last Modify'],
                                "simple") + "\n"
                        elif command == 'exec admin/ps::':
                            ps_entry = []
                            for proc in data_from_implant.split(':::::'):
                                try:
                                    buffer_row = []
                                    name, pid, path = proc.split('###')
                                    buffer_row.append(name)
Exemple #2
0
 def getFileSize(fname):
     return tools.sizeof_fmt(os.path.getsize(fname))
                                Helper.recv_msg(connection)
                                continue
                        data_to_forward = Helper().Parse(command)
                        Helper.send_msg(connection, data_to_forward)

                        data_from_implant = Helper.recv_msg(connection)

                        if command == 'exec admin/ls::':
                            dir_entry = []
                            for line in data_from_implant.split(';;;;'):
                                try:
                                    buffer_row = []
                                    name, typ, siz, lastmodify = line.split('::')
                                    buffer_row.append(name)
                                    buffer_row.append(typ)
                                    buffer_row.append(tools.sizeof_fmt(int(siz)))
                                    buffer_row.append(lastmodify)
                                    dir_entry.append(buffer_row)
                                except ValueError:
                                    pass
                            data_from_implant = "\n" + color.ReturnTabulate(dir_entry,
                                                                            ['Name', 'Type', 'Size', 'Last Modify'],
                                                                            "simple") + "\n"
                        elif command == 'exec admin/ps::':
                            ps_entry = []
                            for proc in data_from_implant.split(':::::'):
                                try:
                                    buffer_row = []
                                    name, pid, path = proc.split('###')
                                    buffer_row.append(name)
                                    buffer_row.append(pid)