'Use pysmb to operate the smb server as annoymous user

This is the package I grabbed for someone else's smb server, it can log in to the server anonymously, but I can't。 enter image description here

I found that the difference between the packet I sent to the target and the one he sent is that there is Unicode password. enter image description here

I've no idea how to remove the item.Below is my python code。

from smb import smb_structs
from smb.SMBConnection import SMBConnection
smb_structs.SUPPORT_EXTENDED_SECURITY = False
smb_structs.SMB_FLAGS_CANONICALIZED_PATHS = False
smb_structs.SMB_FLAGS2_UNICODE = False
smb_structs.SMB_FLAGS2_IS_LONG_NAME = False
smb_structs.SMB_FLAGS2_NT_STATUS = False
smb_structs.CAP_UNICODE = False
smb_structs.CAP_LARGE_FILES = False
smb_structs.CAP_STATUS32 = False


def transfer():
    smb = SMBConnection(username, password, "", "IIE-BCHIOVTGH68<20>", sign_options=0, use_ntlm_v2=False)
    try:
        res = smb.connect(ip)

        folders = smb.listShares()
        for i in folders:
            print(i.name)

    except Exception as e:
        print(e)
        smb.close()
    smb.close()


if __name__ == '__main__':
    ip, port, username, password = '192.168.20.102', 139, "", ""
    transfer()


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source