Uploaded December 2024 | Updated November 2026, 3 hours ago
This challenge involves coding a computer to handle 3 bit instructions and operands. In part two, I'll do some targetted brute force to find the correct input.
Dikstra's algorithm: en.wikipedia.org/wiki/Dijkstra%27s_algorithm
2024 AOC repo: gitlab.com/0xdf/aoc2024
2024 AOC Intro video: youtube.com/watch?v=4XKZZrhhiQE
VSCode Debug video: youtube.com/watch?v=cNhtk2Ob4B8
☕ Buy Me A Coffee: buymeacoffee.com/0xdf
[00:00] Part1 introduction
[03:30] Setup / data overview
[04:50] Parsing input
[06:14] Making computer
[12:36] Joining ouput
[13:27] Solving part 1
[13:53] Part 2 challenge
[14:16] Program analysis
[17:15] Part 2 strategy
[17:55] Putting computer in function
[19:53] Manual running of computer to find end
[22:00] Looping over entire program from back
[24:00] Debugging
[25:08] Solving part 2
#adventofcode #python
This challenge involves coding a computer to handle 3 bit instructions and operands. In part two, I'll do some targetted brute force to find the correct input.
Dikstra's algorithm: en.wikipedia.org/wiki/Dijkstra%27s_algorithm
2024 AOC repo: gitlab.com/0xdf/aoc2024
2024 AOC Intro video: youtube.com/watch?v=4XKZZrhhiQE
VSCode Debug video: youtube.com/watch?v=cNhtk2Ob4B8
☕ Buy Me A Coffee: buymeacoffee.com/0xdf
[00:00] Part1 introduction
[03:30] Setup / data overview
[04:50] Parsing input
[06:14] Making computer
[12:36] Joining ouput
[13:27] Solving part 1
[13:53] Part 2 challenge
[14:16] Program analysis
[17:15] Part 2 strategy
[17:55] Putting computer in function
[19:53] Manual running of computer to find end
[22:00] Looping over entire program from back
[24:00] Debugging
[25:08] Solving part 2
#adventofcode #python
![LFI into RCE Abusing NGINX Temp Files [PikaTwoo - HackTheBox]
In the PikaTwoo box from HackTheBox, Ill find a local file include (LFI) that I want to abuse to get code execution and a shell. To do that, Ill abuse the feature in nginx where it caches large requests as files on disk temporarily. In this video, Ill walk through the script provided
Temp Files Blog Post: https://bierbaumer.net/security/php-lfi-with-nginx-assistance/
Full PikaTwoo Writeup: https://0xdf.gitlab.io/2023/09/09/htb-pikatwoo.html
HackTheBox PitaTwoo: https://www.hackthebox.com/machines/pikatwoo
☕ Buy Me A Coffee: https://www.buymeacoffee.com/0xdf
[00:00] Introduction
[00:47] Showing the LFI
[01:46] Blog post / script introduction
[02:11] Walkthrough of the exploit script
[05:28] Updating script for PikaTwoo
[10:05] Running, debugging
[11:30] Fixing bug to POST large requests
[12:04] Summary, wrap-up LFI into RCE Abusing NGINX Temp Files [PikaTwoo - HackTheBox]](https://i.ytimg.com/vi/0ZMpwb2fGmU/mqdefault.jpg)
![Day 13: Point of Incidence [AOC2023 Python]
For Advent of Code 2023 Day 13, I get another grid, this time with . and #. I need to find the horizontal or vertical line that forms a mirror point for this grid. In part 2, I need to find a mirror point with exactly one difference.
Code 2023 AOC: https://gitlab.com/0xdf/aoc2023
Challenge Link: https://adventofcode.com/2023/day/13
☕ Buy Me A Coffee: https://www.buymeacoffee.com/0xdf
[00:00] Part 1 description
[01:26] Input analysis
[02:17] Process / loop over input
[05:49] Checking newlines
[06:18] find_mirror
[09:38] Debug small zip issue
[09:58] Debug major logic error
[12:14] Fixing comparison
[12:48] Solve part 1
[13:07] Part 2 description
[13:22] Refactor find_mirror
[15:36] Adding part 2
[16:03] Solve part 2
#adventofcode #python Day 13: Point of Incidence [AOC2023 Python]](https://i.ytimg.com/vi/0aL3S4Jw3Mg/mqdefault.jpg)
![Day 12: Hot Springs [AOC2023 Python]
For Advent of Code 2023 Day 12, each line of input has a mapping of springs using # for a spring and . for space. Theres also ? for unknown. After the map, theres a list of numbers. These numbers represent the number of springs in a row, each separated by space. Im asked to find the number of possible arrangements of each row and sum them up. Ill use a recursive solution to brute force all possibilities. In part two, each map and list of numbers becomes five times longer. With caching on my recursive solution, it still works fine.
Code 2023 AOC: https://gitlab.com/0xdf/aoc2023
Challenge Link: https://adventofcode.com/2023/day/12
functools cache: https://docs.python.org/3/library/functools.html
☕ Buy Me A Coffee: https://www.buymeacoffee.com/0xdf
[00:00] Part 1 description
[01:39] Input analysis
[02:22] Framework for solve
[03:45] Start get_combinations
[09:30] Using errors to update base cases
[10:25] Solving part 1
[10:54] Part 2 description
[11:41] Refactoring part 1
[14:13] Adding cache
[14:53] Changing list to tuple
[15:35] Solve part 2
[15:45] Summary
#adventofcode #python Day 12: Hot Springs [AOC2023 Python]](https://i.ytimg.com/vi/0kvDfjjJPog/mqdefault.jpg)
![Day 4 - Security Through Obscurity [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 4 challenge, Security Through Obscurity, involves parsing funky lines of text to get an encrypted name, a sector number, and a checksum. Ill first validate lines using the checksum, and then use the sector number to do a shift decryption on the encoded name looking for a specific clear text.
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:47] Challenge Part 1
[02:06] genday.sh script
[02:43] Strategy
[03:23] Room class tests
[06:49] Room class, init
[09:19] Room class, is_valid
[12:06] Using failed tests to debug
[14:00] parse function
[14:36] part 1 function
[15:02] part 1 tests (should have been first)
[16:11] Passing tests, solving part 1
[16:44] Challenge part 2
[17:40] decrypted_name test
[19:17] Rabbit hole into useless shift function
[21:36] Trying to write tests for shift, realizing it was a bad idea
[23:50] Combining shift back into decrypted_name
[24:35] Solving part 2
[27:40] Recap of part 2
#ctf #adventofcode #revivalofcode #python Day 4 - Security Through Obscurity [Revival of Code 2023 - Advent of Code 2016]](https://i.ytimg.com/vi/1YlRAt9Aviw/mqdefault.jpg)
![Day 2: Cube Conundrum [AOC2023 Python]
For Advent of Code 2023 Day2, each line of text represents a game. Each game is a series of observations of colored cubes being pulled from a bag. Ill be asked to first determine which games are possible, and then to find the minimum number of cubes in each bag.
Code 2023 AOC: https://gitlab.com/0xdf/aoc2023
Challenge Link: https://adventofcode.com/2023/day/2
☕ Buy Me A Coffee: https://www.buymeacoffee.com/0xdf
#adventofcode #python
[00:00] Part 1 description
[01:00] genday / input review
[01:38] Create target
[02:50] Parsing lines
[04:53] Adding check for part1
[05:51] Running part 1
[06:15] Debugging newline issue
[07:10] Solving part 1
[07:26] Part 2 description
[08:08] Adding part 2 to loop
[10:15] Solving Part2 Day 2: Cube Conundrum [AOC2023 Python]](https://i.ytimg.com/vi/1tXPgCWW91s/mqdefault.jpg)
![Day 15 - Timing is Everything [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 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! Ill include a Manim animation to show how the math works, and solve.
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/
Manim: https://www.manim.community/
☕ Buy Me A Coffee: https://www.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 Day 15 - Timing is Everything [Revival of Code 2023 - Advent of Code 2016]](https://i.ytimg.com/vi/2HOjaaZF0HA/mqdefault.jpg)
![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)