Challenge data
- Name: Registering X
- Category: Misc
- Points: 300
Solution
The challenge only had a file to download, which had the following content:
Here's a regex 4 u. Match it if you can...
infernoCTF{.(?<=H){21}.[a-z](?<=\+a){1024}[a-z][a-j](?<!([a-u]|[w-z])(j|[a-h])).{2,64}(?<!\S){255}n.{2}(?<=\s)g_fUn\W(?<=[A-z])}(?<=\..{14})(?<=^.{33})
Never did a challenge like this, so it was an interesting target. In order to match this regex, I split it in part, otherwise it would have be a mess.
I used the following pages to test the regex: 1. https://pythex.org/ 2. https://regex101.com/
1st part: infernoCTF{.(?<=H){21}.[a-z]
Total: infernoCTF{.(?<=H){21}.[a-z] Type: Positive look behind Matching string: infernoCTF{Hzz
2nd part: (?<=+a){1024}[a-z][a-j]
Total: infernoCTF{.(?<=H){21}.a-z{1024}[a-z][a-j] Type: Positive look behind Matching string: infernoCTF{H+azj
3rd part: (?<!([a-u]|[w-z])(j|[a-h])).{2,64}
Total: infernoCTF{.(?<=H){21}.a-z{1024}[a-z]a-j.{2,64} Type: Negative look behind Matching string: infernoCTF{H+avixx
- xx can be any thing
- vi in order to negate both conditions (maybe with one was enough).
4th part: (?<!\S){255}n.{2}
Total: infernoCTF{.(?<=H){21}.a-z{1024}[a-z]a-j.{2,64}(?<!\S){255}n.{2} Type: Negative look behind Matching string: infernoCTF{H+avixx nxx
- xx can be anything.
5th part: (?<=\s)g_fUn\W
Total: infernoCTF{.(?<=H){21}.a-z{1024}[a-z]a-j.{2,64}(?<!\S){255}n.{2}(?<=\s)g_fUn\W Type: Positive look behind Matching string: infernoCTF{H+avixx nx g_fUn!
- must be a space before g_fUn
- must end with a non-alphanumeric (/W)
6th part: (?<=[A-z])}
Total: infernoCTF{.(?<=H){21}.a-z{1024}[a-z]a-j.{2,64}(?<!\S){255}n.{2}(?<=\s)g_fUn\W(?<=[A-z])} Type: Positive look behind Matching string: infernoCTF{H+avixx nx g_fUn^}
- [A-z] involves some non alphanumeric character such as:
- [
- /
- ]
- ^
- _ (check ascii table)
At this point, just to make a little more sense, I changed, to spaces: infernoCTF{H+avi n g_fUn^}
7th part: (?<=..{14})
Total: infernoCTF{.(?<=H){21}.a-z{1024}[a-z]a-j.{2,64}(?<!\S){255}n.{2}(?<=\s)g_fUn\W(?<=[A-z])}(?<=..{14}) Type: Positive look behind Matching string: infernoCTF{H+avi . n g_fUn^}
- Must be a point (14 chars before) and 14 chars..
- We can add spaces in the part of {2,64}.
8th part: (?<=^.{33})
Total: infernoCTF{.(?<=H){21}.a-z{1024}[a-z]a-j.{2,64}(?<!\S){255}n.{2}(?<=\s)g_fUn\W(?<=[A-z])}(?<=..{14})(?<=^.{33}) Type: Positive look behind
Matching string: infernoCTF{H+avi . n g_fUn^}
- Total amount of chars should be 33.
- Remove some spaces.
Flag
infernoCTF{H+avi . n g_fUn^}
Kudos
To @NicolasRaus who worked together with me to develop this one.