Get the App
SLTechnology News&Howtos  ›  Development  › 

How to get the physical path of the remote machine shared directory in the server

Shulou Source: shulou.com Published: 2022-06-03 07:46:32 10月27日 Update

This article mainly introduces how to get the physical path of the remote machine shared directory in the server, which has a certain reference value. Interested friends can refer to it. I hope you will learn a lot after reading this article. Let's take the editor to know it.

First: rely on 135port, use wmi. Like the script below is the physical directory where you get the shared directory ttt.

The code is as follows:

StrPath = "\ 192.168.1.55\ ttt"

StrPath = Replace (strPath, "\", "")

ArrPath = Split (strPath, "\")

StrComputer = arrPath (0)

StrShare = arrPath (1)

Set objSWbemLocator = CreateObject ("WbemScripting.SWbemLocator")

Set objWMIService = objSWbemLocator.ConnectServer (strComputer, "\ root\ CIMV2", "admin", "123")

Set colItems = objWMIService.ExecQuery _

("Select * From Win32_Share Where Name ='" & strShare & "'")

For Each objItem in colItems

Wscript.Echo objItem.Path

Next

/ * * there is something wrong with Microsoft's script, so you can only get the native machine * /

StrPath = "\\ atl-fs-01\ public"

StrPath = Replace (strPath, "\", "")

ArrPath = Split (strPath, "\")

StrComputer = arrPath (0)

StrShare = arrPath (1)

Set objWMIService = GetObject ("winmgmts:\\" & strComputer & "\ root\ cimv2")

Set colItems = objWMIService.ExecQuery _

("Select * From Win32_Share Where Name ='" & strShare & "'")

For Each objItem in colItems

Wscript.Echo objItem.Path

Next

/ * * there is something wrong with Microsoft's script, so you can only get the native machine * /

Second, rely on port 445, rely on smb. Nmap under bt5

The code is as follows:

Root@bt:~# nmap-- script smb-enum-shares-- script-args=smbuser=administrator,smbpass=toor 192.168.1.108-p445

Starting Nmap 5.59BETA1 (http://nmap.org) at 2012-02-14 15:29 CST

Nmap scan report for 192.168.1.108

Host is up (0.00013s latency).

PORT STATE SERVICE

445/tcp open microsoft-ds

MAC Address: 00:0C:29:B3:F6:79 (VMware)

Host script results:

| smb-enum-shares:

| | ADMIN$ |

| | Type: STYPE_DISKTREE_HIDDEN |

| | Comment: Remote Admin |

| Users: 0, Max:

| | Path: C:\ WINDOWS |

| Anonymous access:

| | Current user ('administrator') access: READ/WRITE |

| | C$ |

| | Type: STYPE_DISKTREE_HIDDEN |

| | Comment: Default share |

| Users: 0, Max:

| | Path: C:\ |

| Anonymous access:

| | Current user ('administrator') access: READ/WRITE |

| | IPC$ |

| | Type: STYPE_IPC_HIDDEN |

| | Comment: Remote IPC |

| Users: 1, Max:

| Path:

| | Anonymous access: READ |

| | Current user ('administrator') access: READ |

| | NETLOGON |

| | Type: STYPE_DISKTREE |

| | Comment: Logon server share |

| Users: 0, Max:

| | Path: C:\ WINDOWS\ SYSVOL\ sysvol\ haiyangtop.com\ SCRIPTS |

| Anonymous access:

| | Current user ('administrator') access: READ/WRITE |

| | SYSVOL |

| | Type: STYPE_DISKTREE |

| | Comment: Logon server share |

| Users: 0, Max:

| | Path: C:\ WINDOWS\ SYSVOL\ sysvol |

| Anonymous access:

| | Current user ('administrator') access: READ/WRITE |

| | ttt |

| | Type: STYPE_DISKTREE |

| Comment:

| Users: 0, Max:

| | Path: C:\ sharettt |

| Anonymous access:

| | _ Current user ('administrator') access: READ |

Nmap done: 1 IP address (1 host up) scanned in 0.56 seconds

Root@bt:~#

Thank you for reading this article carefully. I hope the article "how to get the physical path of the remote machine shared directory in the server" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Tags: Directories articles physics scripts servers machines paths services code ports questions Microsoft native value interests at the same time more friends knowledge editing Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft Shulou Information vpn Huawei Shulou Tech Info