parse.py 766 B

12345678910111213141516171819202122232425262728293031323334
  1. import re
  2. from dataclasses import dataclass
  3. judges_by_proxy = (
  4. 'https://www.proxy-listen.de/azenv.php',
  5. 'http://mojeip.net.pl/asdfa/azenv.php',
  6. 'http://www.wfuchs.de/azenv.php',
  7. 'http://azenv.net',
  8. 'http://proxyjudge.us/',
  9. )
  10. @dataclass(slots=True)
  11. class ParseProxyPattern:
  12. proxy_type = re.compile(r'(\w+)://')
  13. host = re.compile(r'(\d+.\d+.\d+.\d+)')
  14. port = re.compile(r'\d+.\d+.\d+.\d+:(\d+)')
  15. username = re.compile(r'://(\w+):')
  16. password = re.compile(r':(\w+)@')
  17. def parse_search(search_compile:re.Pattern, string:str) -> str|None:
  18. if search := search_compile.search(string):
  19. return search.group(1)
  20. @dataclass(slots=True)
  21. class ResponseSerch:
  22. host = re.compile(r'REMOTE_ADDR = (\d+.\d+.\d+.\d+)')