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


Python smbserver.SimpleSMBServer方法代碼示例

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


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

示例1: __init__

# 需要導入模塊: from impacket import smbserver [as 別名]
# 或者: from impacket.smbserver import SimpleSMBServer [as 別名]
def __init__(self, logger, share_name, share_path='/tmp/cme_hosted', listen_address='0.0.0.0', listen_port=445, verbose=False):
        try:
            threading.Thread.__init__(self)

            self.server = smbserver.SimpleSMBServer(listen_address, listen_port)
            self.server.addShare(share_name.upper(), share_path)
            if verbose: self.server.setLogFile('')
            self.server.setSMB2Support(True)
            self.server.setSMBChallenge('')
        except Exception as e:
            errno, message = e.args
            if errno == 98 and message == 'Address already in use':
                logger.error('Error starting SMB server on port 445: the port is already in use')
            else:
                logger.error('Error starting SMB server on port 445: {}'.format(message))
                exit(1) 
開發者ID:byt3bl33d3r,項目名稱:CrackMapExec,代碼行數:18,代碼來源:smb.py

示例2: __init__

# 需要導入模塊: from impacket import smbserver [as 別名]
# 或者: from impacket.smbserver import SimpleSMBServer [as 別名]
def __init__(self):
        # Setup logging
        handler = logging.StreamHandler(Logger())
        logging.getLogger().addHandler(handler)
        logging.getLogger().setLevel(logging.DEBUG)

        # Create a new SMB server
        server = smbserver.SimpleSMBServer()
        
        # Support SMBv2
        server.setSMB2Support(True)
        
        ## Set a random SMB challenge
        #challenge = ''.join(random.choice(string.digits) for i in range(16))
        #server.setSMBChallenge(challenge)
        
        # Log SMB traffic to console
        server.setLogFile('')
        
        # Start the server
        server.start() 
開發者ID:tatanus,項目名稱:SPF,代碼行數:23,代碼來源:smbsrv.py

示例3: smb_server

# 需要導入模塊: from impacket import smbserver [as 別名]
# 或者: from impacket.smbserver import SimpleSMBServer [as 別名]
def smb_server(lip):
    server = smbserver.SimpleSMBServer(listenAddress=lip, listenPort=445)
    server.addShare('LOLWAT', '.', '')
    server.setSMBChallenge('')
    server.setLogFile('/dev/null')
    server.start()

##
# Converts a normal string to a utf 16 with a length field.
# @param s the string to convert
## 
開發者ID:tenable,項目名稱:poc,代碼行數:13,代碼來源:cmd_66_exploit.py

示例4: smb_server

# 需要導入模塊: from impacket import smbserver [as 別名]
# 或者: from impacket.smbserver import SimpleSMBServer [as 別名]
def smb_server(lip):
    server = smbserver.SimpleSMBServer(listenAddress=lip, listenPort=445)
    server.addShare('00000000', '.', '')
    server.setSMBChallenge('')
    server.setLogFile('/dev/null')
    server.start() 
開發者ID:tenable,項目名稱:poc,代碼行數:8,代碼來源:kodi_attack.py

示例5: __init__

# 需要導入模塊: from impacket import smbserver [as 別名]
# 或者: from impacket.smbserver import SimpleSMBServer [as 別名]
def __init__(self, interface_address, port):
        Thread.__init__(self)
        self.smbserver = smbserver.SimpleSMBServer(listenAddress = interface_address, listenPort = int(port))
        self.smbserver.addShare(PSUTIL_SHARE, PSUTIL_DIR, shareComment='P0w3r$he11')
        self.smbserver.setSMB2Support(True) 
開發者ID:ShawnDEvans,項目名稱:smbmap,代碼行數:7,代碼來源:smbmap.py

示例6: start_smb_server

# 需要導入模塊: from impacket import smbserver [as 別名]
# 或者: from impacket.smbserver import SimpleSMBServer [as 別名]
def start_smb_server(self):
        try:
            serverThread = SimpleSMBServer('0.0.0.0', 445)
            serverThread.daemon = True
            serverThread.start()
        except:
            print('[!] Run as r00t, or maybe something is using port 445...')
            sys.exit() 
開發者ID:ShawnDEvans,項目名稱:smbmap,代碼行數:10,代碼來源:smbmap.py

示例7: __init__

# 需要導入模塊: from impacket import smbserver [as 別名]
# 或者: from impacket.smbserver import SimpleSMBServer [as 別名]
def __init__(self, logger, share_name, share_path='/tmp/.ar3', share_comment = '', username= '', password='', listen_address='0.0.0.0', listen_port=445, verbose=False):
        self.running = True
        self._smb2support = False
        self._share_path = share_path

        try:
            threading.Thread.__init__(self)

            # If suggested share_path not exist, create
            if not os.path.exists(share_path):
                os.makedirs(share_path)

            # Setup SMB Server
            self.server = smbserver.SimpleSMBServer(listen_address, int(listen_port))
            self.server.addShare(share_name, share_path, share_comment)
            if verbose:
                self.server.setLogFile('')
            self.server.setSMB2Support(self._smb2support)
            self.server.setSMBChallenge('')

            if username:
                if password:
                    lmhash = compute_lmhash(password)
                    nthash = compute_nthash(password)
                self.server.addCredential(username, 0, lmhash, nthash)

        except Exception as e:
            errno, message = e.args
            if errno == 98 and message == 'Address already in use':
                logger.fail('Error starting SMB server on port 445: the port is already in use')
            else:
                logger.fail('Error starting SMB server on port 445: {}'.format(message))
                exit(1) 
開發者ID:m8r0wn,項目名稱:ActiveReign,代碼行數:35,代碼來源:smb.py


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