Uploaded July 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 15 challenge, Timing is Everything, breaks down to a really simple math problem solving a system of congruences. That requires some math knowledge to solve, or the sympy library! I'll include a Manim animation to show how the math works, and solve.
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
Manim: https://www.manim.community/
☕ Buy Me A Coffee: buymeacoffee.com/0xdf
[00:00] Introduction
[00:15] Challenge part 1
[01:13] Math explainer
[05:01] genday
[05:36] Parsing test
[07:20] Parsing data into remainder / modulus pairs
[09:32] Setting up for part 1
[10:24] Changing parsing and parsing test
[12:30] Tests for solving part1
[13:12] part1 function
[14:28] Solving part1
[14:40] Challenge part 2
[14:53] Adding extra disc
[15:45] Troubleshooting dumb mistake
[18:04] Summary
#ctf #adventofcode #revivalofcode #python #manim
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 15 challenge, Timing is Everything, breaks down to a really simple math problem solving a system of congruences. That requires some math knowledge to solve, or the sympy library! I'll include a Manim animation to show how the math works, and solve.
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
Manim: https://www.manim.community/
☕ Buy Me A Coffee: buymeacoffee.com/0xdf
[00:00] Introduction
[00:15] Challenge part 1
[01:13] Math explainer
[05:01] genday
[05:36] Parsing test
[07:20] Parsing data into remainder / modulus pairs
[09:32] Setting up for part 1
[10:24] Changing parsing and parsing test
[12:30] Tests for solving part1
[13:12] part1 function
[14:28] Solving part1
[14:40] Challenge part 2
[14:53] Adding extra disc
[15:45] Troubleshooting dumb mistake
[18:04] Summary
#ctf #adventofcode #revivalofcode #python #manim
![Chrome Local Overrides [Snowball Showdown - Sans Holiday Hack 2024]
Chrome dev tools have a really neat feature called Overrides where I can set up a local copy of a file that a website requests and have that served instead of asking the server for a copy. This allows me to tweak JavaScript, images, HTTP headers, whatever I would like. In this video Ill show this feature and how to use it to solve the Snowball Showdown challenge in the 2024 SANS Holiday Hack challenge.
2024 HHC Blog post: [Coming Jan 2025]
☕ Buy Me A Coffee: https://www.buymeacoffee.com/0xdf
[00:00] Introduction
[00:32] Game introductcion
[01:38] Client / server considerations
[01:58] Setting up overrides
[03:06] Overriding background image
[04:08] Overriding HTTP headers
[04:44] Overriding JS
[35:56] Conclusion
#javascript #devtools #overrides #hacking #ctf Chrome Local Overrides [Snowball Showdown - Sans Holiday Hack 2024]](https://i.ytimg.com/vi/2HR52C3h4Xg/mqdefault.jpg)
![Day 18: Lavaduct Lagoon [AOC2023 Python]
For Advent of Code 2023 Day 18, I get a series of instructions for moving around a grid digging out a polygon trench. In each part, I need to find the total number of squares included in the trench once the internal points are dug out as well. In part 2, its the same problem, but a different interpretation of the instructions so that the area gets enormous. Ill use the shoelace formula and Picks theorem to solve instantly.
Code 2023 AOC: https://gitlab.com/0xdf/aoc2023
Challenge Link: https://adventofcode.com/2023/day/10
Shoelace Formula: https://en.wikipedia.org/wiki/Shoelace_formula
Picks Theorem: https://en.wikipedia.org/wiki/Pick%27s_theorem
☕ Buy Me A Coffee: https://www.buymeacoffee.com/0xdf
[00:00] Part 1 description
[01:33] Strategy / Shoelace / Picks
[03:41] Prep
[04:09] Parse input to points
[06:41] Perimeter
[09:50] Shoelace
[10:49] Apply Picks
[12:27] Solve part 1
[12:45] Part 2 description
[13:26] Clone part 1
[14:13] Updating parsing
[16:15] Solve part 2
[16:34] Summary
#adventofcode #python Day 18: Lavaduct Lagoon [AOC2023 Python]](https://i.ytimg.com/vi/2Rk2-NxmgR4/mqdefault.jpg)
![Directory Traversal / File Read Into Zip with Python [HackTheBox Snoopy]
In Snoopy from HackTheBox, I have a directory traversal / file read vulnerability in the website, but when the file comes back, its inside a zip archive. Ill write a quick Python script that takes a file path and optional save location, gets the file, reads it from the zip, and then either prints it to the screen or saves it to a file.
Full Snoopy Blog Post: https://0xdf.gitlab.io/2023/09/23/htb-snoopy.html
HTB Snoopy: https://www.hackthebox.com/machines/snoppy
☕ Buy Me A Coffee: https://www.buymeacoffee.com/0xdf
[00:00] Introduction
[00:49] Demonstrating the vulnerabity
[02:22] Starting Python, handling input
[03:38] Getting file
[04:18] Showing ways to debug
[06:00] Unzipping file
[08:38] Adding download option
[10:50] Conclusion
#pentest #ctf #bugbounty Directory Traversal / File Read Into Zip with Python [HackTheBox Snoopy]](https://i.ytimg.com/vi/2a4OJeSZ_N0/mqdefault.jpg)
![Triple Knock [HackTheBox - Coding Challenge]
For Triple Knock, Ill parse a series of log lines showing username, date and time, and login success or failure. I need to find any user with three failed logins in a 10 minute window. To accomplish this in Python, Ill create a simple Event class that handles parsing the line into a user, failed boolean, and a minutes timestamp. Then Ill store failed logins in a defaultdict by username, and then loop over using a sliding window to find targeted users.
Final code: https://gitlab.com/0xdf/ctfscripts/-/tree/master/htb-triple_knock
☕ Buy Me A Coffee: https://www.buymeacoffee.com/0xdf
[00:00] Introduction
[01:05] Challenge intro
[03:00] Reading S, N
[03:55] Starting loop to process lines
[04:30] Creating Event class
[07:40] Printing Events
[09:44] Collecting failed logins by user
[11:32] Sorting failures by user
[11:58] Checking users for targeting
[13:39] gt
[14:34] Formatting output
[15:10] Conclusion
#python Triple Knock [HackTheBox - Coding Challenge]](https://i.ytimg.com/vi/3iRXRU5dVRQ/mqdefault.jpg)
![Day 14 - One-Time Pad [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 14 challenge, One-Time Pad, is another challenge brute forcing MD5 hashes (like day 5). This time I have to regularly check the next 1000 hashes, which means caching is key!
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
[01:50] genday.sh / input
[02:12] cached_md5 test
[05:17] cached_md5 function
[07:07] get_triple function
[08:17] get_triple test
[10:28] is_valid_key test
[14:26] is_valid_key function
[15:30] generate_keys test
[16:58] generate_keys function
[18:40] part1 test
[19:18] part1 function
[20:41] Solving part 1
[21:01] Challenge part 2
[21:38] Test for stretched md5
[22:20] Updating main for new md5
[24:42] Debugging typos
[27:00] part2 test
[27:48] part2 function, updating all
[29:10] Running test, debugging issues
[30:25] More tests for generate_keys
[31:46] Found issue, fixing, and solving
#ctf #adventofcode #revivalofcode #python Day 14 - One-Time Pad [Revival of Code 2023 - Advent of Code 2016]](https://i.ytimg.com/vi/3ozBxtPPOFE/mqdefault.jpg)
![Introduction [Advent of Code 2024]
Advent of Code is here! This video is in an introduction to my setup for AOC, including the script I use to pull data, the git setup, and the VSCode debugging setup.
2024 AOC repo: https://gitlab.com/0xdf/aoc2024/
VSCode Debug video: https://www.youtube.com/watch?v=cNhtk2Ob4B8
☕ Buy Me A Coffee: https://www.buymeacoffee.com/0xdf
[00:00] Introduction
[00:55] genday.sh script
[02:11] Git configuration
[02:55] VSCode debug setup
#adventofcode #python Introduction [Advent of Code 2024]](https://i.ytimg.com/vi/4XKZZrhhiQE/mqdefault.jpg)
![Disk Fragmenter [Day 9 - Advent of Code 2024 - Python]
This challenge involves taking a string of numbers and manipulating it to handle empty space on a disk. Nothing too complicated, though easy to mess up on the logic.
2024 AOC repo: https://gitlab.com/0xdf/aoc2024/
2024 AOC Intro vide: 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:45] Setup / data overview
[02:20] Parsing input into disk list
[05:08] Fragmenting disk
[08:16] Calculate checksum
[08:35] Solving part 1
[08:48] Part 2 challenge
[09:43] Re-parsing input into dict/list
[12:27] Looping over files to move them
[16:16] Calculating checksum
[17:29] Fixing logic bug
[18:34] Solving part 2
#adventofcode #python Disk Fragmenter [Day 9 - Advent of Code 2024 - Python]](https://i.ytimg.com/vi/5k8O1EloI5M/mqdefault.jpg)
![Reassembling Werkzeugs Pin - Hacking Flask Debug Mode [Part 1]
Flask is a really common Python web framework, and one of the features it offers is a debug mode. In this mode, when your application crashes, it gives not only the stanard stack trace, but the ability to drop into a Python repl or shell at that point and run commands. Any pentester / hacker immediately perks up at this mention, because thats just RCE. Flask knew this was dangerous, with all sorts of warnings not to run this in production, but it still happened. In 2015 with version 0.11, Flask added a pin feature to limit access to the terminal, but the pin is calculated based on information on the running system. In this video, were going to:
- start with a really simple flask application and show debug mode
- look at the werkzeug code that generates the pin
- look at the common guides out there for hacking the pin
- show how they dont take into account what happens with the script is started with a server like gunicorn
- show how to get the pin in these cases.
☕ Buy Me A Coffee: https://www.buymeacoffee.com/0xdf
[00:00] Introduction
[01:44] Introduction to HelloWorld app
[02:19] Create virtual env
[03:05] Running app
[04:47] Putting app in debug mode
[06:00] Looking at Werkzeug debug source code
[07:38] Hacktricks generation page / script
[08:05] Generating the pin
[12:40] Second example run with Gunicorn
[15:34] Pin change with WSGI start
[17:54] Applying to unknown application
#pentest #ctf #bugbounty #python #flask #werkzeug Reassembling Werkzeugs Pin - Hacking Flask Debug Mode [Part 1]](https://i.ytimg.com/vi/6BWaea0nfE0/mqdefault.jpg)
![Keypad Conundrum [Day 21 - Advent of Code 2024 - Python]
Im giving commands to a robot thats commanding a robot thats commanding a robot to work a keypad! Its complicated! In part two, the same, but with 25 robots!
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
[02:18] Part 1 code
[08:10] Part 2 challenge
[08:21] Part 2 code
[11:38] Conclusion
#adventofcode #python Keypad Conundrum [Day 21 - Advent of Code 2024 - Python]](https://i.ytimg.com/vi/6EjqRL70g7c/mqdefault.jpg)
![Modifying .NET Exe: Encrypt to Decrypt [HackTheBox Coder]
In the Coder box from HackTheBox, I get a encryption executable and an encrypted file. In this video, Ill use DotPeek and Visual Studio to create a decryptor program and decrypt the file.
HackTheBox Coder: https://www.hackthebox.com/machines/coder
Coder Blog Post: https://0xdf.gitlab.io/2023/12/16/htb-coder.html
DotPeek: https://www.jetbrains.com/decompiler/
☕ Buy Me A Coffee: https://www.buymeacoffee.com/0xdf
[00:00] Introduction
[00:49] Reversing with DotPeek
[02:07] Export to VS Project
[02:56] Making sure code runs
[03:16] Replacing arg parse with hardcoded input / output
[04:21] Hardcoding datetime for random seed
[06:22] EncryptFile to DecryptFile
[07:37] Checking output in Linux VM
[08:13] Review and Conclusion
#pentest #ctf #bugbounty #csharp #dotpeek #visualstudio Modifying .NET Exe: Encrypt to Decrypt [HackTheBox Coder]](https://i.ytimg.com/vi/6PJNbdMoEq0/mqdefault.jpg)
![Day 20 - Firewall Rules [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 20 challenge, Firewall Rules, involves processing overlapping ranges to find gaps across a range of 4 billion numbers.
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
[00:59] genday.sh / input
[01:22] Plot analysis
[05:22] Creating fixture / parse test
[07:28] Parsing input into list of int pairs
[08:32] Part 1 test
[09:06] Part 1 code
[10:55] Pass tests / solve part 1
[11:13] Challenge part 2
[11:20] Starting part 2 script
[11:46] Part 2 test
[12:28] Part 2 code
[13:44] Debugging bad test value
[14:17] Passing tests / solve part 2
[14:50] Combining part 1 and part 2 to run
#ctf #adventofcode #revivalofcode #python Day 20 - Firewall Rules [Revival of Code 2023 - Advent of Code 2016]](https://i.ytimg.com/vi/6bjPfCEXLK4/mqdefault.jpg)