H4CK0R Network Security ยท Recon ยท Education

๐Ÿ“‘ Reference

Fast lookups for the things nobody memorises: which port a service listens on, what an SOA field means, which HTTP status a proxy is really reporting, and the flags for the tools you reach for under pressure. Filter the whole page below.

Two honest caveats A port number is a convention, not a guarantee โ€” anything can listen anywhere, which is why a port scan reports the banner rather than assuming the service. And command flags differ between implementations: GNU and BSD sed -i disagree, macOS ships bash 3.2, and there are three common netcat variants. When it matters, read the man page on the box in front of you.

๐ŸŒ Protocol Reference

Lookup tables for the things you stop remembering the moment you need them: port numbers, DNS record syntax, status codes, header values, address ranges, flag bits and file signatures. Every value here is the real one โ€” copy it straight into a zone file, a config or a terminal. Use the filter box above to jump to a single row.

๐Ÿ”Œ Common ports & services

A port number is a convention, not a promise โ€” anything can listen anywhere. Confirm with a banner before you believe the label. Rows marked never expose are services that historically ship with no authentication, weak authentication, or full remote control, and belong on a private interface or behind a VPN.

0โ€“1023Well-known ports. On Unix-likes, binding one requires root or CAP_NET_BIND_SERVICE.
1024โ€“49151Registered ports โ€” assigned by IANA to specific applications.
49152โ€“65535Dynamic / ephemeral. Linux actually uses 32768โ€“60999 by default (/proc/sys/net/ipv4/ip_local_port_range).
20, 21 / tcpFTP data and control. Credentials and files in cleartext. 20 is used only for active-mode data; passive mode uses a high port.
22 / tcpSSH โ€” also carries SFTP, SCP and port forwarding. The banner (SSH-2.0-OpenSSH_9.6) gives you the version for free.
23 / tcpTelnet. Cleartext remote shell. Finding it open on the internet is a finding in itself.
25 / tcpSMTP relay between mail servers. Opportunistic TLS via STARTTLS; plaintext otherwise.
43 / tcpWHOIS. Increasingly replaced by RDAP over HTTPS, which returns structured JSON.
53 / udp + tcpDNS. UDP for normal queries, TCP when a response exceeds the negotiated size or for zone transfers (AXFR/IXFR).
67, 68 / udpDHCP โ€” 67 server, 68 client. DHCPv6 uses 546 (client) and 547 (server).
69 / udpTFTP. No authentication at all; classic source of leaked router configs and PXE images.
80 / tcpHTTP. Should exist only to redirect to HTTPS (301 to the same path).
88 / tcp + udpKerberos KDC (AS and TGS exchanges). Its presence usually means an Active Directory domain controller.
110 / tcpPOP3 (cleartext). Its implicit-TLS twin is 995.
111 / tcp + udprpcbind / portmapper. Enumerable with rpcinfo -p; a UDP reflection source and the front door to NFS.
123 / udpNTP. Old ntpd mode-7 monlist made it a huge amplification vector; disabled in current builds.
135 / tcpMSRPC endpoint mapper โ€” hands out the dynamic ports the actual RPC services listen on.
137โ€“139NetBIOS: 137/udp name service, 138/udp datagram, 139/tcp session. Legacy Windows file sharing; leaks host and workgroup names.
143 / tcpIMAP (cleartext). Implicit TLS on 993.
161, 162 / udpSNMP agent and trap receiver. v1/v2c community strings travel in cleartext โ€” public still works far too often. v3 adds real auth and privacy.
179 / tcpBGP. Sessions are point-to-point between configured peers and should be protected with TCP-MD5 or TCP-AO plus a GTSM hop-count check.
389 / tcp + udpLDAP. UDP 389 (CLDAP) is a known reflection/amplification vector and should never face the internet.
443 / tcp + udpHTTPS. UDP 443 is HTTP/3 over QUIC โ€” a host can be reachable over QUIC while TCP 443 is filtered.
445 / tcpSMB over TCP. The single most abused Windows port on the internet; block it at the perimeter without exception.
465 / tcpSMTP submission with implicit TLS (SMTPS). Re-blessed for submission use by RFC 8314.
500 / udpIKE / ISAKMP for IPsec. 4500/udp is NAT traversal (UDP-encapsulated ESP).
514514/udp is syslog (RFC 5426); 514/tcp is historically rsh. Syslog over TLS is 6514 (RFC 5425).
515 / tcpLPD line printer daemon. Printers are routinely the oldest unpatched software on a network.
587 / tcpMail submission (RFC 6409) with STARTTLS and mandatory authentication. This is what a mail client should use.
623 / udpnever expose IPMI / RMCP โ€” the baseboard management controller. Out-of-band power and console control, with a long history of authentication-bypass and password-hash-disclosure flaws.
636 / tcpLDAPS โ€” LDAP with implicit TLS. 3268/3269 are the Active Directory Global Catalog equivalents.
853 / tcpDNS over TLS (RFC 7858). 853/udp is DNS over QUIC (RFC 9250).
873 / tcprsync daemon. Anonymous modules are common and frequently expose entire backup trees.
993, 995 / tcpIMAPS and POP3S โ€” implicit TLS from the first byte, no STARTTLS downgrade window.
1080 / tcpSOCKS proxy. An open SOCKS proxy will be found and abused within hours.
1194 / udpOpenVPN default (TCP is a fallback). WireGuard has no assigned port; 51820/udp is the common convention.
1433 / tcpMicrosoft SQL Server. 1434/udp is the SQL Browser service, which will happily tell you every instance and its port.
1521 / tcpOracle TNS listener. Enumerable service names; historically a rich attack surface.
1723 / tcpPPTP (plus IP protocol 47, GRE). Its MS-CHAPv2 authentication is broken โ€” treat any PPTP VPN as unencrypted.
2049 / tcp + udpNFS. Classic no_root_squash exports plus host-based trust; keep it off untrusted networks.
2375, 2376 / tcpnever expose Docker daemon API โ€” 2375 plaintext, 2376 TLS. Access to the API is root on the host: it can mount / into a container.
2379, 2380 / tcpnever expose etcd client and peer ports. etcd holds every Kubernetes secret in the cluster.
3306 / tcpMySQL / MariaDB. Bind to loopback or a private interface; the greeting packet leaks the exact server version.
3389 / tcp + udpRDP. Requires Network Level Authentication and an MFA gateway or VPN in front โ€” never bare on the internet.
4444 / tcpNo widely-deployed standard service, but it is the default handler/listener port in common offensive tooling. An unexplained listener here is worth chasing down.
5060, 5061 / tcp+udpSIP signalling โ€” 5060 cleartext, 5061 SIP over TLS. Scanned constantly for toll fraud.
5432 / tcpPostgreSQL. Check pg_hba.conf: trust on a non-loopback line means no password at all.
5601 / tcpKibana. Frequently deployed with no authentication in front of an equally open Elasticsearch.
5900+ / tcpVNC (RFB); display n listens on 5900+n. The legacy VNC challenge-response only uses the first 8 characters of the password.
5985, 5986 / tcpWinRM over HTTP and HTTPS โ€” the transport for PowerShell Remoting. A primary lateral-movement path inside Windows networks.
6379 / tcpnever expose Redis. No authentication unless you set one; commands like CONFIG SET dir turn a database into arbitrary file write. Protected mode only saves you when no bind/password is configured.
6443 / tcpKubernetes API server. Exposure is survivable only with strict RBAC and no anonymous auth. The kubelet on 10250 is the dangerous one โ€” never expose.
8009 / tcpTomcat AJP connector. The Ghostcat flaw (CVE-2020-1938) turned a reachable AJP port into file read and potential code execution.
8080, 8443 / tcpHTTP and HTTPS alternates โ€” app servers, proxies, admin consoles, dev instances left running. Always worth a look.
9000 / tcpPHP-FPM FastCGI by default (also SonarQube, Portainer, MinIO console). An exposed FastCGI socket is remote code execution โ€” loopback only.
9090 / tcpPrometheus (also Cockpit). 9093 Alertmanager, 9100 node_exporter โ€” the exporter alone maps your whole host.
9200, 9300 / tcpnever expose Elasticsearch HTTP API and transport. Open clusters have been the source of many large data leaks; security is on by default only from 8.x onward.
10250 / tcpnever expose kubelet API. With anonymous auth enabled it grants exec into any pod on the node.
11211 / tcp + udpnever expose memcached. No auth, and the UDP listener was the engine of record-breaking amplification attacks โ€” UDP is disabled by default in modern builds.
27017 / tcpnever expose MongoDB (27018/27019 for shards and config servers). Modern versions bind to localhost by default; older deployments did not.

๐Ÿ“– DNS record types

Real zone-file syntax: name TTL class type rdata. A trailing dot makes a name absolute; without it, the name is relative to $ORIGIN โ€” forgetting the dot is the single most common zone-file bug (mail.example.com silently becomes mail.example.com.example.com.).

Aexample.com. 300 IN A 198.51.100.10
IPv4 address. TTL 300 = five minutes of cache before resolvers ask again.
AAAAexample.com. 300 IN AAAA 2001:db8::1
IPv6 address. Publishing one commits you to serving IPv6 properly โ€” clients will prefer it.
CNAMEwww 300 IN CNAME example.com.
Alias to another name. A name with a CNAME may hold no other records, so it can never sit at the zone apex. Use ALIAS/ANAME (vendor-specific) or an HTTPS record instead.
MXexample.com. 3600 IN MX 10 mail.example.com.
Mail exchanger; lower preference wins. The target must be a hostname with an address record โ€” never an IP, never a CNAME (RFC 2181 ยง10.3).
TXTexample.com. 3600 IN TXT "v=spf1 include:_spf.example.net -all"
Free-form strings. Each quoted string is capped at 255 bytes; longer values are split into several strings that the resolver concatenates.
NSexample.com. 172800 IN NS ns1.example.net.
Delegates the zone to a nameserver. The set at the parent (the delegation) and the set in the zone itself should match.
SOAexample.com. 3600 IN SOA ns1.example.net. hostmaster.example.com. 2026072601 7200 3600 1209600 3600
Primary NS, admin mailbox (first dot = @), then serial, refresh, retry, expire, and the negative-cache TTL (RFC 2308).
PTR10.100.51.198.in-addr.arpa. 3600 IN PTR host.example.com.
Reverse lookup โ€” the IPv4 octets reversed. IPv6 uses reversed nibbles under ip6.arpa. Mail servers care; set it to match the HELO name.
SRV_sip._tcp.example.com. 3600 IN SRV 10 60 5060 sipserver.example.com.
Service location: priority, weight, port, target. Lowest priority first; weight distributes load within a priority.
CAAexample.com. 3600 IN CAA 0 issue "letsencrypt.org"
Flags, tag, value. Tags: issue, issuewild, iodef. Restricts which CAs may issue for the name (RFC 8659); CAs must check it at issuance time.
DSexample.com. 3600 IN DS 12345 13 2 <64 hex digits>
Key tag, algorithm (13 = ECDSAP256SHA256), digest type (2 = SHA-256), digest of the DNSKEY. Lives in the parent zone โ€” this is the link that makes DNSSEC work.
DNSKEYexample.com. 3600 IN DNSKEY 257 3 13 <base64 key>
Flags 257 = key-signing key (SEP bit set), 256 = zone-signing key. Protocol is always 3.
RRSIGexample.com. 300 IN RRSIG A 13 2 300 20260801000000 20260701000000 12345 example.com. <base64 sig>
Type covered, algorithm, labels, original TTL, expiration, inception, key tag, signer, signature. An expired RRSIG breaks resolution outright โ€” validators return SERVFAIL, not stale data.
NSEC / NSEC3a.example.com. 3600 IN NSEC b.example.com. A RRSIG NSEC
Authenticated denial of existence: proves nothing exists between two names. Plain NSEC lets anyone walk the zone; NSEC3 hashes the names. RFC 9276 says use NSEC3 with 0 extra iterations and an empty salt.
TLSA_443._tcp.www.example.com. 3600 IN TLSA 3 1 1 <64 hex digits>
DANE. Usage, selector, matching type โ€” 3 1 1 means "this exact end-entity key, SPKI, SHA-256". Only trustworthy when the zone is DNSSEC-signed.
SSHFPhost.example.com. 3600 IN SSHFP 4 2 <64 hex digits>
SSH host key fingerprint. Algorithm 1 = RSA, 2 = DSA, 3 = ECDSA, 4 = Ed25519; type 1 = SHA-1, 2 = SHA-256. Clients use it with VerifyHostKeyDNS yes, and only trust it under DNSSEC.
NAPTRexample.com. 3600 IN NAPTR 100 10 "U" "E2U+sip" "!^.*$!sip:info@example.com!" .
Order, preference, flags, service, regexp, replacement. Mostly ENUM and SIP discovery.
HTTPS / SVCBexample.com. 300 IN HTTPS 1 . alpn="h3,h2" ipv4hint=198.51.100.10
RFC 9460. Priority 0 = AliasMode (works at the apex, unlike CNAME); โ‰ฅ1 = ServiceMode with parameters. Carries the ech= config for Encrypted Client Hello.

๐Ÿ”ข HTTP status codes

The first digit is the class: 1xx informational, 2xx success, 3xx redirection, 4xx client error, 5xx server error. What matters when debugging is which side is complaining.

100 ContinueServer accepted the headers of a request sent with Expect: 100-continue; send the body.
101 Switching ProtocolsUpgrade accepted โ€” WebSocket handshakes end here.
103 Early HintsPreload hints sent before the final response (RFC 8297).
200 OKSuccess with a body. Note that an API returning 200 with {"error":โ€ฆ} is a design smell, not a success.
201 CreatedNew resource created; its URL should be in the Location header.
202 AcceptedQueued for processing โ€” the work has not happened yet.
204 No ContentSuccess, deliberately no body. Used by connectivity checks and DELETE handlers.
206 Partial ContentRange request satisfied. Pairs with Content-Range and Accept-Ranges: bytes.
301 Moved PermanentlyPermanent. Cached aggressively and, for HSTS-preloaded sites, effectively forever โ€” do not use it for a temporary move.
302 FoundTemporary, but clients historically rewrite POST to GET. Ambiguous by history.
303 See OtherExplicitly "GET this other URL" โ€” the correct answer after a form POST.
304 Not ModifiedConditional request matched ETag/If-Modified-Since. No body; use the cache.
307 Temporary RedirectLike 302 but the method and body are preserved. Use this for temporary POST redirects.
308 Permanent RedirectLike 301 with method preserved.
400 Bad RequestMalformed syntax. Often a proxy rejecting a header or an oversized cookie before your app ever sees it.
401 UnauthorizedActually "unauthenticated". Must carry a WWW-Authenticate header naming the scheme.
403 ForbiddenAuthenticated (or anonymous) but not permitted. On a CDN-fronted site it is frequently the WAF, not the app.
404 Not FoundNo such resource. Some sites deliberately return 404 instead of 403 to avoid confirming that something exists.
405 Method Not AllowedMust include an Allow header listing what is permitted โ€” useful during a methods probe.
406 / 415406 Not Acceptable โ€” cannot satisfy Accept. 415 Unsupported Media Type โ€” cannot parse the request's Content-Type.
408 Request TimeoutClient was too slow sending the request. Cheap defence against slow-request attacks.
409 / 410409 Conflict โ€” state clash, e.g. a duplicate. 410 Gone โ€” deliberately removed and not coming back.
413 / 414 / 431Too large: 413 body, 414 URI, 431 request headers. A sudden 431 usually means cookie bloat.
421 Misdirected RequestThis server cannot serve the requested authority โ€” connection coalescing under HTTP/2 hit the wrong certificate.
422 Unprocessable ContentSyntactically valid, semantically wrong. The usual choice for validation failures.
425 / 426 / 428425 Too Early (TLS 1.3 0-RTT replay risk). 426 Upgrade Required. 428 Precondition Required โ€” send If-Match to avoid lost updates.
429 Too Many RequestsRate limited. Should include Retry-After in seconds or as an HTTP date.
451 Unavailable For Legal ReasonsBlocked by legal demand (RFC 7725); the number is a nod to Fahrenheit 451.
500 Internal Server ErrorThe application threw. Anything more specific in the body is an information leak in production.
501 / 505501 Not Implemented โ€” method unknown to the server. 505 HTTP Version Not Supported.
502 Bad GatewayThe proxy reached the upstream but got garbage or a dropped connection. Look at the backend, not the proxy.
503 Service UnavailableDeliberately down or overloaded โ€” maintenance mode, or no healthy upstream in the pool.
504 Gateway TimeoutUpstream accepted the connection but did not answer in time. A slow query or a wedged worker pool.
511 Network Authentication RequiredCaptive portal wants you to log in. Should never come from your own server.
520 (Cloudflare)Origin returned something Cloudflare could not parse โ€” an empty reply, or headers that violate the spec.
521 (Cloudflare)Origin refused the connection. Origin is down, or its firewall is not allowing Cloudflare's IP ranges.
522 (Cloudflare)TCP handshake to the origin timed out โ€” packets are being dropped silently, typically by a firewall.
523 (Cloudflare)Origin unreachable โ€” usually a bad origin DNS record or a deleted server.
524 (Cloudflare)Connected, but the origin did not finish responding within the proxy read timeout (100 seconds by default). Long jobs need to become asynchronous.
525 / 526 (Cloudflare)525 TLS handshake with the origin failed (no shared protocol/cipher). 526 the origin certificate is invalid while the SSL mode is Full (strict).
530 (Cloudflare)Always accompanied by a 1xxx error code in the body โ€” read that number; 1016 is an origin DNS failure, 1020 an access-rule block.

๐Ÿ›ก๏ธ HTTP security headers

Header โ†’ a value that is safe to start from โ†’ what it actually buys you. Set them at the edge and in the app; a proxy-only policy disappears the moment someone bypasses the proxy.

Strict-Transport-Securitymax-age=31536000; includeSubDomains; preload
31536000 seconds = 365 days. Forces HTTPS for the whole registrable domain. preload is a promise to the browser vendors โ€” hard to undo, and it covers every subdomain including internal ones.
Content-Security-Policydefault-src 'self'; object-src 'none'; base-uri 'self'; frame-ancestors 'none'; script-src 'self' 'nonce-RANDOM' 'strict-dynamic'
The single most effective XSS mitigation. A fresh nonce per response plus strict-dynamic beats host allow-lists, which are routinely bypassable through a permitted CDN.
X-Content-Type-Optionsnosniff
Makes the browser honour the declared Content-Type instead of guessing at the bytes, so a user-supplied file served as text/plain or image/png is never treated as script or HTML.
X-Frame-OptionsDENY
Anti-clickjacking for older browsers. Superseded by CSP frame-ancestors, which is what modern browsers honour โ€” set both.
Referrer-Policystrict-origin-when-cross-origin
Sends the full URL same-origin, only the origin cross-origin, and nothing when downgrading to HTTP. Use no-referrer if your URLs contain tokens.
Permissions-Policygeolocation=(), camera=(), microphone=(), payment=(), usb=()
An empty allow-list () disables the feature for everyone, including your own page. (self) allows only your own origin.
Cross-Origin-Opener-Policysame-origin
Severs the window.opener link to cross-origin pages, closing a family of cross-site leak and tab-nabbing tricks.
Cross-Origin-Embedder-Policyrequire-corp
With COOP same-origin this makes the page cross-origin isolated (required for SharedArrayBuffer). It will break third-party embeds that do not opt in.
Cross-Origin-Resource-Policysame-origin
Stops other sites embedding your responses as resources โ€” a direct defence against speculative side-channel reads.
X-XSS-Protection0
Yes, zero. The legacy XSS auditor was removed from Chrome and Edge and could itself be abused; explicitly disable it and rely on CSP.
Cache-Controlno-store on any authenticated response.
Keeps personal data out of disk caches and shared proxies. no-cache means "revalidate", not "do not store".
Clear-Site-Data"cache", "cookies", "storage"
Send it on logout so the browser drops local state as well as the session cookie. Quotes are part of the syntax.
Set-Cookie__Host-sid=โ€ฆ; Secure; HttpOnly; SameSite=Lax; Path=/
The __Host- prefix is enforced by the browser: it requires Secure and Path=/ and forbids Domain, so a subdomain cannot overwrite the cookie.
Access-Control-Allow-OriginEcho a single origin from an allow-list, never the request's Origin blindly. * is illegal together with Access-Control-Allow-Credentials: true, and null is reachable from a sandboxed iframe โ€” never allow it.
Server / X-Powered-ByRemove or flatten them. Version banners do not stop attacks but they do sort you into a scanner's target list.
Reporting-Endpointscsp-endpoint="https://example.com/csp" plus report-to csp-endpoint in the policy.
Deploy CSP with Content-Security-Policy-Report-Only first and read the reports before enforcing.

๐Ÿ”’ TLS versions & state

What to enable in 2026: TLS 1.2 and TLS 1.3 only, AEAD ciphers only, ECDHE key exchange for forward secrecy. Everything above that line is history you still meet in the wild.

SSL 2.0prohibited 1995. Broken by design (no handshake integrity, weak MACs). Prohibited by RFC 6176.
SSL 3.0prohibited 1996. Deprecated by RFC 7568 after POODLE (CVE-2014-3566) made its CBC padding exploitable.
TLS 1.0deprecated RFC 2246 (1999). Formally deprecated by RFC 8996; card-industry rules pushed migration off it years earlier. Vulnerable to BEAST (CVE-2011-3389) in its original form.
TLS 1.1deprecated RFC 4346 (2006). Also deprecated by RFC 8996. Adds an explicit IV over 1.0 but keeps SHA-1/MD5 in the PRF and no AEAD.
TLS 1.2allow RFC 5246 (2008). Still fine โ€” but only with AEAD suites. Turn off CBC, RC4, 3DES, export, anonymous and NULL suites, and compression.
TLS 1.3prefer RFC 8446 (2018). One round trip, forward secrecy always, static RSA key exchange and renegotiation removed, most of the handshake encrypted.
TLS 1.3 suitesTLS_AES_128_GCM_SHA256 (0x13,0x01) โ€” mandatory to implement
TLS_AES_256_GCM_SHA384 (0x13,0x02)
TLS_CHACHA20_POLY1305_SHA256 (0x13,0x03)
TLS_AES_128_CCM_SHA256 (0x13,0x04)
TLS_AES_128_CCM_8_SHA256 (0x13,0x05)
Note the names no longer mention key exchange or authentication โ€” in 1.3 those are negotiated separately.
Good TLS 1.2 suitesTLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 (0xC0,0x2B)
TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (0xC0,0x2F)
TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 (0xCC,0xA8)
ECDHE = forward secrecy; GCM/ChaCha20-Poly1305 = authenticated encryption.
0-RTTTLS 1.3 early data saves a round trip but is replayable by design. Only ever allow it for idempotent requests, never for anything that changes state.
Named attacksPOODLE (SSL 3.0 CBC), BEAST (TLS 1.0 CBC), CRIME (TLS compression, CVE-2012-4929), FREAK and Logjam (export-grade RSA/DH), Sweet32 (64-bit block ciphers such as 3DES, CVE-2016-2183). Heartbleed (CVE-2014-0160) was an OpenSSL bug, not a protocol flaw โ€” worth keeping the distinction straight.
Certificate lifetimePublicly-trusted certificate validity is capped by the CA/Browser Forum Baseline Requirements, and the Forum has adopted a schedule that shortens the maximum in stages over the coming years. Check the current Baseline Requirements for the figure in force rather than trusting a number in a cheat sheet โ€” and automate renewal so it stops mattering.
Inspect by handopenssl s_client -connect example.com:443 -servername example.com
Add -tls1_2 or -tls1_3 to force a version; the handshake output names the negotiated protocol and cipher.

๐Ÿงญ IP ranges you should recognise

Special-purpose address blocks. Knowing them on sight tells you instantly whether a log line is internal, a lab, a document, or something that should never have been routed. IANA keeps the authoritative registries; RFC 6890 is the umbrella document.

0.0.0.0/8"This network" (RFC 1122). 0.0.0.0 as a source means "no address yet" (DHCP); as a bind address it means every interface on the host.
10.0.0.0/8Private (RFC 1918) โ€” 16,777,216 addresses. Never routed on the public internet.
172.16.0.0/12Private (RFC 1918) โ€” 172.16.0.0 to 172.31.255.255. Note it is a /12, not "all of 172".
192.168.0.0/16Private (RFC 1918). The home-router default.
100.64.0.0/10Carrier-grade NAT / shared address space (RFC 6598). Seeing it as a client IP means the user is behind a provider NAT โ€” geolocation and per-IP blocking will be unreliable.
127.0.0.0/8Loopback (RFC 1122). The whole /8, not just 127.0.0.1 โ€” handy to know when reviewing SSRF filters that only block one address.
169.254.0.0/16Link-local, self-assigned when DHCP fails (RFC 3927). 169.254.169.254 is the cloud instance metadata endpoint โ€” the classic SSRF target for stealing instance credentials.
192.0.0.0/24IETF protocol assignments โ€” reserved for protocol machinery such as DS-Lite and NAT64 discovery.
192.0.2.0/24TEST-NET-1 (RFC 5737). Use it in documentation and examples instead of someone's real address.
198.51.100.0/24TEST-NET-2 (RFC 5737).
203.0.113.0/24TEST-NET-3 (RFC 5737).
198.18.0.0/15Benchmark testing (RFC 2544). Must not leave the test harness; it sometimes leaks from appliances.
192.88.99.0/24Former 6to4 relay anycast, deprecated by RFC 7526. Traffic to it today is a misconfiguration.
224.0.0.0/4Multicast. 224.0.0.1 all systems on this subnet, 224.0.0.2 all routers, 224.0.0.251 mDNS, 239.0.0.0/8 administratively scoped.
240.0.0.0/4Reserved for future use (RFC 1112). 255.255.255.255 is the limited broadcast address and is never forwarded by a router.
::/128 and ::1/128Unspecified address and IPv6 loopback. IPv6 loopback is a single address, not a whole block.
::ffff:0:0/96IPv4-mapped IPv6 addresses โ€” ::ffff:198.51.100.10. Dual-stack sockets log client IPv4 addresses in this form, which is another trap for naive allow-lists.
64:ff9b::/96Well-known prefix for NAT64 (RFC 6052) โ€” an IPv4 address embedded in the low 32 bits.
100::/64Discard-only prefix (RFC 6666). Routing traffic here is a deliberate black hole.
2000::/3Global unicast โ€” the range currently being allocated to real networks.
2001:db8::/32Documentation prefix (RFC 3849). The IPv6 equivalent of TEST-NET; every example on this page uses it.
2001::/32Teredo tunnelling (RFC 4380). Largely historical.
2002::/166to4 (RFC 3056). The transition mechanism itself is deprecated โ€” RFC 7526 retired the 192.88.99.0/24 relay anycast it depended on.
fc00::/7Unique local addresses (RFC 4193) โ€” the rough IPv6 analogue of RFC 1918. In practice only fd00::/8 is used, with a randomly generated 40-bit global ID.
fe80::/10Link-local. Every IPv6 interface has one, and it is what neighbour discovery and routing protocols run over. Needs a zone index to be usable: ping6 fe80::1%eth0.
ff00::/8Multicast. ff02::1 all nodes on the link, ff02::2 all routers, ff02::fb mDNS. IPv6 has no broadcast at all โ€” multicast replaces it.

๐Ÿ“ IPv4 subnet mask table

Prefix โ†’ dotted mask ยท wildcard mask (the inverse, used in ACLs) ยท total addresses ยท usable hosts. "Usable" subtracts the network and broadcast addresses; /31 and /32 are the documented exceptions.

/8255.0.0.0 ยท wildcard 0.255.255.255 ยท 16,777,216 addresses ยท 16,777,214 hosts
/9255.128.0.0 ยท wildcard 0.127.255.255 ยท 8,388,608 ยท 8,388,606 hosts
/10255.192.0.0 ยท wildcard 0.63.255.255 ยท 4,194,304 ยท 4,194,302 hosts
/11255.224.0.0 ยท wildcard 0.31.255.255 ยท 2,097,152 ยท 2,097,150 hosts
/12255.240.0.0 ยท wildcard 0.15.255.255 ยท 1,048,576 ยท 1,048,574 hosts
/13255.248.0.0 ยท wildcard 0.7.255.255 ยท 524,288 ยท 524,286 hosts
/14255.252.0.0 ยท wildcard 0.3.255.255 ยท 262,144 ยท 262,142 hosts
/15255.254.0.0 ยท wildcard 0.1.255.255 ยท 131,072 ยท 131,070 hosts
/16255.255.0.0 ยท wildcard 0.0.255.255 ยท 65,536 ยท 65,534 hosts
/17255.255.128.0 ยท wildcard 0.0.127.255 ยท 32,768 ยท 32,766 hosts
/18255.255.192.0 ยท wildcard 0.0.63.255 ยท 16,384 ยท 16,382 hosts
/19255.255.224.0 ยท wildcard 0.0.31.255 ยท 8,192 ยท 8,190 hosts
/20255.255.240.0 ยท wildcard 0.0.15.255 ยท 4,096 ยท 4,094 hosts
/21255.255.248.0 ยท wildcard 0.0.7.255 ยท 2,048 ยท 2,046 hosts
/22255.255.252.0 ยท wildcard 0.0.3.255 ยท 1,024 ยท 1,022 hosts
/23255.255.254.0 ยท wildcard 0.0.1.255 ยท 512 ยท 510 hosts
/24255.255.255.0 ยท wildcard 0.0.0.255 ยท 256 ยท 254 hosts
/25255.255.255.128 ยท wildcard 0.0.0.127 ยท 128 ยท 126 hosts
/26255.255.255.192 ยท wildcard 0.0.0.63 ยท 64 ยท 62 hosts
/27255.255.255.224 ยท wildcard 0.0.0.31 ยท 32 ยท 30 hosts
/28255.255.255.240 ยท wildcard 0.0.0.15 ยท 16 ยท 14 hosts
/29255.255.255.248 ยท wildcard 0.0.0.7 ยท 8 ยท 6 hosts
/30255.255.255.252 ยท wildcard 0.0.0.3 ยท 4 ยท 2 hosts โ€” the traditional point-to-point link
/31255.255.255.254 ยท wildcard 0.0.0.1 ยท 2 addresses ยท both usable on point-to-point links (RFC 3021) โ€” no network or broadcast address
/32255.255.255.255 ยท wildcard 0.0.0.0 ยท 1 address โ€” a single host, as used in firewall rules and loopback interfaces
Quick mathsAddresses = 2^(32 โˆ’ prefix). Each step down the prefix doubles the block. Wildcard mask = 255.255.255.255 minus the mask, octet by octet.
IPv6 noteThere is no broadcast address, so nothing is subtracted. /64 is the standard LAN size because stateless address autoconfiguration assumes a 64-bit interface identifier; /48 or /56 is the usual site allocation, /127 the recommendation for router-to-router links.

๐Ÿšฆ TCP flags, handshake & states

The control bits share one byte of the TCP header โ€” offset 13, the byte tcpdump calls tcp[13]. Reading them is how you tell "the host refused you" from "a firewall ate the packet".

FIN โ€” 0x01No more data from the sender. Starts a graceful close.
SYN โ€” 0x02Synchronise sequence numbers. Only ever set on the first packet of each direction.
RST โ€” 0x04Abort. Sent when a port is closed, when state is lost, or by a middlebox terminating the connection.
PSH โ€” 0x08Deliver buffered data to the application now rather than waiting for more.
ACK โ€” 0x10The acknowledgement number is meaningful. Set on every packet after the first SYN.
URG โ€” 0x20The urgent pointer is meaningful. Effectively unused, inconsistently implemented, and best filtered.
ECE โ€” 0x40ECN-Echo (RFC 3168): the receiver is reporting that a congestion mark was seen. Used together with CWR.
CWR โ€” 0x80Congestion Window Reduced (RFC 3168): the sender is confirming it reacted to that congestion signal.
NSECN nonce sum โ€” took one of the reserved bits in RFC 3540. That experiment was reclassified as Historic by RFC 8311, so treat the bit as reserved.
Handshakeclient โ†’ SYN seq=x
server โ†’ SYN,ACK seq=y ack=x+1
client โ†’ ACK seq=x+1 ack=y+1
Three packets, and the connection is ESTABLISHED. Sequence numbers must be randomly chosen โ€” predictable ISNs allow off-path spoofing.
TeardownFour-way, because each direction closes independently: FIN โ†’ ACK, then FIN โ†’ ACK the other way. The side that closes first sits in TIME_WAIT (60 seconds on Linux) so late duplicates cannot land in a new connection.
Open vs closed vs filteredSYN,ACK back = open. RST back = closed but reachable. Nothing back at all = filtered โ€” a firewall dropped it silently. That three-way distinction is the whole basis of port scanning.
Scan typesSYN ("half-open") sends SYN and answers the SYN,ACK with RST. ACK scans map firewall rules rather than services. FIN, NULL and Xmas (FIN+PSH+URG) rely on the RFC 793 rule that closed ports answer with RST โ€” Windows stacks answer RST either way, so they misreport.
LISTENA socket waiting for connections. ss -lntp shows every listener with its process.
SYN_SENT / SYN_RECVHandshake in progress. A pile of SYN_RECV means the backlog is filling โ€” genuine load or a SYN flood; SYN cookies are the defence.
ESTABLISHEDData can flow both ways.
FIN_WAIT1 / FIN_WAIT2This side sent FIN and is waiting for the acknowledgement, then for the peer's FIN. Many stuck FIN_WAIT2 sockets mean the peer never closed.
CLOSE_WAITThe peer closed and your application has not called close(). A growing CLOSE_WAIT count is an application bug โ€” file descriptors are leaking.
LAST_ACK / CLOSINGFinal acknowledgement outstanding; or both sides sent FIN simultaneously.
TIME_WAITNormal and healthy after a close. Thousands of them on a busy proxy is expected โ€” connection reuse, not tcp_tw_recycle, is the fix.
Capture filterstcpdump 'tcp[tcpflags] & (tcp-syn|tcp-fin) != 0'
tcpdump 'tcp[tcpflags] & tcp-rst != 0'
In Wireshark the equivalent is tcp.flags.syn == 1 && tcp.flags.ack == 0.

๐Ÿ“ก ICMP types worth knowing

ICMP is not optional plumbing you can safely drop wholesale โ€” parts of it are load-bearing for the internet to work at all.

Type 0Echo Reply โ€” the answer to a ping.
Type 3Destination Unreachable. The code carries the real information (see the next rows). Contains the first bytes of the offending packet, which is how the sending host knows which connection to fail.
3 / code 0, 1Network unreachable, host unreachable โ€” no route, or ARP/ND got no answer on the final hop.
3 / code 2, 3Protocol unreachable, port unreachable. Port unreachable is how a UDP scan proves a port is closed, and how classic UDP traceroute knows it reached the destination.
3 / code 4Fragmentation needed but the Don't Fragment bit is set โ€” this is the Path MTU Discovery message. Block it and you get the classic failure: handshakes complete, small requests work, large transfers hang forever.
3 / code 9, 10, 13Administratively prohibited by the network, by the host, or by a filter. Code 13 is a firewall politely admitting it dropped you โ€” most firewalls stay silent instead.
Type 5Redirect โ€” "use this other gateway for that destination". Legitimate on a LAN with two routers, and a tidy man-in-the-middle primitive otherwise. Most hosts should be configured to ignore it (net.ipv4.conf.all.accept_redirects=0).
Type 8Echo Request โ€” ping. Blocking it hides nothing from a real scanner and mostly breaks your own monitoring.
Type 11 / code 0TTL exceeded in transit. This is what makes traceroute work: send packets with TTL 1, 2, 3โ€ฆ, and each router in turn answers with a type 11 from its own address.
Type 11 / code 1Fragment reassembly time exceeded โ€” fragments arrived but not all of them.
Types 13, 14Timestamp Request and Reply. They leak the host's clock, which can help fingerprint a system or undermine time-based defences; commonly blocked, and routinely flagged by compliance scanners.
ICMPv6 differs128 Echo Request, 129 Echo Reply, 1 Destination Unreachable, 3 Time Exceeded, and 2 Packet Too Big. Type 2 is mandatory: IPv6 routers never fragment, so PMTUD is the only mechanism there is.
ICMPv6 neighbour discovery133 Router Solicitation, 134 Router Advertisement, 135 Neighbour Solicitation, 136 Neighbour Advertisement, 137 Redirect. Drop these and IPv6 simply stops working โ€” RFC 4890 sets out what is safe to filter.
Sensible policyPermit echo request/reply at a controlled rate, always permit type 3 code 4 (and ICMPv6 type 2) and type 11, and permit the ICMPv6 neighbour-discovery types on the local link. Drop redirects and timestamps.
No ping hereSending ICMP needs raw sockets, which shared PHP hosting does not grant โ€” so this site measures reachability and latency with TCP connects instead of ping. try a TCP reachability check โ†’

๐Ÿ“ง Email authentication records

Exact published syntax for each record, with the tags that matter. All of these are DNS TXT records except the MTA-STS policy, which is fetched over HTTPS.

SPFexample.com. IN TXT "v=spf1 ip4:198.51.100.0/24 include:_spf.example.net -all"
Mechanisms: all a mx ip4 ip6 include exists (ptr is deprecated). Qualifiers: + pass, - fail, ~ softfail, ? neutral.
SPF limitsRFC 7208 allows at most 10 DNS-querying mechanisms per evaluation; exceeding it is a PermError and your mail stops being authenticated. Publish exactly one SPF TXT record โ€” two is also a PermError. SPF checks the envelope sender (MAIL FROM), which is why it alone cannot stop display-name spoofing.
DKIM public keysel1._domainkey.example.com. IN TXT "v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8Aโ€ฆ"
Tags: v version, k key type (rsa or ed25519, RFC 8463), p the base64 public key, t=y testing mode, h permitted hash algorithms. An empty p= revokes the key.
DKIM signatureDKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=example.com; s=sel1; h=from:to:subject:date; bh=โ€ฆ; b=โ€ฆ
d signing domain, s selector (the two locate the DNS key), h the signed headers, bh body hash, b the signature. Use 2048-bit RSA; RFC 8301 rules out keys under 1024 bits and SHA-1.
DMARC_dmarc.example.com. IN TXT "v=DMARC1; p=reject; rua=mailto:dmarc@example.com; adkim=s; aspf=s; sp=reject; fo=1"
p policy (none, quarantine, reject), sp subdomain policy, rua aggregate report address, ruf forensic reports, adkim/aspf alignment (r relaxed, s strict). Defined in RFC 7489.
DMARC alignmentDMARC passes only if SPF or DKIM passes and that domain aligns with the visible From: header domain. This is the piece SPF and DKIM alone are missing. Start at p=none with rua, read the reports for a few weeks, then tighten to quarantine and reject.
MTA-STS record_mta-sts.example.com. IN TXT "v=STSv1; id=20260726T000000"
The id is an opaque version string โ€” change it whenever you change the policy file, or senders will keep the cached one.
MTA-STS policyServed at https://mta-sts.example.com/.well-known/mta-sts.txt with Content-Type: text/plain, on a certificate valid for that hostname:
version: STSv1
mode: enforce
mx: mail.example.com
mx: *.example.net
max_age: 604800

mode is enforce, testing or none; max_age is in seconds (604800 = 7 days). RFC 8461.
TLS-RPT_smtp._tls.example.com. IN TXT "v=TLSRPTv1; rua=mailto:tlsrpt@example.com"
Daily JSON reports of TLS negotiation failures from senders (RFC 8460). Deploy it before you switch MTA-STS to enforce โ€” it is how you find out what breaks.
BIMIdefault._bimi.example.com. IN TXT "v=BIMI1; l=https://example.com/logo.svg; a=https://example.com/vmc.pem"
l an SVG Tiny PS logo over HTTPS, a the Verified Mark Certificate. Requires DMARC already at quarantine or reject. BIMI is still being standardised and support differs between mailbox providers, so confirm each provider's current requirements before paying for a mark certificate.
DANE for SMTP_25._tcp.mail.example.com. IN TLSA 3 1 1 <64 hex digits>
The alternative to MTA-STS. It only means anything if the zone is DNSSEC-signed, because the resolver's answer is the whole trust anchor.

๐Ÿ”‘ Certificate & key file formats

PEM is base64-encoded DER wrapped in -----BEGIN X----- armour (RFC 7468). The label tells you what is inside; the file extension frequently lies.

BEGIN CERTIFICATEAn X.509 certificate. Several concatenated in one file is a chain โ€” leaf first, then intermediates, and normally not the root.
BEGIN CERTIFICATE REQUESTA PKCS#10 CSR: the public key plus the subject and requested extensions, self-signed to prove key possession. Contains no private key and is safe to share.
BEGIN PRIVATE KEYPKCS#8, unencrypted, algorithm-agnostic โ€” RSA, EC, Ed25519 all use this label. Secret. If you ever paste one anywhere, treat it as compromised and reissue.
BEGIN ENCRYPTED PRIVATE KEYPKCS#8 protected by a passphrase. The modern, portable way to store a key at rest.
BEGIN RSA PRIVATE KEYPKCS#1 โ€” the legacy RSA-only format. If encrypted it carries Proc-Type: 4,ENCRYPTED and DEK-Info headers, which use weak legacy key derivation; convert to PKCS#8.
BEGIN EC PRIVATE KEYSEC1 elliptic-curve private key (RFC 5915), usually with the curve as a named parameter.
BEGIN PUBLIC KEYSubjectPublicKeyInfo โ€” a public key with its algorithm identifier. This is what a JWK or a DKIM p= value decodes to.
BEGIN RSA PUBLIC KEYPKCS#1 RSAPublicKey โ€” just modulus and exponent, no algorithm identifier. Not interchangeable with the previous label.
BEGIN DH PARAMETERSPKCS#3 Diffie-Hellman parameters (prime and generator). Not secret, but weak or shared small primes are exactly what the Logjam work exploited.
BEGIN OPENSSH PRIVATE KEYOpenSSH's own key container, the default since OpenSSH 7.8. Not a PKCS#8 file โ€” openssl pkey will not always read it; use ssh-keygen.
BEGIN X509 CRLA certificate revocation list โ€” signed by the CA, listing revoked serial numbers.
.pemBase64 armour. Can hold any of the above, and often several at once. Always look at the BEGIN line rather than the extension.
.crt / .cerA certificate โ€” but it may be PEM or binary DER. Check with file cert.crt, or just try both -inform pem and -inform der.
.derRaw binary DER, no armour, no base64. Windows and Java tooling produce these.
.keyConvention only โ€” normally a private key, in PEM. Nothing enforces it, so read the BEGIN line.
.csrA PKCS#10 certificate signing request.
.p7b / .p7cPKCS#7 / CMS: certificates and chains only โ€” never a private key. Common when a CA sends you the intermediates.
.pfx / .p12PKCS#12: certificate, chain and private key in one password-protected binary blob. What IIS and code-signing tools expect. Handle as a secret.
.jksJava KeyStore โ€” a Java-specific container managed with keytool. Modern JDKs prefer PKCS#12.
Read a certificateopenssl x509 -in cert.pem -noout -text -fingerprint -sha256
Convert DER โ†’ PEMopenssl x509 -inform der -in cert.der -out cert.pem
Unpack a PKCS#12openssl pkcs12 -in bundle.pfx -nodes -out everything.pem
-nodes writes the private key unencrypted โ€” delete the output when you are done.
Does this key match this cert?openssl x509 -in cert.pem -noout -pubkey | openssl sha256
openssl pkey -in key.pem -pubout | openssl sha256
Identical digests mean they belong together. This works for RSA, EC and Ed25519 alike, unlike the older modulus comparison.

๐Ÿงฌ File magic bytes

The first few bytes of a file identify its real type regardless of what the extension or the upload's Content-Type claims โ€” which is exactly why upload filters that trust the extension fail. Offsets are from the start of the file unless stated.

PNG89 50 4E 47 0D 0A 1A 0A โ€” \x89PNG\r\n\x1a\n. The CR/LF and EOF bytes exist to detect mangling by text-mode transfers.
JPEGFF D8 FF then E0 (JFIF), E1 (Exif) or DB. Ends with FF D9 โ€” data after that trailer is appended, not part of the image.
GIF47 49 46 38 37 61 = GIF87a, 47 49 46 38 39 61 = GIF89a.
BMP42 4D โ€” BM.
PDF25 50 44 46 2D โ€” %PDF- followed by the version, e.g. 1.7. The file should end with %%EOF.
ZIP50 4B 03 04 โ€” PK\x03\x04. An empty archive starts 50 4B 05 06. This also covers .docx, .xlsx, .pptx, .jar, .apk, .odt and .epub โ€” they are all ZIP containers.
GZIP1F 8B 08 โ€” the third byte is the compression method (08 = deflate).
BZIP242 5A 68 โ€” BZh, then a digit for the block size.
XZFD 37 7A 58 5A 00 โ€” \xfd7zXZ\0.
7-Zip37 7A BC AF 27 1C โ€” 7z plus a fixed signature.
RAR52 61 72 21 1A 07 00 for versions 1.5โ€“4.x; 52 61 72 21 1A 07 01 00 for 5.0 and later.
TAR75 73 74 61 72 โ€” the string ustar at offset 257, not at the start. A plain tar has no signature in its first bytes at all.
ELF7F 45 4C 46 โ€” \x7fELF. Byte 4: 01 = 32-bit, 02 = 64-bit. Byte 5: 01 = little-endian, 02 = big-endian. Linux and BSD executables, shared objects and core dumps.
PE / MZ4D 5A โ€” MZ at offset 0. The 4-byte little-endian value at offset 0x3C points to the PE header, which begins 50 45 00 00 (PE\0\0). Windows .exe, .dll, .sys.
Mach-OFE ED FA CE 32-bit, FE ED FA CF 64-bit (byte-reversed on little-endian targets). macOS and iOS binaries.
Java classCA FE BA BE then the minor and major version. The same four bytes are also the Mach-O universal ("fat") binary magic โ€” context decides.
WASM00 61 73 6D โ€” \0asm, followed by the version 01 00 00 00.
SQLite 353 51 4C 69 74 65 20 66 6F 72 6D 61 74 20 33 00 โ€” the literal string SQLite format 3 plus a NUL. Sixteen bytes, unmistakable in a hex dump.
OLE2 compound fileD0 CF 11 E0 A1 B1 1A E1 โ€” legacy .doc, .xls, .ppt and .msi. Seeing this where a .docx was expected means an old-format (macro-capable) document.
RIFF containers52 49 46 46 (RIFF), 4 size bytes, then the form type at offset 8: WAVE, AVI  or WEBP.
MP4 / ISO BMFF66 74 79 70 โ€” ftyp at offset 4, preceded by a 4-byte box length. The brand that follows (isom, mp42, M4A , heic) names the exact flavour.
Shebang23 21 โ€” #! followed by an interpreter path. A "JPEG" upload starting with this is a script, not an image.
Verify, do not trustCheck the signature server-side, re-encode images where you can, store uploads outside the web root, and never derive the served Content-Type from the user's filename.

โŒจ๏ธ Command Reference

The command lines that actually get typed during recon, triage and incident response — each with real, verified flags. Where a command needs root or is destructive, the description says so. Commands with a spare screen equivalent on this site link straight to it.

๐Ÿ›ฐ๏ธ nmap — network mapper

nmap 10.0.0.1Default scan: top 1000 TCP ports of one host. As root this is a SYN scan (-sS); unprivileged it falls back to a full connect scan (-sT).
nmap -sn 10.0.0.0/24Host discovery only ("ping sweep") — which hosts are up, no port scan.
nmap -Pn hostSkip host discovery, treat the target as up. Use when the host drops ping but you know it exists.
nmap -sS hostSYN "half-open" scan. Fast and quiet; needs root (raw sockets).
nmap -sT hostFull TCP connect scan. No root needed; completes the 3-way handshake so it is louder in logs.
nmap -sU hostUDP scan. Slow (relies on ICMP port-unreachable); needs root.
nmap -p 22,80,443 hostNamed ports. -p- = all 65535, -p 1-1024 = a range, -F = fast (top 100), --top-ports 100 = the 100 most common.
nmap -sV hostService/version detection — probe open ports to name the software and version.
nmap -O hostOS fingerprint from TCP/IP stack behaviour. Needs root.
nmap -A hostAggressive: version + OS detection, default scripts and traceroute in one shot.
nmap -sC hostRun the default NSE script set (equivalent to --script=default). Also --script=vuln, --script http-title, --script-help <name>.
nmap -T4 hostTiming template 0–5 (paranoid → insane). -T4 is the usual choice; add --min-rate 1000 to floor the packet rate.
nmap --open -n host--open shows only open ports; -n skips DNS (faster); -6 scans IPv6; --reason explains each port state.
nmap -oA scan hostWrite all three output formats with one base name: -oN normal, -oX XML, -oG greppable.
-f / -D / -g / --spoof-macEvasion flags exist — packet fragmentation, decoy source addresses, source-port and MAC spoofing — to test whether an IDS/firewall detects a scan. Only relevant on systems you are authorised to test.
nmap -sV -sC -T4 hostThe everyday combo: what is open, what is running, and the default checks.
โ–ถ on h4ck0rrun a TCP port scan →

๐Ÿ“– dig / host / nslookup — DNS queries

dig example.comA record by default, with the full ANSWER/AUTHORITY sections and query stats.
dig example.com MXQuery a specific type: A AAAA MX TXT NS SOA CNAME CAA SRV.
dig +short example.comJust the answer values, one per line — ideal for scripts. Combine: dig +short MX example.com.
dig @1.1.1.1 example.comQuery a specific resolver instead of your system default.
dig +trace example.comResolve iteratively from the root down, showing each delegation — the tool for diagnosing broken delegation.
dig +dnssec example.comSet the DO bit and request signatures (RRSIG). An ad flag in the header means the resolver validated DNSSEC.
dig -x 8.8.8.8Reverse lookup (PTR) for an IP. Add +short for just the name.
dig +noall +answer NS example.comTrim the output to only the ANSWER section — clean, greppable.
dig ANY example.comAsk for every type — but most servers now refuse or minimise ANY (RFC 8482), so results are usually incomplete.
host -t MX example.comhost equivalent. host example.com gives A/AAAA/MX in one line; host 8.8.8.8 does reverse; host -a is verbose (ANY-style).
nslookup -type=MX example.com 1.1.1.1nslookup form: -type= sets the record, a trailing server picks the resolver. Bare nslookup opens interactive mode (set type=NS, server 1.1.1.1).
โ–ถ on h4ck0rlook up DNS records →

๐ŸŒ curl — HTTP client

curl https://example.comGET the URL, body to stdout.
curl -I urlHEAD request — response headers only. -i includes headers with the body; -v shows the full request, TLS handshake and headers.
curl -sS urlSilent, but still print errors — the standard pairing for scripts. -L follows redirects.
curl -X POST urlSet the HTTP method explicitly. With -d, POST is already implied.
curl -d 'a=1&b=2' urlSend a form body (implies POST, Content-Type: application/x-www-form-urlencoded). --data-urlencode 'q=a b' encodes safely.
curl -d @body.json -H 'Content-Type: application/json' urlSend a JSON file as the request body with the right content type.
curl -H 'Authorization: Bearer TOKEN' urlAdd an arbitrary header. -u user:pass does HTTP Basic auth.
curl -c jar.txt -b jar.txt url-c saves cookies to a jar, -b jar.txt replays them; -b 'k=v' sends one inline.
curl --connect-timeout 5 --max-time 15 urlCap the connect and total time so a hung host cannot block a script.
curl --resolve example.com:443:203.0.113.5 urlForce a hostname to a specific IP — test one backend behind a CDN or before DNS is cut over, keeping the correct SNI/Host.
curl --cert client.pem --key client.key urlPresent a client certificate (mTLS). --cacert ca.pem pins a trusted CA; -k skips TLS verification — diagnostics only, never in production.
curl -x http://proxy:8080 urlRoute through a proxy. -x socks5://host:1080 for SOCKS.
curl -O urlDownload to a file. -O keeps the remote name, -o name chooses one, -C - resumes a partial download.
curl -w '%{http_code} %{time_total}\n' -o /dev/null -s urlWrite-out format string. Fields include %{time_namelookup} (DNS), %{time_connect} (TCP), %{time_appconnect} (TLS), %{time_starttransfer} (TTFB), %{size_download}, %{num_redirects}, %{remote_ip}, %{url_effective}.
โ–ถ on h4ck0rinspect a URL's headers →

๐Ÿ”’ openssl — TLS & PKI toolkit

openssl s_client -connect example.com:443 -servername example.comOpen a TLS session and print the negotiated cert. -servername sends SNI so you get the right virtual host's certificate.
openssl s_client -connect host:443 -showcertsDump the full chain the server sent, in PEM — useful for finding a missing intermediate.
openssl s_client -connect host:443 -tls1_2Force a protocol version (-tls1_2 / -tls1_3) to check what a server will accept.
openssl s_client -connect mail:587 -starttls smtpNegotiate STARTTLS before the handshake — also imap, pop3, ftp, ldap.
echo | openssl s_client -connect host:443 2>/dev/null | openssl x509 -noout -datesOne-liner for a cert's validity window. echo | closes stdin so the session ends.
openssl x509 -in cert.pem -text -nooutFull human-readable certificate. -noout -subject -issuer -dates -serial -fingerprint -sha256 for one-line facts; -ext subjectAltName lists the SANs.
openssl genrsa -out key.pem 2048Generate an RSA private key. Modern equivalent: openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:2048 -out key.pem.
openssl ecparam -name prime256v1 -genkey -noout -out ec.pemGenerate an EC private key on P-256 (a.k.a. prime256v1 / secp256r1). Public key: openssl pkey -in key.pem -pubout.
openssl req -new -newkey rsa:2048 -nodes -keyout key.pem -out csr.pemNew key + CSR in one step (-nodes = no passphrase). Inspect a CSR: openssl req -in csr.pem -noout -text -verify.
openssl req -x509 -newkey rsa:2048 -nodes -keyout key.pem -out cert.pem -days 365Self-signed certificate for a lab/test host.
openssl x509 -in cert.pem -outform der -out cert.derPEM → DER. Reverse with -inform der. Bundle key + cert into PKCS#12: openssl pkcs12 -export -in cert.pem -inkey key.pem -out bundle.p12; unpack with openssl pkcs12 -in bundle.p12 -nodes -out out.pem.
openssl dgst -sha256 fileHash a file. -hmac 'key' for an HMAC; -sign key.pem -out sig file and -verify pub.pem -signature sig file for signatures.
openssl enc -aes-256-cbc -salt -pbkdf2 -in plain -out encSymmetric encryption; -d to decrypt. Always include -pbkdf2 so the passphrase is stretched properly. Note this is unauthenticated: enc cannot emit or verify an AEAD tag, so tampering with the ciphertext is undetectable and CBC decryption is a padding-oracle risk. For anything that matters, use an AEAD mode via a real library, or sign the file separately.
openssl rand -hex 3232 random bytes as hex (or -base64 32) — keys, tokens, salts.
openssl verify -CAfile ca.pem cert.pemVerify a cert against a trusted CA. Add -untrusted chain.pem to supply the intermediates.

๐Ÿ”‘ ssh / scp / ssh-keygen

ssh-keygen -t ed25519 -C 'you@host'Generate a modern Ed25519 key (small, fast, strong). Use -t rsa -b 4096 only where Ed25519 is unsupported.
ssh-keygen -l -f id_ed25519.pubShow a key's fingerprint. -y -f key derives the public key from a private one; -p -f key changes its passphrase.
ssh -i ~/.ssh/id_ed25519 -p 2222 user@hostConnect with a specific key and port. ssh-copy-id user@host installs your public key on the server.
eval "$(ssh-agent -s)" && ssh-add ~/.ssh/id_ed25519Start the agent and load a key so the passphrase is entered once. ssh-add -l lists loaded keys; ssh -A forwards the agent (use sparingly — a compromised host can use your keys).
ssh -L 8080:localhost:80 user@hostLocal forward: your localhost:8080 reaches port 80 as seen from the server.
ssh -R 9000:localhost:3000 user@hostRemote forward: the server's port 9000 reaches your local port 3000.
ssh -D 1080 user@hostDynamic forward — a local SOCKS5 proxy tunnelling through the host. Add -N -f to background a tunnel with no shell.
ssh -J bastion user@internalJump through a bastion (ProxyJump) to reach a host you cannot connect to directly.
~/.ssh/configPer-host defaults: Host web then indented HostName, User, Port, IdentityFile, ProxyJump. Then just ssh web.
ssh-keygen -R hostRemove a stale host key from ~/.ssh/known_hosts after a legitimate rebuild. ssh-keygen -F host finds it; verify a new fingerprint out-of-band before trusting it.
scp -P 2222 file user@host:/path/Copy a file up (note capital -P for the port); -r for directories; reverse the arguments to pull a file down.
rsync -avz -e 'ssh -p 2222' dir/ user@host:/path/Efficient sync over SSH — only changed data. -P shows progress and resumes; --dry-run previews; --delete mirrors deletions (verify with a dry run first).

๐Ÿงช tcpdump — packet capture (root)

tcpdump -DList capturable interfaces. Almost every tcpdump command needs root.
tcpdump -i eth0Capture on one interface; -i any captures on all.
tcpdump host 10.0.0.1BPF filter by host. Also src host / dst host for one direction.
tcpdump port 443Filter by port (src port / dst port too); net 10.0.0.0/24 filters a subnet.
tcpdump tcp / udp / icmp / arpFilter by protocol; combine expressions with and / or / not, e.g. 'tcp port 80 and host 10.0.0.1'.
tcpdump 'tcp[tcpflags] & tcp-syn != 0'Flag-based filter — match packets with the SYN bit set. Equivalent numeric form: 'tcp[13] & 2 != 0'.
tcpdump -nn-n stops host name resolution, -nn also stops port-name resolution — faster and unambiguous.
tcpdump -c 100 -s 0-c stops after N packets; -s 0 captures the full packet (snaplen), important when writing a pcap for later analysis.
tcpdump -w cap.pcapWrite raw packets to a pcap. Read one back (no root needed) with tcpdump -r cap.pcap, or open it in Wireshark.
tcpdump -A / -X-A prints payloads as ASCII, -X as hex + ASCII; -e shows the link-layer header; -tttt gives human-readable timestamps.
tcpdump -i any -nn -s0 -w cap.pcap 'port 443'Recipe: capture all HTTPS traffic to a file for offline analysis.
tcpdump -i eth0 -nn 'tcp[tcpflags] & (tcp-syn|tcp-ack) == tcp-syn'Recipe: bare SYNs only — connection attempts, useful for spotting a scan or a SYN flood.

๐Ÿ”Œ netcat / socat — raw sockets

nc -lvnp 4444Listen on a port, verbose, numeric (-p is the port on traditional/ncat; OpenBSD nc takes the port as the last argument). Add > file to receive a file.
nc host 4444Connect to a host/port — a bidirectional pipe over stdin/stdout. Pair with a listener redirecting < file to send a file.
nc -zv host 20-25Port check: -z = zero-I/O (just test), -v = report state. Single named target only.
printf 'HEAD / HTTP/1.0\r\n\r\n' | nc host 80Banner / response grab — speak just enough protocol to read what the service announces.
nc -u host 53-u switches to UDP; -w 3 sets a timeout so a dead peer does not hang the pipe.
which ncKnow your variant: OpenBSD nc (default on most Linux/macOS) removed the -e exec flag for safety; the traditional (GNU) nc and Nmap's ncat keep it. ncat --ssl host 443 adds TLS.
socat - TCP:host:443Connect stdio to a TCP service. socat OPENSSL:host:443,verify=0 - does the same over TLS.
socat TCP-LISTEN:8080,reuseaddr,fork TCP:backend:80A quick TCP port-forwarder/relay — fork handles multiple clients.
noteReverse shells (a listener catching a call-back connection) are a standard part of authorised penetration testing. Only ever point one at a system you own or have written authorisation to test.

๐Ÿงฑ iptables / nftables / ufw — host firewall (root)

iptables -L -n -v --line-numbersList rules with packet counters and rule numbers. iptables -S prints them in save/restore syntax.
iptables -A INPUT -p tcp --dport 22 -j ACCEPTAppend an allow rule for SSH. -A adds to the end; -I INPUT 1 inserts at the top (position matters — see below).
iptables -D INPUT 3Delete rule number 3 (from --line-numbers), or repeat the exact rule with -D instead of -A.
iptables -P INPUT DROPDefault-deny. Order is everything: first matching rule wins, so allow loopback and established traffic before the policy drops the rest — otherwise you lock yourself out.
iptables -A INPUT -i lo -j ACCEPTAllow loopback, then iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT keeps existing connections alive under a default-deny policy.
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADESource-NAT for a gateway. Port-forward (DNAT): iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to-destination 10.0.0.5:8080.
iptables-save > /etc/iptables/rules.v4iptables rules are not persistent by default. Save them (restore with iptables-restore < file), or use the iptables-persistent / netfilter-persistent package.
nft list rulesetnftables equivalent of listing everything. It is the modern replacement for iptables.
nft add rule inet filter input tcp dport 22 acceptAllow SSH in nft. A default-deny chain: nft add chain inet filter input '{ type filter hook input priority 0 ; policy drop ; }', then add ct state established,related accept. Load a file with nft -f /etc/nftables.conf.
ufw allow 22/tcpThe friendly front-end. ufw allow from 10.0.0.0/24 to any port 22 scopes by source; ufw status numbered then ufw delete N removes a rule.
ufw default deny incomingSet a deny-by-default posture, then ufw default allow outgoing and ufw enable. ufw status verbose confirms.

๐Ÿ”Ž Linux triage & forensics one-liners

w / whoWho is logged in right now, and what they are running.
lastRecent successful logins (from wtmp). lastb shows failed attempts (btmp, root only); lastlog shows the last login per account.
ss -tulpnListening sockets: -t TCP, -u UDP, -l listening, -p owning process (needs root for others), -n numeric. ss -tanp shows established connections. (Legacy: netstat -tulpn.)
ps auxfProcess list as a tree; pstree -ap shows the parentage with arguments — spot a shell spawned by a web server.
lsof -i :443What is bound to a port. lsof -p PID lists a process's open files; lsof +L1 reveals deleted-but-still-open files, a common malware hiding trick.
crontab -lCurrent user's cron jobs; crontab -l -u user for another. Also check /etc/crontab, /etc/cron.d/, /etc/cron.* and /var/spool/cron/.
systemctl list-timers --allsystemd's cron equivalent. systemctl list-units --type=service lists services; systemctl cat <unit> shows a unit's definition.
find / -mtime -1 -type f 2>/dev/nullFiles modified in the last day. Scope it (find /etc -mtime -1) to cut noise; -newermt '2026-07-25' filters by an exact date.
find / -perm -4000 -type f 2>/dev/nullSUID binaries (run as their owner) — a privilege-escalation surface. -perm -2000 finds SGID files.
rpm -VaVerify installed files against the package manifest (RHEL); a 5 in the output means the checksum changed. Debian: dpkg -V or debsums -c.
journalctl -u ssh --since '1 hour ago'Read a service's logs. -k kernel, -f follow live, -b current boot. Auth events also land in /var/log/auth.log (Debian) or /var/log/secure (RHEL).

๐Ÿ“ grep / sed / awk / jq — text & log work

grep -rin 'pattern' /path-r recursive, -i case-insensitive, -n line numbers. Add -c count, -v invert, -w whole word, -l filenames only, -A/-B/-C N context lines.
grep -E 'foo|bar' / grep -P '\d+'-E = extended regex (POSIX ERE), -P = Perl-compatible (PCRE, needed for \d, lookarounds). -o prints only the matched text.
grep -Eo '([0-9]{1,3}\.){3}[0-9]{1,3}' access.log | sort | uniq -c | sort -rn | headWorked example: pull every IP out of a log and rank the noisiest talkers.
sed -n '10,20p' filePrint a line range. sed 's/foo/bar/g' file substitutes to stdout; -i edits in place, -i.bak keeps a backup.
sed '/DEBUG/d' app.logWorked example: strip out matching lines (here, drop DEBUG noise before reading a log).
awk -F: '{print $1}' /etc/passwd-F sets the field separator; $1$NF are fields, $0 the whole line. awk shines at column extraction and arithmetic over columns.
awk '$9==404 {print $7}' access.log | sort | uniq -c | sort -rnWorked example: in a combined access log, field 9 is the status and field 7 the path — this ranks the top 404 URLs. awk '{sum+=$10} END{print sum}' totals bytes served.
jq '.' file.jsonPretty-print and validate JSON. -r emits raw strings (no quotes), -c compact output.
curl -s api/users | jq -r '.[] | select(.active) | [.id,.email] | @tsv'Worked example: filter a JSON API to active users and emit clean tab-separated columns. Also jq 'keys', jq 'length', jq '.data[].name'.
โ–ถ on h4ck0rtest a regex live →

๐Ÿ—‚๏ธ git forensics — leaked-secret hunting

git log -p -S 'AKIA' --allPickaxe: every commit across all branches that added or removed the string — the fastest way to find where a secret entered history. -G'regex' is the regex variant.
git log --all --oneline -- path/to/fileFull history of one file, including on branches you are not on.
git grep 'pattern' $(git rev-list --all)Grep the working tree of every commit ever made (thorough but heavy on large repos).
git log --oneline --graph --allVisualise branch/merge topology. git blame -L 10,20 file shows who last touched specific lines and in which commit.
git show <commit>:pathPrint a file exactly as it was at a commit. git show <commit> alone shows that commit's full diff.
git log --diff-filter=D --oneline -- pathFind the commit that deleted a file, then recover its last content with git show <commit>^:path (the ^ means the parent, i.e. before the deletion).
โ€ผ the key pointRewriting history (git filter-repo, BFG) does not un-leak a credential. Anyone who cloned or forked still has it, mirrors and CI caches keep it, and hosting providers can serve an old commit by its SHA. If a secret was ever pushed, treat it as compromised and rotate/revoke it — history cleanup is only tidying up afterwards.

๐ŸชŸ Windows / PowerShell equivalents

ipconfig /allFull network config (adapters, DNS, DHCP, MAC). ipconfig /flushdns clears the resolver cache; ipconfig /displaydns dumps it.
nslookup -type=MX example.com 1.1.1.1DNS lookup (same syntax as elsewhere). PowerShell-native: Resolve-DnsName example.com -Type MX.
netstat -anoConnections and listeners with the owning PID. netstat -anob (admin) also names the executable; cross-reference the PID in Task Manager.
Get-NetTCPConnection -State Listen | Sort LocalPortPowerShell-native listener list; the OwningProcess column is the PID. Use -State Established for active connections.
Test-NetConnection host -Port 443The PowerShell "can I reach this TCP port" test — the closest thing to a TCP ping. Add -TraceRoute for path insight.
Get-FileHash file -Algorithm SHA256Hash a file (SHA-256 is the default). Command-prompt equivalent: certutil -hashfile file SHA256.
certutil -dump cert.cerInspect a certificate. certutil -decode in.b64 out.bin / -encode converts to and from Base64 (a handy built-in when other tools are absent).
whoami /privList the current token's privileges — a first stop when checking for privilege-escalation footholds (e.g. SeImpersonatePrivilege). whoami /groups and whoami /all show more.
Get-WinEvent -FilterHashtable @{LogName='Security';Id=4625}Query the event log efficiently. Security event 4625 is a failed logon, 4624 a successful one. Get-WinEvent -LogName Security -MaxEvents 50 grabs the most recent entries.

๐Ÿ”ฃ Regex quick reference

^   $   \b   \BAnchors: ^ start, $ end (of string, or of each line with the m flag), \b word boundary, \B non-boundary. Anchors match a position, not a character.
. \d \w \s [abc] [^abc] [a-z]Classes: . any char (except newline unless s flag), \d digit, \w = [A-Za-z0-9_], \s whitespace (uppercase negates: \D \W \S). [ ] is a custom set, [^ ] negates it.
* + ? {n} {n,} {n,m}Quantifiers: * 0+, + 1+, ? 0 or 1, {n,m} a range. Greedy by default (grab as much as possible); append ? for lazy: .*? takes the fewest characters.
(ab) (?:ab) (?<y>ab) \1 a|bGroups: ( ) captures, (?: ) groups without capturing, (?<name> ) names a group. \1 is a backreference to the first group's matched text; | is alternation.
(?=..) (?!..) (?<=..) (?<!..)Lookaround (zero-width): (?= ) lookahead, (?! ) negative lookahead, (?<= ) lookbehind, (?<! ) negative lookbehind. Not every engine supports lookbehind (POSIX ERE has none).
flags: i g m s x ui case-insensitive, g global (all matches), m multiline anchors, s dotall (. matches newline), x extended/verbose, u Unicode.
\b(?:\d{1,3}\.){3}\d{1,3}\bIPv4 (loose — also matches 999.999.999.999). For strict octets use each group as (25[0-5]|2[0-4]\d|1?\d?\d).
[^@\s]+@[^@\s]+\.[^@\s]+Pragmatic email extractor. No regex fully validates an email address (RFC 5322 is far more permissive than any usable pattern) — use this to find candidates, then confirm by sending mail.
https?://[^\s/$.?#]\S*Pragmatic http/https URL matcher for pulling links out of text.
\b[a-fA-F0-9]{64}\bHex hash by length: 32 = MD5, 40 = SHA-1, 64 = SHA-256. Swap the {n} to target one.
\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}:\d{2}ISO-8601 timestamp; add (?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})? to also catch fractional seconds and the timezone offset.
โ–ถ on h4ck0rbuild & test patterns →

Want to run these against something real? The toolkit covers DNS, TLS, HTTP headers and email authentication live, and the learning modules explain what the values mean.