mirror of
https://github.com/agresdominik/website.git
synced 2026-04-21 18:05:53 +00:00
Some small color and typeface changes
This commit is contained in:
@@ -14,6 +14,7 @@ After getting my hands on these files I decided that I will try to parse and ana
|
||||
# Data
|
||||
|
||||
The dataset (fail2ban.log file) consists of relatively simple and understandable logs. Here is a snippet of the average log section:
|
||||
|
||||
```txt
|
||||
// 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
|
||||
@@ -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.
|
||||
The most simple way is to create a for loop like this:
|
||||
|
||||
```golang
|
||||
```go
|
||||
for scanner.Scan() {
|
||||
|
||||
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.
|
||||
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.
|
||||
// Because I do not like Regex, I will not do this.
|
||||
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
|
||||
|
||||
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 {
|
||||
IpAddress string `json:"ipAddress"`
|
||||
TotalLogs int `json:"totalLogs"`
|
||||
|
||||
@@ -22,6 +22,8 @@ Welche Rechte haben Sie? Sie haben jederzeit das Recht, unentgeltlich Auskunft
|
||||
|
||||
# Allgemeine Hinweise und Pflichtinformationen
|
||||
|
||||
<br>
|
||||
|
||||
## Datenschutz
|
||||
|
||||
Ich behandle Ihre personenbezogenen Daten vertraulich und entsprechend der gesetzlichen Datenschutzvorschriften sowie dieser Datenschutzerklärung.
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
<style>
|
||||
#typedText::after {
|
||||
content: "|";
|
||||
animation: blink 0.7s infinite;
|
||||
content: "|";
|
||||
animation: blink 1s infinite;
|
||||
font-weight: bolder;
|
||||
}
|
||||
@keyframes blink {
|
||||
50% { opacity: 0; }
|
||||
60% { opacity: 0; }
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -18,7 +19,7 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
if (index < text.length) {
|
||||
element.textContent += text.charAt(index);
|
||||
index++;
|
||||
setTimeout(type, 120);
|
||||
setTimeout(type, 256);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+15
-17
@@ -20,7 +20,7 @@
|
||||
--font-weight-regular: 400;
|
||||
--font-weight-bold: 600;
|
||||
|
||||
--max-width: 700px;
|
||||
--max-width: 70ch;
|
||||
--padding-page: 1rem;
|
||||
|
||||
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);
|
||||
line-height: 1.8;
|
||||
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 {
|
||||
color: var(--link);
|
||||
text-decoration: underline;
|
||||
@@ -296,14 +296,13 @@ code {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.chroma .k { color: #ff79c6; } /* Keywords */
|
||||
.chroma .s { color: #f1fa8c; } /* Strings */
|
||||
.chroma .n { color: #f8f8f2; } /* Names */
|
||||
.chroma .p { color: #bd93f9; } /* Punctuation */
|
||||
.chroma .c { color: #6272a4; font-style: italic; } /* Comments */
|
||||
.chroma .m { color: #8be9fd; } /* Numbers */
|
||||
.chroma .o { color: #ffb86c; } /* Operators */
|
||||
.chroma .err { color: #ff5555; background: #2e2e2e; } /* Errors */
|
||||
.chroma .k { color: #ff9349; }
|
||||
.chroma .s { color: #b8e3b7; }
|
||||
.chroma .c { color: #737983; font-style: italic; }
|
||||
.chroma .m { color: #eacaa6; }
|
||||
.chroma .o { color: #e1e5ec; }
|
||||
.chroma .kt { color: #9bb8ff; }
|
||||
|
||||
|
||||
/* ---------- Landing Page ---------- */
|
||||
|
||||
@@ -313,13 +312,12 @@ code {
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
text-align: center;
|
||||
min-height: 70vh;
|
||||
min-height: 55vh;
|
||||
}
|
||||
|
||||
.landing-welcome h1 {
|
||||
font-size: 2.5rem;
|
||||
/*font-weight: 300;*/
|
||||
margin-bottom: 40px;
|
||||
margin-bottom: 25px;
|
||||
}
|
||||
|
||||
.landing-links {
|
||||
|
||||
Reference in New Issue
Block a user