本文整理汇总了Python中util.getConnectionInfo函数的典型用法代码示例。如果您正苦于以下问题:Python getConnectionInfo函数的具体用法?Python getConnectionInfo怎么用?Python getConnectionInfo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getConnectionInfo函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_overwrite
def test_overwrite():
info = util.getConnectionInfo()
info['filename'] = os.sep + 'StoreTest-%d-%d.dat' % ( time.time(), random.randint(0, 10000) )
test_s = 'test1234'
test_md = MD5()
test_md.update(test_s)
director = urllib2.build_opener(SMBHandler)
upload_fh = director.open('smb://%(user)s:%(password)[email protected]%(server_ip)s/smbtest/%(filename)s' % info, data = StringIO(test_s))
retr_fh = director.open('smb://%(user)s:%(password)[email protected]%(server_ip)s/smbtest/%(filename)s' % info)
s = retr_fh.read()
md = MD5()
md.update(s)
assert md.hexdigest() == test_md.hexdigest()
assert len(s) == len(test_s)
upload_fh = director.open('smb://%(user)s:%(password)[email protected]%(server_ip)s/smbtest/%(filename)s' % info, data = open(TEST_FILENAME, 'rb'))
retr_fh = director.open('smb://%(user)s:%(password)[email protected]%(server_ip)s/smbtest/%(filename)s' % info)
s = retr_fh.read()
md = MD5()
md.update(s)
示例2: test_listshares_SMB2
def test_listshares_SMB2():
info = getConnectionInfo()
smb_structs.SUPPORT_SMB2 = True
factory = ListSharesFactory(info['user'], info['password'], info['client_name'], info['server_name'], use_ntlm_v2 = True)
reactor.connectTCP(info['server_ip'], info['server_port'], factory)
return factory.d
示例3: setup_func_SMB2
def setup_func_SMB2():
global conn
smb_structs.SUPPORT_SMB2 = True
info = getConnectionInfo()
conn = SMBConnection(info['user'], info['password'], info['client_name'], info['server_name'], use_ntlm_v2 = True)
assert conn.connect(info['server_ip'], info['server_port'])
示例4: test_store_long_filename_SMB1
def test_store_long_filename_SMB1():
info = getConnectionInfo()
smb_structs.SUPPORT_SMB2 = False
factory = StoreFilesFactory(info['user'], info['password'], info['client_name'], info['server_name'], use_ntlm_v2 = True)
factory.service_name = 'smbtest'
factory.filename = os.sep + 'StoreTest %d-%d.dat' % ( time.time(), random.randint(0, 10000) )
reactor.connectTCP(info['server_ip'], info['server_port'], factory)
return factory.d
示例5: test_unicode_directory_SMB2
def test_unicode_directory_SMB2():
info = getConnectionInfo()
smb_structs.SUPPORT_SMB2 = True
factory = DirectoryFactory(info['user'], info['password'], info['client_name'], info['server_name'], use_ntlm_v2 = True)
factory.service_name = 'smbtest'
factory.path = os.sep + u'文件夹创建 %d-%d' % ( time.time(), random.randint(0, 1000) )
reactor.connectTCP(info['server_ip'], info['server_port'], factory)
return factory.d
示例6: test_listshares_SMB2
def test_listshares_SMB2():
info = getConnectionInfo()
smb_structs.SUPPORT_SMB2 = True
factory = ListSnapshotsFactory(info['user'], info['password'], info['client_name'], info['server_name'], use_ntlm_v2 = True)
factory.service_name = 'smbtest'
factory.path = '/rfc1001.txt'
reactor.connectTCP(info['server_ip'], info['server_port'], factory)
return factory.d
示例7: test_rename_unicode_directory_SMB2
def test_rename_unicode_directory_SMB2():
info = getConnectionInfo()
smb_structs.SUPPORT_SMB2 = True
factory = RenameDirectoryFactory(info['user'], info['password'], info['client_name'], info['server_name'], use_ntlm_v2 = True)
factory.service = 'smbtest'
factory.old_path = u'/改名测试 %d-%d' % ( time.time(), random.randint(1000, 9999) )
factory.new_path = u'/改名测试 %d-%d' % ( time.time(), random.randint(1000, 9999) )
reactor.connectTCP(info['server_ip'], info['server_port'], factory)
return factory.d
示例8: test_rename_english_file_SMB2
def test_rename_english_file_SMB2():
info = getConnectionInfo()
smb_structs.SUPPORT_SMB2 = True
factory = RenameFileFactory(info['user'], info['password'], info['client_name'], info['server_name'], use_ntlm_v2 = True)
factory.service = 'smbtest'
factory.old_path = '/RenameTest %d-%d.txt' % ( time.time(), random.randint(1000, 9999) )
factory.new_path = '/RenameTest %d-%d.txt' % ( time.time(), random.randint(1000, 9999) )
reactor.connectTCP(info['server_ip'], info['server_port'], factory)
return factory.d
示例9: test_NTLMv2_auth_SMB2
def test_NTLMv2_auth_SMB2():
def result(auth_passed):
assert auth_passed
smb_structs.SUPPORT_SMB2 = True
info = getConnectionInfo()
factory = AuthFactory(info['user'], info['password'], info['client_name'], info['server_name'], use_ntlm_v2 = True)
factory.d.addCallback(result)
reactor.connectTCP(info['server_ip'], info['server_port'], factory)
return factory.d
示例10: test_retr_unicodefilename_SMB2
def test_retr_unicodefilename_SMB2():
# Test file retrieval that has a long non-English filename inside a folder with a non-English name
info = getConnectionInfo()
smb_structs.SUPPORT_SMB2 = True
factory = RetrieveFileFactory(info['user'], info['password'], info['client_name'], info['server_name'], use_ntlm_v2 = True)
factory.service = 'smbtest'
factory.path = u'/测试文件夹/垃圾文件.dat'
factory.digest = '8a44c1e80d55e91c92350955cdf83442'
factory.filesize = 256000
reactor.connectTCP(info['server_ip'], info['server_port'], factory)
return factory.d
示例11: test_retr_multiplereads_SMB2
def test_retr_multiplereads_SMB2():
# Test file retrieval using multiple ReadAndx calls (assuming each call will not reach more than 65534 bytes)
info = getConnectionInfo()
smb_structs.SUPPORT_SMB2 = True
factory = RetrieveFileFactory(info['user'], info['password'], info['client_name'], info['server_name'], use_ntlm_v2 = True)
factory.service = 'smbtest'
factory.path = '/rfc1001.txt'
factory.digest = '5367c2bbf97f521059c78eab65309ad3'
factory.filesize = 158437
reactor.connectTCP(info['server_ip'], info['server_port'], factory)
return factory.d
示例12: test_retr_longfilename_SMB1
def test_retr_longfilename_SMB1():
# Test file retrieval that has a long English filename
info = getConnectionInfo()
smb_structs.SUPPORT_SMB2 = False
factory = RetrieveFileFactory(info['user'], info['password'], info['client_name'], info['server_name'], use_ntlm_v2 = True)
factory.service = 'smbtest'
factory.path = '/Implementing CIFS - SMB.html'
factory.digest = '671c5700d279fcbbf958c1bba3c2639e'
factory.filesize = 421269
reactor.connectTCP(info['server_ip'], info['server_port'], factory)
return factory.d
示例13: test_retr_offset_SMB2
def test_retr_offset_SMB2():
# Test file retrieval from offset to EOF
info = getConnectionInfo()
smb_structs.SUPPORT_SMB2 = True
factory = RetrieveFileFactory(info['user'], info['password'], info['client_name'], info['server_name'], use_ntlm_v2 = True)
factory.service = 'smbtest'
factory.path = u'/测试文件夹/垃圾文件.dat'
factory.digest = 'a141bd8024571ce7cb5c67f2b0d8ea0b'
factory.filesize = 156000
factory.offset = 100000
reactor.connectTCP(info['server_ip'], info['server_port'], factory)
return factory.d
示例14: test_retr_offset_and_biglimit_SMB2
def test_retr_offset_and_biglimit_SMB2():
# Test file retrieval from offset with a big max_length
info = getConnectionInfo()
smb_structs.SUPPORT_SMB2 = True
factory = RetrieveFileFactory(info['user'], info['password'], info['client_name'], info['server_name'], use_ntlm_v2 = True)
factory.service = 'smbtest'
factory.path = u'/测试文件夹/垃圾文件.dat'
factory.digest = '83b7afd7c92cdece3975338b5ca0b1c5'
factory.filesize = 100000
factory.offset = 100000
factory.max_length = 100000
reactor.connectTCP(info['server_ip'], info['server_port'], factory)
return factory.d
示例15: test_retr_offset_and_smalllimit_SMB2
def test_retr_offset_and_smalllimit_SMB2():
# Test file retrieval from offset with a small max_length
info = getConnectionInfo()
smb_structs.SUPPORT_SMB2 = True
factory = RetrieveFileFactory(info['user'], info['password'], info['client_name'], info['server_name'], use_ntlm_v2 = True)
factory.service = 'smbtest'
factory.path = u'/测试文件夹/垃圾文件.dat'
factory.digest = '746f60a96b39b712a7b6e17ddde19986'
factory.filesize = 10
factory.offset = 100000
factory.max_length = 10
reactor.connectTCP(info['server_ip'], info['server_port'], factory)
return factory.d