Exemple #1
0
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
Exemple #2
0
def test_NTLMv2_auth_SMB1():
    global conn, conn2, conn3
    smb_structs.SUPPORT_SMB2 = False
    info = getConnectionInfo()
    conn = SMBConnection(info['user'],
                         info['password'],
                         info['client_name'],
                         info['server_name'],
                         use_ntlm_v2=True,
                         is_direct_tcp=True)
    assert conn.connect(info['server_ip'], info['server_port'])

    conn2 = SMBConnection(info['user'],
                          'wrongPass',
                          info['client_name'],
                          info['server_name'],
                          use_ntlm_v2=True,
                          is_direct_tcp=True)
    assert not conn2.connect(info['server_ip'], info['server_port'])

    conn3 = SMBConnection('INVALIDUSER',
                          'wrongPass',
                          info['client_name'],
                          info['server_name'],
                          use_ntlm_v2=True,
                          is_direct_tcp=True)
    assert not conn3.connect(info['server_ip'], info['server_port'])
Exemple #3
0
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'])
Exemple #4
0
def setup_func_SMB1():
    global conn
    smb_structs.SUPPORT_SMB2 = smb_structs.SUPPORT_SMB2x = False

    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'])
Exemple #5
0
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)s@%(server_ip)s/smbtest/%(filename)s' % info, data = StringIO(test_s))

    retr_fh = director.open('smb://%(user)s:%(password)s@%(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)s@%(server_ip)s/smbtest/%(filename)s' % info, data = open(TEST_FILENAME, 'rb'))

    retr_fh = director.open('smb://%(user)s:%(password)s@%(server_ip)s/smbtest/%(filename)s' % info)

    s = retr_fh.read()
    md = MD5()
    md.update(s)
Exemple #6
0
def test_NTLMv1_auth_SMB2():
    global conn
    smb_structs.SUPPORT_SMB2 = smb_structs.SUPPORT_SMB2x = True
    info = getConnectionInfo()
    conn = SMBConnection(info['user'],
                         info['password'],
                         info['client_name'],
                         info['server_name'],
                         domain=info['domain'],
                         use_ntlm_v2=False)
    assert conn.connect(info['server_ip'], info['server_port'])

    conn2 = SMBConnection(info['user'],
                          'wrongPass',
                          info['client_name'],
                          info['server_name'],
                          use_ntlm_v2=False)
    assert not conn2.connect(info['server_ip'], info['server_port'])

    conn3 = SMBConnection('INVALIDUSER',
                          'wrongPass',
                          info['client_name'],
                          info['server_name'],
                          use_ntlm_v2=False)
    assert not conn3.connect(info['server_ip'], info['server_port'])
Exemple #7
0
def test_getAttributes_SMB2_test3():
    info = getConnectionInfo()
    smb_structs.SUPPORT_SMB2 = True

    factory = GetAttributesFactory(info['user'], info['password'], info['client_name'], info['server_name'], use_ntlm_v2 = True)
    factory.path = u'/\u6d4b\u8bd5\u6587\u4ef6\u5939'
    factory.is_directory = True
    reactor.connectTCP(info['server_ip'], info['server_port'], factory)
    return factory.d
Exemple #8
0
def test_getAttributes_SMB1_test1():
    info = getConnectionInfo()
    smb_structs.SUPPORT_SMB2 = False

    factory = GetAttributesFactory(info['user'], info['password'], info['client_name'], info['server_name'], use_ntlm_v2 = True)
    factory.path = '/Test Folder with Long Name/'
    factory.is_directory = True
    reactor.connectTCP(info['server_ip'], info['server_port'], factory)
    return factory.d
Exemple #9
0
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
Exemple #10
0
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
Exemple #11
0
def test_getAttributes_SMB2_test2():
    info = getConnectionInfo()
    smb_structs.SUPPORT_SMB2 = True

    factory = GetAttributesFactory(info['user'], info['password'], info['client_name'], info['server_name'], use_ntlm_v2 = True)
    factory.path = '/rfc1001.txt'
    factory.is_directory = False
    reactor.connectTCP(info['server_ip'], info['server_port'], factory)
    return factory.d
Exemple #12
0
def test_echo():
    info = getConnectionInfo()
    factory = EchoFactory(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
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
Exemple #14
0
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
Exemple #15
0
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
Exemple #16
0
def test_NTLMv2_auth_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'])
Exemple #17
0
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
Exemple #18
0
def setup_func():
    global conn
    info = getConnectionInfo()
    conn = SMBConnection(info['user'],
                         info['password'],
                         info['client_name'],
                         info['server_name'],
                         use_ntlm_v2=True,
                         is_direct_tcp=True)
    assert conn.connect(info['server_ip'], info['server_port'])
Exemple #19
0
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
Exemple #20
0
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
Exemple #21
0
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
Exemple #22
0
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
Exemple #23
0
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
Exemple #24
0
def test_unicode():
    # Test smb URLs with unicode paths
    director = urllib.request.build_opener(SMBHandler)
    fh = director.open(
        'smb://%(user)s:%(password)s@%(server_ip)s/smbtest/测试文件夹/垃圾文件.dat' %
        util.getConnectionInfo())

    s = fh.read()
    md = MD5()
    md.update(s)
    assert md.hexdigest() == '8a44c1e80d55e91c92350955cdf83442'
    assert len(s) == 256000

    fh.close()
Exemple #25
0
def test_basic():
    # Basic test for smb URLs
    director = urllib.request.build_opener(SMBHandler)
    fh = director.open(
        'smb://%(user)s:%(password)s@%(server_ip)s/smbtest/rfc1001.txt' %
        util.getConnectionInfo())

    s = fh.read()
    md = MD5()
    md.update(s)
    assert md.hexdigest() == '5367c2bbf97f521059c78eab65309ad3'
    assert len(s) == 158437

    fh.close()
Exemple #26
0
def test_store_unicode_filename_SMB2():
    info = getConnectionInfo()
    smb_structs.SUPPORT_SMB2 = True

    factory = StoreFilesFactory(info['user'],
                                info['password'],
                                info['client_name'],
                                info['server_name'],
                                use_ntlm_v2=True)
    factory.service_name = 'smbtest'
    factory.filename = os.sep + u'上载测试 %d-%d.dat' % (time.time(),
                                                     random.randint(0, 10000))
    reactor.connectTCP(info['server_ip'], info['server_port'], factory)
    return factory.d
Exemple #27
0
def test_retr_offset_and_zerolimit_SMB2():
    # Test file retrieval from offset to EOF with max_length=0
    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 = 'd41d8cd98f00b204e9800998ecf8427e'
    factory.filesize = 0
    factory.offset = 100000
    factory.max_length = 0
    reactor.connectTCP(info['server_ip'], info['server_port'], factory)
    return factory.d
Exemple #28
0
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
Exemple #29
0
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
Exemple #30
0
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
def test_retr_longfilename_SMB2():
    # Test file retrieval that has a long English filename
    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 = '/Implementing CIFS - SMB.html'
    factory.digest = '671c5700d279fcbbf958c1bba3c2639e'
    factory.filesize = 421269
    reactor.connectTCP(info['server_ip'], info['server_port'], factory)
    return factory.d
Exemple #32
0
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
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
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
Exemple #35
0
def test_rename_english_file_SMB1():
    info = getConnectionInfo()
    smb_structs.SUPPORT_SMB2 = False

    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
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
def test_retr_offset_and_zerolimit_SMB2():
    # Test file retrieval from offset to EOF with max_length=0
    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 = 'd41d8cd98f00b204e9800998ecf8427e'
    factory.filesize = 0
    factory.offset = 100000
    factory.max_length = 0
    reactor.connectTCP(info['server_ip'], info['server_port'], factory)
    return factory.d
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
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
Exemple #40
0
def test_upload():
    info = util.getConnectionInfo()
    info['filename'] = os.sep + 'StoreTest-%d-%d.dat' % (
        time.time(), random.randint(0, 10000))

    director = urllib.request.build_opener(SMBHandler)
    upload_fh = director.open(
        'smb://%(user)s:%(password)s@%(server_ip)s/smbtest/%(filename)s' %
        info,
        data=open(TEST_FILENAME, 'rb'))

    retr_fh = director.open(
        'smb://%(user)s:%(password)s@%(server_ip)s/smbtest/%(filename)s' %
        info)

    s = retr_fh.read()
    md = MD5()
    md.update(s)

    assert md.hexdigest() == TEST_DIGEST
    assert len(s) == TEST_FILESIZE
Exemple #41
0
def setup_func():
    global conn
    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'])
Exemple #42
0
    for name in names:
        if name.isDirectory:
            if name.filename not in [u'.', u'..']:
                dirs.append(name.filename)
        else:
            nondirs.append(name.filename)

    yield top, dirs, nondirs

    for name in dirs:
        new_path = os.path.join(top, name)
        for x in smbwalk(conn, shareddevice, new_path):
            yield x


info = getConnectionInfo()
smb_structs.SUPPORT_SMB2 = smb_structs.SUPPORT_SMB2x = True
"""
 problems
 
 if connection reset by peer in windows file sharing the server_name is important for SMBConnection
 we get server name by getBIOSName function and set to smb object


"""
BASE_DIR = info['BASE_DIR']

log_file = open(os.path.join(BASE_DIR, info['log_file']), "a")

conn = SMBConnection(info['user'], info['password'], info['client_name'], getBIOSName(info['server_ip'])[0],
                     use_ntlm_v2=True, domain=info['domain'])
Exemple #43
0
def test_basic():
    # Basic test for smb URLs
    director = urllib2.build_opener(SMBHandler)
    fh = director.open('smb://%(user)s:%(password)s@%(server_ip)s/smbtest/rfc1001.txt' % util.getConnectionInfo())

    s = fh.read()
    md = MD5()
    md.update(s)
    assert md.hexdigest() == '5367c2bbf97f521059c78eab65309ad3'
    assert len(s) == 158437

    fh.close()
Exemple #44
0
def test_echo():
    info = getConnectionInfo()
    factory = EchoFactory(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
Exemple #45
0
def test_NTLMv2_auth_SMB1():
    global conn
    smb_structs.SUPPORT_SMB2 = False
    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'])
Exemple #46
0
def test_unicode():
    # Test smb URLs with unicode paths
    director = urllib2.build_opener(SMBHandler)
    fh = director.open(u'smb://%(user)s:%(password)s@%(server_ip)s/smbtest/测试文件夹/垃圾文件.dat' % util.getConnectionInfo())

    s = fh.read()
    md = MD5()
    md.update(s)
    assert md.hexdigest() == '8a44c1e80d55e91c92350955cdf83442'
    assert len(s) == 256000

    fh.close()