mirror of
https://github.com/NohamR/LetCTF.git
synced 2026-05-24 19:59:20 +00:00
147 lines
5.6 KiB
Python
147 lines
5.6 KiB
Python
from src.platforms.hackropole import HackropolePlatform
|
|
from src.platforms.theblackside import TheBlackSidePlatform
|
|
from src.platforms.crackmes import CrackmesPlatform
|
|
from src.platforms.crackmy import CrackmyPlatform
|
|
from src.platforms.cattheflag import CatTheFlagPlatform
|
|
from src.platforms.imaginaryctf import ImaginaryCTFPlatform
|
|
from src.platforms.rootme import RootMePlatform
|
|
from src.platforms.ecsc import ECSCPlatform
|
|
from src.generator import WriteupGenerator
|
|
from pathlib import Path
|
|
|
|
def hackropole():
|
|
challenge_url = 'https://hackropole.fr/fr/challenges/reverse/fcsc2023-reverse-chaussette-xs/'
|
|
platform = HackropolePlatform()
|
|
|
|
generator = WriteupGenerator(platform, Path("./writeups"))
|
|
generator.fetch_challenge(challenge_url=challenge_url)
|
|
print(generator.challenges)
|
|
generator.generate_writeup_structure(hugo_header=True, translated=True)
|
|
|
|
def theblackside():
|
|
challenge_url = 'https://theblackside.fr/challenges/steganographie/Meow'
|
|
platform = TheBlackSidePlatform(cookies_file="./config/theblackside.cookies.json")
|
|
|
|
generator = WriteupGenerator(platform, Path("./writeups"))
|
|
generator.fetch_challenge(challenge_url=challenge_url)
|
|
print(generator.challenges)
|
|
generator.generate_writeup_structure(hugo_header=True, translated=True)
|
|
|
|
def crackmes():
|
|
challenge_url = 'https://crackmes.one/crackme/6784f8a84d850ac5f7dc5173'
|
|
platform = CrackmesPlatform()
|
|
|
|
generator = WriteupGenerator(platform, Path("./writeups"))
|
|
generator.fetch_challenge(challenge_url=challenge_url)
|
|
print(generator.challenges)
|
|
generator.generate_writeup_structure(hugo_header=True, translated=True)
|
|
|
|
def crackmy():
|
|
challenge_url = 'https://crackmy.app/crackmes/yet-another-packer-v1-5514'
|
|
# platform = CrackmyPlatform(config_file="./config/crackmy.json")
|
|
platform = CrackmyPlatform()
|
|
|
|
generator = WriteupGenerator(platform, Path("./writeups"))
|
|
generator.fetch_challenge(challenge_url=challenge_url)
|
|
print(generator.challenges)
|
|
generator.generate_writeup_structure(hugo_header=True, translated=True)
|
|
|
|
def cattheflag():
|
|
challenge_url = 'https://cattheflag.org/defis/reverse2.php'
|
|
platform = CatTheFlagPlatform(config_file="./config/catthefile.json")
|
|
|
|
generator = WriteupGenerator(platform, Path("./writeups"))
|
|
generator.fetch_challenges() # Mandatory to get every information about a specific challenge for this platform
|
|
generator.fetch_challenge(challenge_url=challenge_url)
|
|
print(generator.challenges)
|
|
generator.generate_writeup_structure(hugo_header=True, translated=True)
|
|
|
|
def imaginaryctf():
|
|
challenge_name = "Wrong ssh"
|
|
challenge_url = challenge_name.lower().replace(' ', '-')
|
|
platform = ImaginaryCTFPlatform()
|
|
|
|
generator = WriteupGenerator(platform, Path("./writeups"))
|
|
generator.fetch_challenges()
|
|
generator.fetch_challenge(challenge_url=challenge_url)
|
|
print(generator.challenges)
|
|
generator.generate_writeup_structure(hugo_header=True, translated=True)
|
|
|
|
def rootme():
|
|
challenge_url = 'https://www.root-me.org/fr/Challenges/Cracking/ELF-x86-0-protection'
|
|
platform = RootMePlatform(config_file="./config/rootme.json")
|
|
|
|
generator = WriteupGenerator(platform, Path("./writeups"))
|
|
generator.fetch_challenge(challenge_url=challenge_url)
|
|
print(generator.challenges)
|
|
generator.generate_writeup_structure(hugo_header=True, translated=True)
|
|
|
|
def ecsc():
|
|
challenge_url = 'https://challenges.ecsc.eu/challenges/binary'
|
|
platform = ECSCPlatform()
|
|
|
|
generator = WriteupGenerator(platform, Path("./writeups"))
|
|
generator.fetch_challenge(challenge_url=challenge_url)
|
|
print(generator.challenges)
|
|
generator.generate_writeup_structure(hugo_header=True, translated=True)
|
|
|
|
# theblackside()
|
|
# hackropole()
|
|
# crackmes()
|
|
# crackmy()
|
|
# cattheflag()
|
|
# imaginaryctf()
|
|
# rootme()
|
|
# ecsc()
|
|
|
|
def main():
|
|
"""
|
|
Main function that prompts for a challenge URL and processes it based on the platform
|
|
"""
|
|
print("Welcome to the Writeup Generator!")
|
|
url = input("Please enter the challenge URL: ").strip()
|
|
|
|
output_path = Path("./writeups")
|
|
|
|
if "hackropole.fr" in url:
|
|
platform = HackropolePlatform()
|
|
elif "theblackside.fr" in url:
|
|
platform = TheBlackSidePlatform(cookies_file="./config/theblackside.cookies.json")
|
|
elif "crackmes.one" in url:
|
|
platform = CrackmesPlatform()
|
|
elif "crackmy.app" in url:
|
|
platform = CrackmyPlatform()
|
|
elif "cattheflag.org" in url:
|
|
platform = CatTheFlagPlatform(config_file="./config/catthefile.json")
|
|
elif "root-me.org" in url:
|
|
platform = RootMePlatform(config_file="./config/rootme.json")
|
|
elif "challenges.ecsc.eu" in url:
|
|
platform = ECSCPlatform()
|
|
elif "imaginaryctf.org" in url:
|
|
platform = ImaginaryCTFPlatform()
|
|
challenge_name = input("Please enter the challenge name: ").strip()
|
|
url = challenge_name.lower().replace(' ', '-')
|
|
else:
|
|
print("Unsupported platform or invalid URL")
|
|
return
|
|
|
|
try:
|
|
generator = WriteupGenerator(platform, output_path)
|
|
|
|
if isinstance(platform, (CatTheFlagPlatform, ImaginaryCTFPlatform)):
|
|
generator.fetch_challenges()
|
|
|
|
generator.fetch_challenge(challenge_url=url)
|
|
|
|
print("\nFound challenges:")
|
|
print(generator.challenges)
|
|
|
|
print("\nGenerating writeup structure...")
|
|
generator.generate_writeup_structure(hugo_header=True, translated=True)
|
|
print("\nWriteup structure generated successfully!")
|
|
|
|
except Exception as e:
|
|
print(f"An error occurred: {str(e)}")
|
|
|
|
if __name__ == "__main__":
|
|
main() |