Get the App
SLTechnology News&Howtos  ›  Development  › 

How to implement the script of alarm when an IP connects to port 3389 of my machine in windows

Shulou Source: shulou.com Published: 2022-06-03 06:24:02 11月17日 Update

This article is about how to implement an alarm script in windows when an IP connects to port 3389 of my machine. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

I know that IPSEC can also be used to allow only an IP to access. With netstat-an, you can see that an IP is accessing port 3389 of my machine. I want to monitor the access of an IP and then call the police or enter > *. Txt.

Can't you set up only a single IP to connect you with 3389 in the firewall?

Scripting is not everything.

I just saw it. Indeed, the firewall that comes with windows can record it.

Here is a flexible method.

1. Save the following code as a vbs file

The copy code is as follows:

Set obji = GetObject ("winmgmts: {impersonationLevel=impersonate}! Win32_Service='TermService'")

If obji.TotalSessions > 0 then

Wscript.echo "warning, there is a remote user connection!"

End if

2. Put the above script into the scheduled task and run it every ten minutes

3, the principle of this method is very simple, if there is a user connection to enter, then the total number of sessions will be greater than 1, prompt the alarm at this time!

Thank you for reading! This is the end of the article on "how to realize the script for alarm when an IP connects to port 3389 of my machine in windows". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out for more people to see!

Tags: Scripts alarms machines ports code content methods more users articles firewalls fireproofing no good practical tasks principles files articles Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft Huawei Shulou Technology Shulou Information Shulou Tech Info