fortra / impacket

Impacket is a collection of Python classes for working with network protocols.
https://www.coresecurity.com
Other
12.99k stars 3.5k forks source link

Get owner/acl smb folder #1693

Open anasbousselham opened 5 months ago

anasbousselham commented 5 months ago

Hi, I need to grab the owner name/SID and all the ACL data on a shared folder not files but only folder. my little example:

tree = conn.connectTree("Data")
folder = conn.openFile(tree, '\\', READ_CONTROL , creationOption=FILE_LIST_DIRECTORY)
info = conn.getSMBServer().queryInfo(tree, folder, infoType=SMB2_0_INFO_SECURITY, fileInfoClass=SMB2_SEC_INFO_00, additionalInformation=OWNER_SECURITY_INFORMATION, flags=0)
sd = ldaptypes.SR_SECURITY_DESCRIPTOR()
sd.fromString(info)
print(f"{sd['OwnerSid']}")

I have this error: STATUS_ACCESS_DENIED({Access Denied} A process has requested access to an object but has not been garanted those access rights)

thanks

sec13b commented 4 months ago

what cmd u run ?

anadrianmanrique commented 4 months ago

can you provide more context about the target share? permissions ? windows version?