Skip to content

Commit 6b35f13

Browse files
committed
fix: Update metavar in argparse for clarity and consistency
1 parent 617b380 commit 6b35f13

File tree

3 files changed

+35
-31
lines changed

3 files changed

+35
-31
lines changed

Jiyu_udp_attack/__main__.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -78,39 +78,39 @@ def format_usage(self) -> str:
7878
"-f",
7979
"--teacher-ip",
8080
type=str,
81-
metavar="ip",
81+
metavar="<ip>",
8282
default=None,
8383
help="Teacher's IP address",
8484
)
8585
network_config_group.add_argument(
8686
"-fp",
8787
"--teacher-port",
8888
type=int,
89-
metavar="port",
89+
metavar="<port>",
9090
default=None,
9191
help="Teacher's port (default to random port)",
9292
)
9393
network_config_group.add_argument(
9494
"-t",
9595
"--target",
9696
type=str,
97-
metavar="ip",
97+
metavar="<ip>",
9898
required=True,
9999
help="Target IP address",
100100
)
101101
network_config_group.add_argument(
102102
"-tp",
103103
"--target-port",
104104
type=int,
105-
metavar="port",
105+
metavar="<port>",
106106
default=4705,
107107
help="Port to send packets to (default: 4705)",
108108
)
109109
network_config_group.add_argument(
110110
"-i",
111111
"--ip-id",
112112
type=int,
113-
metavar="ip_id",
113+
metavar="<ip_id>",
114114
default=None,
115115
help="IP ID for the packet (default: random ID)",
116116
)
@@ -123,21 +123,21 @@ def format_usage(self) -> str:
123123
"-m",
124124
"--message",
125125
type=str,
126-
metavar="msg",
126+
metavar="<msg>",
127127
help="Message to send",
128128
)
129129
attack_action.add_argument(
130130
"-w",
131131
"--website",
132132
type=str,
133-
metavar="url",
133+
metavar="<url>",
134134
help="Website URL to ask to open",
135135
)
136136
attack_action.add_argument(
137137
"-c",
138138
"--command",
139139
type=str,
140-
metavar="command",
140+
metavar="<command>",
141141
help="Command to execute on the target",
142142
)
143143
temp = attack_action.add_argument(
@@ -147,36 +147,36 @@ def format_usage(self) -> str:
147147
default=None,
148148
action=ModeOptionalAction,
149149
modes=("minimize", "maximize"),
150-
metavar=("program", "args"),
150+
metavar=("<program>", "<args>"),
151151
help="Execute a program with arguments on the target machine",
152152
)
153153
attack_action.add_argument(
154154
"-s",
155155
"--shutdown",
156156
nargs="*",
157157
default=None,
158-
metavar=("timeout", "message"),
158+
metavar=("<timeout>", "<message>"),
159159
help="Shutdown the target machine, optionally with a timeout and message",
160160
)
161161
attack_action.add_argument(
162162
"-r",
163163
"--reboot",
164164
nargs="*",
165165
default=None,
166-
metavar=("timeout", "message"),
166+
metavar=("<timeout>", "<message>"),
167167
help="Reboot the target machine, optionally with a timeout and message",
168168
)
169169
attack_action.add_argument(
170170
"-n",
171171
"--rename",
172172
nargs=2,
173-
metavar=("name", "name_id"),
173+
metavar=("<name>", "<name_id>"),
174174
help="Rename the target machine",
175175
)
176176
attack_action.add_argument(
177177
"--hex",
178178
type=str,
179-
metavar="hex_data",
179+
metavar="<hex_data>",
180180
help="Hexadecimal string to send as a raw packet",
181181
)
182182

README.md

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,12 @@
1919
使用 `python Jiyu_udp_attack -h` 来获取帮助信息:
2020

2121
```
22-
usage: Jiyu_udp_attack [-h] -f ip [-fp port] -t ip [-tp port] [-i ip_id]
23-
(-m msg | -w url | -c command |
24-
-s [timeout [message ...]] |
25-
-r [timeout [message ...]] | -n name name_id |
26-
--hex hex_data)
22+
usage: Jiyu_udp_attack [-h] [-f <ip>] [-fp <port>] -t <ip> [-tp <port>]
23+
[-i <ip_id>] (-m <msg> | -w <url> | -c <command> |
24+
-e <program> [<args> ...] |
25+
-s [<timeout> [<message> ...]] |
26+
-r [<timeout> [<message> ...]] | -n <name> <name_id> |
27+
--hex <hex_data>)
2728
2829
Jiyu Attack Script
2930
@@ -33,30 +34,33 @@ options:
3334
Network Configuration:
3435
Specify the network configuration for the attack.
3536
36-
-f, --teacher-ip ip Teacher's IP address
37-
-fp, --teacher-port port
37+
-f, --teacher-ip <ip>
38+
Teacher's IP address
39+
-fp, --teacher-port <port>
3840
Teacher's port (default to random port)
39-
-t, --target ip Target IP address
40-
-tp, --target-port port
41+
-t, --target <ip> Target IP address
42+
-tp, --target-port <port>
4143
Port to send packets to (default: 4705)
42-
-i, --ip-id ip_id IP ID for the packet (default: random ID)
44+
-i, --ip-id <ip_id> IP ID for the packet (default: random ID)
4345
4446
Attack Action:
4547
Specify the action to perform on the target machine.
4648
47-
-m, --message msg Message to send
48-
-w, --website url Website URL to ask to open
49-
-c, --command command
49+
-m, --message <msg> Message to send
50+
-w, --website <url> Website URL to ask to open
51+
-c, --command <command>
5052
Command to execute on the target
51-
-s, --shutdown [timeout [message ...]]
53+
-e, --execute, --minimize-execute, --maximize-execute <program> [<args> ...]
54+
Execute a program with arguments on the target machine
55+
-s, --shutdown [<timeout> [<message> ...]]
5256
Shutdown the target machine, optionally with a timeout
5357
and message
54-
-r, --reboot [timeout [message ...]]
58+
-r, --reboot [<timeout> [<message> ...]]
5559
Reboot the target machine, optionally with a timeout
5660
and message
57-
-n, --rename name name_id
61+
-n, --rename <name> <name_id>
5862
Rename the target machine
59-
--hex hex_data Hexadecimal string to send as a raw packet
63+
--hex <hex_data> Hexadecimal string to send as a raw packet
6064
6165
Github Repositories: https://github.com/weilycoder/Jiyu_udp_attack/tree/main/
6266
```

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "Jiyu-udp-attack"
3-
version = "0.3.0"
3+
version = "0.4.0"
44
description = "Send packets to student machines disguised as Jiyu teacher machine"
55
authors = [{ name = "weilycoder", email = "[email protected]" }]
66
license = "MIT"

0 commit comments

Comments
 (0)