I'm planning to develop an Intrusion Prevention System. To restrict access for the certain IP address, the only way I found is adding rules to the Window Firewall. Is it possible I create a new Firewall rule through Java application?
Asked
Active
Viewed 844 times
0
-
You can add Windows Firewall rule programatically using .NET C# [Add Firewall Rule](https://social.msdn.microsoft.com/Forums/vstudio/en-US/a3e390d1-4383-4f23-bad9-b725bef33499/add-firewall-rule-programatically?forum=wcf). Also you can use Visual Basic Script for the same [VBS](https://www.codeofhonor.com/blog/installing-firewall-exception-rules). Using PowerShell: `netsh advfirewall firewall add rule name="Program name" dir=in action=allow program="FullPathName.exe" enable=yes` – Mauricio Kenny Oct 10 '20 at 18:28
-
Usually IPS systems are very integrated with/within the operating system. IMHO Java is not really intended or built to do so, as the runtime sits on top of the operating system in its own virtual machine. In theory you may call the system functions using the JNA interface or invoking command-line level operations (e.g. calling PowerShell commands), but it may be very cumbersome to hook-up your application to the network or system callbacks as expected from a serious security app. – gusto2 Oct 10 '20 at 18:33