RdpGuard Plugin API - protect your applications from brute-force attacks with custom C# log parsers
RdpGuard
Intrusion prevention system for your Windows Server
 

RdpGuard Plugin API

Use the RdpGuard Plugin API to detect failed login attempts in application logs that RdpGuard does not support natively. Your plugin parses log entries; RdpGuard monitors the files, counts failed attempts and blocks IP addresses according to your settings.

Create a .NET Framework class library and add a reference to rdpguard-plugin-api.dll from your RdpGuard installation folder. The API and sample plugin target .NET Framework 4.5.

Implement IExternalLogBasedEngine in a public class with a parameterless constructor. The sample below gets this constructor automatically because it does not declare any constructors.

Place your plugin in the Plugins folder inside the RdpGuard installation folder, for example C:\Program Files\RdpGuard\Plugins.

The plugin interface is below:

namespace rdpguard_plugin_api {

    public interface IExternalEngine {

        string Name { get; }
        string Protocol { get; }
    }

    public interface IExternalLogBasedEngine : IExternalEngine {

        string Directory { get; }
        string FileMask { get; }

        bool IsFailedLoginAttempt(string _line, out string _ip, out string _username);
    }
}

Return true for a failed login attempt and set _ip to a valid IP address. Set _username to null if the log does not include a user name. Return false for other log entries.

The sample implementation:

using rdpguard_plugin_api;

namespace rdpguard_test_plugin {

    public class MyEngine : IExternalLogBasedEngine {

        public string Name => "TestEngine";
        public string Protocol => "MyProto";

        public string Directory => @"C:\MyApp\Logs\";
        public string FileMask => "*.log";

        public bool IsFailedLoginAttempt(string _line, out string _ip, out string _username) {

            _ip = _username = null;

            // sample log line:
            // 2020-06-22 10:29:18 AUTH-ERROR admin 66.249.65.238 Invalid+username+or+password

            var parts = _line.Split(' ');

            if (parts.Length > 5 && "AUTH-ERROR" == parts[2]) {
                _username = parts[3];
                _ip = parts[4];
                return true;
            }

            return false;
        }
    }
}

Build your plugin and copy the resulting DLL to C:\Program Files\RdpGuard\Plugins (or the Plugins folder in your chosen installation directory). Create the folder if necessary, then restart the RdpGuard service using Tools, RdpGuard Service, Restart.

Select Verbose logging in Tools, Options, Logging and click Save before restarting the service. Look for this message in the log:

ExternalLogBasedEngine::TestEngine started (C:\MyApp\Logs\)

This message confirms that the plugin has started. To test detection, generate new failed login attempts in your application and check that RdpGuard records them.

Feel free to contact us if you need any help with your plugin.

RdpGuard 10.4.5 Free Trial

RdpGuard protects:

Our customers say

"This sotware is really great. It's a relief. Because my server is constantly under attack. Thanks RdpGuard" - Joaquim De Sousa Marques

"Nice product. I used to implement something similiar in a low-tech and cumbersome manner via a script called TSBlock (not mine). This makes it much easier and is well worth the pricetag for SMB's." - J. Johnson

"Absolutely amazed at your product. We are a church in the North Dallas area, and I discovered this morning multiple failed logon attempts via our Remote Access Server. A friend suggested your product, so I immediately downloaded the trial. It had a list of about five blocked IP addresses in minutes, and that was enough to lead me to push the BUY button. Over the past 10-15 minutes the list is now about thirty with at least a third being international attempts to break into our system. Thanks for a great product. You may have just saved us much grief." - John Hallford

"Love the software. RDP on our Windows servers is just ridiculous. We would block it in the router but we have lots of old-time customers that would have issues." - Scott Hirsch

"Love the software! Makes it easier than tailoring VB Scripts!!" - Nick Brennan

"It's a great product - really stopping those RDP attackers :-)" - Dave, UK

"First of all: Your application is very (!!!) useful and I like it very much securing my 2012 R2 server. RdpGuard is the best solution, I found on the market and after 10 minutes of testing it I ordered the fully-featured version. :-)" - Carsten Baltes

Our Other Products
Copyright © 2012-2026 Netsdk Software FZE. All rights reserved.  Terms of Use.  Privacy Policy.  Refund Policy.