Some small color and typeface changes

This commit is contained in:
2025-11-13 01:40:04 +01:00
parent bea033816c
commit bccb0cda2e
4 changed files with 27 additions and 24 deletions
+5 -3
View File
@@ -14,6 +14,7 @@ After getting my hands on these files I decided that I will try to parse and ana
# Data # Data
The dataset (fail2ban.log file) consists of relatively simple and understandable logs. Here is a snippet of the average log section: The dataset (fail2ban.log file) consists of relatively simple and understandable logs. Here is a snippet of the average log section:
```txt ```txt
// I will not be exposing the IP addresses for obvious reasons // I will not be exposing the IP addresses for obvious reasons
2025-10-25 17:04:35,850 fail2ban.filter [77278]: INFO [sshd] Found xxx.xxx.xxx.xxx - 2025-10-25 17:04:35 2025-10-25 17:04:35,850 fail2ban.filter [77278]: INFO [sshd] Found xxx.xxx.xxx.xxx - 2025-10-25 17:04:35
@@ -54,7 +55,7 @@ type Logs struct {
These are the key value fields we will want to fill with the information from the log file. The log file is read with golangs `os` and `bufio` packages. With these we open the log file and pass it to a scanner instance. The scanner then gives us a multitude of functions to handle the reading of the file. These are the key value fields we will want to fill with the information from the log file. The log file is read with golangs `os` and `bufio` packages. With these we open the log file and pass it to a scanner instance. The scanner then gives us a multitude of functions to handle the reading of the file.
The most simple way is to create a for loop like this: The most simple way is to create a for loop like this:
```golang ```go
for scanner.Scan() { for scanner.Scan() {
line := scanner.Text() line := scanner.Text()
@@ -66,7 +67,7 @@ for scanner.Scan() {
This ensures that in each iteration of the loop, the `line` variable is given the next row until none are available. `line` now contains a row from the log file. This ensures that in each iteration of the loop, the `line` variable is given the next row until none are available. `line` now contains a row from the log file.
Now comes the parsing. I have decided that I hate myself and that I will use Regex Expressions in order to find and extract the usual values in the fail2ban logs. For this I defined a Regex Expression for each of the above mentioned json tags, these being[^2]: Now comes the parsing. I have decided that I hate myself and that I will use Regex Expressions in order to find and extract the usual values in the fail2ban logs. For this I defined a Regex Expression for each of the above mentioned json tags, these being[^2]:
```golang ```go
// For (probably much) better efficiency these expressions can be grouped into one large expression with matching groups for each field. // For (probably much) better efficiency these expressions can be grouped into one large expression with matching groups for each field.
// Because I do not like Regex, I will not do this. // Because I do not like Regex, I will not do this.
dateRegex, _ := regexp.Compile(`\d{4}-\d{2}-\d{2}`) dateRegex, _ := regexp.Compile(`\d{4}-\d{2}-\d{2}`)
@@ -106,7 +107,8 @@ And there we go, I have written a very simple fail2ban log to json parser. From
## Analysing ## Analysing
In order to analyse the data we have collected, I will read our json file containing all the logs and creating a new file which aggregates the different log messages by IP Address. This means we will create a new struct which looks like this: In order to analyse the data we have collected, I will read our json file containing all the logs and creating a new file which aggregates the different log messages by IP Address. This means we will create a new struct which looks like this:
```golang
```go
type StatsByIp struct { type StatsByIp struct {
IpAddress string `json:"ipAddress"` IpAddress string `json:"ipAddress"`
TotalLogs int `json:"totalLogs"` TotalLogs int `json:"totalLogs"`
+2
View File
@@ -22,6 +22,8 @@ Welche Rechte haben Sie? Sie haben jederzeit das Recht, unentgeltlich Auskunft
# Allgemeine Hinweise und Pflichtinformationen # Allgemeine Hinweise und Pflichtinformationen
<br>
## Datenschutz ## Datenschutz
Ich behandle Ihre personenbezogenen Daten vertraulich und entsprechend der gesetzlichen Datenschutzvorschriften sowie dieser Datenschutzerklärung. Ich behandle Ihre personenbezogenen Daten vertraulich und entsprechend der gesetzlichen Datenschutzvorschriften sowie dieser Datenschutzerklärung.
+5 -4
View File
@@ -1,10 +1,11 @@
<style> <style>
#typedText::after { #typedText::after {
content: "|"; content: "|";
animation: blink 0.7s infinite; animation: blink 1s infinite;
font-weight: bolder;
} }
@keyframes blink { @keyframes blink {
50% { opacity: 0; } 60% { opacity: 0; }
} }
</style> </style>
@@ -18,7 +19,7 @@ document.addEventListener("DOMContentLoaded", function () {
if (index < text.length) { if (index < text.length) {
element.textContent += text.charAt(index); element.textContent += text.charAt(index);
index++; index++;
setTimeout(type, 120); setTimeout(type, 256);
} }
} }
+15 -17
View File
@@ -20,7 +20,7 @@
--font-weight-regular: 400; --font-weight-regular: 400;
--font-weight-bold: 600; --font-weight-bold: 600;
--max-width: 700px; --max-width: 70ch;
--padding-page: 1rem; --padding-page: 1rem;
font-feature-settings: 'liga' 1, 'calt' 1; font-feature-settings: 'liga' 1, 'calt' 1;
@@ -46,13 +46,13 @@ main h1, main h2, main h3, main h4 {
font-weight: var(--font-weight-bold); font-weight: var(--font-weight-bold);
line-height: 1.8; line-height: 1.8;
display: inline; display: inline;
/*background-image: linear-gradient(120deg, #E45420 0%, #E87045 100%);*/
background-repeat: no-repeat;
background-size: 100% 0.6em;
background-position: 0 88%;
transition: background-size 0.5s ease;
} }
main h1 { font-size: 1.8rem; }
main h2 { font-size: 1.6rem; }
main h3 { font-size: 1.4rem; }
main h4 { font-size: 1.2rem; }
a { a {
color: var(--link); color: var(--link);
text-decoration: underline; text-decoration: underline;
@@ -296,14 +296,13 @@ code {
white-space: nowrap; white-space: nowrap;
} }
.chroma .k { color: #ff79c6; } /* Keywords */ .chroma .k { color: #ff9349; }
.chroma .s { color: #f1fa8c; } /* Strings */ .chroma .s { color: #b8e3b7; }
.chroma .n { color: #f8f8f2; } /* Names */ .chroma .c { color: #737983; font-style: italic; }
.chroma .p { color: #bd93f9; } /* Punctuation */ .chroma .m { color: #eacaa6; }
.chroma .c { color: #6272a4; font-style: italic; } /* Comments */ .chroma .o { color: #e1e5ec; }
.chroma .m { color: #8be9fd; } /* Numbers */ .chroma .kt { color: #9bb8ff; }
.chroma .o { color: #ffb86c; } /* Operators */
.chroma .err { color: #ff5555; background: #2e2e2e; } /* Errors */
/* ---------- Landing Page ---------- */ /* ---------- Landing Page ---------- */
@@ -313,13 +312,12 @@ code {
justify-content: center; justify-content: center;
align-items: center; align-items: center;
text-align: center; text-align: center;
min-height: 70vh; min-height: 55vh;
} }
.landing-welcome h1 { .landing-welcome h1 {
font-size: 2.5rem; font-size: 2.5rem;
/*font-weight: 300;*/ margin-bottom: 25px;
margin-bottom: 40px;
} }
.landing-links { .landing-links {