Uploaded August 2023 | Updated November 2026, 3 hours ago
Python Discord is doing an event called Revival of Code, where we work through the 2016 Advent of Code, one challenge every two days. The day 22 challenge, Grid Computing, involves looking at the output of `df -h` on a bunch of devices, and looking for ways to move data around. Most of the challenge is analysis of the input data to give a bunch of constraints that make solving the challenge pretty easy.
Repo for Advent of Code 2016 Solutions: gitlab.com/0xdf/aoc2016
Intro video for this event: youtube.com/watch?v=qEPpsS0StQI
Configuring VSCode to debug PyTest: youtube.com/watch?v=zL2YTdIj3R8
Real Python post with templates: realpython.com/python-advent-of-code
☕ Buy Me A Coffee: buymeacoffee.com/0xdf
[00:00] Introduction
[00:16] Challenge part 1
[01:16] genday.sh / input
[01:48] Node class
[03:57] Creating example data / fixture
[04:51] Test for parse
[06:44] parse function
[09:51] Test for part 1
[10:47] part1 function
[11:43] Fixing bad test data
[12:22] Solving part 1
[12:38] Challenge part 2
[14:06] Input analysis with Bash
[16:10] Mapping data
[22:34] Debugging name issue
[23:43] Map analysis
[24:35] Updating map to return necessary information
[26:12] Updating part 2
[29:53] Solving part 2 + Conclusion
#ctf #adventofcode #revivalofcode #python
Python Discord is doing an event called Revival of Code, where we work through the 2016 Advent of Code, one challenge every two days. The day 22 challenge, Grid Computing, involves looking at the output of `df -h` on a bunch of devices, and looking for ways to move data around. Most of the challenge is analysis of the input data to give a bunch of constraints that make solving the challenge pretty easy.
Repo for Advent of Code 2016 Solutions: gitlab.com/0xdf/aoc2016
Intro video for this event: youtube.com/watch?v=qEPpsS0StQI
Configuring VSCode to debug PyTest: youtube.com/watch?v=zL2YTdIj3R8
Real Python post with templates: realpython.com/python-advent-of-code
☕ Buy Me A Coffee: buymeacoffee.com/0xdf
[00:00] Introduction
[00:16] Challenge part 1
[01:16] genday.sh / input
[01:48] Node class
[03:57] Creating example data / fixture
[04:51] Test for parse
[06:44] parse function
[09:51] Test for part 1
[10:47] part1 function
[11:43] Fixing bad test data
[12:22] Solving part 1
[12:38] Challenge part 2
[14:06] Input analysis with Bash
[16:10] Mapping data
[22:34] Debugging name issue
[23:43] Map analysis
[24:35] Updating map to return necessary information
[26:12] Updating part 2
[29:53] Solving part 2 + Conclusion
#ctf #adventofcode #revivalofcode #python
![CVE-2022-23935 Analysis: Command Injection in Exiftool [HackTheBox - Investigation]
In Investigation from HackTheBox, Ill exploit CVE-2022-23935, command injection in Exiftool. In this video, well walk through the vulnerability to understand the mistake that was made and see how they fixed it.
Investigation blog post: https://0xdf.gitlab.io/2023/04/22/htb-investigation.html
perl open docs: https://perldoc.perl.org/functions/open#Opening-a-filehandle-into-a-command
CVE gist: https://gist.github.com/ert-plus/1414276e4cb5d56dd431c2f0429e4429
Exiftool tag 12.38 changes: https://github.com/exiftool/exiftool/commit/74dbab1d2766d6422bb05b033ac6634bf8d1f582
☕ Buy Me A Coffee: https://www.buymeacoffee.com/0xdf
[00:00] Introduction
[00:30] Perldocs for open
[01:53] Reviewing GitHub gist about vulnerability
[02:42] Exiftool in GitHub
[03:42] Legit example of pipe command in Perl
[05:15] Show where the vulnerability is executed
[06:28] Examining the fix
[09:12] Conclusion CVE-2022-23935 Analysis: Command Injection in Exiftool [HackTheBox - Investigation]](https://i.ytimg.com/vi/UiRx1Zkeqzg/mqdefault.jpg)
![Day 18 - Like a Rogue [Revival of Code 2023 - Advent of Code 2016]
Python Discord is doing an event called Revival of Code, where we work through the 2016 Advent of Code, one challenge every two days. The day 18 challenge, Like a Rogue, involves generating rows of off/on based on the previous row. Ill start with 40 rows and then 400,000, but all run in reasonable time.
Repo for Advent of Code 2016 Solutions: https://gitlab.com/0xdf/aoc2016
Intro video for this event: https://www.youtube.com/watch?v=qEPpsS0StQI
Configuring VSCode to debug PyTest: https://www.youtube.com/watch?v=zL2YTdIj3R8
Real Python post with templates: https://realpython.com/python-advent-of-code/
☕ Buy Me A Coffee: https://www.buymeacoffee.com/0xdf
[00:00] Introduction
[00:17] Challenge part 1
[01:14] genday.sh / input
[01:40] next_row test
[03:09] Debugging typos
[03:46] next_row
[05:48] Test for part 1
[07:04] Solve part 1
[08:22] Refactoring stub to solve part 1
[08:55] Part 2 solve
#ctf #adventofcode #revivalofcode #python Day 18 - Like a Rogue [Revival of Code 2023 - Advent of Code 2016]](https://i.ytimg.com/vi/V5BjaODBSZs/mqdefault.jpg)
![Python Flask Jinja2 SSTI Payload Analysis
Ill walk through a common SSTI payload pulled from PayloadsAllTheThings and look at how it works, using the Flask request object to get a function, which gives access to the globals . From there it gets the builtins dictionary and the import function.
Payload: https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/Server%20Side%20Template%20Injection/README.md#jinja2 filter-bypass
Flask Request object: https://flask.palletsprojects.com/en/3.0.x/api/#flask.Request
Flask globals: https://flask.palletsprojects.com/en/3.0.x/templating/#standard-context
Jinja2 attr: https://jinja.palletsprojects.com/en/3.1.x/templates/#jinja-filters.attr
Python Function attributes: https://docs.python.org/3/reference/datamodel.html#special-read-only-attributes
☕ Buy Me A Coffee: https://www.buymeacoffee.com/0xdf
[00:00] Introduction
[00:55] Data overview
[01:33] Making dummy Flask app
[02:35] Flask request object
[03:38] request in Jinja context
[04:22] attr / getattr / dot
[05:30] Using function to get globals
[07:40] Getting builtins from globals
[09:31] Using import to get the os module
[10:31] Getting execution
[11:50] Conclusion
#ssti #ctf #python #jinja2 Python Flask Jinja2 SSTI Payload Analysis](https://i.ytimg.com/vi/VBifwXFQJMQ/mqdefault.jpg)
![Day 17 - Two Steps Forward [Revival of Code 2023 - Advent of Code 2016]
Python Discord is doing an event called Revival of Code, where we work through the 2016 Advent of Code, one challenge every two days. The day 17 challenge, Two Steps Forward, involves taking an MD5 hash of the path taken so far with a salt to determine which direction I can move next, trying to find both the shortest and longest path through a maze.
Repo for Advent of Code 2016 Solutions: https://gitlab.com/0xdf/aoc2016
Intro video for this event: https://www.youtube.com/watch?v=qEPpsS0StQI
Configuring VSCode to debug PyTest: https://www.youtube.com/watch?v=zL2YTdIj3R8
Real Python post with templates: https://realpython.com/python-advent-of-code/
☕ Buy Me A Coffee: https://www.buymeacoffee.com/0xdf
[00:00] Introduction
[00:16] Challenge part 1
[02:22] genday.sh / input
[02:33] Tests for doors_open
[05:17] doors_open function
[07:03] Debugging typos
[08:28] Part 1 solve tests
[09:53] Solve with BFS
[13:24] Cleaning up template and solving
[13:59] Challenge part 2
[14:17] Refactor part 1
[15:38] Test for part 2
[17:08] Part 2 solve
[18:05] Conclusion
#ctf #adventofcode #revivalofcode #python Day 17 - Two Steps Forward [Revival of Code 2023 - Advent of Code 2016]](https://i.ytimg.com/vi/V_eOyg3k7ck/mqdefault.jpg)
![Wearhouse Woes [Day 15 - Advent of Code 2024 - Python]
Im given a grid representing a wearhouse with a robot that is pushing crates around. In part two everything gets wider and more complex.
2024 AOC repo: https://gitlab.com/0xdf/aoc2024/
2024 AOC Intro video: https://www.youtube.com/watch?v=4XKZZrhhiQE
VSCode Debug video: https://www.youtube.com/watch?v=cNhtk2Ob4B8
☕ Buy Me A Coffee: https://www.buymeacoffee.com/0xdf
[00:00] Part1 introduction
[01:30] Setup / data overview
[02:03] Parsing input
[02:55] Find robot
[03:50] Calculating move distance
[06:16] Moving robot and crates
[08:17] Calculating score
[08:53] Debugging part 1
[09:10] Solving part 1
[09:38] Part 2 challenge
[10:40] Strategy
[11:08] Refactor parsing input
[12:58] Calculating what moves
[17:03] Moving stuff
[19:38] Debugging issues
[20:24] Solving part 2
[21:51] Conclusion
#adventofcode #python Wearhouse Woes [Day 15 - Advent of Code 2024 - Python]](https://i.ytimg.com/vi/VqVd_E9neKs/mqdefault.jpg)
![Day 25: Snowverload [AOC2023 Python]
For Advent of Code 2023 Day 25, I get a bunch of nodes and wires connecting them. Ill read them into a Graph with the Python networkx library, and then use the Stoer-Wagner algorithm implemented in networkx to get the answer very easily.
Code 2023 AOC: https://gitlab.com/0xdf/aoc2023
Challenge Link: https://adventofcode.com/2023/day/25
Stoer-Wagner: https://en.wikipedia.org/wiki/Stoer%E2%80%93Wagner_algorithm
networkx: https://networkx.org/
networkx stoer_wagner: https://networkx.org/documentation/stable/_modules/networkx/algorithms/connectivity/stoerwagner.html#stoer_wagner
☕ Buy Me A Coffee: https://www.buymeacoffee.com/0xdf
[00:00] Part 1 description
[01:33] Input analysis
[02:16] Install networkx in venv
[03:12] Prase lines into graph
[03:59] Stoer-Wagner
[05:50] Solve part 1
[06:28] Summary
#adventofcode #python Day 25: Snowverload [AOC2023 Python]](https://i.ytimg.com/vi/W47oxi5ZvmU/mqdefault.jpg)
![Day 5: If You Give A Seed A Fertilizer [AOC2023 Python]
For Advent of Code 2023 Day5, I get a few seed values and many maps from one medium to the next. In part one, I take each seed and use the maps to figure out a location value, and return the lowerst. In part two, I have to map huge ranges through these maps, meaning I have to work with ranges rather than numbers.
Code 2023 AOC: https://gitlab.com/0xdf/aoc2023
Challenge Link: https://adventofcode.com/2023/day/5
☕ Buy Me A Coffee: https://www.buymeacoffee.com/0xdf
#adventofcode #python
[00:00] Part 1 description
[02:30] Part 1
[16:05] Part 2 description
[17:03] Input analysis
[17:40] Part 2
[28:24] Summary Day 5: If You Give A Seed A Fertilizer [AOC2023 Python]](https://i.ytimg.com/vi/W6gZrw9-QpY/mqdefault.jpg)
![Finding and Fixing a Bug in Netexec NFS
Netexec has some awesome NFS capabilities. While playing Slonik from VulnLab / HackTheBox, I found an issue I couldnt understand. Ill walk through how Netexec works with NFS, show the issues, and dive into the code to see the issue and the fix!
Blog: https://0xdf.gitlab.io
uv Cheatsheet: https://0xdf.gitlab.io/cheatsheets/uv
Netexec: https://www.netexec.wiki/
Netexec NFS documentation: https://www.netexec.wiki/nfs-protocol/enumeration
Netexec NFS source: https://github.com/Pennyw0rth/NetExec/blob/main/nxc/protocols/nfs.py
Netexec PR: https://github.com/Pennyw0rth/NetExec/pull/1103
☕ Buy Me A Coffee: https://www.buymeacoffee.com/0xdf
[00:00] Introduction
[01:19] Showing NFS configuration
[01:54] Netexec NSF capabilities
[02:55] Analysis of exports config file
[04:26] Three interesting cases: shadow, root.txt, .bash_history
[05:25] Explaining whats confusing
[06:08] Netexec NFS get_file function
[07:34] Debugging file handle data
[09:10] Continuing with get_file
[11:06] PR for bug fix
[11:45] Talking through reading exports
[12:28] Talking through reading shadow
[13:11] Talking through reading root.txt
[13:26] Talking through reading .bash_history
[14:30] Wrap-up
#netexec #nfs #programming #debug #python Finding and Fixing a Bug in Netexec NFS](https://i.ytimg.com/vi/WVWPgOjIpoI/mqdefault.jpg)
![Reflective XSS via Link Click / SSRF [Hackvent 2022 - Day 14]
The day 14 challenge in Hackvent 2022 is to get the bank employee to transfer money into your account. I can get them to click a link, and Ill need to build a page that automatically submits a form to exploit a reflective XSS in the bank site, loading my JavaScript, which can then perform the requests necessary to make the transaction.
Hackvent 2022 writeup: https://0xdf.gitlab.io/hackvent2022/medium
☕ Buy Me A Coffee: https://www.buymeacoffee.com/0xdf
#hackvent
[00:00] Introduction
[00:11] Overview of websiet
[01:07] Sending links to support
[02:32] Looking at transfer
[03:15] Finding reflective XSS in transfer
[04:24] Checking back on link click data - sending again
[05:04] Writing direct page
[09:45] Analysis of contract source
[10:12] Testing direct page - fails due to CORs
[11:04] Proving XSS over link click
[16:55] Validating XSS page in my browser
[17:32] Sending link to support
[17:58] Quick fix hopefully before link click
[18:06] Summary of whats happening / going to happen
[18:43] Seeing money / getting flag / summary Reflective XSS via Link Click / SSRF [Hackvent 2022 - Day 14]](https://i.ytimg.com/vi/XHOvZDLnJ2Y/mqdefault.jpg)
![Troubleshooting proxychains
Trying to run `certipy` over `proxychains` was failing for me. In this video, Ill show how I troubleshot, and what the issues was. Well cover proxychains, LD_PRELOAD, and capabilities along the way.
Chisel Cheatsheet: https://0xdf.gitlab.io/cheatsheets/chisel
uv Cheatsheet: https://0xdf.gitlab.io/cheatsheets/uv
uv video: https://www.youtube.com/watch?v=G36QXtBXKBQ
Mist blogpost: https://0xdf.gitlab.io/2024/10/26/htb-mist.html
man ld.so: https://man7.org/linux/man-pages/man8/ld.so.8.html
☕ Buy Me A Coffee: https://www.buymeacoffee.com/0xdf
[00:00] Introduction
[00:35] Scenario setup
[02:30] Showing commands and failure
[02:58] Exploring /proc
[04:28] sudo fixes it
[05:56] Same with nc
[07:12] Capabilities
[09:38] How proxychains works
[11:38] LD_PRELOAD secure-execution
[12:45] secure-execution triggers
[13:38] faketime
[14:38] Conclusion
#proxychains #ld_preload Troubleshooting proxychains](https://i.ytimg.com/vi/XKyTOGN2GB4/mqdefault.jpg)
![Elf Connect - JavaScript Game Hacking [Sans Holiday Hack 2024]
The first real terminal in the 2024 Sans Holdiay Hack Challenge is Elf Connect, a rift on the New York Times Connections game. In this video, Ill show how to find the source code in browesr dev tools, autoate solving the game to different degrees, and finally just cheat the score variable.
2024 HHC Blog post: [Coming soon]
Terminal Link: https://hhc24-elfconnect.holidayhackchallenge.com/
TamperMonkey Script: https://gitlab.com/0xdf/ctfscripts/-/blob/master/holidayhack/termlink.js
NYT Connections: https://www.nytimes.com/games/connections
☕ Buy Me A Coffee: https://www.buymeacoffee.com/0xdf
[00:00] Introduction
[00:28] Game Overview
[01:18] Dev tools overview / Scope
[04:36] Opening in new window
[05:28] Initial source analysis
[06:25] Print answers JavaScript
[08:00] Solve analysis
[10:20] Solve JavaScript
[13:27] Hacking the score
[15:48] Conclusion
#javascript #ctf #devtools Elf Connect - JavaScript Game Hacking [Sans Holiday Hack 2024]](https://i.ytimg.com/vi/XsEqZvrTyoU/mqdefault.jpg)