Python impacket.dcerpc.v5.tsch.hSchRpcDelete() Examples
The following are 8
code examples of impacket.dcerpc.v5.tsch.hSchRpcDelete().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
impacket.dcerpc.v5.tsch
, or try the search function
.
Example #1
Source File: taskexe.py From lsassy with MIT License | 6 votes |
def execute(self, commands): dce = self._rpctransport.get_dce_rpc() dce.set_credentials(*self._rpctransport.get_credentials()) if self._conn.kerberos: dce.set_auth_type(RPC_C_AUTHN_GSS_NEGOTIATE) dce.connect() dce.bind(tsch.MSRPC_UUID_TSCHS) xml = self.gen_xml(commands) tmpName = ''.join(random.choice(string.ascii_letters + string.digits) for _ in range(8)) self._log.debug("Register random task {}".format(tmpName)) tsch.hSchRpcRegisterTask(dce, '\\%s' % tmpName, xml, tsch.TASK_CREATE, NULL, tsch.TASK_LOGON_NONE) tsch.hSchRpcRun(dce, '\\%s' % tmpName) done = False while not done: resp = tsch.hSchRpcGetLastRunInfo(dce, '\\%s' % tmpName) if resp['pLastRuntime']['wYear'] != 0: done = True else: time.sleep(2) time.sleep(3) tsch.hSchRpcDelete(dce, '\\%s' % tmpName) dce.disconnect()
Example #2
Source File: test_tsch.py From Slackor with GNU General Public License v3.0 | 6 votes |
def test_SchRpcRename(self): dce, rpctransport = self.connect(self.stringBindingAtSvc, tsch.MSRPC_UUID_TSCHS) resp = tsch.hSchRpcCreateFolder(dce, '\\Beto') resp.dump() request = tsch.SchRpcRename() request['path'] = '\\Beto\x00' request['newName'] = '\\Anita\x00' request['flags'] = 0 try: resp = dce.request(request) resp.dump() except Exception as e: if str(e).find('E_NOTIMPL') <= 0: raise pass resp = tsch.hSchRpcDelete(dce, '\\Beto') resp.dump()
Example #3
Source File: test_tsch.py From Slackor with GNU General Public License v3.0 | 6 votes |
def test_hSchRpcRename(self): dce, rpctransport = self.connect(self.stringBindingAtSvc, tsch.MSRPC_UUID_TSCHS) resp = tsch.hSchRpcCreateFolder(dce, '\\Beto') resp.dump() try: resp = tsch.hSchRpcRename(dce, '\\Beto', '\\Anita') resp.dump() except Exception as e: if str(e).find('E_NOTIMPL') <= 0: raise pass resp = tsch.hSchRpcDelete(dce, '\\Beto') resp.dump()
Example #4
Source File: test_tsch.py From CVE-2017-7494 with GNU General Public License v3.0 | 5 votes |
def test_hSchRpcCreateFolder_hSchRpcEnumFolders_hSchRpcDelete(self): dce, rpctransport = self.connect(self.stringBindingAtSvc, tsch.MSRPC_UUID_TSCHS) resp = tsch.hSchRpcCreateFolder(dce, '\\Beto') resp.dump() resp = tsch.hSchRpcEnumFolders(dce, '\\') resp.dump() resp = tsch.hSchRpcDelete(dce, '\\Beto') resp.dump()
Example #5
Source File: test_tsch.py From cracke-dit with MIT License | 5 votes |
def test_hSchRpcCreateFolder_hSchRpcEnumFolders_hSchRpcDelete(self): dce, rpctransport = self.connect(self.stringBindingAtSvc, tsch.MSRPC_UUID_TSCHS) resp = tsch.hSchRpcCreateFolder(dce, '\\Beto') resp.dump() resp = tsch.hSchRpcEnumFolders(dce, '\\') resp.dump() resp = tsch.hSchRpcDelete(dce, '\\Beto') resp.dump()
Example #6
Source File: test_tsch.py From Slackor with GNU General Public License v3.0 | 5 votes |
def test_hSchRpcCreateFolder_hSchRpcEnumFolders_hSchRpcDelete(self): dce, rpctransport = self.connect(self.stringBindingAtSvc, tsch.MSRPC_UUID_TSCHS) resp = tsch.hSchRpcCreateFolder(dce, '\\Beto') resp.dump() resp = tsch.hSchRpcEnumFolders(dce, '\\') resp.dump() resp = tsch.hSchRpcDelete(dce, '\\Beto') resp.dump()
Example #7
Source File: test_tsch.py From PiBunny with MIT License | 5 votes |
def test_hSchRpcCreateFolder_hSchRpcEnumFolders_hSchRpcDelete(self): dce, rpctransport = self.connect(self.stringBindingAtSvc, tsch.MSRPC_UUID_TSCHS) resp = tsch.hSchRpcCreateFolder(dce, '\\Beto') resp.dump() resp = tsch.hSchRpcEnumFolders(dce, '\\') resp.dump() resp = tsch.hSchRpcDelete(dce, '\\Beto') resp.dump()
Example #8
Source File: atexec.py From ActiveReign with GNU General Public License v3.0 | 4 votes |
def doStuff(self, command): dce = self.__rpctransport.get_dce_rpc() dce.set_credentials(*self.__rpctransport.get_credentials()) dce.connect() #dce.set_auth_level(ntlm.NTLM_AUTH_PKT_PRIVACY) dce.bind(tsch.MSRPC_UUID_TSCHS) tmpName = gen_random_string(8) tmpFileName = tmpName + '.tmp' xml = self.gen_xml(command) taskCreated = False self.logger.debug('Creating task \\{}'.format(tmpName)) tsch.hSchRpcRegisterTask(dce, '\\{}'.format(tmpName), xml, tsch.TASK_CREATE, NULL, tsch.TASK_LOGON_NONE) taskCreated = True self.logger.debug('Running task \\{}'.format(tmpName)) tsch.hSchRpcRun(dce, '\\{}'.format(tmpName)) done = False while not done: self.logger.debug('Calling SchRpcGetLastRunInfo for \\{}'.format(tmpName)) resp = tsch.hSchRpcGetLastRunInfo(dce, '\\{}'.format(tmpName)) if resp['pLastRuntime']['wYear'] != 0: done = True else: sleep(2) self.logger.debug('Deleting task \\{}'.format(tmpName)) tsch.hSchRpcDelete(dce, '\\{}'.format(tmpName)) taskCreated = False if taskCreated is True: tsch.hSchRpcDelete(dce, '\\{}'.format(tmpName)) # Get output if self.noOutput: self.__outputBuffer = "Command executed with no output" elif self.fileless_output: self.get_output_fileless() else: self.get_output() dce.disconnect()