
PyRat,python xmlrpc로 만든 RAT
PyRat는 python XmlRPC 기반으로 완성된 원격 제어 오픈소스 프로젝트로, 클라이언트와 서버(컨트롤러라고도 하며, 이후 통칭 서버)를 포함합니다.
공지: 프로젝트는 기술 교류용으로만 제공되며, 상업적 또는 불법적인 용도로 사용하지 마십시오. 이로 인해 발생하는 모든 법적 분쟁은 본인과 무관합니다!
클라이언트
> python .\pyratcli.py localhost 80
서버
> python pyratsvr.py 80
--------------------Python RAT-----------------------
--------------------anhkgg---------------------------
--------------------Copyright (c) 2018---------------
软件仅供技术交流,请勿用于商业及非法用途,如产生法律纠纷与本人无关!
--------------------Task command---------------------
--|(l)ist (a)live (k)ill (s)elect (p)rint (c)mdshell (n)ew (d)ownload (r)unexec (u)pload (t)erminate (q)uit (h)elp|--
cmd >
클라이언트가 온라인 상태가 되면 서버가 알림을 표시하고, 가장 최근에 온라인이 된 클라이언트를 기본 작업 대상으로 설정합니다.
cmd >test-3333333 is online.
Auto set target test-3333333
help 또는 h를 입력하면 서버가 지원하는 모든 명령을 확인할 수 있습니다.
cmd >help
(l)ist: list all clients
(a)live: list alive clients
(k)ill: delete client
(s)elect: select target client
(p)rint: show current client
(c)mdshell: create a cmdshell, type q to exit cmdshell
(n)ew: update client version
(d)ownload: let client download a file
(r)unexec: let client run a exe
(u)pload: upload a file to client
(t)erminate:terminate process
(q)uit: quit server
서버는 sqlite를 사용하여 클라이언트 기본 정보 및 작업 정보를 저장하며, 명령을 통해 클라이언트를 관리할 수 있습니다.
//枚举所有客户端
cmd >l
test-3333333 offline 2018-03-20 22:46:59!
id | client_id | version | localip | remoteip | username | osversion | firsttime | lasttime | status
10 | test-3333333 | 0.1.0 | 192.168.149.1 | 114.245.47.12 | test | Windows10.0.16299 | 2018-03-17 12:39:56 | 2018-03-20 22:46:59 | 0
cmd >
//枚举在线客户端
cmd >a
no alive client
//删除客户端数据库记录或者卸载客户端
cmd >k
target cid(or ALL):test-3333333
Do you want to uninstall client?(Y/N)
클라이언트를 제어해야 하는 경우 select 또는 s를 사용하여 작업할 클라이언트 대상을 선택해야 합니다.
cmd >c //想进入cmdshell,提示无目标
Please first set target client by (s)elect command.
cmd >s //设置目标
client_id:test-3333333
Set target client: test-3333333
//查看当前目标
cmd >p
test-3333333
cmdshell 또는 c로 cmdshell에 진입할 수 있으며, 직접 q를 입력하지 않는 한 계속 cmdshell에서 작업 디렉터리를 유지합니다.
cmdshell은 작업 디렉터리를 기록합니다. 예를 들어 cd c:\를 실행하면 다음 작업도 해당 디렉터리에서 수행되어, 파이프 연결과 유사한 cmdshell이 구현됩니다.
또한 cmdshell을 통해 프로세스를 시작하면 일부 프로세스가 메시지 반환을 차단할 수 있으므로 권장하지 않으며, 대신 runexec를 사용하는 것이 좋습니다.
cmd >c
RAT-CMD > dir
RAT-CMD > test-3333333 do cmdshell(195) dir True
驱动器 D 中的卷是 gitrepo
卷的序列号是 EB2F-5AC0
D:\PyRat\client 的目录
2018/02/24 09:40 <DIR> .
2018/02/24 09:40 <DIR> ..
2018/03/20 22:46 4,919 pyratcli.py
2018/03/20 23:01 28 cmd.log
2018/03/17 12:39 1,322 pyratfc.py
2018/03/17 11:19 2,500 osver.py
2018/03/17 12:39 2,161 pyratfc.pyc
5 个文件 10,930 字节
2 个目录 647,836,565,504 可用字节
RAT-CMD > ver
RAT-CMD > test-3333333 do cmdshell(196) ver True
Microsoft Windows [版本 10.0.16299.309]
RAT-CMD > tasklist
RAT-CMD > test-3333333 do cmdshell(197) tasklist True
映像名称 PID 会话名 会话# 内存使用
========================= ======== ================ =========== ============
System Idle Process 0 Services 0 8 K
System 4 Services 0 3,564 K
smss.exe 360 Services 0 412 K
csrss.exe 492 Services 0 1,700 K
Calculator.exe 21656 RDP-Tcp#85 1 56,772 K
RAT-CMD > tasklist |findstr Cal
RAT-CMD > test-3333333 do cmdshell(200) tasklist |findstr Cal True
Calculator.exe 21656 RDP-Tcp#85 1 51,856 K
RAT-CMD > taskkill /IM Calculator.exe
RAT-CMD > test-3333333 do cmdshell(201) taskkill /IM Calculator.exe True
成功: 给进程 "Calculator.exe" 发送了终止信号,进程的 PID 为 21656。
RAT-CMD > taskkill /PID 21656
RAT-CMD > test-3333333 do cmdshell(202) taskkill /PID 21656 True
成功: 给进程发送了终止信号,进程的 PID 为 21656。
파일 업로드와 다운로드를 지원하며, 다운로드의 경우 네트워크 파일과 서버 로컬 파일을 모두 지원합니다. 현재는 단일 파일 업로드 및 다운로드만 지원합니다.
cmd >d
url(type N to download local file):N //选择下载本地文件
local file:db.db
dest path:db.db
cmd >test-3333333 do download(203) local db.db db.db True
download success
cmd >d
url(type N to download local file):https://dl.360safe.com/360/inst.exe //下载网络文件
dest path:inst.exe
cmd >test-3333333 do download(204) net https://dl.360safe.com/360/inst.exe inst.exe True
download success
cmd >r
run target:inst.exe
runexec inst.exe
cmd > t
Select type(name/pid):name
process name:notepad.exe
cmd >test-3333333 do terminate(212) name notepad.exe True
成功: 给进程 "notepad.exe" 发送了终止信号,进程的 PID 为 25416。
클라이언트가 linux에서 실행되고 서버가 windows 플랫폼에서 실행되는 경우, 두 플랫폼이 사용하는 인코딩이 다르기 때문에 중국어가 깨질 수 있습니다. 현재는 별도로 처리하지 않았습니다.
