from .Challenge import Challenge import requests class GemasNotes(Challenge): history_location = 'history/gemas-notes.txt' host = "http://localhost:12000" def distribute(self, flag): try: username = "gemasflagreceiver" password = "AuTeEbn%.Q5$pC_ge6" result = requests.post(f"{self.host}/flag_receiver", json={"flag": flag}, auth=(username,password)).json() if not result.get("success"): return False with open(self.history_location, 'a') as f: f.write(flag + '\n') self.logger.info(f'Flag {flag} updated in gemas-notes database') return True except Exception as e: self.logger.error(f'Could send flag to gemas-notes challenge: {e}') return False def check(self): try: url = f'http://localhost:{self.port}' # login token = requests.post(f"{url}/api/login",json={"email":"checker@gemasnotes.id", "password":"uRIqCvJ