Uploaded July 2023 | Updated November 2026, 1 hour 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 9 challenge, Explosions in Cyberspace, I'm given a string where I need to find markers of the pattern `(AxB)`, and use that to read the next A characters and repeat it B times. In part one, I'll take markers inside the next A characters as just text. In part two, I'll have to recursively expand those first.
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:14] Challenge Part 1
[01:20] genday.sh / input
[02:06] Part 1 tests
[03:27] Parsing into deque
[03:57] Part 1 solve
[07:16] Part 1 tests solve, submitting solution
[07:47] Challenge Part 2
[09:06] Tests for Part 2
[10:16] Refactoring part 1 into decompress
[11:30] Adding part 2
[16:20] Debugging issues
[16:50] Tests pass, part 2 doesn't return
[18:32] Debugging issues related to passing data twice
[19:45] Identified issue
[21:25] Fixing tests after refactor
[22:08] 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 9 challenge, Explosions in Cyberspace, I'm given a string where I need to find markers of the pattern `(AxB)`, and use that to read the next A characters and repeat it B times. In part one, I'll take markers inside the next A characters as just text. In part two, I'll have to recursively expand those first.
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:14] Challenge Part 1
[01:20] genday.sh / input
[02:06] Part 1 tests
[03:27] Parsing into deque
[03:57] Part 1 solve
[07:16] Part 1 tests solve, submitting solution
[07:47] Challenge Part 2
[09:06] Tests for Part 2
[10:16] Refactoring part 1 into decompress
[11:30] Adding part 2
[16:20] Debugging issues
[16:50] Tests pass, part 2 doesn't return
[18:32] Debugging issues related to passing data twice
[19:45] Identified issue
[21:25] Fixing tests after refactor
[22:08] Conclusion
#ctf #adventofcode #revivalofcode #python
![Tracing Automations in HackTheBox Mailroom [Beyond Root]
In Mailroom from HackTheBox, Ill need to trace another process where the user is opening their KeePass database and I can get the password as they type it in. There were some issues that came up, and I wanted to look at how that automation is handled on the box once I had a root shell.
Mailroom Blog Post: https://0xdf.gitlab.io/2023/08/19/htb-mailroom.html
☕ Buy Me A Coffee: https://www.buymeacoffee.com/0xdf
[00:00] Introduction
[01:37] Showing solution as matthew
[04:44] Looking at crons
[05:47] matthew_kpcli.py
[08:56] Conclusion
#pentest #ctf #bugbounty Tracing Automations in HackTheBox Mailroom [Beyond Root]](https://i.ytimg.com/vi/pQrjQLktqss/mqdefault.jpg)
![Christmas Tree Farm [AOC2025 Day 12]
Advent of Code 2025 Day 12 provides a challenge that on its face I think is nearly impossibe, figuring out if I can place a lot of specific shapes into a space by rotating them and flipping them. So I go looking for tricks, and find that over half of the scenarios dont have space for the presents regardless of shape. The remaining scenarios have presents that fill up less than 3/4 of the space. And that works as a pass to solve the challenge. Claude gets really stuck trying to solve the example, which doesnt have the same data pattern as my input, and tries a bunch of things that never work, though it does call out the correct answer several times without knowing its the answer.
Solutions Repo: https://gitlab.com/0xdf/aoc2025
VSCode Debug Setup: https://www.youtube.com/watch?v=cNhtk2Ob4B8
Claude: https://claude.ai/
☕ Buy Me A Coffee: https://www.buymeacoffee.com/0xdf
[00:00] Introduction
[01:29] Pulling / examining input
[02:46] Initial input parsing
[03:23] Parsing gifts
[05:16] Looping over tree lines
[06:39] Exploring data
[10:50] Solving part 1
[11:53] Solving with Claude
[16:34] Cutting Claude off
[17:25] Conclusion
#AdventOfCode #claude Christmas Tree Farm [AOC2025 Day 12]](https://i.ytimg.com/vi/pX7pszKHfYw/mqdefault.jpg)
![Simple Use After Free Exploitation [Hackvent 2022 - Day 21]
Day 21 for Hackvent gives a server with a simple text based menu, as well as the binary. Looking at the binary, theres some heap use, and a relatively obvious use after free risk. To exploit that, Ill need a memory leak, which is a bit harder to find. Putting that all together, Im able to call the present function, which gives a shell.
Hackvent 2022 writeup: https://0xdf.gitlab.io/hackvent2022/hard
☕ Buy Me A Coffee: https://www.buymeacoffee.com/0xdf
#hackvent
[00:00] Introduction / overview
[01:35] Opening in Ghidra
[02:25] Checksec to see protections
[02:55] Looking at binary in Ghidra
[03:14] init in Ghidra
[03:26] menu in Ghidra
[04:08] steal in Ghidra
[04:40] tell_deed in Ghidra
[06:04] naughty in Ghidra
[06:59] present in Ghidra
[07:22] Strategy
[08:00] Memory leak in naughty
[09:19] Using gdb to test use after free
[10:53] Testing memory leak using gdb
[15:52] Input to get to index 4
[17:02] Verifying in gdb
[18:24] Building exploit script
[18:55] Leaking address to defeat PIE
[24:54] Freeing workshop
[25:20] Put malicious payload into heap buffer
[27:07] Trigger payload and get shell
[27:33] Running, get shell Simple Use After Free Exploitation [Hackvent 2022 - Day 21]](https://i.ytimg.com/vi/pniG3nzVMqE/mqdefault.jpg)
![Factory [AOC2025 Day 10]
Advent of Code 2025 Day 10 has some buttons that each control one or more outputs. In part 1, they toggle on and off a light, and Ill have to find the minimum number of button pushes to get a desired light configuration. In part 2, they add power to a circuit on each push, so Ill have to solve linear equations to get a minimum number of pushes.
Solutions Repo: https://gitlab.com/0xdf/aoc2025
VSCode Debug Setup: https://www.youtube.com/watch?v=cNhtk2Ob4B8
Claude: https://claude.ai/
☕ Buy Me A Coffee: https://www.buymeacoffee.com/0xdf
[00:00] Introduction
[01:46] Pulling / examining input
[02:29] Strategy
[02:58] Processing lines
[09:30] Function to find min pushes
[11:11] Debugging counting error
[12:07] Solving part 1
[12:21] Part 2 introduction
[13:10] Reparsing lines
[16:59] Starting z3 solver
[17:38] Strategy overview
[18:39] Setting constraints
[23:08] Checking / parsing z3 result
[25:33] Solving part 2
[26:00] Solving with Claude
[30:45] Interupting to tell Claude how to use packages
[31:57] Analysis of Claudes solution
[33:20] Conclusion
#AdventOfCode #claude Factory [AOC2025 Day 10]](https://i.ytimg.com/vi/ppQuB--h4MU/mqdefault.jpg)
![Introduction [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. In this video, Ill cover all the intro stuff for this year, including how Im going to approach is using a test-driven strategy, using templates inspired by a Real Python article. Ill show my script for generating the stub solution and test files, as well as getting the puzzle input. And Ill show how I plan to use PyTest to drive the solutions.
Real Python post: https://realpython.com/python-advent-of-code/
Repo for Advent of Code 2016 Solutions: https://gitlab.com/0xdf/aoc2016
☕ Buy Me A Coffee: https://www.buymeacoffee.com/0xdf
[00:00] Introduction
[01:04] Real Python article
[02:24] genday.sh script
[07:04] Running genday.sh
[07:33] Solution stub
[09:40] Tests stub and PyTest
[13:38] Conclusion
#ctf #adventofcode #revivalofcode #python Introduction [Revival of Code 2023 - Advent of Code 2016]](https://i.ytimg.com/vi/qEPpsS0StQI/mqdefault.jpg)
![QuickScan [HackTheBox Cyber Apocalypse CTF 2024]
QuickScan is a challenge from the 2024 HackTheBox Syber Apocalypse CTF. Im given ELF binaries as a base64 encoded string. Each one loads 24 bytes onto the stack and exits. I need to get that value and return it 129 times in less than 2 minutes to get the flag. Ill do some basic reverse engineering in gdb and Ghidra, and then use Python and PwnTools to interact with the server, get the bianry, decode it, locate the buffer, read it, and send it back.
Final Script: https://gitlab.com/0xdf/ctfscripts/-/tree/master/htb-quickscan
☕ Buy Me A Coffee: https://www.buymeacoffee.com/0xdf
[00:00] Introduction
[00:57] Challenge introduction
[01:32] Interacting with server
[02:05] Strategy
[02:44] Saving binaries
[03:24] Reversing warmup
[10:30] Reversing elf1
[11:13] Setting up Python program to get bytes
[12:30] Connecting and reading base64 string
[15:18] Saving ELF to file
[16:21] Calculating addresses
[20:17] Getting values as hex string
[21:00] Sending result to server
[21:18] Making function to loop over
[24:12] Solving challenge!
[24:31] Conclusion
#HackTheBox #ctf #reverse-engineering #python #pwntools QuickScan [HackTheBox Cyber Apocalypse CTF 2024]](https://i.ytimg.com/vi/qN4mcemE6mA/mqdefault.jpg)
![Day 15: Lens Library [AOC2023 Python]
For Advent of Code 2023 Day 15, Im first asked to implement a custom (and bad) hashing algorithm that reduces any string to a single byte. Ill apply it to a series of strings in my puzzle input. In part 2, Im actually handling those strings as instructions, either adding or removing a lens from one of 256 boxes. Ill hash the lens name to get what box it goes in, and track the order lenses are inserted into each box.
Code 2023 AOC: https://gitlab.com/0xdf/aoc2023
Challenge Link: https://adventofcode.com/2023/day/15
☕ Buy Me A Coffee: https://www.buymeacoffee.com/0xdf
[00:00] Part 1 description
[01:06] Input analysis
[01:38] Hash function
[02:30] Testing badhash
[02:52] Apply hash to input
[03:36] Solve part 1
[03:54] Part 2 description
[07:08] Sorting lenses
[12:43] Check sort result
[13:14] Scoring result
[14:31] Solve part 2
[14:45] Summary
#adventofcode #python Day 15: Lens Library [AOC2023 Python]](https://i.ytimg.com/vi/qO-n8OHc-Cw/mqdefault.jpg)
![Day 7: Camel Cards [AOC2023 Python]
For Advent of Code 2023 Day7, Im given a series of poker hands that I need to rank. The rules are a simplified version of poker. Ill use a Hand class, along with some neat static methods. In part 2, there are wildcards to handle, which Ill brute force every possible hand to get the best hand.
Code 2023 AOC: https://gitlab.com/0xdf/aoc2023
Challenge Link: https://adventofcode.com/2023/day/7
☕ Buy Me A Coffee: https://www.buymeacoffee.com/0xdf
#adventofcode #python
[00:00] Part 1 description
[01:52] Input analysis
[02:25] Create Hand class
[03:44] Getting hand type
[08:01] Testing hand type
[10:34] Adding eq and gt
[14:46] Testing comparison
[15:07] Scoring hands
[16:10] Fixing bug in hand_type
[17:02] Part 2 description
[17:19] Strategies
[17:49] Updating card_map
[18:53] Reorganizing get_hand_type
[20:40] replace_wilds
[23:16] Testing replace_wilds
[24:02] Getting best hand_type
[25:08] Scoring part 2
[26:05] Solve part 2
[12:53] Brute force solution Day 7: Camel Cards [AOC2023 Python]](https://i.ytimg.com/vi/qPrz0vXYAQ0/mqdefault.jpg)
![Bypassing Python Filters [Code - HackTheBox]
In Code from HackTheBox, Ive got a website that has a Python editor can execute what I run. Theres a block-list in place to prevent my getting RCE, but Im going to bypass it to do just that!
Full Code solution: https://0xdf.gitlab.io/2025/08/02/htb-code.html
Bash reverse shell explainer: https://www.youtube.com/watch?v=OjkVep2EIlw
Shell upgrade explainer: https://www.youtube.com/watch?v=DqE6DxqJg8Q
☕ Buy Me A Coffee: https://www.buymeacoffee.com/0xdf
[00:00] Introduction
[00:30] Application overview
[01:04] Getting blocked
[02:51] Inspiration from SSTI payloads
[04:25] Globals
[06:20] Getting os
[07:51] Getting popen
[09:05] Executing command
[10:28] Getting shell
[11:27] Review code
[12:34] Conclusion
#HackTheBox #ctf #python #debug Bypassing Python Filters [Code - HackTheBox]](https://i.ytimg.com/vi/qgOb2BDnkHI/mqdefault.jpg)
![Reversing APT29 Duke Malware
Im looking at three binary files. The first is a legit Microsoft signed exe. The second is a stub DLL that does nothing. The third is APT 29 malware that is DLL side-loaded by the legit executable. Ill show how the DLL opens the decoy document, loads wininet.dll using LdrLoadDll, and then connects to a the Zulip chat service for C2 (including the username and password). This malware comes from HackTheBoxs Einladen Sherlock.
APT 29 malware post: https://0xdf.gitlab.io/2024/05/08/htb-sherlock-einladen-malware-re.html
HackTheBox Einladen Blog post: https://0xdf.gitlab.io/2024/05/02/htb-sherlock-einladen.html
HackTheBox Einladen: https://app.hackthebox.com/sherlocks/Einladen
☕ Buy Me A Coffee: https://www.buymeacoffee.com/0xdf
[00:00] Introduction
[01:26] Situation overview
[01:55] msoev.exe (legit)
[04:30] AppVIsvSubsystems64.dll
[07:01] mso.dll start
[07:49] Exports, imports, and strings
[09:56] ShellExecuteA to show decoy
[11:03] String decryption functions
[13:14] Decrypting string to show decoy
[15:05] Loading wininet.dll
[19:05] Getting wininet functions
[22:48] C2 activity
[27:54] Back to entry point
[29:25] Conclusion
#pentest #ctf #malware #ghidra #apt29 Reversing APT29 Duke Malware](https://i.ytimg.com/vi/qp3W8Zt4GTQ/mqdefault.jpg)
![Day 9: Mirage Maintenance [AOC2023 Python]
For Advent of Code 2023 Day 9, I get a bunch of lines, each with a pattern of numbers. For each line, I need to find the next number in the pattern. Ill use a recurrsive function to find the next item. In part two, I need to do the same but in reverse, so Ill just reverse the input.
Code 2023 AOC: https://gitlab.com/0xdf/aoc2023
Challenge Link: https://adventofcode.com/2023/day/9
☕ Buy Me A Coffee: https://www.buymeacoffee.com/0xdf
[00:00] Part 1 description
[01:43] Input analysis
[02:30] Recurrsive get_next
[04:58] Calculating answer
[05:37] Running on examples and solving
[06:05] Part 2 description
[06:22] Solve part 2
[06:55] Summary
#adventofcode #python Day 9: Mirage Maintenance [AOC2023 Python]](https://i.ytimg.com/vi/rkrwrByDLKg/mqdefault.jpg)