Skip to content

Commit b479ba2

Browse files
committed
Add more articles.
Signed-off-by: elModo7 <elmodo7yt@gmail.com>
1 parent b6fc6cc commit b479ba2

13 files changed

+225
-57
lines changed

about.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,21 +38,21 @@ <h5 class="widget-user-desc">Software Architect</h5>
3838
</div>
3939
<div class="card-footer p-0">
4040
<ul class="nav flex-column">
41-
<li class="nav-item goWorkProjects">
42-
<a href="#" class="nav-link">
43-
Work Projects <span style="margin-right:2px; margin-top:3px" class="float-right badge bg-primary">+25</span>
44-
</a>
45-
</li>
4641
<li class="nav-item goPersonalProjects">
4742
<a href="#" class="nav-link">
48-
Personal Projects <span style="margin-right:2px; margin-top:3px" class="float-right badge bg-info">+100</span>
43+
<b>Personal Projects </b><span style="margin-right:2px; margin-top:3px" class="float-right badge bg-info">+100</span>
4944
</a>
5045
</li>
5146
<li class="nav-item goPills">
5247
<a href="#" class="nav-link">
5348
<b>Pills </b><span style="margin-right:2px; margin-top:3px" class="float-right badge bg-success">+100</span>
5449
</a>
5550
</li>
51+
<li class="nav-item goWorkProjects">
52+
<a href="#" class="nav-link">
53+
Work Projects <span style="margin-right:2px; margin-top:3px" class="float-right badge bg-primary">+25</span>
54+
</a>
55+
</li>
5656
<li class="nav-item">
5757
<b><a class="nav-link" onclick="copyMail()"> <!-- href="mailto:martinez.picardo.victor@gmail.com" target="_blank" -->
5858
<span style="margin-right:2px; margin-top:3px" class="float-left badge bg-danger"><i class="fas fa-envelope"></i></span>

common/menu.html

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,26 @@
1818
<p>ABOUT ME</p>
1919
</a>
2020
</li>
21-
<li class="nav-item">
22-
<a href="#" id="btn_work_projects" class="nav-link text-info">
23-
<i class="fas fa-briefcase nav-icon"></i>
24-
<p>WORK PROJECTS</p>
25-
</a>
26-
</li>
2721
<li class="nav-item">
2822
<a href="#" id="btn_personal_projects" class="nav-link text-warning">
2923
<i class="fas fa-project-diagram nav-icon"></i>
3024
<p>PERSONAL PROJECTS</p>
3125
</a>
3226
</li>
3327
<li class="nav-item">
34-
<a href="#" id="btn_pills" class="nav-link">
28+
<a href="#" id="btn_pills" class="nav-link text-success">
3529
<i class="fas fa-poll-h nav-icon"></i>
3630
<p>PILLS - SNIPPETS</p>
3731
</a>
3832
</li>
3933
<li class="nav-item">
40-
<a href="#" id="btn_upcoming_content" class="nav-link text-success">
34+
<a href="#" id="btn_work_projects" class="nav-link text-info">
35+
<i class="fas fa-briefcase nav-icon"></i>
36+
<p>WORK PROJECTS</p>
37+
</a>
38+
</li>
39+
<li class="nav-item">
40+
<a href="#" id="btn_upcoming_content" class="nav-link" style="color:#fd7e14">
4141
<i class="fas fa-rss-square nav-icon"></i>
4242
<p>CONTENT LOG</p>
4343
</a>

personal_projects/ram_optimizer.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,5 +85,7 @@ <h3>💻 Explaining the main 3 functions:</h3>
8585
; Finally, call 'EmptyWorkingSet' on the current process (-1) to clean up its memory.
8686
return DllCall("psapi.dll\EmptyWorkingSet", "ptr", -1)
8787
}</code></pre>
88+
<br>
89+
<lite-youtube videoid="saVLW6He1Ns"></lite-youtube>
8890
</div>
8991
</div>
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
<!-- https://elmodo7.github.io/?article=pills/ssh_successful_login_log.html&title=Monitor%3Cb%3ESSH%20Logins%3C/b%3E&description=Get%20a%20%3Ci%3Efiltered%20log%20of%20all%20%3Cb%3Esuccessful%20logins%3C/b%3E%20on%20your%20Unix%20devices. -->
2+
<div>
3+
<div>
4+
<br>
5+
<h2>A bit of context</h2>
6+
<p>
7+
In this small pill we will be <b>monitoring both successful logins and failed attempts</b> towards our Linux server.<br>
8+
Generally speaking we want to monitor <b>exposed servers</b> that offer some sort of remote shell, like SSH.<br>
9+
I will be basing this article on <b>Debian</b> and <b>OpenSSH Server</b>, but it should be pretty similar to most distros like Ubuntu, Linux Mint...
10+
<br><br>
11+
Our logs are placed under <i>"/var/log"</i>, specifically:
12+
<pre class="col-md-12"><code class="language-clike">/var/log/auth.log</code></pre>
13+
<br>
14+
<h3><b>Monitoring Successful Logins</b></h3>
15+
<pre class="col-md-12"><code class="language-clike">zgrep sshd /var/log/auth.log* -h | grep -F 'Accepted'</code></pre>
16+
</p>
17+
<p>This command is used to search through system log files to display logs of accepted SSH session logins. Let’s break it down step by step:</p>
18+
19+
<ol>
20+
<li>
21+
<strong><code>zgrep</code></strong>
22+
<ul>
23+
<li><code>zgrep</code> is a command-line utility that works like <code>grep</code>, but it can search through both compressed (e.g., <code>.gz</code>) and uncompressed files.</li>
24+
<li>In this case, it looks for occurrences of the term <strong><code>sshd</code></strong> (the SSH daemon) in the specified log files.</li>
25+
</ul>
26+
</li>
27+
<li>
28+
<strong><code>/var/log/auth.log*</code></strong>
29+
<ul>
30+
<li>This specifies the log files to search.</li>
31+
<li><code>auth.log</code> is a common log file that stores authentication-related logs (like SSH login attempts).</li>
32+
<li>The <code>*</code> allows the command to search through all files that match the pattern, including older or compressed versions (e.g., <code>auth.log.1</code>, <code>auth.log.2.gz</code>, etc.).</li>
33+
</ul>
34+
</li>
35+
<li>
36+
<strong><code>-h</code></strong>
37+
<ul>
38+
<li>The <code>-h</code> option suppresses the printing of file names in the output. This is useful when multiple files are searched, and you only care about the log content, not which file it came from.</li>
39+
</ul>
40+
</li>
41+
<li>
42+
<strong><code>|</code> (Pipe)</strong>
43+
<ul>
44+
<li>The pipe sends the output of the first command (<code>zgrep sshd</code>) as input to the next command (<code>grep -F 'Accepted'</code>).</li>
45+
</ul>
46+
</li>
47+
<li>
48+
<strong><code>grep -F 'Accepted'</code></strong>
49+
<ul>
50+
<li><code>grep</code> searches for lines containing the literal string <strong><code>Accepted</code></strong>.</li>
51+
<li>The <code>-F</code> option tells <code>grep</code> to interpret the search string literally (not as a regular expression).</li>
52+
</ul>
53+
</li>
54+
</ol>
55+
56+
<p><strong>Purpose:</strong><br>
57+
The full command filters logs to show entries where the SSH daemon (<code>sshd</code>) indicates an <strong>accepted login attempt</strong>, i.e., successful SSH authentications.</p>
58+
59+
<p><strong>Example Output:</strong><br>
60+
You might see output like this:</p>
61+
62+
<pre class="col-md-12"><code class="language-clike">Jan 27 12:45:23 server-name sshd[12345]: Accepted password for user1 from 192.168.1.100 port 54321 ssh2
63+
Jan 27 14:12:34 server-name sshd[12346]: Accepted publickey for user2 from 10.0.0.200 port 59876 ssh2</code></pre>
64+
65+
<p>This output tells you:</p>
66+
<ul>
67+
<li>The date and time of the login.</li>
68+
<li>The user who logged in.</li>
69+
<li>The IP address from which they connected.</li>
70+
<li>The authentication method (e.g., <code>password</code> or <code>publickey</code>).</li>
71+
</ul>
72+
73+
Here is an real example from my ODROID-XU4:
74+
<br><img class="shadow-lg article-inner-image" src="static/img/pills/ssh_successful_login_log/ssh_successful_attempts.jpg"></img><br>
75+
<br><br>
76+
<h3><b>Monitoring Failed Login Attempts</b></h3>
77+
*While the previous section was mainly my own usage, I found a <b>great source</b> for monitoring failed attempts and <i>this part of the article takes a lot of references</i> from it:<br>
78+
<a href="https://www.tecmint.com/find-failed-ssh-login-attempts-in-linux/">Tecmint Article: Find failed ssh login attepts in linux</a><br><br>
79+
<h4>Listing All Failed SSH Login Attempts</h4>
80+
The simplest way of listing all failed login attempts:
81+
<pre class="col-md-12"><code class="language-clike"># grep "Failed password" /var/log/auth.log</code></pre>
82+
The same result could be achieved by using cat command:
83+
<pre class="col-md-12"><code class="language-clike"># cat /var/log/auth.log | grep "Failed password"</code></pre>
84+
<br><img class="shadow-lg article-inner-image" src="static/img/pills/ssh_successful_login_log/List-All-Failed-SSH-Login-Attempts.png"></img><br>
85+
<br><br>
86+
<h4>Capturing extra information</h4>
87+
In order to display extra information about the failed SSH logins, issue the command as shown in the below example.
88+
<pre class="col-md-12"><code class="language-clike"># egrep "Failed|Failure" /var/log/auth.log</code></pre>
89+
<br><img class="shadow-lg article-inner-image" src="static/img/pills/ssh_successful_login_log/Find-Failed-SSH-Logins.png"></img><br>
90+
<br><br>
91+
<h4>Capturing the IP Address of the issuer</h4>
92+
To display a list of all IP addresses that tried and failed to log in to the SSH server alongside the number of failed attempts of each IP address, issue the below command.
93+
<pre class="col-md-12"><code class="language-clike"># grep "Failed password" /var/log/auth.log | awk ‘{print $11}’ | uniq -c | sort -nr</code></pre>
94+
<br><img class="shadow-lg article-inner-image" src="static/img/pills/ssh_successful_login_log/Find-IP-Addresses-SSH-Failed-Logins.png"></img><br>
95+
<br><h5>Command Breakdown</h5>
96+
<ul>
97+
<li>
98+
<strong>grep "Failed password" /var/log/auth.log</strong>:
99+
Searches the <code>/var/log/auth.log</code> file for lines containing the phrase <em>"Failed password"</em>. These lines typically indicate failed SSH login attempts.
100+
</li>
101+
<li>
102+
<strong>awk '{print $11}'</strong>:
103+
Extracts the 11th field from each line. In failed login log entries, the 11th field usually contains the IP address of the machine attempting to log in.
104+
</li>
105+
<li>
106+
<strong>uniq -c</strong>:
107+
Counts the number of occurrences of each unique IP address.
108+
</li>
109+
<li>
110+
<strong>sort -nr</strong>:
111+
Sorts the output in numeric, reverse order so that IPs with the highest number of failed attempts appear first.
112+
</li>
113+
</ul>
114+
<br><br>
115+
<h4>Using journalctl to retrieve real time attempts</h4>
116+
<pre class="col-md-12"><code class="language-clike"># journalctl _SYSTEMD_UNIT=ssh.service | egrep "Failed|Failure"</code></pre>
117+
<br><img class="shadow-lg article-inner-image" src="static/img/pills/ssh_successful_login_log/Find-Real-Time-Failed-SSH-Logins-768x402.png"></img><br>
118+
<br>
119+
<h5>Command Breakdown</h5>
120+
<ul>
121+
<li>
122+
<strong>journalctl _SYSTEMD_UNIT=ssh.service</strong>:
123+
Queries the system logs for entries specifically related to the <code>ssh.service</code>. The <code>_SYSTEMD_UNIT</code> filter ensures that only logs generated by the SSH service are included.
124+
</li>
125+
<li>
126+
<strong>|</strong> (pipe):
127+
Passes the output of the <code>journalctl</code> command as input to the next command.
128+
</li>
129+
<li>
130+
<strong>egrep "Failed|Failure"</strong>:
131+
Searches the logs for lines containing the words <em>"Failed"</em> or <em>"Failure"</em>. This extended regular expression (<code>egrep</code>) helps pinpoint entries related to failed login attempts or failures in SSH connections.
132+
</li>
133+
</ul>
134+
</div>
135+
</div>

static/data/personal_projects.json

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@
262262
"name": "Linux"
263263
},
264264
{
265-
"color": "badge-dark",
265+
"color": "badge-danger",
266266
"name": "Java"
267267
},
268268
{
@@ -320,8 +320,8 @@
320320
"html",
321321
"css"
322322
],
323-
"title": "<b>NVM GUI</b>",
324-
"url": "https://github.com/elModo7/NVM_GUI-win",
323+
"title": "<b>NVM Graphical</b>",
324+
"url": "https://github.com/elModo7/nvm-windows-graphical",
325325
"page": ""
326326
},
327327
{
@@ -431,5 +431,44 @@
431431
"title": "<b>AHK Code Generator</b>",
432432
"url": "",
433433
"page": "personal_projects/script_generator/article.html"
434+
},
435+
{
436+
"badges": [
437+
{
438+
"color": "badge-primary",
439+
"name": "Windows"
440+
},
441+
{
442+
"color": "badge-dark",
443+
"name": "AHK"
444+
},
445+
{
446+
"color": "badge-dark",
447+
"name": "HTML"
448+
},
449+
{
450+
"color": "badge-dark",
451+
"name": "CSS"
452+
},
453+
{
454+
"color": "badge-dark",
455+
"name": "JS"
456+
}
457+
],
458+
"date": "2024/12/12",
459+
"description": "Control your PC from your phone or another PC",
460+
"id": 10,
461+
"img": "static/img/pills/multimedia_web_remote.png",
462+
"tags": [
463+
"ahk",
464+
"windows",
465+
"web",
466+
"html",
467+
"css",
468+
"js"
469+
],
470+
"title": "Multimedia <b>Web Controller</b>",
471+
"url": "https://www.youtube.com/shorts/DvuWoBrmtik",
472+
"page": ""
434473
}
435474
]

static/data/pills.json

Lines changed: 32 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -62,45 +62,6 @@
6262
"title": "<b>Remove Flickering</b> from GUIs",
6363
"url": "https://www.autohotkey.com/boards/viewtopic.php?style=10&p=337653",
6464
"page": ""
65-
},
66-
{
67-
"badges": [
68-
{
69-
"color": "badge-primary",
70-
"name": "Windows"
71-
},
72-
{
73-
"color": "badge-dark",
74-
"name": "AHK"
75-
},
76-
{
77-
"color": "badge-dark",
78-
"name": "HTML"
79-
},
80-
{
81-
"color": "badge-dark",
82-
"name": "CSS"
83-
},
84-
{
85-
"color": "badge-dark",
86-
"name": "JS"
87-
}
88-
],
89-
"date": "2024/07/27",
90-
"description": "Control your PC from your phone or another PC",
91-
"id": 2,
92-
"img": "static/img/pills/multimedia_web_remote.png",
93-
"tags": [
94-
"ahk",
95-
"windows",
96-
"web",
97-
"html",
98-
"css",
99-
"js"
100-
],
101-
"title": "Multimedia <b>Web Controller</b>",
102-
"url": "https://www.youtube.com/shorts/DvuWoBrmtik",
103-
"page": ""
10465
},
10566
{
10667
"badges": [
@@ -123,7 +84,7 @@
12384
],
12485
"date": "2024/07/28",
12586
"description": "Reverse VNC + FTP from poisoned autoinstall USB drivers",
126-
"id": 3,
87+
"id": 2,
12788
"img": "static/img/pills/badusb_rubberducky.jpg",
12889
"ribbon": {
12990
"color": "bg-danger",
@@ -138,5 +99,36 @@
13899
"title": "Malduino <b>BadUSB</b>",
139100
"url": "https://www.youtube.com/watch?v=EZBDRhWpYvM",
140101
"page": ""
102+
},
103+
{
104+
"badges": [
105+
{
106+
"color": "badge-dark",
107+
"name": "SSH"
108+
},
109+
{
110+
"color": "badge-dark",
111+
"name": "Linux"
112+
}
113+
],
114+
"date": "2025/01/27",
115+
"description": "Get a <i>filtered log</i> of all <b>successful logins</b> on your Unix devices.",
116+
"id": 3,
117+
"img": "static/img/pills/ssh_successful_login_log.jpg",
118+
"ribbon": {
119+
"color": "bg-info",
120+
"name": "SYSADMIN"
121+
},
122+
"tags": [
123+
"sys",
124+
"sysadmin",
125+
"networking",
126+
"cybersecurity",
127+
"linux",
128+
"ssh"
129+
],
130+
"title": "Monitor <b>SSH Logins</b>",
131+
"url": "",
132+
"page": "pills/ssh_successful_login_log.html"
141133
}
142134
]

static/img/base_img/ssh_base.png

69.5 KB
Loading
39.4 KB
Loading
4.49 KB
Loading
811 Bytes
Loading

0 commit comments

Comments
 (0)