Update main.py

This commit is contained in:
√(noham)²
2025-08-31 14:45:30 +02:00
parent 8afa404d78
commit 6f48a20e9d

54
main.py
View File

@@ -92,4 +92,56 @@ def ecsc():
# cattheflag()
# imaginaryctf()
# rootme()
# ecsc()
# 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()