@@ -1705,18 +1705,18 @@ def enum(self):
17051705 smbclient will open a connection to the Server Service Remote Protocol named pipe (srvsvc). Once connected
17061706 it calls the NetShareEnumAll() to get a list of shares.
17071707 '''
1708- command = ["smbclient" , "-t" , f"{ self .target .timeout } " , "-W" , self .target .workgroup , "-U" , f"{ self .creds .user } %{ self .creds .pw } " , "-L" , f"//{ self .target .host } " ]
1708+ command = ["smbclient" , "-t" , f"{ self .target .timeout } " , "-W" , self .target .workgroup , "-U" , f"{ self .creds .user } %{ self .creds .pw } " , "-L" , f"//{ self .target .host } " , "-g" ]
17091709 result = run (command , "Attempting to get share list using authentication" , self .target .samba_config )
17101710
17111711 if not result .retval :
17121712 return Result (None , f"Could not list shares: { result .retmsg } " )
17131713
17141714 shares = {}
1715- match_list = re .findall (r"^\s*([\S]+)\s+( Device|Disk|IPC|Printer)[ \t]*([^\n] *)$" , result .retmsg , re .MULTILINE | re .IGNORECASE )
1715+ match_list = re .findall (r"^( Device|Disk|IPC|Printer)\|(.*)\|(. *)$" , result .retmsg , re .MULTILINE | re .IGNORECASE )
17161716 if match_list :
17171717 for entry in match_list :
1718- share_name = entry [0 ]
1719- share_type = entry [1 ]
1718+ share_type = entry [0 ]
1719+ share_name = entry [1 ]
17201720 share_comment = entry [2 ].rstrip ()
17211721 shares [share_name ] = {'type' :share_type , 'comment' :share_comment }
17221722
@@ -1752,7 +1752,7 @@ def check_access(self, share):
17521752 if "tree connect failed: NT_STATUS_ACCESS_DENIED" in result .retmsg :
17531753 return Result ({"mapping" :"denied" , "listing" :"n/a" }, "Mapping: DENIED, Listing: N/A" )
17541754
1755- if "NT_STATUS_INVALID_INFO_CLASS" in result .retmsg or "NT_STATUS_NETWORK_ACCESS_DENIED" in result .retmsg :
1755+ if "NT_STATUS_INVALID_INFO_CLASS" in result .retmsg or "NT_STATUS_NETWORK_ACCESS_DENIED" in result .retmsg or "NT_STATUS_NOT_A_DIRECTORY" in result . retmsg :
17561756 return Result ({"mapping" :"ok" , "listing" :"not supported" }, "Mapping: OK, Listing: NOT SUPPORTED" )
17571757
17581758 if "NT_STATUS_OBJECT_NAME_NOT_FOUND" in result .retmsg :
0 commit comments