async def from_smbconnection(connection: SMBConnection, auth_level=None, open: bool = True, perform_dummy: bool = False): """ Creates the connection to the service using an established SMBConnection. This connection will use the given SMBConnection as transport layer. """ try: if auth_level is None: #for SMB connection no extra auth needed auth_level = RPC_C_AUTHN_LEVEL_NONE rpctransport = SMBDCEFactory(connection, filename=SRVSRPC().service_pipename) service, err = await SRVSRPC.from_rpcconnection( rpctransport.get_dce_rpc(), auth_level=auth_level, open=open, perform_dummy=perform_dummy) if err is not None: raise err return service, None except Exception as e: return None, e
async def connect(self, open = True): rpctransport = SMBDCEFactory(self.connection, filename=r'\srvsvc') self.dce = rpctransport.get_dce_rpc() await rr(self.dce.connect()) await rr(self.dce.bind(srvs.MSRPC_UUID_SRVS)) return True,None
async def connect(self, open=True): rpctransport = SMBDCEFactory(self.connection, filename=r'\atsvc') self.dce = rpctransport.get_dce_rpc() self.dce.set_auth_level(RPC_C_AUTHN_LEVEL_CONNECT) await rr(self.dce.connect()) await rr(self.dce.bind(tsch.MSRPC_UUID_TSCHS)) return True, None
async def connect(self, open=False): rpctransport = SMBDCEFactory(self.connection, filename=r'\winreg') self.dce = rpctransport.get_dce_rpc() await rr(self.dce.connect()) await rr(self.dce.bind(rrp.MSRPC_UUID_RRP)) if open == True: await rr(self.open()) return True, None
async def connect(self, open = True): rpctransport = SMBDCEFactory(self.connection, filename=r'\samr') self.dce = rpctransport.get_dce_rpc() await rr(self.dce.connect()) await rr(self.dce.bind(samr.MSRPC_UUID_SAMR)) if open == True: await rr(self.open()) return True,None
async def connect(self, open=True): rpctransport = SMBDCEFactory(self.connection, filename=r'\protected_storage') self.dce = rpctransport.get_dce_rpc() self.dce.set_auth_level(RPC_C_AUTHN_LEVEL_PKT_PRIVACY) _, err = await self.dce.connect() if err is not None: return False, err _, err = await self.dce.bind(bkrp.MSRPC_UUID_BKRP) if err is not None: return False, err return True, None
async def connect(self): try: rpctransport = SMBDCEFactory(self.connection, filename=r'\winreg') self.dce = rpctransport.get_dce_rpc() _, err = await self.dce.connect() if err is not None: raise err _, err = await self.dce.bind(rrp.MSRPC_UUID_RRP) if err is not None: raise err return True, None except Exception as e: return None, e
async def connect(self, open=True): rpctransport = SMBDCEFactory(self.connection, filename=r'\svcctl') self.dce = rpctransport.get_dce_rpc() _, err = await self.dce.connect() if err is not None: return False, err _, err = await self.dce.bind(scmr.MSRPC_UUID_SCMR) if err is not None: return False, err if open == True: _, err = await self.open() if err is not None: return False, err return True, None