Giter Site home page Giter Site logo

password-spray-logmonitor's Introduction

Monitor Failed Logins for Password Spraying

A very basic Bash script to monitor for password spraying attacks. The script tallies a count of failed login attempts for all users and datetime stamps of the last failed logins.

This is mainly a personal exercise in shell scripting. Log monitoring can be a relatively weak approach for protection when compared to preventative controls such as fail2ban.

The script is not efficient as it stands. A work in progress.

Core Commands Used

A list of usernames is grep'd from the /etc/passwd file. The script filters user from system accounts based on UID. This can easily be replaced with something like getent which could be configured to return usernames of users within LDAP, for example.

Failed login attempts are extracted from the /var/log/btmp logfile using the lastb command, remembering to pass the -w option to return the username in full for matching to the list of usernames described above.

General Usage

As the script is reading from /etc/passwd and /var/log/btmp it requires sudo privileges in order to run.

THe script could be run using something like the watch command.

E.g. >$ sudo watch ./passwordFailsMonitor.sh (by default will re-run the script every two seconds)

Built With

Authors

password-spray-logmonitor's People

Contributors

andrewhoulbrook avatar

Watchers

James Cloos avatar

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.