<?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 Cisc0_pete on Medium]]></title>
        <description><![CDATA[Stories by Cisc0_pete on Medium]]></description>
        <link>https://medium.com/@pagaudiomonte?source=rss-7a261d38e18d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*f3i5MJ0mYaXMQSgOoM_XGw.jpeg</url>
            <title>Stories by Cisc0_pete on Medium</title>
            <link>https://medium.com/@pagaudiomonte?source=rss-7a261d38e18d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 17:13:56 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@pagaudiomonte/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[Threat Hunting with Zeek’s UID & JA4+]]></title>
            <link>https://medium.com/@pagaudiomonte/threat-hunting-with-zeeks-uid-ja4-c823e8b1bc05?source=rss-7a261d38e18d------2</link>
            <guid isPermaLink="false">https://medium.com/p/c823e8b1bc05</guid>
            <category><![CDATA[zeek]]></category>
            <category><![CDATA[ja4]]></category>
            <category><![CDATA[malware]]></category>
            <category><![CDATA[wireshark]]></category>
            <category><![CDATA[encryption]]></category>
            <dc:creator><![CDATA[Cisc0_pete]]></dc:creator>
            <pubDate>Sun, 04 Jan 2026 19:33:50 GMT</pubDate>
            <atom:updated>2026-01-04T19:48:39.698Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/736/1*tq_5i4s56E5VsWYo8RgNQQ.png" /></figure><p>JA4+ is powerful because it shifts the focus from what a packet is saying to how the packet is built. In an era where everything is encrypted and attackers rotate IPs and domains in seconds, JA4+ provides a stable fingerprint for network traffic. By converting TCP and TLS handshakes into a modular $a\_b\_c$ format, it allows us to identify the specific software, libraries, or tools behind a connection. Even if the attacker changes their encryption keys or hides behind a new proxy, fingerprinting is still possible. JA4+ essentially turns the noise of seemingly randomized network data into a clear, searchable signature that is easy for humans to read and for machines to track. Couple this with Zeek’s powerful detection engine and real time, threat detection is possible.</p><p>Today, we are experimenting with astandalone Zeek implementation and personally written python scripts to find possible matches for known malicious JA4+ fingerprints. This is a work in progress and Zeek’s Connection ID (UID) is at the core of these scripts. Possibly illuminating additional threat intelligence, faster and more concisely.</p><p>Please see FoxIO’s GitHub for way more information:</p><p><a href="https://github.com/FoxIO-LLC/ja4">https://github.com/FoxIO-LLC/ja4</a></p><p>Here is some initial data you may find important:</p><pre>thedr@gallifrey:~/zeek$ zeek -v<br>zeek version 8.0.4<br><br>thedr@gallifrey:~/zeek$ cat /etc/os-release<br>PRETTY_NAME=&quot;Ubuntu 22.04.3 LTS&quot;<br>NAME=&quot;Ubuntu&quot;<br>VERSION_ID=&quot;22.04&quot;<br>VERSION=&quot;22.04.3 LTS (Jammy Jellyfish)&quot;<br><br>thedr@gallifrey:~/zeek$ tshark -v<br>TShark (Wireshark) 4.6.2.<br><br>2023-10-03-Pikabot-infection-with-Cobalt-Strike.pcap </pre><p>This Zeek instance is running standalone. For Zeek to run properly we need to install Tshark. I will post an additional article showcasing how to download Zeek and Wireshark on a fresh VM via the CLI. There is no GUI for Zeek. When Zeek processes a PCAP, it will out put to a folder of files based on the traffic seen within the PCAP.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/568/1*rzZ6yjhV80c_wHa4ocnO5g.png" /><figcaption>Zeek output on 2023–10–03-Pikabot-infection-with-Cobalt-Strike.pcap</figcaption></figure><p>I will be show casing a file obtained from my FAVORITE website for tracking relevant malware. Malware-Traffic-Analysis.net</p><p>Be mindful! This is real malware. By all means do not export nor manipulate this PCAP file unless you know what you are doing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VgGzPf6VLsk5bfcccVpYJQ.png" /><figcaption>2023–10–03 Pikabot infection with Cobalt Strike</figcaption></figure><p>I chose 2023–10–03-Pikabot-infection-with-Cobalt-Strike.pcap because I know for a fact <strong>Cobalt Strike</strong> has multiple <strong>JA4+</strong> fingerprints. This a great example to showcase.</p><p>Let’s run this in real-time.</p><pre>thedr@gallifrey:~/pcap/pikabot$ zeek -r ../2023-10-03-Pikabot-infection-with-Cobalt-Strike.pcap ../../<br>zeek/<br><br>## ../xxxxx tells the shell to please look in the previous parent directory<br>## ../../xxxx please look back 2 directories<br><br>thedr@gallifrey:~/pcap/pikabot$ ls<br>conn.log     files.log     ldap.log         packet_filter.log  ssl.log<br>dce_rpc.log  http.log      ldap_search.log  smb_files.log      weird.log<br>dns.log      kerberos.log  ocsp.log         smb_mapping.log    x509.log</pre><p>Now, you see all of the different log files Zeek has created for us. This is what makes Zeek so special. It aggregates all the important information into groups. Now comes the python scripts I have developed to not only extract the already processed JA4+ fingerprints but also compare that to my local database.</p><pre>thedr@gallifrey:~/pcap/pikabot$ python3 ~/petes_python/ja4_threat_hunter_v7.py .<br><br>================================================================================<br>[*] Analysis Complete<br>[*] Total connections checked: 280<br>[*] Malicious connections detected: 203<br>================================================================================<br><br>================================================================================<br>Finding #1<br>================================================================================<br>Connection ID (UID): Clj9x532tezTvr9dbe<br>Log Source: ssl.log<br>Timestamp: 2023-10-03 16:11:39 UTC<br><br>[PRIMARY DETECTION]<br>  JA4S Match: t120300_c030_52d195ce1d92<br>    Application: Cobalt Strike v4.9.1 beacon<br>    Notes: Cobalt Strike v4.9.1 over winhttp<br><br>[RELATED DATA]<br>  JA4T: 65535_2-1-3-1-1-4_1460_8 (from conn.log)<br>  JA4TS: 64240_2-1-1-4-1-3_1396_7 (from conn.log)<br><br>[CONNECTION DETAILS]<br>  10.1.2.147:49388 -&gt; 179[.]60.149[.]244:443</pre><p>Here is <strong>ja4_threat_hunter_v7.py</strong>. So this is actually a comprehensive JA4+ threat hunter that covers the full suite of JA4 fingerprints (TLS, HTTP, SSH, X.509, and TCP), not just the SSL/TLS fingerprints. The database at /home/thedr/db/ja4+_db.jsoncontains the known malicious fingerprints we want to detect (ja4_fingerprint, ja4s_fingerprint, ja4h_fingerprint, etc.).</p><p><strong><em>**JA4X on Zeek is not working for at the moment. I used JA4.py via the FoxIO python scripts further down to pivot from Zeek to identify additional JAX Certificate Infrastructure.</em></strong></p><p>This is not a live database. I downloaded the file from Ja4db.com. In the future, I will modify the script to use an API so all potential fingerprints are using the latest threat intelligence.</p><pre>thedr@gallifrey:~/pcap/pikabot$ cat ~/petes_python/ja4_threat_hunter_v7.py<br>#!/usr/bin/env python3<br>&quot;&quot;&quot;<br>JA4 Threat Hunter v4 - Compare Zeek JA4 fingerprints against known database<br>Works with FoxIO-style database format (array of objects)<br>Usage: python3 ja4_threat_hunter_v4.py /path/to/zeek/logs<br>&quot;&quot;&quot;<br><br>import json<br>import gzip<br>import sys<br>import os<br>from pathlib import Path<br>from collections import defaultdict<br>from datetime import datetime<br><br># JA4 field mappings for each log type<br># Primary fingerprints (can trigger detections)<br>PRIMARY_FIELDS = {<br>    &#39;ssl.log&#39;: [&#39;ja4&#39;, &#39;ja4s&#39;],<br>    &#39;http.log&#39;: [&#39;ja4h&#39;],<br>    &#39;ssh.log&#39;: [&#39;ja4ssh&#39;],<br>    &#39;x509.log&#39;: [&#39;ja4x&#39;]<br>}<br><br># All other logs that contain related data<br>RELATED_LOGS = {<br>    &#39;conn.log&#39;: [&#39;ja4t&#39;, &#39;ja4ts&#39;],  # TCP fingerprints - always related to any connection<br>    &#39;ssl.log&#39;: [&#39;ja4&#39;, &#39;ja4s&#39;],      # TLS fingerprints<br>    &#39;x509.log&#39;: [&#39;ja4x&#39;]             # Certificate fingerprints<br>}<br><br>def load_malicious_db(db_path):<br>    &quot;&quot;&quot;Load the malicious JA4 database (FoxIO format - array of objects)&quot;&quot;&quot;<br>    try:<br>        with open(db_path, &#39;r&#39;) as f:<br>            db_array = json.load(f)<br><br>        # Convert array format to lookup dictionaries for fast searching<br>        fingerprint_db = {<br>            &#39;ja4&#39;: {},<br>            &#39;ja4s&#39;: {},<br>            &#39;ja4h&#39;: {},<br>            &#39;ja4ssh&#39;: {},<br>            &#39;ja4x&#39;: {},<br>            &#39;ja4t&#39;: {},<br>            &#39;ja4ts&#39;: {}<br>        }<br><br>        for entry in db_array:<br>            if entry.get(&#39;ja4_fingerprint&#39;):<br>                fingerprint_db[&#39;ja4&#39;][entry[&#39;ja4_fingerprint&#39;]] = entry<br>            if entry.get(&#39;ja4s_fingerprint&#39;):<br>                fingerprint_db[&#39;ja4s&#39;][entry[&#39;ja4s_fingerprint&#39;]] = entry<br>            if entry.get(&#39;ja4h_fingerprint&#39;):<br>                fingerprint_db[&#39;ja4h&#39;][entry[&#39;ja4h_fingerprint&#39;]] = entry<br>            if entry.get(&#39;ja4ssh_fingerprint&#39;):<br>                fingerprint_db[&#39;ja4ssh&#39;][entry[&#39;ja4ssh_fingerprint&#39;]] = entry<br>            if entry.get(&#39;ja4x_fingerprint&#39;):<br>                fingerprint_db[&#39;ja4x&#39;][entry[&#39;ja4x_fingerprint&#39;]] = entry<br>            if entry.get(&#39;ja4t_fingerprint&#39;):<br>                fingerprint_db[&#39;ja4t&#39;][entry[&#39;ja4t_fingerprint&#39;]] = entry<br>            if entry.get(&#39;ja4ts_fingerprint&#39;):<br>                fingerprint_db[&#39;ja4ts&#39;][entry[&#39;ja4ts_fingerprint&#39;]] = entry<br><br>        return fingerprint_db<br><br>    except FileNotFoundError:<br>        print(f&quot;[!] Database not found: {db_path}&quot;)<br>        sys.exit(1)<br>    except json.JSONDecodeError:<br>        print(f&quot;[!] Invalid JSON in database: {db_path}&quot;)<br>        sys.exit(1)<br><br>def parse_zeek_log(log_path):<br>    &quot;&quot;&quot;Parse a Zeek log file (handles both plain and gzipped)&quot;&quot;&quot;<br>    if log_path.endswith(&#39;.gz&#39;):<br>        opener = gzip.open<br>        mode = &#39;rt&#39;<br>    else:<br>        opener = open<br>        mode = &#39;r&#39;<br><br>    try:<br>        with opener(log_path, mode) as f:<br>            headers = None<br>            separator = None<br><br>            for line in f:<br>                line = line.strip()<br>                if line.startswith(&#39;#&#39;):<br>                    if line.startswith(&#39;#separator&#39;):<br>                        separator = line.split()[-1]<br>                        if separator.startswith(&#39;\\x&#39;):<br>                            separator = bytes.fromhex(separator[2:]).decode(&#39;ascii&#39;)<br>                    elif line.startswith(&#39;#fields&#39;):<br>                        headers = line.split(&#39;\t&#39;)[1:]<br>                    continue<br><br>                if not line:<br>                    continue<br><br>                if headers and separator:<br>                    values = line.split(separator if separator != &#39;\\x09&#39; else &#39;\t&#39;)<br>                    if len(values) == len(headers):<br>                        yield dict(zip(headers, values))<br><br>    except Exception as e:<br>        print(f&quot;[!] Error parsing {log_path}: {e}&quot;)<br><br>def extract_ja4_fingerprints(log_entry, ja4_fields):<br>    &quot;&quot;&quot;Extract JA4 fingerprints from a log entry&quot;&quot;&quot;<br>    fingerprints = {}<br>    for field in ja4_fields:<br>        if field in log_entry and log_entry[field] not in [&#39;-&#39;, &#39;(empty)&#39;, &#39;&#39;]:<br>            fingerprints[field] = log_entry[field]<br>    return fingerprints<br><br>def check_against_db(fingerprints, malicious_db):<br>    &quot;&quot;&quot;Check if any fingerprints match the malicious database&quot;&quot;&quot;<br>    matches = []<br>    for fp_type, fp_value in fingerprints.items():<br>        if fp_type in malicious_db and fp_value in malicious_db[fp_type]:<br>            entry = malicious_db[fp_type][fp_value]<br>            matches.append({<br>                &#39;type&#39;: fp_type,<br>                &#39;fingerprint&#39;: fp_value,<br>                &#39;application&#39;: entry.get(&#39;application&#39;, &#39;Unknown&#39;),<br>                &#39;os&#39;: entry.get(&#39;os&#39;, &#39;Unknown&#39;),<br>                &#39;device&#39;: entry.get(&#39;device&#39;, &#39;Unknown&#39;),<br>                &#39;library&#39;: entry.get(&#39;library&#39;, &#39;Unknown&#39;),<br>                &#39;notes&#39;: entry.get(&#39;notes&#39;, &#39;&#39;),<br>                &#39;verified&#39;: entry.get(&#39;verified&#39;, False)<br>            })<br>    return matches<br><br>def find_log_files(directory):<br>    &quot;&quot;&quot;Find all Zeek log files recursively&quot;&quot;&quot;<br>    log_files = {&#39;primary&#39;: [], &#39;related&#39;: []}<br>    all_log_types = {**PRIMARY_FIELDS, **RELATED_LOGS}<br><br>    for log_file in Path(directory).rglob(&quot;*.log*&quot;):<br>        filename = log_file.name<br>        for log_type in all_log_types.keys():<br>            if filename == log_type or filename.startswith(log_type.replace(&#39;.log&#39;, &#39;.&#39;)):<br>                category = &#39;primary&#39; if log_type in PRIMARY_FIELDS else &#39;related&#39;<br>                log_files[category].append((str(log_file), log_type))<br>                break<br>    return log_files<br><br>def convert_ts_to_utc(timestamp_str):<br>    &quot;&quot;&quot;Convert Zeek timestamp to UTC format&quot;&quot;&quot;<br>    try:<br>        ts = float(timestamp_str)<br>        return datetime.utcfromtimestamp(ts).strftime(&#39;%Y-%m-%d %H:%M:%S UTC&#39;)<br>    except:<br>        return timestamp_str<br><br>def main():<br>    if len(sys.argv) &lt; 2:<br>        print(&quot;Usage: python3 ja4_threat_hunter_v6.py &lt;zeek_log_directory&gt;&quot;)<br>        sys.exit(1)<br><br>    log_dir = sys.argv[1]<br>    db_path = &quot;/home/thedr/db/ja4+_db.json&quot;<br><br>    malicious_db = load_malicious_db(db_path)<br>    log_files = find_log_files(log_dir)<br><br>    if not log_files[&#39;primary&#39;]:<br>        print(f&quot;[!] No JA4-related log files found in {log_dir}&quot;)<br>        sys.exit(1)<br><br>    # PHASE 1: Scan primary logs for matches<br>    total_checked = 0<br>    findings = []<br>    matched_uids = set()<br><br>    for log_path, log_type in log_files[&#39;primary&#39;]:<br>        for entry in parse_zeek_log(log_path):<br>            fingerprints = extract_ja4_fingerprints(entry, PRIMARY_FIELDS[log_type])<br>            if fingerprints:<br>                total_checked += 1<br>                matches = check_against_db(fingerprints, malicious_db)<br>                if matches:<br>                    uid = entry.get(&#39;uid&#39;, &#39;Unknown&#39;)<br>                    matched_uids.add(uid)<br>                    findings.append({<br>                        &#39;log_file&#39;: log_path,<br>                        &#39;log_type&#39;: log_type,<br>                        &#39;log_entry&#39;: entry,<br>                        &#39;matches&#39;: matches,<br>                        &#39;uid&#39;: uid,<br>                        &#39;related&#39;: []<br>                    })<br><br>    # PHASE 2: Find related data<br>    if matched_uids:<br>        uid_related = defaultdict(list)<br>        for log_path, log_type in log_files[&#39;related&#39;]:<br>            for entry in parse_zeek_log(log_path):<br>                uid = entry.get(&#39;uid&#39;, &#39;&#39;)<br>                if uid in matched_uids:<br>                    fingerprints = extract_ja4_fingerprints(entry, RELATED_LOGS[log_type])<br>                    if fingerprints:<br>                        uid_related[uid].append({<br>                            &#39;log_type&#39;: log_type,<br>                            &#39;fingerprints&#39;: fingerprints,<br>                            &#39;entry&#39;: entry<br>                        })<br><br>        for finding in findings:<br>            if finding[&#39;uid&#39;] in uid_related:<br>                finding[&#39;related&#39;] = uid_related[finding[&#39;uid&#39;]]<br><br>    # Report findings<br>    print(&quot;\n&quot; + &quot;=&quot;*80)<br>    print(f&quot;[*] Analysis Complete&quot;)<br>    print(f&quot;[*] Total connections checked: {total_checked}&quot;)<br>    print(f&quot;[*] Malicious connections detected: {len(findings)}&quot;)<br>    print(&quot;=&quot;*80 + &quot;\n&quot;)<br><br>    if findings:<br>        for i, finding in enumerate(findings, 1):<br>            print(f&quot;{&#39;=&#39;*80}&quot;)<br>            print(f&quot;Finding #{i}&quot;)<br>            print(f&quot;{&#39;=&#39;*80}&quot;)<br>            print(f&quot;Connection ID (UID): {finding[&#39;uid&#39;]}&quot;)<br>            print(f&quot;Log Source: {finding[&#39;log_type&#39;]}&quot;)<br><br>            entry = finding[&#39;log_entry&#39;]<br>            if &#39;ts&#39; in entry:<br>                print(f&quot;Timestamp: {convert_ts_to_utc(entry[&#39;ts&#39;])}&quot;)<br><br>            print(f&quot;\n[PRIMARY DETECTION]&quot;)<br>            for match in finding[&#39;matches&#39;]:<br>                print(f&quot;  {match[&#39;type&#39;].upper()} Match: {match[&#39;fingerprint&#39;]}&quot;)<br>                print(f&quot;    Application: {match[&#39;application&#39;]}&quot;)<br>                if match[&#39;notes&#39;]: print(f&quot;    Notes: {match[&#39;notes&#39;]}&quot;)<br><br>            if finding.get(&#39;related&#39;):<br>                print(f&quot;\n[RELATED DATA]&quot;)<br>                for rel in finding[&#39;related&#39;]:<br>                    for fp_type, fp_val in rel[&#39;fingerprints&#39;].items():<br>                        print(f&quot;  {fp_type.upper()}: {fp_val} (from {rel[&#39;log_type&#39;]})&quot;)<br><br>            print(f&quot;\n[CONNECTION DETAILS]&quot;)<br>            print(f&quot;  {entry.get(&#39;id.orig_h&#39;, &#39;N/A&#39;)}:{entry.get(&#39;id.orig_p&#39;, &#39;N/A&#39;)} -&gt; {entry.get(&#39;id.resp_h&#39;, &#39;N/A&#39;)}:{entry.get(&#39;id.resp_p&#39;, &#39;N/A&#39;)}&quot;)<br>            if entry.get(&#39;server_name&#39;, &#39;-&#39;) != &#39;-&#39;: print(f&quot;  Server Name: {entry[&#39;server_name&#39;]}&quot;)<br>            print()<br>    else:<br>        print(&quot;[+] No malicious fingerprints detected!&quot;)<br><br>if __name__ == &quot;__main__&quot;:<br>    main()<br></pre><p>The script works in two phases:</p><ol><li>Scans primary logs for matches against our malicious database</li><li>For any matches found, it pulls in related JA4 data from other logs using the connection UID.</li></ol><p>Once the malicious fingerprint is matched, we can use Zeek’s connection ID to pivot and learn other important information about these connections. This is where Zeek comes in handy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/533/1*hDjjBZXNDY7Xl2Sewl1pnA.png" /><figcaption>Screenshot of output</figcaption></figure><p>So, 203 different matches were confirmed even though it was the exact same JA4S fingerprint, same IPs. This is the TLS Server Hello. The client is communicating with the malicious server. Every other second, the beacon is sent out. Observe this filtered PCAP to see that the only thing that changes is the ‘Ephemeral” port on the Client’s machine. This shows connections beaconing out every second or so.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/957/1*LxuqsZmOgFrievQXaLuW4w.png" /><figcaption>Wireshark capture showing JA4S Server Hello</figcaption></figure><p>Remember for JA4 &amp; JA4S, JA4T &amp; JA4TS the <strong>handshake </strong>and <strong>TLS Client and Server Hellos</strong> need to be captured to properly fingerprint the connections. The TLS library the application on the client was using for C2 may have been malicious but could not be confirmed with the traffic seen. I am going to assume that was the Cobalt Client speaking with the C2 Server. I am having difficulties with JA4X on this Zeek instance but I can pivot to the Wireshark capture or use FoxIO’s dedicated python script to extract the X509 information. We want to know what other traffic in this PCAP is potentially malicious. The JA4X doesn’t identify what&#39;s in the X509 Cert, it identifies the structure. How the certificate was made. This is reproducible and identifying piece of information here. The certificates could be totally different, but if made the say way, we know there are made by the same bad actor (same application.)</p><p>If the JA4X plugin for Zeek was functional this could be done with the Connection ID. Here, lets look at this the python script provided by FoxIO to extract X509 certificates from the PCAP.</p><pre>thedr@gallifrey:~/foxio_python/ja4-sparse-clone/python$ cat ja4x_out.json | grep -i -a2 -b10 &#39;179[.]60.149[.]244&#39;<br><br>## This is the IP addr with the known Cobalt Strike JA4S Fingerprint<br>## We want to find any other fingerprints connected here<br></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/652/1*INF4eu-dSQJBnc7JjdmTsQ.png" /><figcaption>FoxIO GitHub with example JA4+ fingerprints</figcaption></figure><p>This is my favorite part about JA4+. We can pivot based on the other fingerprints.</p><pre>17530-    &quot;stream&quot;: 76,<br>17548-    &quot;src&quot;: &quot;10.1.2.147&quot;,<br>17573:    &quot;dst&quot;: &quot;179[.]60.149[.]244&quot;,<br>17602-    &quot;srcport&quot;: &quot;49404&quot;,<br>17626-    &quot;dstport&quot;: &quot;443&quot;,<br>17648-    &quot;client_ttl&quot;: &quot;128&quot;,<br>17673-    &quot;server_ttl&quot;: &quot;41&quot;,<br>17697-    &quot;domain&quot;: &quot;zzerxc[.]com&quot;,<br>17725-    &quot;JA4.1&quot;: &quot;t00d190700_4d06a43e2d88_b4cdb2b2a0c3&quot;,<br>17778-    &quot;JA4_r.1&quot;: &quot;t00d190700_,,,,,161,162,171,172,187,188,191,192,195,196,199,200,6,7_000a,000b,000d,0017,0023,ff01_52,53,54,25,81,3,27,83,5,4,37,39&quot;,<br>17927-    &quot;JA4_o.1&quot;: &quot;t00d190700_be9ffe69a4f5_45dadac4372d&quot;,<br>17982-    &quot;JA4_ro.1&quot;: &quot;t00d190700_196,195,200,199,188,187,192,191,162,161,172,171,7,6,,,,,_0000,000a,000b,000d,0023,0017,ff01_52,53,54,25,81,3,27,83,5,4,37,39&quot;,<br>18137-    &quot;JA4X.1&quot;: &quot;a373a9f83c6b_7022c563de38_821a8ec155c6&quot;,<br>--<br>18452-    &quot;server_ttl&quot;: &quot;102&quot;,<br>18477-    &quot;JA4.1&quot;: &quot;t00i190600_4d06a43e2d88_b4cdb2b2a0c3&quot;,<br>18530-    &quot;JA4_r.1&quot;: &quot;t00i190600_,,,,,161,162,171,172,187,188,191,192,195,196,199,200,6,7_000a,000b,000d,0017,0023,ff01_52,53,54,25,81,3,27,83,5,4,37,39&quot;,<br>18679-    &quot;JA4_o.1&quot;: &quot;t00i190600_be9ffe69a4f5_2621bef74af5&quot;,<br>18734-    &quot;JA4_ro.1&quot;: &quot;t00i190600_196,195,200,199,188,187,192,191,162,161,172,171,7,6,,,,,_000a,000b,000d,0023,0017,ff01_52,53,54,25,81,3,27,83,5,4,37,39&quot;,<br>18884-    &quot;JA4X.1&quot;: &quot;1a59268f55e5_1a59268f55e5_795797892f9c&quot;<br>######### ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^##########</pre><pre>&quot;JA4X.1&quot;: &quot;1a59268f55e5_1a59268f55e5_795797892f9c&quot;<br><br>### This is a 100%  match to PIKABOT certificate. </pre><p>An attacker can easily change a file’s SHA256 hash, it is much harder for them to change their <strong>Certificate Authority’s template</strong>. JA4X.2 and .3 allow us to fingerprint the <em>infrastructure</em> providing the certificates, not just the single site. We can now pivot using the JA4X. Let’s see what we find.</p><pre>thedr@gallifrey:~/foxio_python/ja4-sparse-clone/python$ grep -B 15 &#39;1a59268f55e5_1a59268f55e5_795797892f9c&#39; ja4x_out.json | grep -E &#39;&quot;dst&quot;|JA4X.1&#39;<br>    &quot;JA4X.1&quot;: &quot;a373a9f83c6b_2bab15409345_0ce9ea683d50&quot;,<br>    &quot;dst&quot;: &quot;167[.]86.96[.]3&quot;,<br>    &quot;JA4X.1&quot;: &quot;1a59268f55e5_1a59268f55e5_795797892f9c&quot;<br>    &quot;JA4X.1&quot;: &quot;2bab15409345_2166164053c1_68ccbb907075&quot;,<br>    &quot;dst&quot;: &quot;167[.]86.96[.]3&quot;,<br>    &quot;JA4X.1&quot;: &quot;1a59268f55e5_1a59268f55e5_795797892f9c&quot;<br>    &quot;dst&quot;: &quot;79[.]141.175[.]96&quot;,<br>    &quot;JA4X.1&quot;: &quot;1a59268f55e5_1a59268f55e5_795797892f9c&quot;<br>    &quot;dst&quot;: &quot;209[.]126.9[.]47&quot;,<br>    &quot;JA4X.1&quot;: &quot;1a59268f55e5_1a59268f55e5_795797892f9c&quot;<br>    &quot;dst&quot;: &quot;167[.]86.96[.]3&quot;,<br>    &quot;JA4X.1&quot;: &quot;1a59268f55e5_1a59268f55e5_795797892f9c&quot;<br>    &quot;dst&quot;: &quot;79[.]141.175[.]96&quot;,<br>    &quot;JA4X.1&quot;: &quot;1a59268f55e5_1a59268f55e5_795797892f9c&quot;<br>    &quot;JA4X.1&quot;: &quot;2bab15409345_2166164053c1_68ccbb907075&quot;,<br>    &quot;dst&quot;: &quot;209[.]126.9[.]47&quot;,<br>    &quot;JA4X.1&quot;: &quot;1a59268f55e5_1a59268f55e5_795797892f9c&quot;<br>    &quot;dst&quot;: &quot;167[.]86.96[.]3&quot;,<br>    &quot;JA4X.1&quot;: &quot;1a59268f55e5_1a59268f55e5_795797892f9c&quot;<br>    &quot;dst&quot;: &quot;79[.]141.175[.]96&quot;,<br>    &quot;JA4X.1&quot;: &quot;1a59268f55e5_1a59268f55e5_795797892f9c&quot;<br>    &quot;dst&quot;: &quot;209[.]126.9[.]47&quot;,<br>    &quot;JA4X.1&quot;: &quot;1a59268f55e5_1a59268f55e5_795797892f9c&quot;<br>    &quot;dst&quot;: &quot;167[.]86.96[.]3&quot;,<br>    &quot;JA4X.1&quot;: &quot;1a59268f55e5_1a59268f55e5_795797892f9c&quot;</pre><p>Based soley on the JA4X and the initial match JA4S, we have determined that other multiple IP address were also connected to Cobalt and Pikabot.</p><p>This initial Pikabot infection and list of IOCs can be attributed to Palo Alto Unit 42.</p><p><a href="https://github.com/PaloAltoNetworks/Unit42-timely-threat-intel/blob/main/2023-10-03-IOCs-for-Pikabot-infection-with-Cobalt-Strike.txt">Unit42-timely-threat-intel/2023-10-03-IOCs-for-Pikabot-infection-with-Cobalt-Strike.txt at main · PaloAltoNetworks/Unit42-timely-threat-intel</a></p><p>Here is the linkedin post showing the chain of infection.</p><p><a href="https://www.linkedin.com/posts/unit42_pikabot-cobaltstrike-timelythreatintel-activity-7115093198233894912-ZhRp/">#pikabot #cobaltstrike #timelythreatintel #iocs #unit42threatintel #wireshark | Palo Alto Networks Unit 42</a></p><p>Here are the original references based within the Unit42’s GitHub.</p><pre>ORIGINAL REFERENCES:<br><br>- https://twitter.com/Cryptolaemus1/status/1709238615904018605<br>- https://infosec.exchange/@cryptolaemus1@bird.makeup/111171942237441322<br>- https://github.com/pr0xylife/Pikabot/blob/main/Pikabot_03.10.2023.txt<br></pre><p>Thank you for all the work done here. I used this to better understand the infection chain and how JA4+ can be used post incident to continue to uncover addition information. What’s really interesting was JA4+ retrieved all the of same <strong>exact </strong>IP addresses that were connected to this infection directly from fingerprinting of encrypted traffic. So if you think you cannot glean any information because it is encrypted, you are sorely mistaken.</p><p>Thank you for taking the time to read this. I don’t care about likes or shares, just help the next person understand. Sharing the things you are learning with others is enough. Even if you are brand new to this, you have the power to contribute to the community. Get involved and help others get involved too.</p><p>Come check out my LinkedIn if you have any questions or want to say hello!</p><p><a href="https://www.linkedin.com/in/pagaudiomonte771/">https://www.linkedin.com/in/pagaudiomonte771/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c823e8b1bc05" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Vim for Security: Building a Python IDE from the Command Line]]></title>
            <link>https://medium.com/@pagaudiomonte/vim-for-security-building-a-python-ide-from-the-command-line-db8e4cc86555?source=rss-7a261d38e18d------2</link>
            <guid isPermaLink="false">https://medium.com/p/db8e4cc86555</guid>
            <category><![CDATA[vim]]></category>
            <category><![CDATA[command-line]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[linux]]></category>
            <dc:creator><![CDATA[Cisc0_pete]]></dc:creator>
            <pubDate>Sun, 14 Sep 2025 17:18:27 GMT</pubDate>
            <atom:updated>2025-09-14T17:18:27.617Z</atom:updated>
            <content:encoded><![CDATA[<p>As a network security analyst, my terminal is my home. Whether I’m threat hunting, analyzing logs, administrating a servers, whippin up config files for switchs or routes, I need my tools to be fast and powerful. While a full-blown IDE like PyCharm is great for large projects, it’s often overkill for the small, critical Python scripts I write to parse logs or automate security tasks.</p><p>This is where Vim shines. By combining a few key plugins with some unique settings, you can transform Vim from a simple text editor into a lightweight yet incredibly powerful Python IDE. This allows you to work with both code and configs without ever leaving the shell.</p><h3>The Blueprint: Your .vimrc File</h3><p>The .vimrc file is your configuration blueprint. Let&#39;s break down exactly what each part of the script does to build the new IDE.</p><h4>Plugin Manager: vim-plug</h4><p>The first and most crucial part is the plugin manager. Vim doesn’t have a built-in way to manage third-party tools, so vim-plug acts as a foundation.</p><ul><li><strong>call plug#begin()</strong>: This command tells Vim where your plugins will be installed and marks the beginning of the plugin list.</li><li><strong>Plug &#39;...&#39;</strong>: This is the command that makes it all work. It tells vim-plug to go out to GitHub and download the specified plugin.</li><li><strong>call plug#end()</strong>: This command marks the end of your plugin list and activates all the installed plugins.</li></ul><h4>Core Plugins for an IDE Workflow</h4><p>Your configuration adds some of the most essential plugins for a modern development environment.</p><ul><li><strong>neoclide/coc.nvim</strong>: This is the heart of your IDE. <strong>CoC (Complete on Change)</strong> is a fast, intelligent <strong>Language Server Protocol (LSP)</strong> client. It provides features like:</li><li><strong>Intelligent Code Completion</strong>: As you type, it offers suggestions for functions, variables, and methods, just like in a full IDE.</li><li><strong>Syntax Checking &amp; Diagnostics</strong>: It uses a language server to catch syntax errors and highlight code issues as you type, giving you instant feedback.</li><li><strong>airblade/vim-gitgutter</strong>: This is a game-changer for anyone working with code. It adds a small column in the editor&#39;s gutter (the left margin) that shows you which lines have been added, modified, or deleted since your last commit.</li><li><strong>scrooloose/nerdtree</strong>: This plugin gives you a <strong>file system explorer</strong> right inside Vim. You can navigate your project&#39;s directory structure, open files, and manage your project without leaving the editor. Your keybinding <strong>&lt;C-n&gt;</strong> (Control + n) is mapped to toggle this tree.</li><li><strong>vim-syntastic/syntastic</strong>: This is a powerful static analysis tool that checks your code for errors. You&#39;ve configured it to use popular Python linters like <strong>flake8</strong> and <strong>pylint</strong>, which enforce the community-standard PEP8 style guidelines.</li><li><strong>moll/vim-bbye</strong>: A simple but powerful quality-of-life plugin. It allows you to close a buffer (a file you have open) without closing the Vim window itself, which is incredibly useful when managing multiple files in a split-screen layout.</li><li><strong>tpope/vim-surround</strong>: This plugin simplifies a frequent task in any language: manipulating surrounding characters like quotes, brackets, and parentheses. For example, you can quickly change [foo] to {foo} or add single quotes around a word.</li></ul><h4>Essential Vim Settings</h4><p>Beyond the plugins, your configuration includes vital settings that optimize Vim for Python.</p><ul><li><strong>set tabstop=4</strong>, <strong>set shiftwidth=4</strong>, <strong>set expandtab</strong>: These are arguably the most important settings for a Python developer. They tell Vim to use <strong>4 spaces for indentation</strong>, which is the official standard defined by PEP8.</li><li><strong>set number</strong>: This simply displays line numbers on the left, making it easier to navigate files and troubleshoot errors.</li><li><strong>set cursorline</strong>: This setting highlights the line where your cursor is, which is a simple visual aid that makes it easier to track your position in the code.</li><li><strong>set hidden</strong>: This allows you to have multiple files open in different buffers without saving them first. It&#39;s a huge time-saver when switching between files.</li></ul><h4>Custom Key Mappings for a Faster Workflow</h4><p>The final piece of your setup is a custom key mapping that puts a powerful command on a single key.</p><ul><li><strong>nmap &lt;F5&gt; :w&lt;CR&gt;:!python3 %&lt;CR&gt;</strong>: This command is an absolute must-have. It maps the <strong>F5 key</strong> to a sequence of actions:</li></ul><ol><li>saves the current file.</li><li>:!python3 % runs the current file in the terminal using the python3 interpreter. This gives you a one-touch command to <strong>save and run your Python script</strong>, allowing for rapid testing and debugging.</li></ol><p>By putting all these pieces together, you’ve turned a simple text editor into a powerful and efficient development environment perfectly suited for the daily tasks of a network security analyst.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=db8e4cc86555" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Netgear A8000 AXE3000 Driver issues on your Pi?]]></title>
            <link>https://medium.com/@pagaudiomonte/netgear-a8000-axe3000-driver-issues-on-your-pi-dd6f57003c08?source=rss-7a261d38e18d------2</link>
            <guid isPermaLink="false">https://medium.com/p/dd6f57003c08</guid>
            <category><![CDATA[wifi]]></category>
            <category><![CDATA[ieee-802-11]]></category>
            <category><![CDATA[raspberry-pi]]></category>
            <category><![CDATA[kismet]]></category>
            <category><![CDATA[linux]]></category>
            <dc:creator><![CDATA[Cisc0_pete]]></dc:creator>
            <pubDate>Sun, 07 Sep 2025 20:08:33 GMT</pubDate>
            <atom:updated>2025-09-07T20:08:33.863Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/884/1*TLC3gXlq5ejUYmUyjKlwHA.png" /><figcaption>Don’t you love to troubleshoot?</figcaption></figure><p>Have you ever connected your USB Wi-fi adapter just to see that Linux does not recognize it as a Network interface? It sees it is a USB device, but not a network adapter. It sucks, I know.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/550/1*nAnuaT8kicURgZSKVp3ThA.png" /><figcaption>Netgear A8000 AXE3000 MediaTek MT9721u</figcaption></figure><p>This is the culprit. Wi-Fi 6 adapter. Here is the machine I am running on.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/683/1*zCx1JCrRvlS2TR9eF3R2Pg.png" /><figcaption>Raspberry 3B+ &amp; Netgear Wireless Adapter</figcaption></figure><p>Here’s all the important information you may need:</p><pre>dorieus@sparta:~$ uname -a<br><br>  Linux sparta 6.12.25+rpt-rpi-v8 #1 SMP PREEMPT Debian 1:6.12.25-1+rpt1 <br>  (2025-04-30) aarch64 GNU/Linux<br>  <br>dorieus@sparta:~ $ hostnamectl<br><br>  Static hostname: sparta<br>  Icon name: computer<br>  Machine ID: 88882341fb4d49af99428b3ea013ae8d<br>  Boot ID: 68d68b68dec34c509cb4deba3bca336a<br>  Operating System: Debian GNU/Linux 12 (bookworm)<br>  Kernel: Linux 6.12.25+rpt-rpi-v8<br>  Architecture: arm64<br><br><br>dorieus@sparta:~ $ cat /proc/device-tree/model<br><br>  Raspberry Pi 3 Model B Plus Rev 1.3 </pre><p>When we run <strong><em>ip a</em></strong> in our terminal here is the output. Note that we are missing wlan1 in the output.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sL6bjJqtZc08QV8DmMIpYw.png" /><figcaption>Standard output — missing wlan1</figcaption></figure><p>Right now, this raspberry pi is actually about 2 miles away. I am using Tailscale to access this device via SSH. I will be talking about tailscale much more from now on. It is not just a VPN, it is soo much more than that. Tailscale is what the internet was supposed to be like. I can access any device anywhere, as long as it is on my tailscale network. Also, I can create my own exit node and have any of my traffic exit that specific node. Enough about that, lets get back to the Pi</p><p>So No wlan1? Now what? Let’s run <strong><em>lsusb</em> </strong>to figure this out.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/984/1*d7z-W7gf8T2VMO1BhrzNXg.png" /><figcaption>Device 005: ID 0846:9065</figcaption></figure><h3>Identify the Chipset</h3><p>The <strong><em>lsusb </em></strong>output is the most critical piece of information here.</p><ul><li>Bus 001 Device 005: This indicates the device is connected via USB.</li><li>ID 0846:9065: This is the <strong>Vendor ID</strong> (0846) and <strong>Product ID</strong> (9065). This unique combination identifies the specific Netgear model and, more importantly, the chipset it uses.</li></ul><p>Based on the ID 0846:9065 and the NetGear, Inc. Wireless_Device description, it is a <strong>Netgear A8000 (AXE3000) USB adapter</strong>. We knew this but if we were unaware of the Vendor ID and product ID can tell us. This adapter uses a MediaTek chipset, specifically the <strong>mt7921u</strong> chipset.</p><p>Where can we find this information? Let’s google it. Here is a great site, as well. Use the Vendor ID and Device ID to determine Driver information.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/954/1*a3m3rcdKjbaL-0MAOYxtuw.png" /><figcaption>0845:9065 MediaTek MT9721U</figcaption></figure><p><a href="http://www.linux-usb.org/usb-ids.html">The USB ID Repository</a></p><p>In many situation, the driver is already installed. The kernel just needs to know which device to associate with the driver. The process of using modprobe to load the driver and then adding the device ID with echo | sudo tee is the solution to this problem, as it manually creates the link between your hardware and its software driver.</p><p>Let’s use <strong><em>modinfo </em></strong>to see if the driver is installed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6epwi30KGpM8WJYnCrtf3w.png" /><figcaption>modinfo mt7921u</figcaption></figure><p>Now let’s use <strong><em>modprobe </em></strong>to load the driver.</p><pre>dorieus@sparta:~ $ modprobe mt7921u<br><br>#there is no output for this command</pre><p>This next command is used to manually tell a running Linux kernel to associate a specific USB device with an already-loaded driver. It is a powerful administrative command that directly interacts with the kernel’s device management system.</p><pre>dorieus@sparta:~ $ echo &quot;0846 9065&quot; | sudo tee /sys/bus/usb/drivers/mt7921u/new_id</pre><p>This specific command is used when a device’s driver is present in the kernel but the device’s ID is not included in the driver’s default list of supported hardware. By writing the 0846 9065 ID to the new_id file, you are manually adding it to the driver’s list, which forces the kernel to recognize and initialize your wireless adapter</p><p>Now, lets run <strong><em>ip a</em></strong> again and verify the wlan1 interface is now present.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3vZ6SGpYfpWAGCFmU9d0nA.png" /><figcaption>ip a — wlan1 observed</figcaption></figure><p>Unfortunately, this solution is not persistent through reboots. I don’t care too much. My Pi is sitting there running Kismet 24/7. It takes &lt;5 minutes to get it up and going.</p><p>That’s it. Takes a few minutes to get the interface up and you can start capturing your data. Good luck! Here is a link the video I made.</p><p>Here a small bash script to start at boot.</p><pre>#!/bin/bash<br><br># This script loads the mt7921u kernel module and<br># adds the device ID for the Netgear A8000 wireless adapter.<br># This is a persistent solution to ensure the adapter is<br># recognized automatically after a reboot.<br><br># The `modprobe` command loads the driver into the kernel.<br># The `|| true` part ensures the script continues even if the<br># module is already loaded or there&#39;s an error.<br>sudo modprobe mt7921u || true<br><br># Check if the /sys/bus/usb/drivers/mt7921u/new_id file exists<br># If it does, write the Vendor ID and Product ID to it.<br>if [ -e &quot;/sys/bus/usb/drivers/mt7921u/new_id&quot; ]; then<br>    echo &quot;0846 9065&quot; | sudo tee /sys/bus/usb/drivers/mt7921u/new_id<br>fi<br><br># The `tee` command writes to the file while also outputting to the screen.<br># This ensures the kernel associates the driver with the device ID.<br># This script is designed to be run as a cron job at reboot.</pre><p>#netgear #kismet #wi-fi #wifi #wardriving #networkinterface</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dd6f57003c08" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Old Phone, No service? Use the GPS sensor on your old phones for your Raspberry Pi projects.]]></title>
            <link>https://medium.com/@pagaudiomonte/old-phone-no-service-use-the-gps-sensor-on-your-old-phones-for-your-raspberry-pi-projects-91a029e788eb?source=rss-7a261d38e18d------2</link>
            <guid isPermaLink="false">https://medium.com/p/91a029e788eb</guid>
            <category><![CDATA[kismet]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[tcp-ip]]></category>
            <category><![CDATA[gps]]></category>
            <category><![CDATA[raspberry-pi]]></category>
            <dc:creator><![CDATA[Cisc0_pete]]></dc:creator>
            <pubDate>Sat, 23 Aug 2025 01:30:34 GMT</pubDate>
            <atom:updated>2025-08-23T01:30:34.479Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/747/1*MxLcmY8_UoDWDvvEHpL6pA.png" /></figure><p>I don’t pride myself on much, but I can say with confidence, I am quite resourceful. I never had much money. This has allowed me to find various different way to reuse things I have lying around. This time, I did not want to spend the 15 bucks for a GPS sensor on Amazon. I was building a war driving rig with a Raspberry pi. I thought to myself, I’ve got all these phones lying around, I know for damn sure they have GPS sensors on them. How can I tap into these sensors?? There has to be some kind of way. Well I found it. I here to share that with you today.</p><p>gpsd_relay, I never heard of it until a few nights ago.</p><p><a href="https://github.com/project-kaat/gpsdRelay">GitHub - project-kaat/gpsdRelay: Simple Android app that relays NMEA information to a gpsd server</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*yqaQSogxUgaY0s73oeaWdg.png" /><figcaption>GitHub — GPSD Relay</figcaption></figure><p>I needed the GPS data for Kismet (<a href="https://www.kismetwireless.net/docs/readme/gps/gps_gpsd/">https://www.kismetwireless.net/docs/readme/gps/gps_gpsd/</a>) The GPS data is sent via TCP or UDP, how ever you choose to set it up. Kismet configuration allows for multiple types of gps configuration. For this purpose we are using GPSD. Let’s walk through on how to get this set up.</p><p>Start off on the Android device, I am using a Pixel 6a “de-googled” phone running CalyxOS v.6.8.20 Android version 15. Open the app and navigate to the bottom right hand corner. There a plus sign button that allows you to add a new server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/462/1*gvQC2GEooaytT11K3A0Qbw.png" /><figcaption>gpsd_relay — TCP Server</figcaption></figure><p>Pressing the plus button will display a choice between TCP or UDP. Feel free to experiment with both. I chose to use TCP, on port 1234. Not shown in this photo. During testing, I always choose memorable port number or memorable log in information. It is very important to change these when moving to production environments. McDonald’s AI did NOT do this. Learn from them please..</p><p>After you have the TCP server set up, running on whatever port your chose, you will need to press the play button for the gps data to start streaming via TCP. At the end I will show you a Wireshark capture of the TCP stream.</p><p>Once the GPSD_Relay server is up and running, we can set up our GPS configuration on Kismet, running on the Raspberry Pi.</p><pre>dorieus@sparta:~ $ history<br>    1  sudo apt update<br>    2  sudo apt gpsd gpsd-clients <br>    3 sudo apt install vim</pre><p>Any time I am working on a Raspberry Pi, I install Vim. The Vi version running on Pi is not very user friendly. Ironic, when referring to Vim.. I will not be going in to the specifics of getting Kismet up and running, I will only be showing you how to configure GPS to run of an old cell phone. For this purpose I am using the hot spot on my daily driver cell phone for internet. After installation, neither need access to the internet, only local access to each other via IP. The Android device and Raspberry Pi need to be on the same subnet. This can be accomplished by using the wireless network interface card (NIC) on the pi as a dedicated AP using hostAPD and DNSmasq.</p><p>Let’s configure the GPSD Client on the Pi.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*YcPeIqdDiPk4oFpiEwh0-g.png" /><figcaption>gpsd configuration file</figcaption></figure><pre>dorieus@sparta:~ $ sudo vim /etc/default/gpsd</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/989/1*vjlxEys186xbZvnF1EH9EA.png" /><figcaption>gpsd client configuration file</figcaption></figure><pre>#This is where GPSD listens for TCP stream (Android device ip)<br>GPSD_OPTIONS=&quot;-n tcp://10.0.0.64:1234&quot;<br></pre><p>Confirming the ip address of the Android device running gpsd_relay, we enter that into the configuration file so the GPSD client knows where to listen for this GPS data.</p><p>After we have made changes to our client, let’s restart the gpsd service.</p><pre>dorieus@sparta:~ $ sudo systemctl restart gpsd<br>dorieus@sparta:~ $ sudo systemctl status gpsd<br>● gpsd.service - GPS (Global Positioning System) Daemon<br>     Loaded: loaded (/lib/systemd/system/gpsd.service; disabled; preset: enabled)<br>     Active: active (running) since Fri 2025-08-22 18:55:17 EDT; 7s ago<br>TriggeredBy: ● gpsd.socket<br>    Process: 2941 ExecStart=/usr/sbin/gpsd $GPSD_OPTIONS $OPTIONS $DEVICES (code=exited, status=0/SUCCESS)<br>   Main PID: 2942 (gpsd)<br>      Tasks: 1 (limit: 760)<br>        CPU: 12ms<br>     CGroup: /system.slice/gpsd.service<br>             └─2942 /usr/sbin/gpsd -n tcp://10.0.0.64:1234<br><br>Aug 22 18:55:17 sparta systemd[1]: Starting gpsd.service - GPS (Global Positioning System) Daemon...<br>Aug 22 18:55:17 sparta systemd[1]: Started gpsd.service - GPS (Global Positioning System) Daemon.<br>dorieus@sparta:~ $</pre><p>Here is a screenshot for better viewing</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o7vjteIj0j9b3-7QRTj9IQ.png" /><figcaption>gpsd service status</figcaption></figure><p>Now let’s get back to the mobile device. I am located in my test environment, my home lab. The two devices are on their own subnet. As long as they are on the same subnet, this will work. Whether that is a mobile hotspot from a different phone or you have <strong><em>wlan0 </em></strong>set up as an AP (access point) set up on the raspberry pi. Create a local network with only the phone and the Pi. Again, we <strong><em>do not need</em></strong> a gateway. No internet is needed, just local communication via ip.</p><p>Open up gpsd_relay.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YgKwZa8rpVFlliszu5pcfg.png" /><figcaption>gpsd_relay application</figcaption></figure><p>When pressing the play button in the upper right, that will start the TCP streaming. On your client, the pi, use the command <strong><em>gpsmon</em></strong> to determine whether the pi is correctly listening to that stream.</p><pre>dorieus@sparta:~ $ cgps<br>cgps: caught signal 2<br>### The screenshot below is what will be displayed ###</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fdN2H70ur4pZwRfo8eXbNw.png" /><figcaption>Successful gpsd connection — cgps command</figcaption></figure><pre>dorieus@sparta:~ $ gpsmon<br>dorieus@sparta:~ $ gpsmon<br>### Some people like gpsmon and some like to use cgps ###</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/833/1*x5Bzo64B4UZGob0PMhUGzg.png" /><figcaption>gpsmon</figcaption></figure><blockquote>Conclusion</blockquote><p>That’s it. Again, this is all local. GPS services can be used with out access to the internet. Local access is only needed when sharing the data to the client. I will provide a video showing the tool live. This can be applied to any project that require GPS. I am going to continue testing this with different phones. I know most people are not running around with a de-googled phone. I will be sure to update this as I test different cell phones. I will also test different functions to save this data and output to a map. I plan on creating an open source “Google” timeline application. This usually how I keep track of my hours on jobs. We’ll see if anything comes of it.</p><p>Please feel free to contact me with any questions or constructive criticism. Thank you for taking the time to read my article. I appreciate you.</p><p>While you’re at it, check out YouTube channel too. I don&#39;t care if you subscribe or like, I just want to share what I am learning with the world.</p><p><a href="https://www.youtube.com/@cisc0pete">cisc0_pete</a></p><p>#gps #gpsd #wireshark #raspberrypi #CalyxOs</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=91a029e788eb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[PCAPNG vs PCAP — What’s the diff?]]></title>
            <link>https://medium.com/@pagaudiomonte/pcapng-vs-pcap-whats-the-diff-6670ca2273d3?source=rss-7a261d38e18d------2</link>
            <guid isPermaLink="false">https://medium.com/p/6670ca2273d3</guid>
            <category><![CDATA[wireshark]]></category>
            <category><![CDATA[pcapng]]></category>
            <category><![CDATA[tshark]]></category>
            <category><![CDATA[wireshark-training]]></category>
            <category><![CDATA[pcap-analysis]]></category>
            <dc:creator><![CDATA[Cisc0_pete]]></dc:creator>
            <pubDate>Sun, 27 Jul 2025 01:23:22 GMT</pubDate>
            <atom:updated>2025-07-27T21:11:06.159Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/802/1*lhi403Cik_EHgWBVypB8KQ.png" /></figure><h3>PCAPNG vs PCAP — What’s the diff?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/639/1*9PCPBY6Rqy8Wl3-1oHz6ow.png" /><figcaption>WCA — Objectives 1.2</figcaption></figure><p>If you are studying for the recently announced <strong>Wireshark Certified Analyst</strong> certification then you are in the right place. I will be discussing objectives 1.2 and 2.8 — “<em>Describe the difference between different capture file formats, especially pcap and pcapng</em>.” &amp; 2.8 — “<em>Capture traffic using command line tools</em>.”</p><p><strong><em>FUNFACT → ng = “Next Generation” PCAPNG was made the default capture file format in Wireshark version 1.8 in 2012. That was 13 years ago..</em></strong></p><p>I have a horrible attention span. I have spent the day capturing <strong><em>NMAP </em></strong>traffic via <strong><em>tcpdump, dumpcap and tshark</em></strong>. I tried so hard to stay on topic, but it was inevitable I veered off course. This tangent is an attempt to solidify my understanding of these topics, as well share this knowledge with you all.</p><p>Here’s the topology: my Windows 11 laptop (10.0.0.12) has a shell the Pi. (10.0.0.54) A Raspberry Pi 4 running Ubuntu 22.04. With the Raspberry Pi’s <strong><em>wlan0 </em></strong>configured for management (10.0.0.54), its <strong><em>eth0</em></strong> interface is set to promiscuous mode. This allows the NIC to capture every packet flowing through it, not just those intended for the Pi. By connecting this <strong><em>eth0</em></strong> to a SPAN port mirroring the firewall&#39;s trunk, we gain full visibility into the network&#39;s traffic. This method of capture is often preferable to installing tools directly on a target host. It provides a distinct advantage by allowing us to see packets in their entirety <em>before</em> they are processed by the target&#39;s TCP/IP stack, offering an unfiltered view invaluable for deep analysis and troubleshooting.</p><p>I didn’t think much of what I was using to capture traffic. That prompted me to begin experimenting with <strong><em>tcpdump</em></strong>, <strong><em>dumpcap</em></strong>, &amp; <strong><em>tshark</em></strong>. I was trying to capture in way where I could see the traffic live on the terminal as it was being captured. I also popped a shell to tail -f <strong><em>conn.log </em></strong>via my<strong><em> ZEEK </em></strong>node as I ran <strong><em>tshark </em></strong>and <strong><em>NMAP </em></strong>simultaneously.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NDyg2rdeq1BO-g3xAALvJg.png" /></figure><p>Something along these lines. Multiple shells open. I wanted to see the <strong><em>nmap </em></strong>traffic being captured for later analysis. That will be an additional article or video.</p><p>I will admit, I didn’t know the difference between <strong><em>tcpdump</em></strong>, <strong><em>dumcap</em></strong>, and <strong><em>tshark</em></strong>. I knew they were all <em>packet capture</em> command line tools. Why not just use Wireshark, right? Why use the terminal? That is a great question, and one I asked myself. I promise, the command line is not as intimidating as it seems.</p><p>Wireshark’s graphical user interface (GUI) is known for its ability to allow detailed and interactive packet analysis, offering features like visual packet inspection, complex display filters, TCP stream tracking, protocol hierarchy exploration, and traffic statistics over time.</p><p>However, its limitations become apparent in specific scenarios. For instance, in environments without a GUI, such as headless servers or remote systems accessed via SSH, like my Raspberry Pi in the other room. For all intents and purposes, it could be located half away around the world. Additionally, the GUI demands a certain amount of overhead. Resources like CPU, RAM, and display requirements can strain low-power devices or lead to packet loss during long-term or high-volume traffic captures. Furthermore, the GUI lacks robust scripting or automation capabilities. This is where our command line tools shine!</p><h4>1. tcpdump: The Classic, Lightweight Sniffer</h4><p><strong>tcpdump </strong>is the veteran of command-line packet sniffers. It&#39;s designed to be lightweight and efficient for capturing and displaying traffic directly in the terminal, or for saving it to a .<strong><em>pcap </em></strong>file for later analysis.</p><p><strong>Key Strengths:</strong></p><ul><li><strong>Ubiquitous:</strong> It’s almost universally available on Unix-like systems (Linux, macOS, BSDs).</li><li><strong>Minimal Overhead:</strong> Very light on system resources, making it ideal for continuous capture on resource-constrained devices or production servers.</li><li><strong>Simple Filtering:</strong> Excellent for applying basic capture filters (BPF syntax) to reduce the volume of data captured.</li><li><strong>Live Output:</strong> Can display a summary of packets directly to the terminal in real-time.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/943/1*xyxRvSUF4ZgiRsuCX-5Ifw.png" /><figcaption>Live traffic via tcpdump</figcaption></figure><p><strong>Limitations:</strong></p><ul><li><strong>Limited Dissection:</strong> It provides basic protocol dissection (e.g., identifies TCP, UDP, IP) but lacks the deep understanding and detailed parsing capabilities of Wireshark/TShark. You won’t see all the intricate protocol fields.</li><li><strong>Default PCAP Format:</strong> By default, it writes to the older <strong><em>.pcap</em></strong> file format, which has limitations regarding metadata, multi-interface captures, and timestamp granularity. While it <em>can</em> read some <strong><em>.pcapng</em></strong> files, it doesn&#39;t write them. We are going further in-depth on this topic shortly.</li><li><strong>No GUI:</strong> Purely command-line.</li></ul><h4>2. dumpcap: The Dedicated Capture Engine</h4><p>dumpcap is the <em>packet capture engine</em> that both Wireshark and TShark use internally. Its sole focus is efficient, reliable packet capture to a file. It does <em>not</em> perform any dissection or display packets in real-time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R7cO9KTNYSEBjjZ9ziYVeA.png" /><figcaption>Wireshark running dumpcap under the hood</figcaption></figure><p><strong>Key Strengths:</strong></p><ul><li><strong>Minimal Overhead (for capture):</strong> Since it doesn’t do any live dissection or display, <strong>dumpcap </strong>is the most resource-efficient tool for simply capturing raw packets to disk. This makes it excellent for long-term captures or very high-speed links where CPU cycles for dissection are precious.</li><li><strong>Robust File Saving:</strong> Designed for stable and reliable file writing, including handling file rotations and limits.</li><li><strong>Native PCAPNG Output:</strong> Defaults to writing <strong><em>.pcapng</em></strong> files, taking full advantage of its features like rich metadata and multi-interface support.</li><li><strong>Privilege Separation:</strong> In Wireshark, <strong>dumpcap </strong>often runs with elevated privileges to capture packets, while the GUI runs with lower privileges for security.</li></ul><p><strong>Limitations:</strong></p><ul><li><strong>No Live Display:</strong> It will not show you any packet information in the terminal while capturing.</li><li><strong>No Dissection:</strong> Its purpose is purely capture; it won’t tell you anything about the protocols or fields within the packets.</li><li><strong>Limited Filtering:</strong> Only supports BPF <em>capture filters</em> (like <strong>tcpdump</strong>), not the more powerful display filters of <strong>tshark</strong>/<strong>Wireshark</strong>.</li></ul><h4>tshark: Wireshark&#39;s Command-Line Workhorse</h4><p><strong>tshark </strong>is the command-line equivalent of Wireshark&#39;s dissectors. It uses the same powerful dissection engine as the Wireshark GUI, allowing it to understand and display virtually any network protocol.</p><p><strong>Key Strengths:</strong></p><ul><li><strong>Deep Dissection:</strong> Can dissect and display fields for thousands of protocols, just like the Wireshark GUI. This means you can specify specific fields to display using <strong>-e<em> </em></strong>(e.g., <strong>http.request.uri, dns.qry.name</strong>).</li><li><strong>Flexible Output:</strong> Supports various output formats (e.g., <strong>fields</strong>, <strong>json</strong>, <strong>psml</strong>, <strong>pdml</strong>) using the <strong>-T</strong> option, making it great for scripting and integrating with other tools.</li><li><strong>Display Filters:</strong> Can apply complex <em>display filters</em> (the same syntax as Wireshark’s GUI) even to live captures, which are more powerful than <strong><em>tcpdump’s </em></strong>capture filters.</li><li><strong>Default PCAPNG Format:</strong> When saving to file, <strong>tshark </strong>defaults to the more advanced .<strong>pcapng </strong>format, which offers richer metadata and multi-interface support.</li></ul><p><strong>Limitations:</strong></p><ul><li><strong>Higher Resource Usage:</strong> Because of its powerful dissection engine, <strong>tshark </strong>can be more resource-intensive than <strong>tcpdump</strong>, especially on very high-volume traffic or resource-limited systems.</li><li><strong>Initial Startup Time:</strong> Can be slightly slower to start than <strong>tcpdump </strong>due to loading its dissection engine.</li></ul><p>Before I took this deep dive, I was under the impression that tcpdump could still capture in .pcapng format if I forced with the write command. Here are 3 test commands to determine the default behavior of each tool.</p><pre><br>user1@clear:~$ sudo tcpdump -i eth0 -c 50 -w testcap3_tcpdump.pcapng<br><br>user1@clear:~$ dumpcap -i eth0 -c 50 -w testcap2_dumpcap.pcapng<br><br>user1@clear:~$ tshark -i eth0 -c 50 -w testcap1_tshark.pcapng</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/918/0*KFjvqnHR9x6dCvCz" /></figure><p>I ran each test capture with 50 packets then ran <strong><em>file </em></strong>on each file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/932/0*w-UO_veEyUWnMwpE" /></figure><p>I then ran the same commands without a specified file format to determine the default behavior.</p><pre>user1@clear:~$ sudo tcpdump -i eth0 -c 50 -w testcap3_tcpdump_noext<br><br>user1@clear:~$ dumpcap -i eth0 -c 50 -w testcap2_dumpcap_noext<br><br>user1@clear:~$ tshark -i eth0 -c 50 -w testcap1_tshark_noext<br></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/943/0*Y_KAYQhlo_kTcmya" /></figure><p>You can see that even without a specified file extension <strong>tshark </strong>and <strong>dumpcap </strong>both use pcapng natively. <strong>tcpdump </strong>is still using the pcap file format.</p><p>I used <strong><em>SCP </em></strong>to send the files over to my Windows machine so I can use the GUI to visual inspect these three files.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/462/0*U4WQaAvtzcitDmr6" /><figcaption>SCP — Pi → Windows11</figcaption></figure><p>Open up <em>testcap1_tshark.pcapng</em> in Wireshark and navigate to Statistics &gt; Capture File Properties — Great shortcut is <strong>ctrl + shift + alt + c</strong></p><p>You can see the .<strong>pcapng </strong><em>metadata </em>associated with this file. It recorded Linux on a Raspberry Pi as well as the application that captured the packets. This is the information located in the Section Header Block</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cBK0KQew2Xewl0ds" /><figcaption>tshark — .pcapng file — Capture File Properties</figcaption></figure><p><em>testcap2_dumpcap.pcapng</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ZUpSmCZIDkDINtdY" /><figcaption>dumpcap — .pcapng Capture File Properties</figcaption></figure><p><em>testcap3_tcpdump.pcapng — </em>You can see I even used the .<strong>pcapng </strong>file extension when I ran <strong>tcpdump </strong>and it still defaulted back to .<strong>pcap </strong>format. <strong>tcpdump </strong>cannot capture .<strong>pcapng </strong>files.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*r7G-WM6e-s5HHYzj" /></figure><p>This is where the differences begin to add up. <strong>tcpdump </strong>won&#39;t display details like the hardware, operating system, or application that created the capture, even though they are stored as options in the Section Header Block (SHB) in a .<strong><em>pcapng </em></strong>file. Lets compare and contrast the legacy format and the next gen pcap.</p><h3><strong>PCAP vs. PCAPNG: The Evolution of Packet Capture Files</strong></h3><p>For years, the <strong>PCAP (.pcap) file format</strong> was the de facto standard for storing captured network traffic. It’s simple, straightforward, and widely supported by almost every network analysis tool. However, as network environments grew more complex and the need for richer metadata increased, the limitations of the classic PCAP format became apparent. This led to the development of the <strong>PCAP Next Generation (.pcapng) Capture File Format</strong>.</p><h4>The Classic: PCAP (.pcap)</h4><p>The .pcap format is fundamentally a flat file structure. At its core, it consists of a single <strong>Global Header</strong> followed by a sequential series of <strong>Packet Records</strong>.</p><p>.pcap — Let’s look at the hex.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/780/0*OHwgKQQ5EJlA52pE" /><figcaption>hexdump of pcap</figcaption></figure><p>Magic Number (32 bits): an unsigned magic number, whose value is either the hexadecimal number 0xA1B2C3D4 or the hexadecimal number 0xA1B23C4D.</p><p><strong>What’s in a PCAP file?</strong></p><ul><li><strong>Global Header:</strong> This fixed-size header kicks off the file with general information about the entire capture. It includes:</li><li>A <strong>Magic Number</strong>: Crucial for identifying the file format and determining the endianness (byte order) of the data.</li><li><strong>Version Numbers</strong>: Indicating the libpcap format version (commonly 2.4).</li><li><strong>Timestamp Details</strong>: Information about timezone correction (thiszone) and accuracy (sigfigs) for the capture’s timestamps.</li><li><strong>Snaplen</strong>: Defines the maximum number of bytes captured from each packet; anything beyond this limit is truncated.</li><li><strong>Linktype</strong>: A vital field that specifies the data link-layer type (e.g., Ethernet, Wi-Fi), telling analysis tools how to interpret the raw packet data that follows.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/607/1*gJ9FEPLD599_7E8W02h1yg.png" /><figcaption>pcap header</figcaption></figure><p><strong>Packet Records:</strong> After the global header, you’ll find each captured packet, which is composed of:</p><ul><li><strong>Packet Header</strong>: A fixed-size header for each individual packet, containing its timestamp (seconds and microseconds/nanoseconds) and both the captured and original lengths of the packet.</li><li><strong>Packet Data</strong>: The raw network traffic itself, including link-layer headers, directly following its header. The Linktype from the Global Header dictates how this data is structured.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/594/1*Xn6JCrXvzvyQOzmV69D8pA.png" /></figure><p><strong>The PCAP’s Limitations:</strong></p><p>Despite its widespread use, the PCAP format has several drawbacks:</p><ul><li><strong>Limited Extensibility:</strong> It offers minimal ways to add new features or metadata without breaking compatibility.</li><li><strong>Minimal Metadata:</strong> Beyond basic global capture settings, it lacks fields for rich details about the capture environment (hardware, OS, capturing application) or specifics for each network interface.</li><li><strong>Single Interface Only:</strong> A single .pcap file can only store traffic from one network interface and assumes a single data link type for the entire capture. This complicates multi-interface captures.</li><li><strong>Fixed Timestamp Resolution:</strong> The timestamp precision is uniform across the entire file.</li><li><strong>No Built-in Name Resolution or Statistics:</strong> Information like DNS resolutions or interface-specific statistics (e.g., dropped packets) cannot be stored directly within the file.</li><li><strong>No Decryption Key Support:</strong> It has no native way to embed decryption secrets.</li><li><strong>No Backward Navigation:</strong> Its flat structure makes reverse parsing difficult.</li></ul><h4>The Next Generation: PCAPNG (.pcapng)</h4><p>The <strong>PCAP Next Generation (pcapng) Capture File Format</strong> was developed to overcome the limitations of the older PCAP format. It introduces a modular, block-based structure that significantly enhances extensibility, portability, and the richness of captured data.</p><p><strong>Key Features of PCAPNG:</strong></p><p>Pcapng files are organized into a series of extensible <strong>blocks</strong>, each with a consistent format (Block Type, Block Total Length, Block Body). This block structure is central to its flexibility, allowing parsers to easily skip unknown or unneeded blocks.</p><p><strong>Rich Metadata:</strong> Pcapng allows for a wealth of metadata:</p><ul><li><strong>Section Header Block (SHB)</strong>: Identifies the start of a capture section and can store details about the hardware, operating system, and application used for the capture. It also defines the file’s endianness.</li><li><strong>Interface Description Block (IDB)</strong>: Provides detailed information for each interface where packets were captured, including name, description, IP/MAC addresses, link speed, and timestamp resolution.</li><li><strong>Allows for comments at both the file and packet levels</strong>. This is helpful for adding notes or context directly within the capture file for collaboration or future reference</li><li><strong>Options</strong>: Almost all blocks can include optional fields (in a Type-Length-Value format) to embed additional, non-critical data.</li><li><strong>Multi-Interface Support:</strong> A single .pcapng file can contain packets captured from multiple network interfaces, even if they have different data link types. This is a major improvement for complex network monitoring.</li><li><strong>Flexible Timestamps:</strong> The Enhanced Packet Block (EPB) uses a 64-bit timestamp, and its resolution is configurable via the if_tsresol option in the associated IDB, allowing for high precision (e.g., nanoseconds, picoseconds).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/612/1*eFh2G3iHK_88eDKqHkkBVA.png" /><figcaption>blocked structure of pcapng</figcaption></figure><ul><li><strong>Enhanced Packet Blocks (EPB):</strong> This is the standard container for captured packets, offering a 64-bit timestamp, Interface ID, captured/original packet lengths, and various options.</li><li><strong>Simple Packet Blocks (SPB):</strong> A more lightweight alternative to EPBs, optimized for performance and space efficiency by providing only essential packet information (original length and packet data) without per-packet timestamps or interface IDs.</li><li><strong>Name Resolution Block (NRB):</strong> Allows for embedding mappings between numeric addresses (like IP addresses) and their canonical names directly within the file. This prevents the need for real-time DNS lookups during analysis and preserves historical name resolutions.</li><li><strong>Interface Statistics Block (ISB):</strong> Records capture statistics for specific interfaces, such as packets received, dropped by the interface, dropped by the OS, or accepted by filters.</li><li><strong>Decryption Secrets Block (DSB):</strong> Crucially for security analysis, this block can store session secrets (e.g., for TLS, SSH, WireGuard, OPC UA, ZigBee) directly within the file to facilitate decryption of encrypted traffic.</li><li><strong>Custom Extensions:</strong> Supports vendor-specific custom blocks and options, enabling proprietary data extensions without compromising file readability for other tools. This is managed via IANA Private Enterprise Numbers (PENs).</li></ul><h3>The Modern Standard for Network Forensics</h3><p>In summary, while the classic <strong>.<em>pcap</em> format</strong> served as a reliable workhorse for many years, its <strong>flat, rigid structure</strong> ultimately limited its ability to adapt to evolving network complexities. It’s simple and broadly compatible, but at the cost of crucial metadata, multi-interface, and advanced features. If you just need a quick capture from a single interface, it still works, but it’s like a basic flip phone in a smartphone world.</p><p>The .<strong><em>pcapng</em> format</strong>, on the other hand, represents a significant leap forward. Its <strong>modular, block-based design</strong> is its defining characteristic, making it incredibly flexible and extensible. This allows it to:</p><ul><li><strong>Store rich metadata</strong> about the capture environment and multiple interfaces.</li><li><strong>Extensible, </strong>meaning adding future capacity is no issue. The format can grow and evolve over time to satisfy new requirements. This extensibility stems from it’s “block-like” structure.</li><li><strong>Support captures from many interfaces</strong> simultaneously, each with its own specific details.</li><li>Offer <strong>higher-precision timestamps</strong> and granular statistics.</li><li>Crucially, <strong>embed decryption keys and name resolution information directly within the file</strong>, which are invaluable for modern security analysis and post-capture processing.</li></ul><p><strong>In essence:</strong></p><ul><li><strong><em>PCAP </em>is like a simple, unannotated photo album:</strong> you get the pictures (packets), but little context about when, where, or how they were taken, or what camera was used. It’s one album per camera.</li><li><strong><em>PCAPNG </em>is like a smart digital album with rich metadata:</strong> each photo (packet) has detailed EXIF data, you can mix photos from multiple cameras (interfaces) in one album, and you can even embed notes (decryption keys) or face tags (name resolutions) directly into the file for easier searching and sharing.</li></ul><p>For most modern network analysis, particularly in security forensics, troubleshooting complex environments, or when sharing captures among different teams and tools, .<strong><em>PCAPNG </em>is the clear preferred standard.</strong> It provides the depth of information and flexibility required to truly understand today’s intricate network traffic, making investigations more efficient and comprehensive. It’s the file format built for the future of network packet analysis.</p><p>Resources: Here are some links that I used during my research. Thank you for taking the time to read my work. I appreciate each and everyone of you.</p><iframe src="https://drive.google.com/viewerng/viewer?url=https%3A//www.wireshark.org/pdf/wca-objectives.pdf&amp;embedded=true" width="600" height="780" frameborder="0" scrolling="no"><a href="https://medium.com/media/cf5ca17b62ef7faded9d736079d0c793/href">https://medium.com/media/cf5ca17b62ef7faded9d736079d0c793/href</a></iframe><ul><li><a href="https://wiki.wireshark.org/FileFormatReference">FileFormatReference</a></li><li><a href="https://github.com/IETF-OPSAWG-WG/draft-ietf-opsawg-pcap">GitHub - IETF-OPSAWG-WG/draft-ietf-opsawg-pcap: PCAP next generation file format specification</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6670ca2273d3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Investigating the Airwaves — Monitor Mode]]></title>
            <link>https://medium.com/@pagaudiomonte/investigating-the-airwaves-monitor-mode-f430b8bf2a8e?source=rss-7a261d38e18d------2</link>
            <guid isPermaLink="false">https://medium.com/p/f430b8bf2a8e</guid>
            <category><![CDATA[monitor-mode]]></category>
            <category><![CDATA[netgear]]></category>
            <category><![CDATA[wireshark]]></category>
            <category><![CDATA[wifi]]></category>
            <category><![CDATA[kali-linux]]></category>
            <dc:creator><![CDATA[Cisc0_pete]]></dc:creator>
            <pubDate>Sun, 06 Jul 2025 21:02:25 GMT</pubDate>
            <atom:updated>2025-07-06T21:02:25.248Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2ML6D7nnxMSTCxD3-PxhWQ.jpeg" /><figcaption>Airodump-ng</figcaption></figure><h3>Investigating the Airwaves — Monitor Mode</h3><p>Now, let’s turn our attention to investigating the device at 192.168.10.35 (MAC: 18:69:D8:45:A1:48) from a unique wireless angle. This gives us a perspective that’s quite different from what we’d see in tools like Zeek or direct firewall captures, allowing us to understand how this device truly behaves on the Wi-Fi network.</p><p>We will now proceed to activate monitor mode on our wireless adapter within Kali Linux. In monitor mode, the adapter operates as a passive listener, capturing raw 802.11 radio waves directly from the air without associating with any network. This fundamentally differs from promiscuous mode, where a network interface, while still part of a network (e.g., associated with an Access Point), is configured to accept all packets it receives, regardless of their intended destination MAC address. Monitor mode provides a broader view of wireless traffic, encompassing frames not directed to or from an associated client. Confirm the correct name of your wireless interface.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/721/1*nHxVMx7eeD82RfKYZyxECQ.png" /><figcaption>ip a output</figcaption></figure><p>We will be using airmon-ng to get the wireless adapter in monitor mode. I am using a Netgear Model: A8000 AXE3000 Wireless Adapter.</p><p>sudo airmon-ng check kill acts as a crucial preparatory step, clearing the deck for a smooth and effective wireless monitoring session. Without it, you&#39;d likely face errors, unstable behavior, or incomplete packet captures.</p><pre>┌──(kali㉿timeywimey)-[~/Desktop]<br>└─$ sudo airmon-ng check kill<br><br>###Time to put wlan0 into Monitor Mode<br><br>┌──(kali㉿timeywimey)-[~/Desktop]<br>└─$ sudo airmon-ng start wlan0</pre><p>If successful you will see:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/764/1*FBKBngM81tObP39yybNiYA.png" /><figcaption>— starting monitor mode</figcaption></figure><p>now run ip a or iwconfig to confirm wireless adapter is now in monitor mode.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/772/1*W50K2X_VWeVlT1EsIMLhHA.png" /><figcaption>— adapter in monitor mode</figcaption></figure><p>To identify the specific BSSID (the MAC address of the Access Point) to which our suspect device is connected, airodump-ng is the primary tool. Executing sudo airodump-ng wlan0mon allows us to observe nearby wireless activity. For this process, the device’s Layer 2 address (its MAC address) is essential, which can typically be sourced from prior network traffic captures in Wireshark or security logs such as Zeek or Ntopng.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q11B_fB6iAfZyUbIMFyW2g.png" /><figcaption>— Ntopng suspected tuple</figcaption></figure><pre>┌──(kali㉿timeywimey)-[~/Desktop]<br>└─$ sudo airodump-ng wlan0mon</pre><p>The following is output from airodump-ng:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*OZvPvr2wvt5M1UcZMy4IYg.png" /><figcaption>— airodump-ng output</figcaption></figure><p>Our analysis confirmed that the suspect client (18:69:D8:45:A1:48) is associated with the Access Point broadcasting as 24:F5:A2:2A:6C:8D. This particular AP, one of our deployed units, is operating on Channel 1. It’s worth noting that these are older devices, and Channel 1 has been statically assigned to this AP to mitigate potential interference from other wireless networks operating in the immediate vicinity.</p><p>With that information in tow, we can analyze the spectrum deeper. Using airodump we can tune the wireless adapter to scan for traffic on that specific BSSID and channel. Equate this to tuning the radio station to listen to your favorite music.</p><pre>┌──(kali㉿timeywimey)-[~/Desktop]<br>└─$ sudo airodump-ng --channel 1 --bssid 24:F5:A2:2A:6C:8D wlan0mon</pre><p>The command <strong><em>sudo airodump-ng — channel 1 — bssid 24:F5:A2:2A:6C:8D wlan0mon</em></strong> is utilized to initiate a focused and efficient capture of 802.11 wireless frames. This specific command provides precise control over the monitoring process. Once this is running, we open Wireshark and make sure we can see traffic is flowing on wlan0mon.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/989/1*nL9CyLT-3uvgx7FBtm4kpA.png" /><figcaption>— airodump-ng running</figcaption></figure><p>Make sure to leave this shell open and running until you are finished with the Wireshark capture.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/802/1*elSR8OloZDsE-ucvCUSxsw.png" /><figcaption>— Wireshark interfaces</figcaption></figure><p>With the airodump-ng utility actively engaged, Wireshark was simultaneously started to record network traffic. A key step in acquiring decryptable data involves capturing the complete 4-way EAPOL handshake; this was achieved by momentarily disconnecting and reconnecting the target device during the capture session, thereby forcing a fresh authentication. In a cybersecurity assessment, methods for obtaining network credentials might include leveraging tools like Aircrack-ng or specialized devices such as the Pwnagotchi, as elaborated in my companion article <a href="https://medium.com/@pagaudiomonte/pwnagotchi-playtime-2c864631af9d"><strong><em>[Pwnagotchi Playtime]</em></strong></a>. After capturing the necessary traffic, the .pcapng file was saved and relocated to a shared directory on the host Windows 11 environment for subsequent analysis. If the PSK for the AP is known, capturing EAPOL is unnecessary.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RUGHYXBhst6FKHYIBRU1ZA.png" /><figcaption>— eapol frames</figcaption></figure><p>Even when successfully capturing raw 802.11 frames, remember that for WPA/WPA2/WPA3 networks, the actual data payload (containing IP, TCP, HTTP, etc.) is encrypted at the wireless link layer. Without the correct decryption keys and a captured 4-way handshake, these frames will appear as unreadable ciphertext, emphasizing the necessity of the decryption steps detailed in this guide.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pzAIvyNZAHlxGYqxjx80iw.png" /><figcaption>— running capture</figcaption></figure><p>At this point we can stop airodump and release the wlan0mon interface.</p><p>Even without decryption, Wireshark still parses the unencrypted parts of the 802.11 header. This gives us valuable clues.</p><p>In the “Protocol” column, look for entries like 802.11 Data or 802.11 QoS Data. These are the frames that contain the higher-layer protocols. Management frames (Beacon, Probe Request, Authentication, Association, Deauthentication) and Control frames (ACK, RTS, CTS) do not carry user data and are often unencrypted themselves.</p><p>Wireshark Display Filter: You can filter your capture to only show these data frames:</p><blockquote><strong>wlan.fc.type_subtype == 0x20 || wlan.fc.type_subtype == 0x28 || wlan.fc.type_subtype == 0x2c || wlan.f</strong></blockquote><p>In this encrypted state, packets are identified at the link layer as 802.11 data frames. Once the decryption process is successfully completed within Wireshark, the software’s parsing engine automatically exposes the encapsulated network and application layer protocols, such as TCP, HTTP, TLS, and DNS, allowing for examination of the traffic’s content.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LN356xz3V1LZIlbSKFhbzA.png" /><figcaption>— filter for data</figcaption></figure><p>Let’s decrypt this 802.11 traffic.</p><p>Edit &gt; Preferences &gt; Protocols &gt; Decryption Keys &gt; Edit</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/921/1*aPj_HDsRgrwisOTD-N8u0A.png" /><figcaption>— Wireshark Preferences</figcaption></figure><p>Click on Edit next to Decryption Keys. Depending on the type of encryption you AP uses will determine the Key Type you will use in the Decryption Keys window. To find the network’s security configuration, filter your Wireshark capture for <strong>Beacon or Association Response frames</strong> from the target Access Point. Within the IEEE 802.11 layer, expand the <strong>RSN Information Element</strong> (or WPA Information Element). Here, you will clearly see the <strong>Pairwise Cipher Suite</strong> and <strong>Auth Key Management Suite (AKM)</strong>, which dictate the correct key type for decryption.</p><p>Here are the Wireshark Docs that explain this in greater detail.</p><p><a href="https://www.wireshark.org/docs/wsug_html_chunked/Ch80211Keys.html">11.10. IEEE 802.11 WLAN Decryption Keys</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/826/1*79SjXmSXJ96lznsosCc_RA.png" /><figcaption>— Decryption Keys</figcaption></figure><p>While the immediate appearance of captured packets may not overtly display decrypted content, a deeper analysis within Wireshark, particularly by applying filters such as <strong><em>ip.addr == 192.168.10.35</em></strong>, will reveal the parsed upper-layer protocols. It is important to note that this decryption configuration is specific to the Wireshark instance on the machine where it was applied. Consequently, opening this capture file on a different system or virtual machine will necessitate re-applying the decryption parameters.</p><p>Applying that filter you will see:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_WKqQeZ27ApSUR1zZQ_dCA.png" /><figcaption>— Decrypted 802.11 traffic</figcaption></figure><p>Although existing methods like direct packet capture from pfSense or analysis of Zeek logs are foundational for network forensics, examining wireless traffic at the 802.11 layer presents a distinct and highly instructive vantage point for following the trail of digital evidence. This deeper dive into the wireless medium elucidates protocol behaviors and device communication patterns in a manner that significantly augments insights gained from higher-level network observations.</p><p>Please let me know what you think! Thank you for taking the time to read my work.</p><p><strong><em>This article and exercise will satisfy learning and understanding a number of the WCA (Wireshark Certified Analyst) objectives. To list a few:</em></strong></p><ul><li><strong><em>1.1 Open, save, and close files, and export specified packets.</em></strong></li><li><strong><em>2.9 Describe the purpose of using promiscuous or monitor mode during a capture</em></strong></li><li><strong><em>3.0 Filter traffic using capture and display filters.</em></strong></li></ul><p>Please see this link for more information on the WCA! <a href="https://www.wireshark.org/certifications">https://www.wireshark.org/certifications</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f430b8bf2a8e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Pi & Python — The Yeast Will Rise]]></title>
            <link>https://medium.com/@pagaudiomonte/pi-python-the-yeast-will-rise-60ac8d0b699f?source=rss-7a261d38e18d------2</link>
            <guid isPermaLink="false">https://medium.com/p/60ac8d0b699f</guid>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[raspberry-pi-4]]></category>
            <category><![CDATA[python-programming]]></category>
            <category><![CDATA[timelapse-photography]]></category>
            <category><![CDATA[bread]]></category>
            <dc:creator><![CDATA[Cisc0_pete]]></dc:creator>
            <pubDate>Fri, 06 Jun 2025 19:30:29 GMT</pubDate>
            <atom:updated>2025-06-06T20:08:00.817Z</atom:updated>
            <content:encoded><![CDATA[<h3>Pi &amp; Python — The Yeast Will Rise</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/631/1*dF9hfxmnOZ3SWrUAe2lD2A.png" /><figcaption>Waiting for that dough to rise..</figcaption></figure><p>Using a Raspberry Pi as in my previous article, I decided to use the webcam as a timelapse camera instead of a streaming device. Here’s a little insight into my personal life. I enjoy baking. I make Sourdough and Focaccia bread as well as ‘discard’ pancakes. It is all homemade, no bread machine, no mixer. Just flour, water, salt and yeast.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xJKIkLN9oR_n6S8CwL-UGQ.jpeg" /><figcaption>Rosemary Parmigianino Reggiano Sourdough</figcaption></figure><p>I make a lot of bread. At least 4 loaves at a time. I have two <strong>starters</strong>, or “<strong>mothers</strong>” I feed and maintain. One born of wild yeast, and one born of commercially produced yeast.</p><p>A <strong>starter </strong>is the leaven that allows the bread to rise. It is was gives bread life. It is a simple mixture of flour and water. Left alone in a warm location the fermentation process will begin.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/534/1*kQtVKCgAptTM2hHq6PlZQQ.png" /><figcaption>Starter — leavening</figcaption></figure><p>After establishing a strong colony of yeast and bacteria, it is best to feed this colony fresh flour every few days. Depending on how often you plan on baking, the starter (colony of micro-organisms) can be fed once every other day, or once a week. Usually, I bake every weekend or every other weekend. So, I maintain my starter in the refrigerator. This allows me to feed the starter less often, as the cold temperatures slow the yeasts metabolism dramatically. The opposite does exactly what you would assume.</p><p>The relationship between temp and activity is directly proportional. We bakers use this to our advantage manipulating proofing times and temperatures to change the complex flavors of the bread.</p><p>As <strong>temperature increases</strong>, <strong>yeast metabolism increases</strong>:</p><ul><li>They feed faster.</li><li>They produce more CO₂ and alcohol.</li><li>The dough rises more quickly.</li></ul><p>As <strong>temperature decreases</strong>, <strong>yeast slows down</strong>:</p><ul><li>Activity nearly halts near refrigerator temps (~4°C / 39°F).</li><li>It goes dormant but doesn’t die unless it freezes.</li></ul><p>I only keep a small about of starter at a time; less than 100g. During feeding, most people discard 80% of the contents. Leaving 20% left to feed on the new influx of fresh flour and water. This is called “discard.” Many people throw it out. I include this as part of my flour and water calculations when I make my children’s pancakes for the week. I will make sure to leave that pancake recipe for you at the end.</p><p>I have always wanted to create a timelapse of the starter feeding on fresh flour. Seeing it rise in real-time gives legitimacy to the fact that is alive; feeding and multiplying.</p><p>So get out your Pi, grab you a webcam from Goodwill for like 7 bucks and open up Vim. I am sure there are already plenty of programs out there that will turn your pi into a timelapse camera, buuuut where is the fun in that. Let’s learn some stuff!</p><pre>pi@gallifrey:~/home/pi $ mkdir timelapse<br><br>pi@gallifrey:~/home/pi $ ll<br><br>total 4<br>drwxrwxr-x 2 pi pi 4096 Jun  6 13:18 timelapse<br><br>pi@gallifrey:~/home/pi $ vim timelapse.py</pre><p>It was not required to make the directory before hand since the script will generate a new dir anyways.</p><pre>import cv2<br>import os<br>import time<br>from datetime import datetime<br>import sys<br><br># Configuration<br>DURATION_HOURS = 8 # duration in hours<br>INTERVAL_SECONDS = 240  # I set 4 minutes between each photo<br>OUTPUT_DIR = os.path.expanduser(&quot;/home/pi/timelpase&quot;)  <br><br>def create_output_directory():<br>    &quot;&quot;&quot;Create the output directory if it doesn&#39;t exist.&quot;&quot;&quot;<br>    try:<br>        os.makedirs(OUTPUT_DIR, exist_ok=True)<br>        print(f&quot;Output directory: {OUTPUT_DIR}&quot;)<br>    except Exception as e:<br>        print(f&quot;Error creating directory {OUTPUT_DIR}: {e}&quot;)<br>        sys.exit(1)<br><br>def capture_photos():<br>    &quot;&quot;&quot;Capture photos for the specified duration at regular intervals.&quot;&quot;&quot;<br>    cap = cv2.VideoCapture(0)  <br>    if not cap.isOpened():<br>        print(&quot;Error: Could not open webcam.&quot;)<br>        sys.exit(1)<br><br>    start_time = time.time()<br>    end_time = start_time + (DURATION_HOURS * 3600)<br><br>    print(f&quot;Starting capture for {DURATION_HOURS} hour(s). Press Ctrl+C to stop early.&quot;)<br><br>    try:<br>        while time.time() &lt; end_time:<br>            ret, frame = cap.read()<br>            if not ret:<br>                print(&quot;Error: Failed to capture image.&quot;)<br>                continue<br><br>            timestamp = datetime.now().strftime(&quot;%Y-%m-%d_%H-%M-%S&quot;)<br>            filename = os.path.join(OUTPUT_DIR, f&quot;photo_{timestamp}.jpg&quot;)<br><br>            # example format: photo_2025-05-31_15-18-06.jpg <br>            # This is not yet the format ffmpeg requires<br><br>            try:<br>                cv2.imwrite(filename, frame)<br>    <br>                print(f&quot;Saved: {filename}&quot;)<br>            except Exception as e:<br>                print(f&quot;Error saving image {filename}: {e}&quot;)<br><br>            time.sleep(INTERVAL_SECONDS)<br><br>    except KeyboardInterrupt:<br>        print(&quot;\nCapture stopped by user.&quot;)<br>    except Exception as e:<br>        print(f&quot;An error occurred: {e}&quot;)<br>    finally:<br>        cap.release()<br>        print(&quot;Webcam released.&quot;)<br><br>if __name__ == &quot;__main__&quot;:<br>    create_output_directory()<br>    capture_photos()</pre><p>I used this format on purpose, opposed to writing the files in the format ffmpeg requires:</p><ul><li>img%03d.jpg</li></ul><p>This format is primarily used printf-style string formatting. It’s a format specifier that indicates how to display an integer. Let me clarify:</p><h3>Meaning of %03d in String Formatting:</h3><ul><li><strong>%d</strong>: Represents a decimal integer.</li><li><strong>0</strong>: Pads the output with zeros if the number has fewer digits than specified.</li><li><strong>3</strong>: Specifies the minimum width of the field (the output will be at least 3 characters wide).</li></ul><p>This gives use the ability to stop and start the script multiple times with out the possibility of writing over previous photos. After all the timelapse photos have been written, I used python again to rename the files into the format specified earlier.</p><pre><br>pi@gallifrey:~/home/pi $ sudo apt install python3-natsort<br><br>pi@gallifrey:~/home/pi $ sudo apt install ffmpeg -y<br><br>pi@gallifrey:~/home/pi $ vim rename_photos.py<br></pre><pre>import os<br>from natsort import natsorted<br>from datetime import datetime<br><br>image_folder = os.path.expanduser(&quot;/home/pi/timelapse/&quot;)<br>prefix = &quot;img&quot;<br>ext = &quot;.jpg&quot;<br><br># the variable images is a list created from iterating through the folder<br>images = [<br>    f for f in os.listdir(image_folder)<br>    if f.lower().endswith((&#39;.jpg&#39;, &#39;.jpeg&#39;, &#39;.png&#39;))<br>]<br>images = sorted(images, key=lambda x: os.path.getmtime(os.path.join(image_folder, x)))<br># this is what sorts the list <br><br># This last loops is what renames the sorted files<br>for i, filename in enumerate(images, start=1):<br>    new_name = f&quot;{prefix}{i:03d}{ext}&quot;<br>    src = os.path.join(image_folder, filename)<br>    dst = os.path.join(image_folder, new_name)<br>    os.rename(src, dst)<br>    print(f&quot;Renamed: {filename} -&gt; {new_name}&quot;)</pre><p>Lets go over some of these functions:</p><p>os.path.expanduser() is a Python function that <strong>replaces the </strong><strong>~ (tilde)</strong> in a file path with the <strong>current user&#39;s home directory</strong>.</p><p>os.listdir(image_folder) Gets <strong>all files and folders</strong> in the given directory.</p><p>for f in ...Loops through each filename.</p><p>f.lower().endswith(...)Converts the filename to lowercase. (so .JPG, .Png, etc. are handled) It keeps only files that end with .jpg, .jpeg, or .png</p><p>[ ... for ... if ... ]Builds a list from only the matching filenames.</p><p>sorted(images, key=...): Sorts the images list using a custom rule.</p><p>lambda x: ...: This defines an <strong>anonymous function</strong> (a &quot;lambda&quot;) that tells sorted how to sort each filename x.</p><p>os.path.getmtime(...): Gets the <strong>modification time</strong> (mtime) of a file — how recently it was edited or saved.</p><p>os.path.join(image_folder, x): Combines the folder path with the image filename, to get the <strong>full path</strong> to each image.</p><p>Here is the output of running rename_photos.py:</p><pre>pi@gallifrey:~/home/pi $ python3 rename.py<br><br>Renamed photo_2025-05-31_15-17-20.jpg to img001.jpg<br>Renamed photo_2025-05-31_15-17-22.jpg to img002.jpg<br>Renamed photo_2025-05-31_15-17-25.jpg to img003.jpg<br>Renamed photo_2025-05-31_15-17-27.jpg to img004.jpg<br>Renamed photo_2025-05-31_15-17-29.jpg to img005.jpg<br>Renamed photo_2025-05-31_15-17-31.jpg to img006.jpg<br>Renamed photo_2025-05-31_15-17-33.jpg to img007.jpg<br>Renamed photo_2025-05-31_15-17-35.jpg to img008.jpg<br>Renamed photo_2025-05-31_15-17-37.jpg to img009.jpg<br>Renamed photo_2025-05-31_15-17-39.jpg to img010.jpg<br>Renamed photo_2025-05-31_15-17-41.jpg to img011.jpg<br>Renamed photo_2025-05-31_15-17-43.jpg to img012.jpg<br>...<br>....<br>Renamed photo_2025-05-31_22-19-33.jpg to img291.jpg<br>Renamed photo_2025-05-31_22-22-53.jpg to img292.jpg<br>Renaming complete!</pre><p>Now here is what we have been waiting for! ffmpeg is a powerful tool for video and audio. You can even use it to help compile your own voice on your one AI assistant.</p><pre>pi@gallifrey /home/pi/timelapse $ ffmpeg --help<br>                      <br>ffmpeg version 7.1.1-1+b1 Copyright (c) 2000-2025 the FFmpeg developers<br>  built with gcc 14 (Debian 14.2.0-19)<br><br>pi@gallifrey /home/pi/timelapse $ <br><br>ffmpeg -framerate 30 -i img%03d.jpg -c:v libx264 -pix_fmt yuv420p timelapse.mp4</pre><p>Yeah that’s a beefy command but I know you can do it!</p><p>Let’s break it down:</p><p>ffmpegCalls the FFmpeg program</p><p>-framerate 30Sets the input frame rate to <strong>30 frames per second</strong> (i.e., 30 images = 1 second of video)</p><p>-i img%03d.jpgLoads files like img001.jpg, img002.jpg, ..., using <strong>3-digit padding</strong> (%03d)</p><p>-c:v libx264Sets the video codec to <strong>H.264</strong>, very common and compatible</p><p>-pix_fmt yuv420pSets pixel format to <strong>yuv420p</strong> — required for playback on many devices</p><p>timelapse.mp4Output video filename</p><p>Here is the final video generated:</p><p>Yeah.. I know I need to work on my lighting. 😂</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*wYFYqr9Edgk06i1ykO90Sg.gif" /><figcaption>Even made a .gif</figcaption></figure><p>Here is that recipe as promised: I will add my sourdough and focaccia recipes to my blog at some point.</p><p>Makes 10–30 pancakes. Get you a kitchen scale too. These pancakes last about a week. 2 kids, 2 pancakes every morning. Freeze them in bags of 4 for the whole week. Microwave 4 frozen pancakes and your kids have fresh, homemade pancakes every morning.</p><p>Flour: 430g</p><p>Sugar: 30g</p><p>Salt: 6g</p><p>Baking Power: 9g</p><p>Milk: 415ml</p><p>Water: 200ml</p><p>Butter: 84g</p><p>Eggs: 1</p><p>If your discard starter was 1:1 ratio just subtract (startergrams/2) for the flour and water. So if the discard weighed 180g than subtract 60g of total flour and 60ml of water from the recipe.</p><p>Step. 1) In a stainless steel bowl on low heat, add butter. Allow to melt fully w/o boiling.</p><p>Step 2.) add room temp milk (415g) This will make the fats in the butter congeal slightly. Keep on low until butter fats are no longer solid, stirring occasionally. add your egg and incorporate. Keep on low low until you’ve mixed dry ingredients.</p><p>Step 2.5) Add discard to 200 ml of warm water and blend so the dough is even distributed in the water. Do not exceed 100F. This water and discard mix will be added right before we incorporate dry ingredients.</p><p>Step 3.) In a dry stainless steel bowl add flour, salt, sugar and baking powder.</p><p>Step 4.) Take your warm milk and butter mixture and add the water/discard mixture. Slowly add your dry ingredients into your liquid. Stir until not clumpy. May need to adjust viscosity by adding water. Trail and error.</p><p>Step 5.) Make sure your cast iron skillet is on 3.5/4 and make some pancakes.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=60ac8d0b699f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Raspberry Pi.. An Electrician’s Tool?.. *Updated*]]></title>
            <link>https://medium.com/@pagaudiomonte/raspberry-pi-an-electricians-tool-updated-5ad367d1b408?source=rss-7a261d38e18d------2</link>
            <guid isPermaLink="false">https://medium.com/p/5ad367d1b408</guid>
            <category><![CDATA[raspberry-pi]]></category>
            <category><![CDATA[dhcp-server]]></category>
            <category><![CDATA[wifihacking]]></category>
            <category><![CDATA[webcam]]></category>
            <category><![CDATA[python3]]></category>
            <dc:creator><![CDATA[Cisc0_pete]]></dc:creator>
            <pubDate>Tue, 27 May 2025 22:18:42 GMT</pubDate>
            <atom:updated>2025-05-27T22:18:42.667Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HcMIhNRU2opLvk9J3v_dFg.jpeg" /></figure><p><strong>Original Project</strong>- <a href="https://medium.com/@pagaudiomonte/raspberry-pi-an-electricians-tool-bae250bc4c12">https://medium.com/@pagaudiomonte/raspberry-pi-an-electricians-tool-bae250bc4c12</a></p><p><strong>🔧 Project Overview</strong></p><p>In this project, I turned a Raspberry Pi 4B+ into a<strong> Wi-Fi access point</strong> that lets me stream live video to any device — <strong>no internet, router, or external infrastructure required</strong>.</p><p>Instead of remoting into the Pi and starting the script, I added a physical trigger, using the GPIO pins and an old doorbell button to <strong>start the web app. </strong>Whether you’re under a crawlspace or out in the field, this is the perfect offline monitoring tool.</p><p><strong>🧱 What You’ll Need</strong></p><ul><li>Raspberry Pi 4 running Raspberry Pi OS (Bookworm or similar)</li><li>USB webcam or Pi Camera Module</li><li>Python3 + Flask for streaming (stream.py)</li><li>hostapd + dnsmasq for wireless AP and DHCP</li><li>Breadboard switch, jumper wires, or just touch two GPIO wires together</li><li>A phone or laptop to view the stream</li></ul><p>Instead of buying brand new, there are so many useful parts on old PCBs destined for the trash. Buttons, switches, antennas. Good Will always has old routers, or electronics for cheap. Desolder.</p><p><strong>🔌 Step-by-Step Setup</strong></p><p>Instead of connecting the Pi to a hotspot or a local network, I used HOSTAPD to use the Pi’s wireless interface as an access point. I also installed and configured a DHCP server on the Pi so my cellphone or whatever device can be used to view the stream. Using an obscure subnet of 10.0.0.96/28, I made sure that collisions with common networks are highly unlikely. If plugged into another network, there is a very low probability its static or DHCP server can cause any issues.</p><p>Sorry guys, I’ve been studying for the CCNA and I have eating, breathing and sleeping subnetting.. it’s really not as bad when you get a hang of it.</p><pre>Subnet Information<br><br>10.0.0.96/28 255.255.255.240<br>11111111.11111111.11111111.11110000<br><br>256-240 = 16 address block size<br><br>10.0.0.96 - Network Id <br>10.0.0.111 - Broadcast Address<br>10.0.0.97 - 10.0.0.110 = 14 Usable Addresses</pre><p>Before starting any project I like to update my device. Then I installed flask, opencv, hostapd, and dnsmasq.</p><pre>pi@streamer:~ $ sudo apt update<br>pi@streamer:~ $ sudo apt install python3-flask python3-opencv hostapd dnsmasq -y</pre><h3>python3-flask</h3><ul><li><strong>What it is</strong>: Flask is a lightweight, micro web framework for Python, designed for building web applications quickly and with minimal overhead. It uses Python 3 (python3-flask is the Debian/Ubuntu package for Flask).</li></ul><h3>python3-opencv</h3><ul><li><strong>What it is</strong>: OpenCV (Open Source Computer Vision Library) is a powerful open-source library for computer vision, image processing, and machine learning, with Python 3 bindings (python3-opencv is the Debian/Ubuntu package).</li></ul><h3>hostapd</h3><ul><li><strong>What it is</strong>: hostapd (Host Access Point Daemon) is a user-space daemon for creating and managing Wi-Fi access points (APs) on Linux systems.</li></ul><h3>dnsmasq</h3><ul><li><strong>What it is</strong>: dnsmasq is a lightweight, easy-to-configure DNS forwarder, DHCP server, and router advertisement tool.</li></ul><p>There are so many other uses for these tools, especially inside a home lab, IoT, micro-network for malware analysis or a DIY security system. I am using it as a tool to help me with my duties as an electrician. Boring, I know! well.. not for me but future posts will be much more entertaining.. I will give additional project ideas at the end. Let’s do this!</p><h3>Step 2: Assign wlan0 a Static IP</h3><pre>pi@streamer:~ $ sudo systemctl stop hostapd<br>pi@streamer:~ $ sudo systemctl stop dnsmasq<br>pi@streamer:~ $ sudo vim /etc/dhcpcd.conf<br><br>###Navigate to the end of dhcpcd.conf and add these lines. ###</pre><pre>interface wlan0  #This will be our static IP for the AP<br>    static ip_address=10.0.0.97/28<br>    nohook wpa_supplicant<br><br>interface eth0 #This is for future access. <br>static ip_address=10.0.0.98/28</pre><p>I added the Pi’s eth0 interface so later on I can add a switch into the mix and this will turn the Pi and any other devices into a small, isolated wired network.</p><h3><strong>Step 3: Configure DHCP with dnsmasq</strong></h3><p>Now it’s time to set up the DHCP server, so my phone or my laptop or any device with Wi-Fi and a browser can view the stream.</p><pre>pi@streamer:~ $sudo vim /etc/dnsmasq.conf</pre><p>Five ip addresses in this small subnet is enough for now.</p><pre>#wlano(wirelessclients)(5addrs)<br>interface=wlan0<br>dhcp-range=10.0.0.99,10.0.0.104,255.255.255.240,24h<br>#dhcp-option=6,10.0.0.101<br><br>#eth0(wiredclients)(5addrs)<br>interface=eth0<br>dhcp-range=10.0.0.105,10.0.0.110,255.255.255.240,24h<br>#dhcp-option=6,10.0.0.101<br><br>#Disregard dhcp-options=6,.. this is used to denote what DNS server each interface<br>#will use. This is for a future project using a Pi-hole to inspect suspicious<br>#dns requests. <br>~<br>~<br>~</pre><p>Now, any device that connects to the Pi’s Wi-Fi will automatically get an IP address from the DHCP server.</p><h3>Step 4: Configure hostapd to Broadcast the Wi-Fi</h3><p>Create /etc/hostapd/hostapd.conf</p><pre>pi@streamer:~ $ sudo vim /etc/hostapd/hostapd.conf</pre><pre>interface=wlan0  #which network interface will broadcast the Wi-Fi signal<br>driver=nl80211  #Tells hostapd which driver to use for the wireless interface<br>ssid=PiStreamAP   #Sets the name of the Wi-Fi network (SSID)<br>hw_mode=g   #Sets the Wi-Fi mode. #g = 2.4 GHz (802.11g)<br>channel=7   #Specifies the Wi-Fi channel to broadcast on<br>auth_algs=1  #Sets allowed authentication algorithm (open)(not secure)<br>wmm_enabled=0  #Wi-Fi Multimedia. It&#39;s a QoS (Quality of Service) feature for prioritizing traffic (like video or voice).</pre><p>I am sure you can figure out how to update the configuration for secure authentication like WPA2.</p><p>Unmask(if needed), enable and start the service:</p><pre>pi@streamer:~ $ sudo systemctl unmask hostapd<br>pi@streamer:~ $ sudo systemctl enable hostapd<br>pi@streamer:~ $ sudo systemctl start hostapd</pre><p>After any configuration changes, restart hostapd and dnsmasq:</p><pre>pi@streamer:~ $ sudo systemctl restart hostapd<br>pi@streamer:~ $ sudo systemctl restart dnsmasq<br>###This can be applied to most configuration changes, restarting the service<br>###pushes the changes into effect. </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/738/1*87ri0BrzIoXKEcjI5Kn18A.jpeg" /></figure><p>We are now broadcasting PiStreamAP — its open and there is no route to the internet, it is all local. I want to get it to a point where I can update the time from my cellphone since it cannot reach any <strong>NTP </strong>servers. Be prepare to see time keeping is not synced. That will be for another day.</p><p>**If you look at the screenshot of the feed via the browser, you will notice the time in the application is correct since it is getting it from the JavaScript running on the browser of my phone, not the Pi..</p><p>Now, it is time to set up the web app that will be hosted on the Pi. All of this will be done with Python. I am still a novice python user, so I had a bit of help from AI. Here is the python script to bring up a webserver and serve the video captured from the connected webcam.</p><pre>pi@streamer:~ $ sudo vim /home/pi/Desktop/stream.py</pre><pre>from flask import Flask, Response<br>import cv2<br>import threading<br>import time<br><br>app = Flask(__name__)<br><br>camera = None<br>output_frame = None<br>lock = threading.Lock()<br><br>def get_camera():<br><br>    return cv2.VideoCapture(0)  # 0 is typically the default camera<br><br>def generate_frames():<br>    global output_frame, camera<br><br>    if camera is None:<br>        camera = get_camera()<br>        time.sleep(2.0) <br><br>    while True:<br>        with lock:<br>            if output_frame is None:<br>                continue<br><br>            (flag, encoded_image) = cv2.imencode(&quot;.jpg&quot;, output_frame)<br>            if not flag:<br>                continue<br><br>        yield(b&#39;--frame\r\n&#39; b&#39;Content-Type: image/jpeg\r\n\r\n&#39; +<br>              bytearray(encoded_image) + b&#39;\r\n&#39;)<br><br>def camera_stream():<br>    global output_frame, camera<br><br>    if camera is None:<br>        camera = get_camera()<br>        time.sleep(2.0) <br><br>    while True:<br>        success, frame = camera.read()<br>        if not success:<br>            print(&quot;Failed to grab frame&quot;)<br>            time.sleep(1)<br>            camera = get_camera()<br>            continue<br><br>        with lock:<br>            output_frame = frame.copy()<br><br>        time.sleep(0.01)<br><br>@app.route(&#39;/&#39;)<br>def index():<br>    return &quot;&quot;&quot;<br>    &lt;html&gt;<br>      &lt;head&gt;<br>        &lt;title&gt;Peter&#39;s Raspberry Pi Camera Stream&lt;/title&gt;<br>        &lt;style&gt;<br>          body { font-family: Arial; text-align: center; margin-top: 50px; background-color:black; color: white;  }<br><br>          img { max-width: 100%; border: 2px solid white; }<br>        &lt;/style&gt;<br>      &lt;/head&gt;<br>      &lt;body&gt;<br>        &lt;h1&gt;Peter&#39;s Raspberry Pi Camera Stream&lt;/h1&gt;<br>        &lt;img src=&quot;/video_feed&quot;&gt;<br>        &lt;h2&gt;Prototype 2.0 HTTP&lt;/h2&gt;<br>        &lt;h2&gt;Electrician&#39;s buddy&lt;/h2&gt;<br>        &lt;script&gt;const options = { year: &#39;numeric&#39;, month: &#39;long&#39;, day: &#39;numeric&#39;, hour: &#39;numeric&#39;, minute: &#39;2-digit&#39;, hour12: true }; document.write(new Date().toLocaleString(&#39;en-US&#39;, options).replace(&#39;,&#39;, &#39; -&#39;));&lt;/script&gt;<br>      &lt;/body&gt;<br>    &lt;/html&gt;<br>    &quot;&quot;&quot;<br><br>@app.route(&#39;/video_feed&#39;)<br>def video_feed():<br>    return Response(generate_frames(),<br>                    mimetype=&#39;multipart/x-mixed-replace; boundary=frame&#39;)<br><br>if __name__ == &#39;__main__&#39;:<br>    t = threading.Thread(target=camera_stream)<br>    t.daemon = True<br>    t.start()<br><br>    app.run(host=&#39;0.0.0.0&#39;, port=8000, debug=False, threaded=True)</pre><p>There are probably 10 different way to set up a web server and serve up the video stream but for this project, I had already used Flask in the original project. I choose Flask because it’s lightweight and flexible, making it perfect for quickly building a simple video streaming app without unnecessary overhead. Its simplicity and easy integration with Python libraries make it ideal for this kind of small, self-contained project.</p><h3>🎥 Live Video Stream with Flask</h3><p>Now lets test stream.pyThe way it is configured it should serve the camera stream via port 8000.</p><p>To run this manually, run the following:</p><pre>pi@streamer:~ $ python3 /home/pi/Desktop/stream.py</pre><p>I can now visit <strong>http://10.0.0.97:8000</strong> on my phone or any device with a browser that is connected to the open Wi-fi SSID: <strong>PiStreamAP</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/738/1*3KIggrzHrsrU2MJ1W8F4vg.jpeg" /></figure><p>My last iteration of this project, linked at top of the page, I was required to SSH into the Pi to run the script directly. I managed to get familiar with the GPIO pins and connect an extra doorbell I had lying around. When the button is pushed, it runs the script that starts the web app.</p><p>Also, the program runs in the background so if need be I can access the shell and run other commands. Previous copy the server ran in the foreground and I had to CNTRL + C to stop it.</p><p>I had to create a listener script which basically listens for the button push. The script runs at boot and when GPIO pin 17 and pin 6 (GRND) make contact (button is pressed or I can just touch the two wires together), /home/pi/Desktop/stream.py is ran.</p><pre>pi@streamer:~ $ sudo vim /home/pi/Desktop/button_trigger.py<br><br>#creating a listener script now</pre><pre>from gpiozero import Button<br>import subprocess<br><br>button = Button(17)<br><br>def start_stream():<br>    subprocess.Popen([&quot;python3&quot;, &quot;/home/pi/Desktop/stream.py&quot;])<br><br>button.when_pressed = start_stream<br><br>pause()  </pre><p>I just threw this on the Desktop with the stream.py and created a crontab to run the listening script at boot.</p><pre>pi@streamer:~ $ crontab -e</pre><p>Add the follow code to the bottom of the file</p><pre>@reboot python3 /home/pi/Desktop/button_trigger.py &amp;</pre><p>Regarding crontab, this just means every time we reboot, run this command. Specifically, in the the background.</p><h3>Bonus: Ethernet Expansion</h3><p>We can also connect the Pi’s eth0 interface to a switch and give it its own DHCP range using a second dnsmasq instance (<strong>/etc/dhcpcd.conf</strong>). With this set up, you can have a small segregated network to sniff traffic or play around with DNS. Sky’s the limit. I created a small network to sniff some traffic from an Android Tv box known to contain some malicious applications. That’s a whole ‘nother article, though!</p><h3>🔧 Project Ideas Using HOSTAPD, DHCP, DNS, and Flask on Raspberry Pi</h3><p>Once you’ve set up your Raspberry Pi with hostapd, DHCP, DNS, or Flask capabilities, you can explore dozens of creative and practical applications. Here are just a few ideas:</p><ul><li><strong>Local Doorbell Cam</strong> — Trigger a video stream when the doorbell is pressed and view it from any connected device.</li><li><strong>Offline Baby Monitor</strong> — Use a webcam and Flask to stream video/audio over a private Wi-Fi AP.</li><li><strong>Portable Dashcam</strong> — Record and stream footage to connected devices while driving or parking.</li><li><strong>Smart Home Controller</strong> — Run a private dashboard to manage relays, lights, or sensors.</li><li><strong>File Drop or Photo Booth</strong> — Let others connect and upload/download files in an offline environment.</li><li><strong>Offline Media Server</strong> — Host movies or music and stream them to phones via local Wi-Fi.</li><li><strong>Capture-the-Flag Lab</strong> — Create a mini pentesting environment with rogue APs or DNS spoofing.</li><li><strong>Presence Detection System</strong> — Log devices as they connect and trigger actions (e.g., lights or alarms).</li><li><strong>Coding Classroom Hotspot</strong> — Let students code and test websites without needing internet.</li></ul><p>These projects combine Flask, hostapd, dnsmasq, GPIO, and networking fundamentals to unlock a wide range of DIY solutions — from fun experiments to real-world tools.</p><h3>🚀 Final Thoughts</h3><p>This upgraded Raspberry Pi project gives you a <strong>private, offline, button-activated camera stream</strong> — powered by open-source tools and GPIO pins. I guess you can say I made a doorbell cam..</p><ul><li>✅ No router</li><li>✅ No cloud</li><li>✅ No subscription</li><li>✅ No nonsense</li></ul><p>Just power it on, press the button, and start streaming to your phone over an access point you created.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5ad367d1b408" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Making the Pi feel like /home]]></title>
            <link>https://medium.com/@pagaudiomonte/making-the-pi-feel-like-home-7d15169085d5?source=rss-7a261d38e18d------2</link>
            <guid isPermaLink="false">https://medium.com/p/7d15169085d5</guid>
            <category><![CDATA[bash]]></category>
            <category><![CDATA[ubuntu]]></category>
            <category><![CDATA[vim]]></category>
            <category><![CDATA[raspberry-pi]]></category>
            <category><![CDATA[ide]]></category>
            <dc:creator><![CDATA[Cisc0_pete]]></dc:creator>
            <pubDate>Wed, 21 May 2025 19:41:41 GMT</pubDate>
            <atom:updated>2025-05-21T19:41:41.312Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*__kvG5rSG1dyqVnQAdL8Xw.jpeg" /><figcaption>AI — generated photo</figcaption></figure><p>Modifying .bashrc and .vimrc to make the Pi more familiar</p><p>When I started this IT journey, I received a great piece of advice that I continue to practice daily. “Learn to live on the command line.” No matter how uncomfortable it is and how many hours of troubleshooting is required. The skills acquired will be invaluable.</p><p>I am most familiar with Debian based distros. Raspberry Pi OS Bookworm is Debian based but there are a few differences that I am glaringly reminded every time I SSH into a Pi. It isn’t much but enough to notice..</p><ol><li>Certain aliases are not enabled by default; such as ll or la. Let’s fix it.. Open .bashrc (using nano until we fix Vim)</li></ol><pre>pi@raspberry:~/Desktop $ sudo nano /home/pi/.bashrc<br><br># Add or uncomment these lines in the .bashrc file. <br><br>  alias ll=&#39;ls -alF&#39; # This is a common &quot;detailed directory listing&quot; alias.<br>  alias la=&#39;ls -A&#39; # Shows hidden files without cluttering the view.<br>  alias l=&#39;ls -CF&#39; # Good for a quick, color-coded glance at files.<br><br><br># These are some safe measures for beginner use<br># Prompts &quot;Are you sure?&quot; before deleting a file.<br># Prevents accidental deletions.<br><br>  alias rm=&#39;rm -i&#39;<br>  alias cp=&#39;cp -i&#39;<br>  alias mv=&#39;mv -i&#39;<br><br><br># Highlights matching text in grep results.<br># Super helpful for spotting what you searched for.<br><br>  alias grep=&#39;grep --color=auto&#39;<br>  alias egrep=&#39;egrep --color=auto&#39;<br>  alias fgrep=&#39;fgrep --color=auto&#39;</pre><p>These modifications to .bashrc can give the Raspberry Pi an “Ubuntu” styled terminal experience. Much of the software that is packaged with Bookworm is specifically chosen to run on resource constrained hardware.</p><p>Nano is one of the first programs one uses in their journey into becoming a Linux user. Nano is user friendly and usually universally installed. Vi/Vim is another story. Even if the entire system is stripped-down, <strong>Vi will still be there</strong> and it is <strong>notoriously intimidating for newcomers. </strong>Raspberry Pi Bookworm ships with Vim. V<strong>i</strong> is usually just an alias or symlink to vim.basic I decided to modify this version to make it more user friendly, especially to beginners.</p><pre>pi@raspberry:~/Desktop $ sudo nano ../.vimrc<br><br># This will create or modify this file.<br># If there is an option that does not suit you, come back here and delete.<br># These options will give you an IDE vibe. <br><br>  syntax on                &quot; Enable syntax highlighting<br>  set nocompatible         &quot; Enable Vim&#39;s full power<br>  set number               &quot; Show line numbers<br>  set tabstop=4            &quot; Number of spaces per tab<br>  set shiftwidth=4         &quot; Indent width<br>  set expandtab            &quot; Convert tabs to spaces<br>  set autoindent           &quot; Auto-indent new lines<br>  set smartindent          &quot; Smarter auto-indenting<br>  set background=dark      &quot; Better theme support for dark backgrounds<br>  set showcmd              &quot; Show (partial) command in bottom bar<br>  set cursorline           &quot; Highlight current line<br>  set wildmenu             &quot; Tab completion menu</pre><p>The arrow keys now move the cursor between lines, instead of inserting odd characters. I promise, you can learn Vim, too. When finished here, run <strong>vimtutor.</strong></p><pre>pi@raspberry:~/Desktop $ vimtutor<br><br>## This will guide you through a body of text using vim. Try it!</pre><p>By upgrading Vim and tweaking Bash on Bookworm, you can closely replicate Ubuntu’s terminal and editing experience without switching OS. If you prefer Ubuntu’s full environment, flash Ubuntu Server to your Pi for authenticity, but be mindful of resource usage on older models.</p><p>Like usual, if you have any suggestions, constructive criticism, or see any errors, please comment or reach out to let me know. We are all students, we are all learning, and we are all here to help each other.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7d15169085d5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Raspberry Pi.. An Electrician’s Tool?]]></title>
            <link>https://medium.com/@pagaudiomonte/raspberry-pi-an-electricians-tool-bae250bc4c12?source=rss-7a261d38e18d------2</link>
            <guid isPermaLink="false">https://medium.com/p/bae250bc4c12</guid>
            <category><![CDATA[python3]]></category>
            <category><![CDATA[streaming]]></category>
            <category><![CDATA[raspberry-pi]]></category>
            <category><![CDATA[flask-framework]]></category>
            <category><![CDATA[wlan]]></category>
            <dc:creator><![CDATA[Cisc0_pete]]></dc:creator>
            <pubDate>Sun, 30 Mar 2025 03:01:25 GMT</pubDate>
            <atom:updated>2025-03-31T10:59:36.039Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fwZILTvJn5xhshq5HORTnA.jpeg" /><figcaption>The goods..</figcaption></figure><p>By day, I am an electrician, albeit a lonely electrician and by night, a student and tinkerer. It has proven quite difficult to find trustworthy and hardworking helpers who want to genuinely learn. I spend many hours up and down stairs, in and out of attics and crawlspaces to flip breakers so I can work safely. Sometimes it could take 15–20 minutes just to crawl out of a particular spot to go flip a few breaker just to army crawl my way back under to confirm I turned off the correct breaker. There was a million other ways to fix my problem, perhaps buy a circuit tracer.. but where’s the fun in that.. lets do this the hard way! So I built a solution using a Rasp Pi 4, an old webcam I bought at Goodwill, a Netgear Wi-Fi adapter, and a decent cell phone charging battery pack.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8rv4ILeJytUA0KZ58QMIww.jpeg" /></figure><p>It is not entirely finished with all the features and lacks the limited user input I expect but it will suffice until I further improve upon the idea. It is a mobile HTTP streaming device I can use anywhere. I would equate it to DroidCam. I can use any browser in the LAN to view the camera. I will use my cell phone and it’s hotspot for sake of ease. Here are the specs.</p><pre>pi@sendstrm:~ $ cat /proc/device-tree/model<br>  Raspberry Pi 4 Model B Rev 1.5<br><br><br>pi@sendstrm:~ $ lsb_release -a<br>  No LSB modules are available.<br>  Distributor ID: Debian<br>  Description:    Debian GNU/Linux 12 (bookworm)<br>  Release:        12<br>  Codename:       bookworm<br><br>pi@sendstrm:~ $ lsusb<br>  Bus 002 Device 002: ID 0846:9060 NetGear, Inc. Model A8000 <br>  AXE3000 USB3.0 Wireless Adapter<br><br>#Side Note: This adapter works very well with Kali right out of the box.<br>#Side Note: Right into Monitor Mode.<br><br>pi@sendstrm:~ $ lsusb -s 001:003<br>  Bus 001 Device 003: ID 0c45:6366 Microdia Webcam Vitade AF <br>    Model: W2 1080P Webcam Lens: 3.6mm PWR: DC 5V<br><br>Anker 321 Power Bank, 5,200 mAh Portable Charger<br>#Side Note: No issues with low voltages. <br></pre><p>So, let me show you how I getting it up and going. After I have place the camera in the ideal spot facing my home made circuit tester, (light bulb on a plug.. highly technical, I know) I activate my hotspot then open Termux on my phone. SSH into the Pi.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QIu2jHq1F-pht-HrPkjRiQ.jpeg" /></figure><p>Once I am logged into the pi on my cell phone, I run the bash script that is located in my home directory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*banikjE1Flh7NdcGDJOaMA.jpeg" /></figure><p>In the future, I would like to run this script via an old door bell button attached to the GPIO pins or a switch / push button I stole off old circuit boards. I love reusing old parts taken off circuit boards that were headed to the dump. A lot of things can be repurposed and resoldered. Here is my bash script.</p><pre>pi@sendstrm:~ $ cat start_stream.sh<br>#/bin/bash<br><br>#Activate venv<br>source ~/pi_stream_env/bin/activate<br><br>#run stream<br><br>python3 ~/pi_stream/stream.py</pre><p>This starts my python script which is a Flask application that streams live video from the webcam to a web browser over HTTP. It uses OpenCV (cv2.VideoCapture(0)) to capture video frames, which are processed and streamed using the generate_frames() function. The /video_feed route streams the video, while the / route displays an HTML page with the live feed and a timestamp. A background thread handles the camera stream, allowing the main Flask server to remain responsive.</p><pre>from flask import Flask, Response<br>import cv2<br>import threading<br>import time<br><br>app = Flask(__name__)<br><br>camera = None<br>output_frame = None<br>lock = threading.Lock()<br><br>def get_camera():<br><br>    return cv2.VideoCapture(0)  # 0 is typically the default camera<br><br>def generate_frames():<br>    global output_frame, camera<br><br>    if camera is None:<br>        camera = get_camera()<br>        time.sleep(2.0) <br><br>    while True:<br>        with lock:<br>            if output_frame is None:<br>                continue<br><br>            (flag, encoded_image) = cv2.imencode(&quot;.jpg&quot;, output_frame)<br>            if not flag:<br>                continue<br><br>        yield(b&#39;--frame\r\n&#39; b&#39;Content-Type: image/jpeg\r\n\r\n&#39; +<br>              bytearray(encoded_image) + b&#39;\r\n&#39;)<br><br>def camera_stream():<br>    global output_frame, camera<br><br>    if camera is None:<br>        camera = get_camera()<br>        time.sleep(2.0) <br><br>    while True:<br>        success, frame = camera.read()<br>        if not success:<br>            print(&quot;Failed to grab frame&quot;)<br>            time.sleep(1)<br>            camera = get_camera()<br>            continue<br><br>        with lock:<br>            output_frame = frame.copy()<br><br>        time.sleep(0.01)<br><br>@app.route(&#39;/&#39;)<br>def index():<br>    return &quot;&quot;&quot;<br>    &lt;html&gt;<br>      &lt;head&gt;<br>        &lt;title&gt;Peter&#39;s Raspberry Pi Camera Stream&lt;/title&gt;<br>        &lt;style&gt;<br>          body { font-family: Arial; text-align: center; margin-top: 50px; background-color:black; color: white;  }<br><br>          img { max-width: 100%; border: 2px solid white; }<br>        &lt;/style&gt;<br>      &lt;/head&gt;<br>      &lt;body&gt;<br>        &lt;h1&gt;Peter&#39;s Raspberry Pi Camera Stream&lt;/h1&gt;<br>        &lt;img src=&quot;/video_feed&quot;&gt;<br>        &lt;h2&gt;Prototype 2.0 HTTP&lt;/h2&gt;<br>        &lt;h2&gt;Electrician&#39;s buddy&lt;/h2&gt;<br>        &lt;script&gt;const options = { year: &#39;numeric&#39;, month: &#39;long&#39;, day: &#39;numeric&#39;, hour: &#39;numeric&#39;, minute: &#39;2-digit&#39;, hour12: true }; document.write(new Date().toLocaleString(&#39;en-US&#39;, options).replace(&#39;,&#39;, &#39; -&#39;));&lt;/script&gt;<br>      &lt;/body&gt;<br>    &lt;/html&gt;<br>    &quot;&quot;&quot;<br><br>@app.route(&#39;/video_feed&#39;)<br>def video_feed():<br>    return Response(generate_frames(),<br>                    mimetype=&#39;multipart/x-mixed-replace; boundary=frame&#39;)<br><br>if __name__ == &#39;__main__&#39;:<br>    t = threading.Thread(target=camera_stream)<br>    t.daemon = True<br>    t.start()<br><br>    app.run(host=&#39;0.0.0.0&#39;, port=8000, debug=False, threaded=True)</pre><p>This setup can be used for for remote monitoring, surveillance applications, dash cams, nanny cam. It provides a real-time video feed in a web browser. I am sure with the right software and a flash drive, the live stream can be recorded for future use.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3jEG6A5eEFCuELGVjuGWUQ.jpeg" /></figure><p>I can pull it up on my phone’s browser when I am at the service panel and work my way through the breakers until I find the correct one.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3F_WVigJm0uRkDLX9EjNaw.jpeg" /><figcaption>Camera Setup for live feed</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cW5WIwL-6NtERcK6bFYMjg.jpeg" /><figcaption>Live Feed — Breaker ON</figcaption></figure><p>This is what I can see via my phone’s browser. Once I turn off the correct breaker, I can tell right away.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uGbSxw3cP3gr9hSspH0cbQ.jpeg" /><figcaption>Live Feed — Breaker OFF</figcaption></figure><p>Again, this can be applied to a litany of other applications. In future versions, I will have a button to enable the script as well as a voltage monitoring tool connected via the GPIO pins that will display live voltages underneath the timestamp within my application. I would also like to condense the peripherals to make it look sleeker and more compact. Perhaps 3D print a larger encloser or find a smaller camera. I love projects like this. Granted, it may not be the best tool suited for the job but it works and combines my passion for programming, Raspberry Pi, python and networking with a real world, practical problem that will actually save me time and money.</p><p>Let me know what you think! If you have any suggestions, or constructive criticism, it would be greatly appreciated. Thank you for taking the time to check out my project. I will update when I have made the proper revisions to my design.</p><p>Happy Hacking!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bae250bc4c12" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>