Sunday, July 26, 2026

 Monitor DNS and SNI


Wireshark

tls.record.content_type==22


DNS Monitor

# IMPORTANT: This script was created used ChatGPT. Use at your own risk.


from scapy.all import sniff

from scapy.layers.dns import DNS, DNSQR

from datetime import datetime


LOG_FILE = "dns_log.txt"


# Optional: domains you want highlighted

BLOCKLIST = [

    "adult",

    "porn",

    "gambling",

    "casino",

]


seen = set()


def process_packet(packet):

    if packet.haslayer(DNSQR):

        try:

            domain = packet[DNSQR].qname.decode("utf-8").rstrip(".")


            # Avoid duplicate spam

            now_minute = datetime.now().strftime("%Y-%m-%d %H:%M")

            unique_key = f"{now_minute}:{domain}"


            if unique_key in seen:

                return


            seen.add(unique_key)


            timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")


            warning = ""

            for word in BLOCKLIST:

                if word.lower() in domain.lower():

                    warning = " [POTENTIALLY INAPPROPRIATE]"

                    break


            log_entry = f"[{timestamp}] {domain}{warning}"


            # Print to screen

            print(log_entry)


            # Save to file

            with open(LOG_FILE, "a", encoding="utf-8") as f:

                f.write(log_entry + "\n")


        except Exception as e:

            print(f"Error processing packet: {e}")


print("DNS monitor started...")

print(f"Logging to: {LOG_FILE}")

print("Press CTRL+C to stop.\n")


# Sniff DNS traffic (UDP port 53)

sniff(filter="udp port 53", prn=process_packet, store=False)


SNI Monitor


# IMPORTANT: This script was created used ChatGPT. Use at your own risk.


from scapy.all import sniff, TCP, Raw

from datetime import datetime


LOG_FILE = "sni_log.txt"


def extract_sni(payload):

    try:

        data = bytes(payload)


        # TLS Handshake check

        if len(data) < 5:

            return None


        # TLS Handshake record

        if data[0] != 0x16:

            return None


        pos = 43


        # Session ID

        session_id_length = data[pos]

        pos += 1 + session_id_length


        # Cipher Suites

        cipher_suites_length = int.from_bytes(data[pos:pos+2], 'big')

        pos += 2 + cipher_suites_length


        # Compression Methods

        compression_methods_length = data[pos]

        pos += 1 + compression_methods_length


        # Extensions

        extensions_length = int.from_bytes(data[pos:pos+2], 'big')

        pos += 2


        end = pos + extensions_length


        while pos + 4 <= end:

            ext_type = int.from_bytes(data[pos:pos+2], 'big')

            ext_length = int.from_bytes(data[pos+2:pos+4], 'big')

            pos += 4


            # SNI Extension

            if ext_type == 0x0000:

                sni_data = data[pos:pos+ext_length]


                # Skip list length + name type

                server_name_length = int.from_bytes(sni_data[3:5], 'big')

                server_name = sni_data[5:5+server_name_length]


                return server_name.decode(errors="ignore")


            pos += ext_length


    except Exception:

        return None


    return None


def packet_callback(packet):

    if packet.haslayer(TCP) and packet.haslayer(Raw):

        payload = packet[Raw].load

        sni = extract_sni(payload)


        if sni:

            timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")

            line = f"[{timestamp}] {sni}"


            print(line)


            with open(LOG_FILE, "a") as f:

                f.write(line + "\n")


print("Listening for TLS SNI traffic...")

sniff(filter="tcp port 443", prn=packet_callback, store=False)


Wednesday, December 10, 2025

STOP POSTING PICTURES WITH YOUR METADATA IN FULL VIEW 

remove meta data from jpg on macOS using Terminal

you will need Brew install on your mac

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

install ExifTool

brew install exiftool

open terminal and change directory to the location of files you wish to remove meta data

Terminal commands

this will display the metadata in your file

exiftool your_file.jpeg

removed all metadata from your file

exiftool -all= -overwrite_original your_file.jpeg 

Extra Paranoid removal

exiftool -all= --icc_profile:all -m -overwrite_original *.jpeg

validate your metadata has been removed

exiftool "your_file.jpg" | grep -i "gps\|location\|date\|camera\|iphone"

Pro-Tip, remove all metadata in files in a directory

exiftool -all= -overwrite_original -r *.jpeg *.jpeg *.png *.heic 2>/dev/null && echo "All metadata stripped ✅"


STOP POSTING PICTURES WITH YOUR METADATA IN FULL VIEW

Thursday, August 21, 2025

 My Brew install list

Brew install btop

Brew install nvtop

Brew install asitop

Brew install duf

Brew install cool-retro-term

Brew install mtr

Brew install glances

brew install termshark

brew install lsof

brew install ipcalc


more to come, if you don't know what these do, google is your friend. I recommend you install them and geek out on them


Wednesday, June 4, 2025

 Linux grep Commands

V grep "example" my.txt search for "example" in "my.txt" 

V grep "example" * txt search for "example" in all ".txt" files 

V grep-i "example" my.txt search for "example" while ignoring cases 

V grep-c "example" my.txt count # of lines that contain "example" 

V grep-n "example" my.txt show line numbers along with matched lines v grep-r "example" '. search for "example" in all files recursively grep-v "example" my.txt display lines that do not contain "example" 

V grep-w "example" search for lines containing "example" as a full word 

V grep -e "key1" -e "key?" my.txt show lines containing either pattern 

V grep-v-e "key1" -e "key2" my.txt show lines containing neither pattern 

V grep "key1"key2" my.txt display lines contain both "key1" and "key?"

V grep -E "errorlwarning" app.log use extended regex for matching 

V grep -E "^[a-zA-Z]" my.tt another extended regex example v grep-m3 "keyword" my.txt limit grep output to a fixed number of lines 

V grep-A2-B2 "example" my.txt show 2 lines before and after match v grep -C3 "error" server.log show 3 lines before and after match grep- "spoofing" my.txt show lines that exactly match a string 

V grep- "example" * display file names that match the pattern 

V grep "^hello" my.txt show all lines that start with "hello" 

V grep "done$" my.txt show all lines that end with "done" grep-o "begin."end" my.txt show only the matched string v grep -color "example" my.txt display matches with color v grep "[0-9]" my.txt show all lines that contain any digits grep-a "string" my.bin search for a string in a binary file

 

Useful Wireshark filters



  • ip.addr == 10.0.0.1: Show all traffic with 10.0.0.1 as either source or destination.
  • ip.addr == 10.0.0.0/24: Show all traffic to and from any address in 10.0.0.0/24.
  • ip.src == 10.0.0.1 && ip.dst == 10.0.0.2: Show all traffic from 10.0.0.1 to 10.0.0.2.
  • ! ip.addr == 10.0.0.1): Exclude all traffic to or from 10.0.0.1.
  • iсmp.type == 3: Show ICMP "destination unreachable" packets.
  • tcp or udp: Show TCP or UDP traffic.
  • tcp.port == 80: Show TCP traffic with port 80.
  • tcp.srcport < 1000: Show TCP traffic with source port range.
  • http or dns: Show all HTTP or DNS traffic.
  • tcp.flags.syn == 1: Show TCP packets with SYN flag set.
  • tcp.flags == 0x012: Show TCP packets with both SYN and ACK flags set.
  • tcp.analysis.retransmission: Show all retransmitted TCP packets.
  • http.request.method == "GET": Show TCP packets associated with HITP GET.
  • http.response.code == 404: Show packets associated with HTTP 404 response.
  • http.host == www.abc.com: Show HTTP traffic matching the Host header field.
  • tls.handshake: Show only TLS handshake packets.
  • tis.handshake.type == 1: Show client Hello packet during TLS handshake.
  • dhep and ip.addr == 10.0.0.0/24: Show DHCP traffic for 10.0.0.0/24 subnet.
  • dhcp.hw.mac_addr == 00:11:22:33:44:55: Show DHCP packets for client MAC address.
  • dns.resp.name == cnn.com: Show DNS responses with name field of "cnn.com".
  • frame contains keyword: Show all packets that contain the word "keyword".
  • frame.len > 1000: Show all packets with total length larger than 1000 bytes.
  • eth.addr == 00:11:22:33:44:55: Show all traffic to or from the specified MAC address.
  • eth[0x47:2] == 01:80: Match Ethernet frames with 2 bytes at offset 0x47 == 01:80.
  • !(arp or icmp or stp): Filter out background traffic from ARP, ICMP, and STP.
  • vlan.id == 100: Show packets with VLAN ID 100.

Thursday, August 3, 2023

Monday, October 24, 2022

 How to find a the WiFi password on a Windows laptop that is connected.

Run CMD as administrator

enter this

netsh wlan show profile

this command will show the WiFi user profile and SSID

now enter this

netsh wlan export profile folder=C:\ key=clear

go to the root of C drive and you will find a XML file, open it with notepad

Search for <keyMaterial> and there you will find the password


how you get to the command prompt of a computer with admin privileges is on you