|
43 | 43 | from nxc.protocols.smb.dpapi import collect_masterkeys_from_target, get_domain_backup_key, upgrade_to_dploot_connection |
44 | 44 | from nxc.protocols.smb.firefox import FirefoxCookie, FirefoxData, FirefoxTriage |
45 | 45 | from nxc.protocols.smb.kerberos import kerberos_login_with_S4U |
46 | | -from nxc.servers.smb import NXCSMBServer |
47 | 46 | from nxc.protocols.smb.wmiexec import WMIEXEC |
48 | 47 | from nxc.protocols.smb.atexec import TSCH_EXEC |
49 | 48 | from nxc.protocols.smb.smbexec import SMBEXEC |
@@ -103,50 +102,6 @@ def get_error_string(exception): |
103 | 102 | else: |
104 | 103 | return str(exception) |
105 | 104 |
|
106 | | - |
107 | | -def requires_smb_server(func): |
108 | | - def _decorator(self, *args, **kwargs): |
109 | | - global smb_server |
110 | | - global smb_share_name |
111 | | - |
112 | | - get_output = False |
113 | | - payload = None |
114 | | - methods = [] |
115 | | - |
116 | | - with contextlib.suppress(IndexError): |
117 | | - payload = args[0] |
118 | | - with contextlib.suppress(IndexError): |
119 | | - get_output = args[1] |
120 | | - with contextlib.suppress(IndexError): |
121 | | - methods = args[2] |
122 | | - |
123 | | - if "payload" in kwargs: |
124 | | - payload = kwargs["payload"] |
125 | | - if "get_output" in kwargs: |
126 | | - get_output = kwargs["get_output"] |
127 | | - if "methods" in kwargs: |
128 | | - methods = kwargs["methods"] |
129 | | - if not payload and self.args.execute and not self.args.no_output: |
130 | | - get_output = True |
131 | | - if (get_output or (methods and ("smbexec" in methods))) and not smb_server: |
132 | | - self.logger.debug("Starting SMB server") |
133 | | - smb_server = NXCSMBServer( |
134 | | - self.nxc_logger, |
135 | | - smb_share_name, |
136 | | - listen_port=self.args.smb_server_port, |
137 | | - verbose=self.args.verbose, |
138 | | - ) |
139 | | - smb_server.start() |
140 | | - |
141 | | - output = func(self, *args, **kwargs) |
142 | | - if smb_server is not None: |
143 | | - smb_server.shutdown() |
144 | | - smb_server = None |
145 | | - return output |
146 | | - |
147 | | - return wraps(func)(_decorator) |
148 | | - |
149 | | - |
150 | 105 | class smb(connection): |
151 | 106 | def __init__(self, args, db, host): |
152 | 107 | self.domain = None |
|
0 commit comments