test.py 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #!/usr/bin/env python3
  2. """argparse migration: all expected flags present, --version exits with v2.0 codename."""
  3. import sys, subprocess
  4. EXPECTED_FLAGS = [
  5. "-h", "--help", "--version", "-v", "--verbose", "--examples", "--timeline",
  6. "--update", "--test-ufonet", "--check-tor", "--force-ssl", "--force-yes", "--gui",
  7. "--crypter", "--network", "--xray", "--xray-ps",
  8. "--proxy", "--user-agent", "--referer", "--host", "--xforw", "--xclient",
  9. "--timeout", "--retries", "--threads", "--delay",
  10. "--auto-search", "-s", "--sd", "--sn", "--se", "--sa", "--sax", "--sl",
  11. "--test-offline", "--test-all", "-t", "--test-rpc", "--attack-me",
  12. "--deploy", "--grider", "--blackhole", "--download-nodes",
  13. "--up-to", "--down-from",
  14. "-i", "-x", "-a", "-f", "-b", "-r", "-m",
  15. "--no-droids", "--no-ucavs", "--no-aliens", "--no-rpcs", "--no-head",
  16. "--no-scan", "--no-purge", "--expire",
  17. "--fraggle", "--tachyon", "--monlist", "--smurf", "--sniper", "--spray",
  18. "--db", "--loic", "--loris", "--ufosyn", "--xmas", "--nuke", "--ufoack",
  19. "--uforst", "--droper", "--overlap", "--pinger", "--ufoudp",
  20. "--memcached", "--chargen", "--cldap", "--ssdp", "--qotd", "--tftp",
  21. "--wsdisco", "--coap", "--mssql", "--arms", "--plex", "--netbios",
  22. "--ripv1", "--middlebox", "--rapidreset", "--slowread", "--goldeneye",
  23. "--finflood",
  24. ]
  25. err = []
  26. r = subprocess.run([sys.executable, "ufonet", "--help"], capture_output=True, text=True, timeout=10)
  27. if r.returncode != 0:
  28. err.append(f"--help exited {r.returncode}")
  29. help_text = r.stdout
  30. missing = [f for f in EXPECTED_FLAGS if f not in help_text]
  31. if missing:
  32. err.append(f"missing flags in --help: {missing}")
  33. r = subprocess.run([sys.executable, "ufonet", "--version"], capture_output=True, text=True, timeout=10)
  34. if r.returncode != 0:
  35. err.append(f"--version exited {r.returncode}")
  36. if "2.0" not in r.stdout:
  37. err.append("--version output missing '2.0'")
  38. if "R3DST4R" not in r.stdout:
  39. err.append("--version output missing 'R3DST4R'")
  40. print(f"--help flags found: {len(EXPECTED_FLAGS) - len(missing)} / {len(EXPECTED_FLAGS)}")
  41. print(f"--version output: {r.stdout.strip()}")
  42. for e in err:
  43. print("FAIL:", e)
  44. sys.exit(0 if not err else 1)