# Active Directory (Kerberos, LDAP), AAA, SMB/NFS & Admin Access

> **FrameAssembly v3.2.2** · Anthology 09 (Layer 7 · 14 Recipes) · MIT License · Canonical URL: https://frameassembly-lang.dev/docs/examples/identity-aaa-storage

Enterprise identity, NAS storage, and bastion captures: `kerberos` AS/TGS exchanges, `ldap` binds and searches, `radius` & `tacacs` AAA, `smb` & `nfs` shares, plus `ssh`, `telnet`, `ftp`, `tftp`, and `whois`.

## Key Wire & Syntax Takeaways

- `kerberos` and `nfs` support `transport tcp` and `transport udp`, automatically adding RFC record-marking headers when carried over TCP.
- `radius` automatically selects UDP 1812 for `access*` authentication packets and UDP 1813 for `accounting*` packets.
- `smb` (TCP 445 NetBIOS-less framing) and `ldap` (ASN.1 BER on TCP 389) let blue teams test lateral-movement detections offline.

## 09.01 · Active Directory Kerberos AS-REQ / TGS-REQ over TCP Port 88 (transport tcp) (`kerberos_tcp88_ticket_flow.frasm`)

Enterprise Windows tickets carrying large PAC group memberships exceed UDP MTU and switch to TCP port 88. This trace validates TCP 88 KDC rules.

- **Protocols:** `tcp`, `kerberos` (7 Ethernet frames)
- **Wire Behavior:** transport tcp on kerberos prepends the 4-byte RFC 4120 record-length header over stateful TCP 88.
- **Wireshark Filter:** `kerberos && tcp.port == 88`
- **CLI Build:** `frameassembly kerberos_tcp88_ticket_flow.frasm`

```frameassembly
host domain_pc { ip 10.10.30.45 }
host dc01_kdc  { ip 10.10.0.10 }

compile {
    domain_pc -> dc01_kdc tcp syn srcport 52088 dstport 88 win 65535 mss 1460 wait 1ms
    domain_pc <- dc01_kdc tcp syn ack win 65535 mss 1460 wait 1ms
    domain_pc -> dc01_kdc tcp ack wait 1ms
    domain_pc -> dc01_kdc kerberos asreq realm "CORP.EXAMPLE.COM" cname "alice" sname "krbtgt/CORP.EXAMPLE.COM" etype 18 transport tcp wait 2ms
    domain_pc <- dc01_kdc kerberos asrep realm "CORP.EXAMPLE.COM" cname "alice" sname "krbtgt/CORP.EXAMPLE.COM" etype 18 transport tcp wait 2ms
    domain_pc -> dc01_kdc kerberos tgsreq realm "CORP.EXAMPLE.COM" cname "alice" sname "cifs/filesrv01.corp.example.com" etype 18 transport tcp wait 2ms
    domain_pc <- dc01_kdc kerberos tgsrep realm "CORP.EXAMPLE.COM" cname "alice" sname "cifs/filesrv01.corp.example.com" etype 18 transport tcp
}
```

## 09.02 · RADIUS 802.1X Access-Challenge / Accept (UDP 1812) + Accounting (UDP 1813) (`radius_auth_and_accounting.frasm`)

Verifies NAC firewall rules for both RADIUS authentication (UDP 1812) and session accounting start/response (UDP 1813).

- **Protocols:** `radius` (6 Ethernet frames)
- **Wire Behavior:** FrameAssembly automatically selects UDP 1812 on access* messages and switches to UDP 1813 on accounting* messages.
- **Wireshark Filter:** `radius`
- **CLI Build:** `frameassembly radius_auth_and_accounting.frasm`

```frameassembly
host edge_sw { ip 10.20.0.5 }
host ise_psn { ip 10.20.100.10 }

compile {
    edge_sw -> ise_psn radius accessrequest id 10 user "mchen" nasip 10.20.0.5 servicetype 2 wait 3ms
    edge_sw <- ise_psn radius accesschallenge id 10 wait 3ms
    edge_sw -> ise_psn radius accessrequest id 11 user "mchen" nasip 10.20.0.5 wait 4ms
    edge_sw <- ise_psn radius accessaccept id 11 framedip 10.20.40.88 wait 5ms
    edge_sw -> ise_psn radius accountingrequest id 20 user "mchen" nasip 10.20.0.5 framedip 10.20.40.88 wait 2ms
    edge_sw <- ise_psn radius accountingresponse id 20
}
```

## 09.03 · Active Directory RC4 Kerberoasting + ADMIN$ SMB Lateral Check (`pentest_ad_kerberos_smb.frasm`)

Simulates an RC4-HMAC (etype 23) Kerberos service ticket request on port 88 followed by an SMB2 ADMIN$ share connection on TCP 445 to validate SOC lateral-movement alerts.

- **Protocols:** `kerberos`, `tcp`, `smb` (10 Ethernet frames)
- **Wire Behavior:** Lets blue-team and SOC engineers verify Zeek kerberos.log / smb_mapping.log and SIEM correlation rules safely without touching a live Domain Controller.
- **Wireshark Filter:** `kerberos || smb2`
- **CLI Build:** `frameassembly pentest_ad_kerberos_smb.frasm`

```frameassembly
// Lab workstation, Active Directory KDC, and Windows member server
host lab_wkstn { ip 10.10.20.44 }
host ad_dc01   { ip 10.10.0.10 }
host file_srv  { ip 10.10.1.45 }

compile {
    // Phase 1: Request SQL SPN ticket downgraded to RC4-HMAC (etype 23 = Kerberoasting test)
    lab_wkstn -> ad_dc01 kerberos tgsreq realm "CORP.INTERNAL" cname "svc_test" sname "MSSQLSvc/sql01.corp.internal:1433" etype 23 wait 2ms
    lab_wkstn <- ad_dc01 kerberos tgsrep realm "CORP.INTERNAL" cname "svc_test" sname "MSSQLSvc/sql01.corp.internal:1433" etype 23 wait 5ms

    // Phase 2: Open TCP 445 to member server and connect to administrative share ADMIN$
    lab_wkstn -> file_srv tcp syn srcport 52445 dstport 445 win 65535 mss 1460 wait 1ms
    lab_wkstn <- file_srv tcp syn ack win 65535 mss 1460 wait 1ms
    lab_wkstn -> file_srv tcp ack wait 1ms
    lab_wkstn -> file_srv smb negotiate msgid 0 wait 1ms
    lab_wkstn <- file_srv smb negotiate msgid 0 status 0 wait 1ms
    lab_wkstn -> file_srv smb sessionsetup msgid 1 sessionid 0x2001 wait 1ms
    lab_wkstn <- file_srv smb sessionsetup msgid 1 sessionid 0x2001 status 0 wait 1ms
    lab_wkstn -> file_srv smb treeconnect msgid 2 sessionid 0x2001 share "\\file_srv\ADMIN$"
}
```

## 09.04 · Kerberos v5 (`kerberos`): AES256 TGT Login Over TCP 88 + RC4 (`etype 23`) Kerberoasting Detection Lab (`kerberos_ad_detection_lab.frasm`)

Models a normal Windows workstation obtaining an AES256 TGT over TCP port 88, followed by an RC4 (`etype 23`) `tgsreq`/`tgsrep` SPN ticket request to trigger SOC Kerberoasting signatures.

- **Protocols:** `kerberos`, `tcp` (7 Ethernet frames)
- **Wire Behavior:** Encodes valid ASN.1 DER RFC 4120 `APPLICATION` tags (`10` AS-REQ, `11` AS-REP, `12` TGS-REQ, `13` TGS-REP, `30` KRB-ERROR) with `pvno = 5`. Splits slash-separated SPNs like `"MSSQLSvc/db01.corp.internal:1433"` into multi-component `PrincipalName` ASN.1 sequences automatically.
- **Wireshark Filter:** `kerberos`
- **CLI Build:** `frameassembly show kerberos_ad_detection_lab.frasm`

```frameassembly
host wkstn_14 { ip 172.16.20.14 }
host dc01_ad  { ip 172.16.1.10 }

compile {
    // 1. Normal Active Directory TGT exchange over TCP port 88 (etype 18 = AES256)
    wkstn_14 -> dc01_ad tcp syn srcport 53088 dstport 88 win 65535 mss 1460 wait 1ms
    wkstn_14 <- dc01_ad tcp syn ack win 65535 mss 1460 wait 1ms
    wkstn_14 -> dc01_ad tcp ack wait 1ms
    wkstn_14 -> dc01_ad kerberos asreq realm "CORP.INTERNAL" cname "alice" sname "krbtgt/CORP.INTERNAL" etype 18 transport tcp wait 2ms
    wkstn_14 <- dc01_ad kerberos asrep realm "CORP.INTERNAL" cname "alice" etype 18 transport tcp wait 5ms
    // 2. Suspicious RC4-HMAC (etype 23) Service Ticket Request for SQL SPN (Kerberoasting test)
    wkstn_14 -> dc01_ad kerberos tgsreq realm "CORP.INTERNAL" cname "alice" sname "MSSQLSvc/db-prod.corp.internal:1433" etype 23 transport tcp wait 2ms
    wkstn_14 <- dc01_ad kerberos tgsrep realm "CORP.INTERNAL" cname "alice" sname "MSSQLSvc/db-prod.corp.internal:1433" etype 23 transport tcp
}
```

## 09.05 · LDAPv3 (`ldap`): AD Bind Failure (`49`), Authorized Bind, Privileged Group Search & Unbind (`ldap_ad_search_audit.frasm`)

Captures a rejected bind (`resultcode 49`), a successful bind (`resultcode 0`), an `(adminCount=1)` privileged-account search returning an entry + `searchdone`, and a clean `unbindreq`.

- **Protocols:** `ldap`, `tcp` (11 Ethernet frames)
- **Wire Behavior:** Defaults to TCP destination port `389` (`psh ack`) and wraps every operation in an ASN.1 BER `SEQUENCE` (`0x30`) with exact definite-length tags. Encodes RFC 4511 protocolOp tags (`0x60` BindRequest, `0x61` BindResponse, `0x63` SearchRequest, `0x64` SearchResultEntry, `0x65` SearchResultDone, `0x42` UnbindRequest).
- **Wireshark Filter:** `ldap`
- **CLI Build:** `frameassembly show ldap_ad_search_audit.frasm`

```frameassembly
host jump_ws { ip 172.16.30.44 }
host ad_dc   { ip 172.16.1.10 }

compile {
    jump_ws -> ad_dc tcp syn srcport 52389 dstport 389 win 65535 mss 1460 wait 1ms
    jump_ws <- ad_dc tcp syn ack win 65535 mss 1460 wait 1ms
    jump_ws -> ad_dc tcp ack wait 1ms
    // 1. Failed Simple Bind -> resultcode 49 (invalidCredentials)
    jump_ws -> ad_dc ldap bindreq msgid 1 basedn "cn=backup_ro,dc=corp,dc=internal" wait 2ms
    jump_ws <- ad_dc ldap bindres msgid 1 resultcode 49 wait 5ms
    // 2. Successful Bind -> Search privileged accounts -> Unbind
    jump_ws -> ad_dc ldap bindreq msgid 2 basedn "cn=backup_ro,dc=corp,dc=internal" wait 2ms
    jump_ws <- ad_dc ldap bindres msgid 2 resultcode 0 wait 2ms
    jump_ws -> ad_dc ldap searchreq msgid 3 basedn "dc=corp,dc=internal" filter "(adminCount=1)" wait 3ms
    jump_ws <- ad_dc ldap searchentry msgid 3 basedn "cn=Domain Admins,cn=Users,dc=corp,dc=internal" wait 1ms
    jump_ws <- ad_dc ldap searchdone msgid 3 resultcode 0 wait 2ms
    jump_ws -> ad_dc ldap unbindreq msgid 4
}
```

## 09.06 · RADIUS (`radius`): MFA Challenge, VPN IP Assignment & RADIUS Accounting Start (`radius_vpn_mfa_accounting.frasm`)

Walks through a VPN gateway sending an Access-Request, handling an MFA Access-Challenge, receiving an Access-Accept with an assigned client IP, and logging an Accounting-Request on UDP 1813.

- **Protocols:** `radius` (6 Ethernet frames)
- **Wire Behavior:** Picks UDP destination port `1812` for `accessrequest`, `accessaccept`, `accessreject`, and `accesschallenge`, or UDP `1813` for `accountingrequest` and `accountingresponse`. Calculates the exact 16-bit RADIUS Length across the 20-byte header and all included AVP attributes, and reverses UDP ports automatically on `<-` replies.
- **Wireshark Filter:** `radius`
- **CLI Build:** `frameassembly show radius_vpn_mfa_accounting.frasm`

```frameassembly
host vpn_gw    { ip 172.16.1.5 }
host radius_01 { ip 172.16.10.20 }

compile {
    // 1. Initial VPN login + MFA Access-Challenge on UDP 1812
    vpn_gw -> radius_01 radius accessrequest id 10 user "oncall.netops" nasip 172.16.1.5 servicetype 2 wait 2ms
    vpn_gw <- radius_01 radius accesschallenge id 10 wait 15ms
    // 2. Second factor approved -> Access-Accept assigns Framed-IP 10.250.0.25
    vpn_gw -> radius_01 radius accessrequest id 11 user "oncall.netops" nasip 172.16.1.5 servicetype 2 wait 2ms
    vpn_gw <- radius_01 radius accessaccept id 11 framedip 10.250.0.25 wait 5ms
    // 3. Session accounting record on UDP 1813
    vpn_gw -> radius_01 radius accountingrequest id 12 user "oncall.netops" nasip 172.16.1.5 framedip 10.250.0.25 wait 2ms
    vpn_gw <- radius_01 radius accountingresponse id 12
}
```

## 09.07 · TACACS+ (`tacacs`): Full TCP 49 Handshake + TACACS+ Admin Login & Command Accounting (`tacacs_admin_session.frasm`)

Opens a TCP port 49 session from a spine router to a TACACS+ server, completes an authentication prompt/reply pair, and sends a command accounting record.

- **Protocols:** `tacacs`, `tcp` (8 Ethernet frames)
- **Wire Behavior:** Defaults to TCP destination port `49` (`psh ack`), TACACS+ version `0xc0`, and calculates the 32-bit payload `length` field automatically. Treats `seq` (`0..255`) on a `tacacs` line as the 1-byte TACACS+ `seq_no` (`1` client start, `2` server reply, `3` client continue) without breaking the outer 32-bit TCP sequence number.
- **Wireshark Filter:** `tacplus`
- **CLI Build:** `frameassembly show tacacs_admin_session.frasm`

```frameassembly
host spine_rtr  { ip 172.20.0.1 }
host tacacs_aaa { ip 172.20.0.49 }

compile {
    // 1. TCP 3-way handshake on port 49
    spine_rtr -> tacacs_aaa tcp syn srcport 51049 dstport 49 win 65535 mss 1460 wait 1ms
    spine_rtr <- tacacs_aaa tcp syn ack win 65535 mss 1460 wait 1ms
    spine_rtr -> tacacs_aaa tcp ack wait 1ms
    // 2. TACACS+ Authentication conversation (odd seq = router, even seq = server)
    spine_rtr -> tacacs_aaa tacacs authen seq 1 flags 1 sessionid 0x44001122 user "secops" data "vty0" wait 2ms
    spine_rtr <- tacacs_aaa tacacs authen seq 2 flags 1 sessionid 0x44001122 data "Password: " wait 5ms
    spine_rtr -> tacacs_aaa tacacs authen seq 3 flags 1 sessionid 0x44001122 user "secops" data "LabPass!" wait 2ms
    // 3. Command authorization & accounting
    spine_rtr -> tacacs_aaa tacacs author seq 1 flags 1 sessionid 0x44001123 user "secops" data "cmd=configure" wait 2ms
    spine_rtr -> tacacs_aaa tacacs acct seq 1 flags 1 sessionid 0x44001124 user "secops" data "task_id=42"
}
```

## 09.08 · SMB2 / SMB3 (`smb`): SMB2 Login Failure (`0xc000006d`) + Administrative `ADMIN$` Named-Pipe Access (`smb_lateral_movement_lab.frasm`)

Completes TCP 445 setup, captures a failed `sessionsetup`, then connects to `\\srv01\ADMIN$` and opens a remote file handle (`create` + `read` + `close`).

- **Protocols:** `smb`, `tcp` (14 Ethernet frames)
- **Wire Behavior:** Defaults to TCP destination port `445` (`psh ack`) and prepends the 4-byte big-endian NetBIOS Session length header (`0x00` + 24-bit size). Builds the full 64-byte `þSMB` header (`StructureSize = 64`, `Command`, `NTSTATUS`, `MessageId`, `TreeId`, `SessionId`) and sets the Server-to-Client flag on `<-` replies.
- **Wireshark Filter:** `smb2`
- **CLI Build:** `frameassembly show smb_lateral_movement_lab.frasm`

```frameassembly
host admin_pc { ip 172.16.20.55 }
host srv_01   { ip 172.16.10.45 }

compile {
    admin_pc -> srv_01 tcp syn srcport 52445 dstport 445 win 65535 mss 1460 wait 1ms
    admin_pc <- srv_01 tcp syn ack win 65535 mss 1460 wait 1ms
    admin_pc -> srv_01 tcp ack wait 1ms
    // 1. SMB2 Negotiate + Failed SessionSetup (STATUS_LOGON_FAILURE = 0xc000006d)
    admin_pc -> srv_01 smb negotiate msgid 0 wait 1ms
    admin_pc <- srv_01 smb negotiate msgid 0 status 0 wait 1ms
    admin_pc -> srv_01 smb sessionsetup msgid 1 wait 2ms
    admin_pc <- srv_01 smb sessionsetup msgid 1 status 0xc000006d wait 5ms
    // 2. Successful SessionSetup + ADMIN$ TreeConnect + Create/Read/Close
    admin_pc -> srv_01 smb sessionsetup msgid 2 sessionid 0x400001 wait 1ms
    admin_pc <- srv_01 smb sessionsetup msgid 2 sessionid 0x400001 status 0 wait 1ms
    admin_pc -> srv_01 smb treeconnect msgid 3 sessionid 0x400001 share "\\srv_01\ADMIN$" wait 2ms
    admin_pc <- srv_01 smb treeconnect msgid 3 sessionid 0x400001 treeid 1 status 0 wait 1ms
    admin_pc -> srv_01 smb create msgid 4 sessionid 0x400001 treeid 1 filename "System32\\drivers\\etc\\hosts" wait 2ms
    admin_pc <- srv_01 smb create msgid 4 sessionid 0x400001 treeid 1 status 0 wait 1ms
    admin_pc -> srv_01 smb close msgid 5 sessionid 0x400001 treeid 1
}
```

## 09.09 · NFSv3 / v4 (`nfs`): NFSv4 TCP 2049 Export Lookup + Legacy NFSv3 UDP Probe (`nfs_storage_audit.frasm`)

Opens TCP port 2049 from a privileged source port (`srcport 850`) to mount `/exports/backups`, then tests a legacy NFSv3 `NULL` ping over UDP 2049.

- **Protocols:** `nfs`, `tcp` (5 Ethernet frames)
- **Wire Behavior:** Defaults to TCP destination port `2049` (`vers 4`, RPC Program `100003`) and prepends the 4-byte ONC RPC Record Marking header (`0x80000000 | length`) over TCP (omitting it cleanly when `transport udp` is selected). Aligns `tag` and `path` UTF-8 strings to 4-byte XDR boundaries per RFC 4506.
- **Wireshark Filter:** `nfs || rpc`
- **CLI Build:** `frameassembly show nfs_storage_audit.frasm`

```frameassembly
host worker_01 { ip 172.16.40.25 }
host netapp_01 { ip 172.16.40.200 }

compile {
    // 1. Stateful NFSv4 COMPOUND over TCP 2049 from privileged port 850 (< 1024)
    worker_01 -> netapp_01 tcp syn srcport 850 dstport 2049 win 65535 mss 1460 wait 1ms
    worker_01 <- netapp_01 tcp syn ack win 65535 mss 1460 wait 1ms
    worker_01 -> netapp_01 tcp ack wait 1ms
    worker_01 -> netapp_01 nfs vers 4 compound xid 0x7001 tag "mount-backups" path "/exports/backups" wait 3ms
    // 2. Legacy NFSv3 NULL RPC check over UDP 2049
    worker_01 -> netapp_01 nfs vers 3 proc "NULL" xid 0x7002 transport udp
}
```

## 09.10 · SSH-2 (`ssh`): Complete SSH-2 Banner Exchange, KEXINIT Negotiation & NEWKEYS Cutover (`ssh_handshake_audit.frasm`)

Establishes a TCP 22 session between an admin workstation and a Linux server, exchanges version banners, negotiates keys via `kexinit`, activates encryption with `newkeys`, and sends encrypted session data.

- **Protocols:** `ssh`, `tcp` (9 Ethernet frames)
- **Wire Behavior:** Defaults to TCP destination port `22` (`psh ack`) and appends standard RFC 4253 `
` terminators to `banner` strings. Computes RFC 4253 binary packet framing (`4-byte packet_length`, `1-byte padding_length`, payload, and 8-byte block padding) automatically on `kexinit`, `newkeys`, and `msgcode` packets.
- **Wireshark Filter:** `ssh`
- **CLI Build:** `frameassembly show ssh_handshake_audit.frasm`

```frameassembly
host admin_ws  { ip 172.16.99.10 }
host linux_srv { ip 172.16.10.22 }

compile {
    admin_ws -> linux_srv tcp syn srcport 53220 dstport 22 win 65535 mss 1460 wait 1ms
    admin_ws <- linux_srv tcp syn ack win 65535 mss 1460 wait 1ms
    admin_ws -> linux_srv tcp ack wait 1ms
    // 1. Cleartext RFC 4253 §4.2 protocol version exchange
    admin_ws -> linux_srv ssh banner "SSH-2.0-OpenSSH_9.7p1" wait 1ms
    admin_ws <- linux_srv ssh banner "SSH-2.0-OpenSSH_9.6p1 Ubuntu-3ubuntu13" wait 2ms
    // 2. Binary KEXINIT (msgcode 20) + NEWKEYS (msgcode 21)
    admin_ws -> linux_srv ssh kexinit cookie "0102030405060708" wait 1ms
    admin_ws <- linux_srv ssh kexinit cookie "aabbccddeeff0011" wait 2ms
    admin_ws -> linux_srv ssh newkeys wait 1ms
    admin_ws <- linux_srv ssh newkeys
}
```

## 09.11 · Telnet (`telnet`): Legacy OT RTU Telnet Login Detection Scenario (`telnet_cleartext_audit.frasm`)

Models a TCP 23 connection to a legacy serial-to-Ethernet terminal server, negotiating Echo/Suppress-Go-Ahead options and sending a `show running-config` command.

- **Protocols:** `telnet`, `tcp` (9 Ethernet frames)
- **Wire Behavior:** Defaults to TCP destination port `23` (`psh ack`) and tracks TCP sequence numbers automatically. Prefixes every `will` (`251`), `wont` (`252`), `do` (`253`), and `dont` (`254`) option with the `0xff` IAC escape byte.
- **Wireshark Filter:** `telnet`
- **CLI Build:** `frameassembly show telnet_cleartext_audit.frasm`

```frameassembly
host eng_laptop { ip 192.168.50.15 }
host rtu_gw     { ip 192.168.50.200 }

compile {
    eng_laptop -> rtu_gw tcp syn srcport 50123 dstport 23 win 65535 mss 1460 wait 1ms
    eng_laptop <- rtu_gw tcp syn ack win 65535 mss 1460 wait 1ms
    eng_laptop -> rtu_gw tcp ack wait 1ms
    eng_laptop <- rtu_gw telnet will 1 do 24 wait 2ms
    eng_laptop <- rtu_gw telnet will 3 data "RTU-GW01 login: " wait 5ms
    eng_laptop -> rtu_gw telnet do 1 wont 24 wait 2ms
    eng_laptop -> rtu_gw telnet do 3 data "maint\r\n" wait 3ms
    eng_laptop <- rtu_gw telnet data "Password: " wait 5ms
    eng_laptop -> rtu_gw telnet data "show version\r\n"
}
```

## 09.12 · FTP (`ftp`): FTP Banner, Failed Brute-Force Login (`530`) & Successful Passive Retrieval (`ftp_login_and_pasv.frasm`)

Completes a TCP 21 handshake, tests a failed `530 Login incorrect` attempt, then logs in cleanly and enters `PASV` mode to retrieve an archive.

- **Protocols:** `ftp`, `tcp` (15 Ethernet frames)
- **Wire Behavior:** Defaults to TCP destination port `21` (`psh ack`) and terminates every command or reply with standard `
` CRLF. Formats `<code_num> <reply>
` automatically when `code` is provided, or `<cmd> <arg>
` for client requests.
- **Wireshark Filter:** `ftp`
- **CLI Build:** `frameassembly show ftp_login_and_pasv.frasm`

```frameassembly
host branch_host { ip 172.16.20.35 }
host dmz_ftp     { ip 172.16.100.21 }

compile {
    branch_host -> dmz_ftp tcp syn srcport 52121 dstport 21 win 65535 mss 1460 wait 1ms
    branch_host <- dmz_ftp tcp syn ack win 65535 mss 1460 wait 1ms
    branch_host -> dmz_ftp tcp ack wait 1ms
    branch_host <- dmz_ftp ftp code 220 reply "DMZ Archive FTP Ready" wait 2ms
    // 1. Rejected login attempt -> 530 Login incorrect
    branch_host -> dmz_ftp ftp cmd "USER" arg "admin" wait 1ms
    branch_host <- dmz_ftp ftp code 331 reply "Password required for admin" wait 2ms
    branch_host -> dmz_ftp ftp cmd "PASS" arg "wrongpass" wait 5ms
    branch_host <- dmz_ftp ftp code 530 reply "Login incorrect." wait 5ms
    // 2. Authorized backup user + PASV + RETR
    branch_host -> dmz_ftp ftp cmd "USER" arg "svc_backup" wait 1ms
    branch_host <- dmz_ftp ftp code 331 reply "Password required" wait 1ms
    branch_host -> dmz_ftp ftp cmd "PASS" arg "LabOnlyToken99" wait 2ms
    branch_host <- dmz_ftp ftp code 230 reply "User logged in, proceed." wait 2ms
    branch_host -> dmz_ftp ftp cmd "PASV" wait 1ms
    branch_host <- dmz_ftp ftp code 227 reply "Entering Passive Mode (172,16,100,21,195,80)." wait 1ms
    branch_host -> dmz_ftp ftp cmd "RETR" arg "daily-config.tar.gz"
}
```

## 09.13 · TFTP (`tftp`): PXE Bootloader Download + Missing Config File Error (`tftp_pxe_boot.frasm`)

Requests `pxelinux.0` in binary `"octet"` mode, transfers Block 1 with TFTP `ack`, and then requests a missing board config returning RFC 1350 Error Code `1`.

- **Protocols:** `tftp` (5 Ethernet frames)
- **Wire Behavior:** Defaults UDP destination port to `69` and writes NUL-terminated (`0x00`) `filename` and transfer `mode` (`"octet"` or `"netascii"`) strings on `rrq`/`wrq`. Encodes 2-byte big-endian Opcode + 2-byte `block` number on `data` (`3`) and `ack` (`4`) packets.
- **Wireshark Filter:** `tftp`
- **CLI Build:** `frameassembly show tftp_pxe_boot.frasm`

```frameassembly
host pxe_host { ip 172.16.50.101 }
host boot_srv { ip 172.16.50.10 }

compile {
    // 1. Successful Read Request (RRQ) + Block 1 transfer
    pxe_host -> boot_srv tftp rrq filename "pxelinux.0" mode "octet" wait 2ms
    pxe_host <- boot_srv tftp data block 1 hexpayload "7f454c46020101000000000000000000" wait 1ms
    pxe_host -> boot_srv tftp ack block 1 wait 4ms
    // 2. Missing profile returns TFTP Error (Opcode 5, Error Code 1 = File not found)
    pxe_host -> boot_srv tftp rrq filename "pxelinux.cfg/default" mode "octet" wait 2ms
    pxe_host <- boot_srv tftp error errcode 1 errmsg "File not found"
}
```

## 09.14 · WHOIS (`whois`): Full TCP 43 WHOIS Lookup & Clean FIN Teardown (`whois_soc_enrichment.frasm`)

Opens TCP port 43 from a SOC automation host, queries `suspicious-login.example`, receives registrar metadata, and closes the TCP session cleanly per RFC 3912.

- **Protocols:** `whois`, `tcp` (8 Ethernet frames)
- **Wire Behavior:** Defaults to TCP destination port `43` (`psh ack`) and appends `
` to `domain` on `query` frames. Formats standard multi-line `Domain Name: <domain>
Registrar: <registrar>
` directory output on `response` frames.
- **Wireshark Filter:** `whois`
- **CLI Build:** `frameassembly show whois_soc_enrichment.frasm`

```frameassembly
host soc_bot  { ip 172.16.80.12 }
host rir_node { ip 198.51.100.43 }

compile {
    soc_bot -> rir_node tcp syn srcport 54043 dstport 43 win 65535 mss 1460 wait 1ms
    soc_bot <- rir_node tcp syn ack win 65535 mss 1460 wait 1ms
    soc_bot -> rir_node tcp ack wait 1ms
    soc_bot -> rir_node whois query domain "suspicious-login.example" wait 4ms
    soc_bot <- rir_node whois response domain "suspicious-login.example" registrar "Example Registrar LLC" wait 1ms
    soc_bot <- rir_node tcp fin ack wait 1ms
    soc_bot -> rir_node tcp fin ack wait 1ms
    soc_bot <- rir_node tcp ack
}
```
