當前位置: 首頁>>代碼示例>>Python>>正文


Python srvs.hNetrShareEnum方法代碼示例

本文整理匯總了Python中impacket.dcerpc.v5.srvs.hNetrShareEnum方法的典型用法代碼示例。如果您正苦於以下問題:Python srvs.hNetrShareEnum方法的具體用法?Python srvs.hNetrShareEnum怎麽用?Python srvs.hNetrShareEnum使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在impacket.dcerpc.v5.srvs的用法示例。


在下文中一共展示了srvs.hNetrShareEnum方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: getShares

# 需要導入模塊: from impacket.dcerpc.v5 import srvs [as 別名]
# 或者: from impacket.dcerpc.v5.srvs import hNetrShareEnum [as 別名]
def getShares(self):
        # Setup up a DCE SMBTransport with the connection already in place
        LOG.info("Requesting shares on %s....." % (self.connection.getRemoteHost()))
        try: 
            self._rpctransport = transport.SMBTransport(self.connection.getRemoteHost(),
                                                        self.connection.getRemoteHost(),filename = r'\srvsvc',
                                                        smb_connection = self.connection)
            dce_srvs = self._rpctransport.get_dce_rpc()
            dce_srvs.connect()

            dce_srvs.bind(srvs.MSRPC_UUID_SRVS)
            resp = srvs.hNetrShareEnum(dce_srvs, 1)
            return resp['InfoStruct']['ShareInfo']['Level1']
        except:
            LOG.critical("Error requesting shares on %s, aborting....." % (self.connection.getRemoteHost()))
            raise 
開發者ID:eth0izzle,項目名稱:cracke-dit,代碼行數:18,代碼來源:serviceinstall.py

示例2: test_hNetrShareEnum

# 需要導入模塊: from impacket.dcerpc.v5 import srvs [as 別名]
# 或者: from impacket.dcerpc.v5.srvs import hNetrShareEnum [as 別名]
def test_hNetrShareEnum(self):
        dce, rpctransport = self.connect()
        resp = srvs.hNetrShareEnum(dce, 0)
        resp.dump()

        resp = srvs.hNetrShareEnum(dce, 1)
        resp.dump()

        resp = srvs.hNetrShareEnum(dce, 2)
        resp.dump()

        resp = srvs.hNetrShareEnum(dce, 501)
        resp.dump()

        resp = srvs.hNetrShareEnum(dce, 502)
        resp.dump()

        resp = srvs.hNetrShareEnum(dce, 503)
        resp.dump() 
開發者ID:joxeankoret,項目名稱:CVE-2017-7494,代碼行數:21,代碼來源:test_srvs.py

示例3: getShares

# 需要導入模塊: from impacket.dcerpc.v5 import srvs [as 別名]
# 或者: from impacket.dcerpc.v5.srvs import hNetrShareEnum [as 別名]
def getShares(self):
        # Setup up a DCE SMBTransport with the connection already in place
        LOG.info("Requesting shares on %s....." % (self.connection.getRemoteHost()))
        try: 
            self._rpctransport = transport.SMBTransport(self.connection.getRemoteHost(), self.connection.getRemoteHost(),filename = r'\srvsvc', smb_connection = self.connection)
            dce_srvs = self._rpctransport.get_dce_rpc()
            dce_srvs.connect()

            dce_srvs.bind(srvs.MSRPC_UUID_SRVS)
            resp = srvs.hNetrShareEnum(dce_srvs, 1)
            return resp['InfoStruct']['ShareInfo']['Level1']
        except:
            LOG.critical("Error requesting shares on %s, aborting....." % (self.connection.getRemoteHost()))
            raise 
開發者ID:joxeankoret,項目名稱:CVE-2017-7494,代碼行數:16,代碼來源:serviceinstall.py

示例4: listShares

# 需要導入模塊: from impacket.dcerpc.v5 import srvs [as 別名]
# 或者: from impacket.dcerpc.v5.srvs import hNetrShareEnum [as 別名]
def listShares(self):
        """
        get a list of available shares at the connected target

        :return: a list containing dict entries for each share, raises exception if error
        """
        # Get the shares through RPC
        from impacket.dcerpc.v5 import transport, srvs
        rpctransport = transport.SMBTransport(self.getRemoteName(), self.getRemoteHost(), filename=r'\srvsvc',
                                              smb_connection=self)
        dce = rpctransport.get_dce_rpc()
        dce.connect()
        dce.bind(srvs.MSRPC_UUID_SRVS)
        resp = srvs.hNetrShareEnum(dce, 1)
        return resp['InfoStruct']['ShareInfo']['Level1']['Buffer'] 
開發者ID:joxeankoret,項目名稱:CVE-2017-7494,代碼行數:17,代碼來源:smbconnection.py

示例5: try_copy_library

# 需要導入模塊: from impacket.dcerpc.v5 import srvs [as 別名]
# 或者: from impacket.dcerpc.v5.srvs import hNetrShareEnum [as 別名]
def try_copy_library(self, lib_name):
    rpctransport = transport.SMBTransport(self.smb.getRemoteName(), self.smb.getRemoteHost(),
                                          filename=r'\srvsvc', smb_connection=self.smb)
    dce = rpctransport.get_dce_rpc()
    dce.connect()
    dce.bind(srvs.MSRPC_UUID_SRVS)
    resp = srvs.hNetrShareEnum(dce, 2)

    l = []
    ignore_shares = ["print$", "IPC$"]
    for share in resp['InfoStruct']['ShareInfo']['Level2']['Buffer']:
      share_name = share['shi2_netname'][:-1]
      share_path = self.translate_smb_path(share['shi2_path'][:-1])
      l.append([share_name, share_path])

    # Randomize the list of shares instead of going from the first to the last
    random.shuffle(l)
    
    if len(self.customBinary) < 1:
      real_file = self.get_real_library_name()
    else:
      real_file = self.customBinary
    
    log("Using  %s" % real_file)
    for share in l:
      log("Trying to copy library '%s' to share '%s'" % (lib_name, share))
      if self.try_put(share, lib_name, real_file):
        log("Done!")
        return share[1]

    return None 
開發者ID:joxeankoret,項目名稱:CVE-2017-7494,代碼行數:33,代碼來源:cve_2017_7494.py

示例6: get_netshare

# 需要導入模塊: from impacket.dcerpc.v5 import srvs [as 別名]
# 或者: from impacket.dcerpc.v5.srvs import hNetrShareEnum [as 別名]
def get_netshare(self):

        resp = srvs.hNetrShareEnum(self._rpc_connection, 1)

        results = list()
        for share in resp['InfoStruct']['ShareInfo']['Level1']['Buffer']:
            results.append(rpcobj.Share(share))

        return results 
開發者ID:the-useless-one,項目名稱:pywerview,代碼行數:11,代碼來源:net.py

示例7: findSuitableShare

# 需要導入模塊: from impacket.dcerpc.v5 import srvs [as 別名]
# 或者: from impacket.dcerpc.v5.srvs import hNetrShareEnum [as 別名]
def findSuitableShare(self):
        from impacket.dcerpc.v5 import transport, srvs
        rpctransport = transport.SMBTransport(self.__smbClient.getRemoteName(), self.__smbClient.getRemoteHost(),
                                              filename=r'\srvsvc', smb_connection=self.__smbClient)
        dce = rpctransport.get_dce_rpc()
        dce.connect()
        dce.bind(srvs.MSRPC_UUID_SRVS)
        resp = srvs.hNetrShareEnum(dce, 2)
        for share in resp['InfoStruct']['ShareInfo']['Level2']['Buffer']:
            if self.isShareWritable(share['shi2_netname'][:-1]):
                sharePath = share['shi2_path'].split(':')[-1:][0][:-1]
                return share['shi2_netname'][:-1], sharePath

        raise Exception('No suitable share found, aborting!') 
開發者ID:Coalfire-Research,項目名稱:Slackor,代碼行數:16,代碼來源:sambaPipe.py


注:本文中的impacket.dcerpc.v5.srvs.hNetrShareEnum方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。