检测远程桌面连接来源
这个问题告诉我如何检测远程桌面会话。
有谁知道是否可以从远程连接的初始化位置找到?
This question tells me how to detect a remote desktop session.
Do anybody know if it's possible to find out from where the remote connection was initialized?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
@Vegar,您可以使用 WTSEnumerateSessions 和 WTSQuerySessionInformation 函数检索此信息。
检查此链接有关使用 Jedi Api 标头 的示例。
检查这个代码。
UPDATE
正如@Remko所说,具有WTSClientAddress类型的WTSQuerySessionInformation函数可以返回客户端的本地IP。如果你想获得真实的 IP,你可以使用位于 JwaWinSta 单元中的 WinStationGetRemoteIPAddress 辅助函数。
@Vegar, you can use the WTSEnumerateSessions and WTSQuerySessionInformation functions to retrieve this info.
check this link for an example using the Jedi Api Headers.
check this code.
UPDATE
As @Remko says, the WTSQuerySessionInformation function with the WTSClientAddress type, can return the local IP of the client. if you wanna get the real ip you can use the WinStationGetRemoteIPAddress helper function located in the JwaWinSta unit.
对我来说,这很有效,它获取了所连接机器的名称。
For me, this worked, it gets the name of the machine connected.
由于它在 Windows 中,请使用 netstat 检查您连接到哪些计算机以及哪些端口,然后解析出使用远程桌面使用的端口的计算机的地址。
Since it's in windows use netstat to check which machines you are connected to and on which ports and just parse out the address for the one that uses the port that remote desktop uses.
WTSQuerySessionInformation 返回客户端报告的客户端 IP,这可能是其本地 IP 地址的(之一)。如果您想知道连接的真实 IP 地址和端口,您可以使用 WinStationQueryInformationW 和信息类 WinStationRemoteAddress。
你需要我的 Jedi Apilib 单位 JwaWinsta。
我还在同一单元中提供了一个简单的包装器:
WTSQuerySessionInformation returns the client IP as the client reports it, this will probably be (one) of it's local IP Address. If you want to know the REAL ip address and port that is connected you can use WinStationQueryInformationW with information class WinStationRemoteAddress.
You will need my unit JwaWinsta from the Jedi Apilib.
I have provided a simple wrapper in the same unit as well:
尝试运行 qwinsta
try running qwinsta
如果您想获取远程会话 ID 并获取通过 Citrix 连接的 IP 地址,您可以使用以下命令。它被设计为当用户通过 Citrix 会话连接到服务器时运行,并显示/创建其连接的 IP 地址的字符串。
If you want to get the remote session ID and get the IP address that connected via Citrix you can use the below. This was designed to run when a user connects to a server via a citrix session and display/create a string for the IP address it is connecting from.