<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Amina Akai on Medium]]></title>
        <description><![CDATA[Stories by Amina Akai on Medium]]></description>
        <link>https://medium.com/@aminaxakai?source=rss-0d3163c6c125------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*O0sMEWFUPsxsbhml</url>
            <title>Stories by Amina Akai on Medium</title>
            <link>https://medium.com/@aminaxakai?source=rss-0d3163c6c125------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 23:46:47 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@aminaxakai/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Building a Real-Time Intrusion Detection Email Alert System with Suricata and Python]]></title>
            <link>https://medium.com/@aminaxakai/building-a-real-time-intrusion-detection-email-alert-system-with-suricata-and-python-06b2f8ce9d6f?source=rss-0d3163c6c125------2</link>
            <guid isPermaLink="false">https://medium.com/p/06b2f8ce9d6f</guid>
            <dc:creator><![CDATA[Amina Akai]]></dc:creator>
            <pubDate>Wed, 29 Oct 2025 14:32:29 GMT</pubDate>
            <atom:updated>2025-10-29T14:32:29.372Z</atom:updated>
            <content:encoded><![CDATA[<p><em>A beginner-friendly cybersecurity project: get email alerts when Suricata detects suspicious traffic.</em></p><p>I built a small project that watches Suricata alerts (from eve.json) and emails them to me using a Python script and Gmail App Passwords. This tutorial covers everything end-to-end: installing Suricata, generating alerts, creating a Gmail app password, the Python tailer script, running it safely, troubleshooting common errors, and next improvements.</p><h3>Why do this project?</h3><p>Suricata is a powerful open-source IDS/IPS that analyzes network traffic. For a home lab or small security project, automatically pushing alerts to your email is an excellent way to learn:</p><ul><li>how Suricata logs alerts,</li><li>how to parse JSON logs in real time,</li><li>how to securely send email from scripts (Gmail App Password),</li><li>and how to automate monitoring using system services.</li></ul><h3>What you’ll build</h3><ul><li>Suricata installed on Kali Linux writing eve.json alerts.</li><li>A Python script that tails eve.json, detects alert events, and sends email via Gmail.</li><li>A secure .env file to store SMTP credentials (use App Passwords — never store real passwords in public repos).</li></ul><h3>Prerequisites</h3><ul><li>Kali Linux (or Debian/Ubuntu). You should have sudo access.</li><li>suricata installed and running. (If not installed, see &quot;Install Suricata&quot; below.)</li><li>Basic familiarity with the terminal and a text editor (nano/vim).</li><li>A Gmail account with <strong>2-Step Verification</strong> enabled so you can create an <strong>App Password</strong>.</li></ul><h3>1) Install Suricata (quick)</h3><p>If you don’t already have Suricata:</p><pre>sudo apt update &amp;&amp; sudo apt upgrade -y<br>sudo apt install -y suricata</pre><p>enable and start:</p><pre>cd /etc/suricata</pre><pre>sudo suricata -c /etc/suricata/suricata.yaml -i eth</pre><p>View the logs in real-time:</p><pre>sudo tail -f /var/log/suricata/fast.log</pre><p>Suricata writes detailed events to /var/log/suricata/eve.json (if eve output is enabled in suricata.yaml). The script in this tutorial watches that file.</p><h3>2) Create a Gmail App Password (mandatory)</h3><p>Google no longer allows plain username/password for SMTP from scripts. You must:</p><ol><li>Enable <strong>2-Step Verification</strong> for your Google account.</li><li>Go to <strong>Security → App passwords</strong> in your Google Account.</li><li>Generate a new app password: choose <em>Mail</em> (or <em>Other</em>), name it e.g. SuricataMailer, and copy the <strong>16-character</strong> password.</li></ol><blockquote><strong><em>Security note:</em></strong><em> Treat the app password like a secret. Don’t post it publicly.</em></blockquote><h3>3) The Python mailer — what it does</h3><p>The Python script:</p><ul><li>tails /var/log/suricata/eve.json (handles log rotation),</li><li>reads new JSON lines,</li><li>filters for event_type == &quot;alert&quot;,</li><li>builds a readable email and sends it via SMTP to your inbox,</li><li>uses environment variables for credentials (loaded from a .env file).</li></ul><p>Create the working directory:</p><pre>sudo mkdir -p /opt/suricata_alert_mailer<br>sudo chown $USER:$USER /opt/suricata_alert_mailer<br>cd /opt/suricata_alert_mailer</pre><p>Create the file /opt/suricata_alert_mailer/suricata_mailer.py and paste this script:</p><pre>#!/usr/bin/env python3<br># suricata_mailer.py - Simple Suricata -&gt; Gmail mailerimport os<br><br>import time<br>import json<br>import smtplib<br>import email.utils<br>from email.mime.text import MIMEText<br>from pathlib import Path<br><br># Config from environment<br><br>EVE_FILE = os.getenv(&quot;EVE_FILE&quot;, &quot;/var/log/suricata/eve.json&quot;)<br>SMTP_HOST = os.getenv(&quot;SMTP_HOST&quot;, &quot;smtp.gmail.com&quot;)<br>SMTP_PORT = int(os.getenv(&quot;SMTP_PORT&quot;, &quot;587&quot;))<br>SMTP_USER = os.getenv(&quot;SMTP_USER&quot;, &quot;&quot;)<br>SMTP_PASS = os.getenv(&quot;SMTP_PASS&quot;, &quot;&quot;)<br>FROM_ADDR = os.getenv(&quot;FROM_ADDR&quot;, SMTP_USER)<br>TO_ADDR = os.getenv(&quot;TO_ADDR&quot;, &quot;&quot;)<br>POLL_INTERVAL = float(os.getenv(&quot;POLL_INTERVAL&quot;, &quot;1.0&quot;))<br>seen = set()<br><br>def send_mail(subject: str, body: str):<br>    msg = MIMEText(body)<br>    msg[&quot;From&quot;] = FROM_ADDR<br>    msg[&quot;To&quot;] = TO_ADDR<br>    msg[&quot;Date&quot;] = email.utils.formatdate(localtime=True)<br>    msg[&quot;Subject&quot;] = subject<br>    with smtplib.SMTP(SMTP_HOST, SMTP_PORT, timeout=20) as s:<br>        s.ehlo()<br>        if SMTP_PORT == 587:<br>            s.starttls()<br>            s.ehlo()<br>        if SMTP_USER and SMTP_PASS:<br>            s.login(SMTP_USER, SMTP_PASS)<br>        s.sendmail(FROM_ADDR, [TO_ADDR], msg.as_string())<br><br>def handle_alert(evt):<br>    alert = evt.get(&quot;alert&quot;, {})<br>    src = evt.get(&quot;src_ip&quot;, &quot;&quot;) or evt.get(&quot;src_addr&quot;, &quot;&quot;)<br>    src_port = evt.get(&quot;src_port&quot;, &quot;&quot;)<br>    dst = evt.get(&quot;dest_ip&quot;, &quot;&quot;) or evt.get(&quot;dest_addr&quot;, &quot;&quot;)<br>    dst_port = evt.get(&quot;dest_port&quot;, &quot;&quot;)<br>    proto = evt.get(&quot;proto&quot;, &quot;&quot;)<br>    timestamp = evt.get(&quot;timestamp&quot;, &quot;&quot;)<br>    signature = alert.get(&quot;signature&quot;, &quot;no-signature&quot;)<br>    sid = alert.get(&quot;signature_id&quot;, alert.get(&quot;sid&quot;, &quot;&quot;))<br>    gid = alert.get(&quot;gid&quot;, &quot;&quot;)<br>    priority = alert.get(&quot;priority&quot;, &quot;N/A&quot;)<br><br>    # dedupe: simple per-event key (adjust as needed)<br><br>    dedupe_key = f&quot;{timestamp}|{signature}|{sid}|{src}|{dst}|{evt.get(&#39;flow_id&#39;,&#39;&#39;)}&quot;<br>    if dedupe_key in seen:<br>        return<br>    seen.add(dedupe_key)<br>    if len(seen) &gt; 20000:<br>        seen.clear()<br><br>    subj = f&quot;[Suricata] {signature} (sid:{sid}) {src}-&gt;{dst}&quot;<br>    body_lines = [<br>        f&quot;Time: {timestamp}&quot;,<br>        f&quot;Signature: {signature} (sid:{sid} gid:{gid})&quot;,<br>        f&quot;Priority: {priority}&quot;,<br>        f&quot;Proto: {proto}&quot;,<br>        f&quot;Src: {src}:{src_port}&quot;,<br>        f&quot;Dest: {dst}:{dst_port}&quot;,<br>        &quot;&quot;,<br>        &quot;Full alert JSON:&quot;,<br>        json.dumps(evt, indent=2)<br>    ]<br>    body = &quot;\n&quot;.join(body_lines)<br>    try:<br>        send_mail(subj, body)<br>        print(f&quot;Email sent: {subj}&quot;)<br>    except Exception as e:<br>        print(&quot;Failed to send email:&quot;, e) <br><br>def tail_file(path):<br>    &quot;&quot;&quot;Yield new lines appended to path, handling rotation.&quot;&quot;&quot;<br>    with open(path, &quot;r&quot;, errors=&quot;ignore&quot;) as f:<br>        f.seek(0, os.SEEK_END)<br>        inode = os.fstat(f.fileno()).st_ino<br>        while True:<br>            where = f.tell()<br>            line = f.readline()<br>            if line:<br>                yield line<br>            else:<br>                time.sleep(POLL_INTERVAL)<br>                try:<br>                    if not os.path.exists(path):<br>                        time.sleep(POLL_INTERVAL)<br>                        continue<br>                    st = os.stat(path)<br>                    if st.st_ino != inode:<br>                        # file rotated, reopen<br>                        newf = open(path, &quot;r&quot;, errors=&quot;ignore&quot;)<br>                        f.close()<br>                        f = newf<br>                        inode = os.fstat(f.fileno()).st_ino<br>                        f.seek(0, os.SEEK_END)<br>                        print(&quot;Reopened rotated file&quot;)<br>                    else:<br>                        f.seek(where)<br>                except Exception:<br>                    time.sleep(POLL_INTERVAL)<br>def main():<br>    eve = Path(EVE_FILE)<br>    if not eve.exists():<br>        print(f&quot;Eve file not found: {EVE_FILE}&quot;)<br>        return<br>    print(&quot;Starting suricata mailer, watching:&quot;, EVE_FILE)<br>    for raw in tail_file(str(eve)):<br>        raw = raw.strip()<br>        if not raw:<br>            continue<br>        try:<br>            obj = json.loads(raw)<br>        except json.JSONDecodeError:<br>            continue<br>        if obj.get(&quot;event_type&quot;) == &quot;alert&quot; or &quot;alert&quot; in obj:<br>            handle_alert(obj)<br><br>if __name__ == &quot;__main__&quot;:<br>    main()</pre><p>Then make it executable:</p><pre>chmod +x /opt/suricata_alert_mailer/suricata_mailer.py</pre><h3>4) .env — secure configuration (never commit)</h3><p>Create /opt/suricata_alert_mailer/.env:</p><pre>SMTP_HOST=smtp.gmail.com<br>SMTP_PORT=587<br>SMTP_USER=yourgmail@gmail.com<br>SMTP_PASS=your_16_char_app_password_here<br>FROM_ADDR=yourgmail@gmail.com<br>TO_ADDR=destination@example.com<br>EVE_FILE=/var/log/suricata/eve.json<br></pre><p>Lock file perms:</p><pre>chmod 600 /opt/suricata_alert_mailer/.env</pre><p>Load the variables into your shell <strong>correctly</strong>:</p><pre>cd /opt/suricata_alert_mailer<br>set -a          # export all variables in file<br>source .env<br>set +a</pre><p>Check:</p><pre>echo $SMTP_USER<br>echo $SMTP_PASS</pre><blockquote><em>Common mistake: running </em><em>source .env and the script in one line. Always </em><em>source first so the variables exist in the environment.</em></blockquote><h3>5) Run the mailer and generate test alerts</h3><p>Start the mailer:</p><pre>python3 /opt/suricata_alert_mailer/suricata_mailer.py</pre><p>Trigger a simple test alert by adding a local rule and pinging:</p><p>Create a local rule (ICMP test):</p><pre>sudo mkdir -p /etc/suricata/rules<br>echo &#39;alert icmp any any -&gt; any any (msg:&quot;ICMP test detected&quot;; sid:1000001; rev:1;)&#39; | sudo tee /etc/suricata/rules/local.rules<br>sudo systemctl restart suricata<br>ping -c 3 8.8.8.8</pre><p>If everything is correct you will see lines like:</p><pre>Email sent: [Suricata] [ALERT] ICMP Detected (sid:1000001) 192.168.1.11-&gt;8.8.8.8</pre><p>and you will receive the alert in your inbox.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l1388xZJo3K86pacg4Fo2w.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Po2D8dT_F2hV5ZKjOm6Ttw.jpeg" /></figure><h3>6) Troubleshooting</h3><p>errors i faced :</p><p><strong>Error:</strong> 535 5.7.8 Username and Password not accepted</p><p><strong>Why it happened:</strong><br> The script tried to log in with empty or wrong credentials. This usually happens because:</p><ul><li>The .env file was not exported to the environment (you ran source .env incorrectly, e.g. in one command with the script), OR</li><li>The App Password was mistyped or generated for a different Google account.</li></ul><p><strong>How we fixed it:</strong></p><ol><li>Generated a correct Gmail App Password.</li><li>Stored the app password (and SMTP settings) in .env.</li><li>Loaded .env with set -a; source .env; set +a so variables were exported.</li><li>Verified the variables (echo $SMTP_USER) before running the script.</li><li>Confirmed SMTP works with a small gmail_test.py script.</li></ol><h3>7) What we learned &amp; security notes</h3><ul><li>Never use your real Gmail password in scripts — use App Passwords.</li><li>Always protect .env with chmod 600.</li><li>The 535 SMTP error almost always means credential mismatch or missing env vars.</li><li>Logging and deduplication are important to avoid being spammed or hitting Gmail rate limits.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=06b2f8ce9d6f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Animetronic in hackmyvm]]></title>
            <link>https://medium.com/@aminaxakai/animetronic-in-hackmyvm-385b0b16749b?source=rss-0d3163c6c125------2</link>
            <guid isPermaLink="false">https://medium.com/p/385b0b16749b</guid>
            <dc:creator><![CDATA[Amina Akai]]></dc:creator>
            <pubDate>Wed, 03 Sep 2025 05:37:59 GMT</pubDate>
            <atom:updated>2025-09-03T05:42:43.252Z</atom:updated>
            <content:encoded><![CDATA[<p>Animetronic in hackmyvm</p><p>Today, we’ll dive into <strong>Animetronic</strong>, an intermediate-level machine that offers a great mix of enumeration, exploitation, and privilege escalation challenges.</p><p>In this walkthrough, I’ll show you <strong>how to approach Animetronic, find vulnerabilities, exploit them, and finally gain root access -</strong>highlighting how to pivot from web fuzzing to SSH access, then escalate privileges to root. Let’s dive in!</p><h3>1. Initial Setup &amp; Recon</h3><p>First things first, I placed both my <strong>attacker machine (Kali Linux)</strong> and the <strong>Animetronic VM</strong> on the same network. I used <strong>Bridge Adapter</strong> mode in VirtualBox to ensure proper communication.</p><p>in attacker machine</p><ol><li>netdiscover -r 192.168.1.5/24 -this command help you discover target ip</li></ol><h3>2. Scanning for Open Ports</h3><p>Next, I ran an <strong>Nmap scan</strong> to identify open ports</p><p>nmap -sC -sV -p- &lt;target ip&gt;</p><p>The output showed:</p><ul><li><strong>Port 22</strong> → SSH (OpenSSH 7.6p1)</li><li><strong>Port 80</strong> → Apache HTTP Server</li></ul><p>This tells us there’s a <strong>web server</strong> running and a <strong>database service</strong> exposed — interesting attack surfaces</p><p>I opened the target in the browser. The homepage looked like a basic <strong>Animetronic theme website</strong>. No obvious functionality, so I ran fuff to find hidden directories.</p><h3>3. Web Enumeration</h3><p>Let’s to do some web enumeration and fuzzing using fuff :</p><ol><li>ffuf -u <a href="http://10.0.2.40/FUZZ">http://</a>192.168.1.5<a href="http://10.0.2.40/FUZZ">/FUZZ</a> -w /usr/share/dirbuster/wordlists/directory-list-2.3-medium.txt</li></ol><p>this shows as staffpage directory again run a fuff on staffpages :</p><p>2.ffuf -u <a href="http://10.0.2.40/staffpages/FUZZ">http://</a>192.168.1.5<a href="http://10.0.2.40/staffpages/FUZZ">/staffpages/FUZZ</a> -w /usr/share/dirbuster/wordlists/directory-list-2.3-medium.txt</p><p>find a new page, let’s go to the address <a href="http://10.0.2.40/staffpages/new_employees">http://</a>192.168.1.5<a href="http://10.0.2.40/staffpages/new_employees">/staffpages/new_employees</a></p><p>this gives an image of FNAF characters, we can investigate this image though. Let’s download it and then inspect it.</p><h3>4. Extracting Hidden Messages</h3><p>Download and analyze the image:</p><ol><li>wget <a href="http://10.0.2.40/staffpages/new_employees">http://</a>192.168.1.5<a href="http://10.0.2.40/staffpages/new_employees">/staffpages/new_employees</a> -O new_emp</li><li>strings new_emp</li></ol><p>Inside, there’s a Base64-encoded string that — once decoded — reveals a message pointing to message_to_michael</p><p>decode command: echo ‘hash’ | base64 -d</p><p>Visiting message_to_michael reveals personal details about “michael” in another page called personal_info.txt.</p><h3>5.Cracking password</h3><p>Generate a custom wordlist using <strong>cupp</strong> (Common User Passwords Profiler)with his personal information from above :</p><p>clone cupp from git.</p><ol><li>python3 cupp.py -i</li></ol><p>Input the details (birthdays, names, etc.), then crack SSH via <strong>ncrack</strong>:</p><p>2. ncrack -p 22 -u michael -P 22 192.168.1.5 custom_wordlist.txt</p><p>Credentials found: leahcim1996</p><h3>6. ssh login</h3><p>SSH into the box:</p><ol><li>ssh michael@192.168.1.5</li></ol><p>Retrieve the user flag:</p><p>2. cat user.txt</p><p>Then explore note.txt , decode any Base64 inside—it may hint to a file like passwordhenry . Find it with</p><p>3. find /home -type f -name henrypassword.txt 2&gt;/dev/null</p><p>Access reveals credentials of henry : IHateWilliam</p><p>4. su henry</p><p>it ask for password then give it.</p><h3>7. Privilage escalation</h3><p>check with :</p><ol><li>sudo -l</li></ol><p>Henry is allowed to execute socat without a password.got onto gtfobins and search for a matching command. i got</p><p>2. sudo socat stdin exec:/bin/bash</p><p>now you got root access, dig and fing root flag with simple ls and cd commands its not that hard ;)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=385b0b16749b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building My First Web Recon Tool in kali linux]]></title>
            <link>https://medium.com/@aminaxakai/building-my-first-web-recon-tool-in-kali-linux-e22f6a91858a?source=rss-0d3163c6c125------2</link>
            <guid isPermaLink="false">https://medium.com/p/e22f6a91858a</guid>
            <category><![CDATA[kali-linux]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[tools]]></category>
            <dc:creator><![CDATA[Amina Akai]]></dc:creator>
            <pubDate>Mon, 19 May 2025 02:12:12 GMT</pubDate>
            <atom:updated>2025-05-19T02:12:12.303Z</atom:updated>
            <content:encoded><![CDATA[<p>As a beginner in cybersecurity and penetration testing, I wanted to take on a project that could teach me how to gather intel on domains, IPs, and phone numbers — and display it in a simple web interface. I built a basic recon web tool using <strong>Python, Flask, and Kali Linux</strong>, and pushed it to <strong>GitHub</strong> using proper version control and authentication.</p><p>In this blog post, I’ll walk you through every step of the journey. If you’re also new to cybersecurity, this might be the perfect project for you to start with.</p><p>It’s a simple web application that lets you input:</p><ul><li>A <strong>domain name</strong> → get its IP address</li><li>An <strong>IP address</strong> → resolve it to hostname</li><li>A <strong>phone number</strong> → get region, carrier &amp; validity</li><li>Basic <strong>subdomain scanning</strong> for common entries</li></ul><p>Tools and Technologies used:</p><ul><li><strong>Kali Linux</strong> (2024)</li><li><strong>Python 3 &amp; Flask</strong></li><li>Python libraries:</li><li>requests</li><li>dnspython</li><li>phonenumbers</li></ul><h4>Step-by-Step Guide to Building It</h4><p>Step 1: Create Project folder</p><pre>mkdir webinfo-tool<br>cd webinfo-tool</pre><p>Step 2: Set Up Virtual Environment</p><pre>sudo apt install python3-venv<br>python3 -m venv venv<br>source venv/bin/activate</pre><p>Step 3: Install Required Libraries</p><pre>pip install flask requests dnspython phonenumbers</pre><p>Step 4: Create Backend with python</p><p>code available on my github page under <strong>app.py</strong> file name (<a href="https://github.com/aminaakai/webinfo_tool">https://github.com/aminaakai/webinfo_tool</a>)</p><p>Step 5: Add a Frontend with HTML</p><p>code available on my github page under<strong> templates/index.html </strong>file name (<a href="https://github.com/aminaakai/webinfo_tool">https://github.com/aminaakai/webinfo_tool</a>)</p><h3>What I Learned:</h3><ul><li>How to use Flask to build a basic web app</li><li>How to fetch data using Python sockets and libraries</li><li>How to validate phone numbers with region and carrier info</li><li>What “externally managed Python environments” mean and how to use virtualenvs</li></ul><h3>What’s Next?</h3><p>I’m planning to add:</p><ul><li>WHOIS lookup for domains</li><li>Port scanning using nmap</li><li>IP intelligence using the Shodan API</li><li>Logging and saving results to a text file or SQLite</li></ul><h3>Final Thoughts</h3><p>This project helped me connect the dots between <strong>Python scripting</strong>, <strong>web development</strong>, and <strong>cybersecurity recon</strong>. If you’re just starting out in ethical hacking, I highly recommend building something similar.</p><h4><strong><em>Want to try the tool or improve it? Here’s the source:<br> </em></strong><a href="https://github.com/aminaakai/webinfo_tool"><strong><em>https://github.com/aminaakai/webinfo_tool</em></strong></a></h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e22f6a91858a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>