7oSkaaa

Treasure island

Mar 20th, 2024
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.86 KB | None | 0 0
  1. import re
  2.  
  3.  
  4. # Function to find CTF patterns in a file
  5. def find_ctf_patterns(filename):
  6.     try:
  7.         with open(filename, 'r') as file:
  8.             content = file.read()
  9.             ctf_patterns = re.findall(r'NOON_CTF{[^}]+}', content)
  10.             return ctf_patterns
  11.     except FileNotFoundError:
  12.         print(f"Error: File '{filename}' not found.")
  13.         return []
  14.  
  15.  
  16. def main():
  17.     # File containing the CTF patterns
  18.     filename = 'CTF_Match.txt'
  19.    
  20.     # Find CTF patterns in the file
  21.     ctf_patterns = find_ctf_patterns(filename)
  22.    
  23.     # Display the CTF patterns found in the file (if any)
  24.     if ctf_patterns:
  25.         print("Found the following CTF patterns:")
  26.         for pattern in ctf_patterns:
  27.             print(pattern)
  28.     else:
  29.         print("No CTF patterns found in the file.")
  30.  
  31.  
  32. if __name__ == "__main__":
  33.     main()
  34.  
Add Comment
Please, Sign In to add comment