Skip to content

Commit 217adf3

Browse files
committed
add clipboard delay
1 parent 472be5a commit 217adf3

2 files changed

Lines changed: 3 additions & 11 deletions

File tree

nxc/protocols/rdp.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ async def execute_shell(self, payload, get_output, shell_type):
427427
await asyncio.sleep(self.args.cmd_delay)
428428

429429
timeout_counter = 0
430-
while not clipboard_ready and timeout_counter < 300: # 30 second timeout
430+
while not clipboard_ready and timeout_counter < (self.args.clipboard_delay * 10): # Convert seconds to deciseconds
431431
try:
432432
data = await asyncio.wait_for(self.conn.ext_out_queue.get(), timeout=0.1)
433433
if hasattr(data, "type") and data.type.name == "CLIPBOARD_READY":
@@ -568,16 +568,7 @@ async def screen(self):
568568
buffer.save(filename, "png")
569569
self.logger.highlight(f"Screenshot saved {filename}")
570570

571-
def screenshot(self):
572-
# Don't take screenshot if we're already taking one during command execution
573-
if hasattr(self.args, "execute") and self.args.execute is not None:
574-
self.logger.debug("Skipping generic screenshot as -x is specified with --screenshot")
575-
return
576-
577-
if hasattr(self.args, "ps_execute") and self.args.ps_execute is not None:
578-
self.logger.debug("Skipping generic screenshot as -X is specified with --screenshot")
579-
return
580-
571+
def screenshot(self):
581572
asyncio.run(self.screen())
582573

583574
async def nla_screen(self):

nxc/protocols/rdp/proto_args.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ def proto_args(parser, parents):
2121
cgroup.add_argument("-x", metavar="COMMAND", dest="execute", help="execute the specified command")
2222
cgroup.add_argument("-X", metavar="PS_COMMAND", dest="ps_execute", help="execute the specified PowerShell command")
2323
cgroup.add_argument("--cmd-delay", type=int, default=3, help="Sleep time before executing command")
24+
cgroup.add_argument("--clipboard-delay", type=int, default=30, help="Maximum time to wait for clipboard initialization (seconds)")
2425
cgroup.add_argument("--no-output", action="store_true", help="do not retrieve command output")
2526

2627
return parser

0 commit comments

Comments
 (0)