This page contains links to notes and code snippets.
- SQL
- XSS
- CSRF
- DNS
- TCP
- UDP
- IP
- ARP
- Networking
- Buffer Overflow
- Shellshock
- Reverse Shell
- Upgrade VM
- Setup Environment
- File Commands and Directory Navigation
- Permissions
- Networking
- Process commands
- Clone a website
SQL
- Setup files: Labsetup.zip
- Create Table: create-table.sql
- Insert Into: insert-into.sql
XSS
- Setup files: Labsetup.zip
- Example of add a friend script: add-a-friend.js
- Example of update profile script: update-profile.js
- Self Propagation test: self-propagation.html
CSRF
- CSRF Prevention Cheat Sheet
- Setup files: Labsetup.zip
| User | User Name | Password |
|---|---|---|
| Admin | admin | seedelgg |
| Alice | alice | seedalice |
| Boby | boby | seedboby |
| Charlie | charlie | seedcharlie |
| Samy | samy | seedsamy |
DNS
- https://www.internic.net/domain/root.zone
- Send DNS query: send_dns_query.py
- DNS server: dns-server.py
- RFC
- DNS Cache
- Dump:
rndc dumpdb -cache - View:
cat /var/cache/bind/dump.db - Flush:
rndc flush
- Dump:
- Potential Traffic Issues
- Delay by 100ms:
tc qdisc add dev eth0 root netem delay 100ms - Delete the
tcentry:tc qdisc del dev eth0 root netem - Show all
tcentries:tc qdisc show dev eth0
- Delay by 100ms:
- Setup files: Labsetup.zip
TCP
- Docker Compose: docker-compose.yml
- Client: client.py
- Server: server.py
- Multi Server: server2.py
- SynFlooding Attack
- Python: synflood.py
- C: synflood.c
sysctl -w net.ipv4.tcp_syncookies=0sysctl -w net.ipv4.tcp_max_syn_backlog=80ip tcp_metrics flush
- Reset: reset.py
- Auto Reset: auto_reset.py
- Hijack Session: hijack.py
UDP
- Client: udp_client.py
- Time Server: udp_server.py
- Docker Compose: docker-compose.yml
- Attack: udp_attack.py
- UDP Flood: flood.py
- DNS Query: dns.py
IP
- Ping: ping.py
- Traceroute: traceroute.py
- Docker Compose: docker-compose.yml
- Fragment: fragment.py
- ICMP: icmp.py
- ICMP Redirect: icmp_redirect.py
sysctl net.ipv4.conf.all.accept_redirects=1
- mitm: mitm.py
ARP
- Docker Compose: docker-compose.yml
- arp_request: arp_request.py
- arp poisoning: arp.py
- arp mitm: mitm.py
sysctl -w net.ipv4.ip_forward=0
Networking
- udp_client: udp_client.py
- udp_server: udp_server.py
- Lab Setup: docker-compose.yml
- Scapy:
- sniff: sniff.py
- icmp_spoof: icmp_spoof.py
- udp_spoof: udp_spoof.py
- sniff_spoof: sniff_spoof.py
Buffer Overflow
- Memory Layout: layout.c
- Use
-m32
- Use
- Buffer Overflow Example: buffer.c
- Use
-m32 -fno-stack-protector
- Use
- ASCII vs binary: print_zero.c
- ASLR: aslr.c
- Launching shell: launch_shell.c
- Setup files: Labsetup.zip
- Turn off address randomization:
sudo /sbin/sysctl -w kernel.randomize_va_space=0 - Update Symbolic Link:
sudo ln -sf /bin/zsh /bin/sh
- Turn off address randomization:
- Old shellcode: shellcode.c
- Compile with:
-m32 -z execstack
- Compile with:
- Print esp: sp.c
Shellshock
- Set-UID Example: vul.c
- Setup files: Labsetup.zip
curl -o Labsetup.zip https://ycpcs.github.io/cs335-spring2026/notes/shellshock/Labsetup.zipunzip Labsetup.zip
Reverse Shell
- Setup files: Labsetup.zip
- File Descriptors Intro: fd.c
- Redirection: redirect.c
- Duplicate a file descriptor: dup.c and dup2.c
- Redirecting IO to TCP Connections: tcp_in.c and tcp_out.c
Upgrade VM
sudo apt update- downloads package information from all configured sources.sudo apt upgrade- will upgrade all installed packages to their latest versions.sudo apt-get autoremove- deletes orphaned packages, or dependencies that remain installed after you have installed an application and then deleted it.sudo apt-get clean- removes all packages from the cache.
Setup Environment
- Sublime:
sudo snap install sublime-text --classic - Visual Studio Code:
sudo snap install --classic code - clion:
sudo snap install clion --classic
File Commands and Directory Navigation
cdgo to $HOME directory.cd ...go one level up the directory tree.cd /etcto change to the /etc directory.lslist all files.- Use
-Rto list all-subdirectories as well -awill list hidden files as well- Use the
-alargument to view details
- Use
pwdlists the present working directory.mkdir directorycreated a directory.rm -r directoryremoves the directory and its contents recursively. Use thefargument to forcefully remove, re:rm -rf directory.touch filewill create an empty file.rm fileremoves a flle.cp file file2will copy file to file2.mv file file2renames or moves file to file2.cat filenamewill display the contests of filename.cat > filenamecreates a new file with filename.
Permissions

- Legend
- User or Owner
U - Group
G - World (Other Users)
W
- User or Owner
- Permission Classes
- Read
r - Write
w - Execute
x
- Read
- File Type
-regular fileddirectory
- Examples
- file desktop.ini:
-rwxrwxrwx 1 seed seed 282 Dec 27 10:10 desktop.ini - directory host:
drwxrwxrwx 1 seed seed 4096 Jan 20 13:22 host
Number Permission Type Symbol 0 No Permission — 1 Execute –x 2 Write -w- 3 Execute + Write -wx 4 Read r– 5 Read + Execute r-x 6 Read +Write rw- 7 Read + Write +Execute rwx - file desktop.ini:
- Permission Examples
chmod 777 filename: rwx rwx rwxchmod 775 filename: rwx rwx r-xchmod 755 filename: rwx r-x r-xchmod 664 filename: rw- rw- r–chmod 644 filename: rw- r– r–
Networking
ifconfig -adisplays all network interfaces and IP address.hostname -Idisplays the IP addresses of the host (all local IP addresses).host domaindisplays IP address for domain.ping hostsends ICMP echo request to host.whois domaindisplays whois records for domain.dig domaindisplays DNS information for domain.dig -x IPdoes reverse lookup of IP address.nslookupquery Internet name servers interactively.- To display the IP/kernel routing table:
netstat -rnip routeroute -n
Process commands
bgsends a process to the background.fgruns a stopped process in the foreground.topshows details on all active processes.psgives the status of processes running for a user.pidofgives the process id (PID) of a process.ps PIDgets the status of a particular process.kill PIDkills a process with PID .nicestarts a process with a given priority.
Clone a website
wget --mirror --convert-links --adjust-extension --page-requisites --no-check-certificate --no-parent https://site-to-copy.com
--mirrormake the download recursive.--no-parentdo not crawl the parent/top directory.--convert-linksmakes all the links work properly with the offline copy.--page-requisitesdownload JS/CSS files.--adjust-extensionadd the appropriate extensions (e.g. html, css, js) to files.--no-check-certificateignores SSL certificate errors To top
