https://github.com/codingo/simple-substitution
A CTF challenge for CrikeyCon 2018
https://github.com/codingo/simple-substitution
Last synced: 2 months ago
JSON representation
A CTF challenge for CrikeyCon 2018
- Host: GitHub
- URL: https://github.com/codingo/simple-substitution
- Owner: codingo
- License: gpl-3.0
- Created: 2017-08-28T22:49:00.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-02-26T06:59:55.000Z (over 7 years ago)
- Last Synced: 2025-03-25T03:06:09.549Z (2 months ago)
- Language: Python
- Homepage:
- Size: 17.6 KB
- Stars: 3
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Simple-Substitution
[](https://twitter.com/codingo_)A regular expression CTF challenge for CrikeyCon 2018
# Challenge Description
```
\w*?(p).*([a])[^l]*(l)[a-zA-Z\d]*?(a)({)\w*?(o).+([W-w])(h)[^f]+(f).*
\9\3\2g\5t\7\6ste\1s\4\8e\2d}
LZckWnfFS0NyHyjMpObY0aLi:cVJVcVZkWnfFS0NvlQNiyZa{NVCHJ6zWPPI5KXxGZyUo55ywhR8LzVm4KM92kSfi}fzQHpjMpOb0ii?
```## Search
```
\w*?(p).*([a])[^l]*(l)[a-zA-Z\d]*?(a)({)\w*?(o).+([W-w])(h)[^f]+(f).*
```
## Replace
```
\9\3\2g\5t\7\6ste\1s\4\8e\2d}
```
# Flag
```
flag{twostepsahead}
```
# Example Solutions
https://regex101.com/r/l1i0Bs/1```
# coding=utf8
import reinput_str = "LZckWnfFS0NyHyjMpObY0aLi:cVJVcVZkWnfFS0NvlQNiyZa{NVCHJ6zWPPI5KXxGZyUo55ywhR8LzVm4KM92kSfi}fzQHpjMpOb0ii?"
regex = r"\w*?(p).*([a])[^l]*(l)[a-zA-Z\d]*?(a)({)\w*?(o).+([W-w])(h)[^f]+(f).*"
replace = "\\9\\3\\2g\\5t\\7\\6ste\\1s\\4\\8e\\2d}"result = re.sub(regex, replace, input_str, 0)
print("Input string: %s" % input_str)
print("Search: %s" % regex)
print("Replace: %s" % replace)
print("-" * 25)
print("Result: %s" % result)
```