Uploaded June 2025 | Updated November 2026, 3 hours ago
For Triple Knock, I'll 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, I'll create a simple Event class that handles parsing the line into a user, failed boolean, and a minutes timestamp. Then I'll store failed logins in a defaultdict by username, and then loop over using a sliding window to find targeted users.
Final code: gitlab.com/0xdf/ctfscripts/-/tree/master/htb-triple_knock
☕ Buy Me A Coffee: 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
For Triple Knock, I'll 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, I'll create a simple Event class that handles parsing the line into a user, failed boolean, and a minutes timestamp. Then I'll store failed logins in a defaultdict by username, and then loop over using a sliding window to find targeted users.
Final code: gitlab.com/0xdf/ctfscripts/-/tree/master/htb-triple_knock
☕ Buy Me A Coffee: 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
![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)
![Day 5 - How About a Nice Game of Chess? [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 5 challenge, How About a Nice Game of Chess?, involves taking MD5 hashes with a seed and a counter to find hashes that start with five 0s.
Repo for Advent of Code 2016 Solutions: https://gitlab.com/0xdf/aoc2016
Intro video for this event: https://www.youtube.com/watch?v=qEPpsS0StQI
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:15] genday.sh script
[01:34] Part 1 tests
[02:38] Solving part 1
[05:14] Challenge part 2
[05:40] Refactoring to solve both parts in one function
[07:05] Part 2 tests
[08:00] Coding part 2
[09:50] Debugging small errors
[11:49] Fixing pretty print and solving
#ctf #adventofcode #revivalofcode #python Day 5 - How About a Nice Game of Chess? [Revival of Code 2023 - Advent of Code 2016]](https://i.ytimg.com/vi/6fzTu0T7HbM/mqdefault.jpg)
![Hacking the HackTheBox Code Editor
In the final video in this series, Ill look at the requests sent by the HackTheBox web IDE and recreate a Python script to submit my code and get the flag without it.
☕ Buy Me A Coffee: https://www.buymeacoffee.com/0xdf
[00:00] Introduction
[00:38] Running IDE through Burp
[01:55] Creating script to submit solutions
[04:12] Posting solution
[07:26] Fixing bugs
[08:20] Troubleshooting in Burp Repeater
[11:45] Conclusion
#python Hacking the HackTheBox Code Editor](https://i.ytimg.com/vi/7TihembjZ6A/mqdefault.jpg)
![Relic Maps [Forensics - Cyber Apocalypse 23 CTF]
The Relic Maps challenge is one that I created for the HTB Cyber Apocalypse 2023 CTF. It mimics really OneNote phishing malware, and Ill have to follow a chain of OneNote - hta - bat - powershell - .NET exe to find the flag.
#pentest #ctf #forensics #CyberApocalypse23
onedump.py: https://github.com/DidierStevens/Beta/blob/master/onedump.py
Based on: https://isc.sans.edu/diary/rss/29470
☕ Buy Me A Coffee: https://www.buymeacoffee.com/0xdf
[00:00] Introduction
[01:28] Challenge description
[02:07] Looking at the OneNote file in Windows
[03:57] hta special character file name
[04:41] Getting hta file from Linux
[06:50] hta analysis
[09:56] windows.bat analysis
[12:12] PowerShell analysis
[15:18] Decrypting exe
[17:14] DotNet exe analysis
[18:07] Conclusion Relic Maps [Forensics - Cyber Apocalypse 23 CTF]](https://i.ytimg.com/vi/84sqhIvE2bQ/mqdefault.jpg)
![Guard Gallivant [Day 6 - Advent of Code 2024 - Python]
A grid challenge where I have to walk a guard until they hit an obstruction, then turn them to the right. In part 1, I count spaces visited. In part 2, I have to find all the places I could add a single obstruction to get the guard caught in a loop. Brute force works relatively quickly here.
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:05] Setup / data overview
[01:49] Strategy
[02:28] Data processing, finding start
[04:08] Walking grid
[06:57] Turns
[08:18] Solving part 1
[08:43] Part 2 challenge
[09:26] Strategy
[10:45] Function to check for loop
[12:41] Trying all possible obstructions
[14:20] Updating grid to be mutable
[15:19] Solving part 2
[16:05] Conclusion
#adventofcode #python Guard Gallivant [Day 6 - Advent of Code 2024 - Python]](https://i.ytimg.com/vi/98M4F1agidQ/mqdefault.jpg)