<commit_before>secure
======

Python program that keeps an eye on `/var/log/secure` and reports "Failed password" attempts.

Features:
--------
* Checks the file `/var/log/secure` every minute for new occurrence of **Failed password** message(s).
* If new attempt is found, it stores details in the SQLite database.
* After adding details to the database, it raises a desktop notification informing the user about the break-in attempt.

Requirements:
------------
To obtain expected results using `secure`, you need to configure `rsyslog` to log dates compatible with RFC 3146. This is because by default `rsyslog` doesn't log year in the messages. To enable RFC 3146 compatibility, comment out below line from `/etc/rsyslog.conf`:
~~~
$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat
~~~
and add below two lines:
~~~
$template RFC3164fmt,"<%PRI%>%TIMESTAMP% %HOSTNAME% %syslogtag%%msg%"
*.* /var/log/all-messages.log;ExampleFormat"
~~~
<commit_msg>Modified README.md to include usage of the script<commit_after>secure
======

Python program that keeps an eye on `/var/log/secure` and reports "Failed password" attempts.

Features:
--------
* Checks the file `/var/log/secure` every minute for new occurrence of **Failed password** message(s).
* If new attempt is found, it stores details in the SQLite database.
* After adding details to the database, it raises a desktop notification informing the user about the break-in attempt.

Requirements:
------------
To obtain expected results using `secure`, you need to configure `rsyslog` to log dates compatible with RFC 3146. This is because by default `rsyslog` doesn't log year in the messages. To enable RFC 3146 compatibility, comment out below line from `/etc/rsyslog.conf`:
~~~
$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat
~~~
and add below two lines:
~~~
$template RFC3164fmt,"<%PRI%>%TIMESTAMP% %HOSTNAME% %syslogtag%%msg%"
*.* /var/log/all-messages.log;ExampleFormat"
~~~

Usage:
------
~~~
$python secure.py
~~~

{'fraction_non_alphanumeric': 0.1245605223505776, 'fraction_numerical': 0.012054244098442994, 'mean_word_length': 4.548746518105849, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2691445', 'n_tokens_mistral': 595, 'n_tokens_neox': 546, 'n_words': 234}