Skip to content

Commit

Permalink
Add log message and use NXC_PATH var
Browse files Browse the repository at this point in the history
  • Loading branch information
NeffIsBack committed Dec 10, 2024
1 parent 8a55f22 commit 55c4cfd
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions nxc/protocols/rdp.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
from asyauth.common.constants import asyauthSecret
from asysocks.unicomm.common.target import UniTarget, UniProto

from nxc.paths import NXC_PATH


class rdp(connection):
def __init__(self, args, db, host):
Expand Down Expand Up @@ -166,6 +168,7 @@ def create_conn_obj(self):
return True

def check_nla(self):
self.logger.debug(f"Checking NLA for {self.host}")
for proto in self.protoflags_nla:
try:
self.iosettings.supported_protocols = proto
Expand Down Expand Up @@ -381,13 +384,14 @@ async def nla_screen(self):
self.conn = RDPConnection(iosettings=self.iosettings, target=self.target, credentials=self.auth)

await self.connect_rdp()
except Exception:
except Exception as e:
self.logger.debug(f"Failed to connect for nla_screenshot with {proto} {e}")
return

await asyncio.sleep(int(self.args.screentime))
if self.conn is not None and self.conn.desktop_buffer_has_data is True:
buffer = self.conn.get_desktop_buffer(VIDEO_FORMAT.PIL)
filename = os.path.expanduser(f"~/.nxc/screenshots/{self.hostname}_{self.host}_{datetime.now().strftime('%Y-%m-%d_%H%M%S')}.png")
filename = os.path.expanduser(f"{NXC_PATH}/screenshots/{self.hostname}_{self.host}_{datetime.now().strftime('%Y-%m-%d_%H%M%S')}.png")
buffer.save(filename, "png")
self.logger.highlight(f"NLA Screenshot saved {filename}")
return
Expand Down

0 comments on commit 55c4cfd

Please sign in to comment.