当前位置: 首页>>代码示例>>Python>>正文


Python SMBConnection.SMBConnection方法代码示例

本文整理汇总了Python中smb.SMBConnection.SMBConnection方法的典型用法代码示例。如果您正苦于以下问题:Python SMBConnection.SMBConnection方法的具体用法?Python SMBConnection.SMBConnection怎么用?Python SMBConnection.SMBConnection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在smb.SMBConnection的用法示例。


在下文中一共展示了SMBConnection.SMBConnection方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: check

# 需要导入模块: from smb import SMBConnection [as 别名]
# 或者: from smb.SMBConnection import SMBConnection [as 别名]
def check(ip,port,timeout):
    socket.setdefaulttimeout(timeout)
    user_list = ['administrator']
    hostname = ip2hostname(ip)
    PASSWORD_DIC.insert(0,'anonymous')
    if not hostname:return
    for user in user_list:
        for pass_ in PASSWORD_DIC:
            try:
                pass_ = str(pass_.replace('{user}', user))
                conn = SMBConnection(user,pass_,'xunfeng',hostname)
                if conn.connect(ip) == True:
                    if pass_ == 'anonymous':return u"存在匿名共享,请查看是否存在敏感文件。"
                    return u"存在弱口令,用户名:%s 密码:%s"%(user,pass_)
            except Exception,e:
                if "Errno 10061" in str(e) or "timed out" in str(e): return 
开发者ID:superhuahua,项目名称:xunfengES,代码行数:18,代码来源:crack_smb.py

示例2: resource

# 需要导入模块: from smb import SMBConnection [as 别名]
# 或者: from smb.SMBConnection import SMBConnection [as 别名]
def resource(self):
        kwargs = dict(
            username=smb_user,
            password=smb_passwd,
            my_name=self.my_name,
            remote_name=self.hostname,
            is_direct_tcp=self.direct_tcp,
        )

        conn = SMBConnection(**kwargs)

        # actually connect
        if self.smb_port is not None:
            assert conn.connect(self.host, port=self.smb_port)
        else:
            assert conn.connect(self.host)

        return conn 
开发者ID:jpmorganchase,项目名称:jupyter-fs,代码行数:20,代码来源:samba.py

示例3: usbfirstconnectremote

# 需要导入模块: from smb import SMBConnection [as 别名]
# 或者: from smb.SMBConnection import SMBConnection [as 别名]
def usbfirstconnectremote(usbserial,remotecompname,remoteuser, remotepassword):
    array_dates = []
    array_time = []
    a = 0
    data_folder="C$"
    conn=SMBConnection(remoteuser, remotepassword, "hn", remotecompname,use_ntlm_v2 = True,domain='testdomain')
    conn.connect(remotecompname,139)

    with open('tempohn.tmp','wb') as devlogfile:
        conn.retrieveFile(data_folder, '\Windows\inf\setupapi.dev.log', devlogfile)

        print("CONECTADO")
    print("USBSERIAL:", usbserial)

    devlogfile = open("tempohn.tmp", 'r')

    for line in devlogfile:
        if re.search(usbserial, line):
            line=next(devlogfile)
            # Split text strings to retrive date and time
            for word in line.split():
                if word.find(':')!=-1: # time
                    array_time.append(word)
                    #print(array_time)
                else:
                    array_dates.append(word)

            array_dates.remove('>>>')
            array_dates.remove('Section')
            array_dates.remove('start')

    mindate = min(array_dates)
    mintime = min(array_time)

    devlogfile.close()
    return (mindate, mintime)

# Class definition 
开发者ID:ElevenPaths,项目名称:HiddenNetworks-Python,代码行数:40,代码来源:HiddenNetworks.py

示例4: connect

# 需要导入模块: from smb import SMBConnection [as 别名]
# 或者: from smb.SMBConnection import SMBConnection [as 别名]
def connect(hostname, domain, user, password, nb_name, port):
    if not domain:
        connection = SMBConnection(user, password, 'Demisto', nb_name, is_direct_tcp=True)
    else:
        connection = SMBConnection(user, password, 'Demisto', nb_name, domain=domain, is_direct_tcp=True)
    if not connection.connect(hostname, port):
        return_error('Authentication failed, verify instance configuration parameters and try again.')
    return connection 
开发者ID:demisto,项目名称:content,代码行数:10,代码来源:SMB.py

示例5: connect

# 需要导入模块: from smb import SMBConnection [as 别名]
# 或者: from smb.SMBConnection import SMBConnection [as 别名]
def connect(url):
    # logger.info("Url: %s" % url)
    global remote
    server_name, server_ip, share_name, path, user, password, domain = parse_url(url)
    
    #Da problemas asumir que la sesión está abierta.  Si se abrió pero ha caducado, dará error.  Mejor conectar siempre
    """
    if not remote or not remote.sock or not server_name == remote.remote_name:
        remote = SMBConnection(user, password, domain, server_name)
        remote.connect(server_ip, 139)
    """
    remote = SMBConnection(user, password, domain, server_name)
    remote.connect(ip=server_ip, timeout=20)

    return remote, share_name, path 
开发者ID:alfa-addon,项目名称:addon,代码行数:17,代码来源:libsmb.py

示例6: connect

# 需要导入模块: from smb import SMBConnection [as 别名]
# 或者: from smb.SMBConnection import SMBConnection [as 别名]
def connect(url):
    #logger.info("Url: %s" % url)
    global remote
    server_name, server_ip, share_name, path, user, password, domain = parse_url(url)
    if not remote or not remote.sock or not server_name == remote.remote_name:
      remote = SMBConnection(user, password, domain, server_name)
      remote.connect(server_ip, 139)
  
    return remote, share_name, path 
开发者ID:pelisalacarta-ce,项目名称:pelisalacarta-ce,代码行数:11,代码来源:libsmb.py

示例7: smb_connect

# 需要导入模块: from smb import SMBConnection [as 别名]
# 或者: from smb.SMBConnection import SMBConnection [as 别名]
def smb_connect(server, user, passwd, domain, timeout):
    # Create SMB Connection using random client string
    client = ''.join([choice(ascii_letters + digits) for x in range(7)])
    con = SMBConnection(user, passwd, client, server, domain=domain, use_ntlm_v2=True, is_direct_tcp=True)
    con.connect(server, 445, timeout=timeout)
    return con 
开发者ID:m8r0wn,项目名称:ActiveReign,代码行数:8,代码来源:smb.py

示例8: authenticate

# 需要导入模块: from smb import SMBConnection [as 别名]
# 或者: from smb.SMBConnection import SMBConnection [as 别名]
def authenticate(self):

        from smb.SMBConnection import SMBConnection

        # There will be some mechanism to capture userID, password, client_machine_name, server_name and server_ip
        # client_machine_name can be an arbitary ASCII string
        # server_name should match the remote machine name, or else the connection will be rejected

        #userID = 'xatportantier'
        userID = 'guest'
        #password = 'SecurFMP_23'
        password = ''
        client_machine_name = 'fmp'
        server_ip = '192.1.3.120'
        server_name = 'Server72'
        server_name = ''

        from nmb.NetBIOS import NetBIOS

        nb = NetBIOS(broadcast=True, listen_port=0)
        #print('ip', nb.queryName(server_name, port=445))
        #print('name', nb.queryIPForName(server_ip))


        conn = SMBConnection(userID, password, client_machine_name, server_name, use_ntlm_v2=True, is_direct_tcp=False)
        from pprint import pprint
        for a in [ 'capabilities', 'domain', 'host_type', 'log', 'my_name', 'remote_name', 'security_mode', 'uid', 'username' ]:
            print(a, getattr(conn, a))
        #print('cap', conn.capabilities)
        #print('domain', conn.domain)

        print('auth', conn.connect(server_ip, 139))
        #print(conn.isUsingSMB2)
        #print(conn.echo('aaaaa'))
        #conn.listShares() 
开发者ID:fportantier,项目名称:habu,代码行数:37,代码来源:auth.py


注:本文中的smb.SMBConnection.SMBConnection方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。