httpx.py 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. import re
  2. from typing import List
  3. from tools.network.httpx import HttpxTool
  4. tool = HttpxTool()
  5. def test_name():
  6. assert tool.name() == "httpx"
  7. def test_description():
  8. assert (
  9. tool.description()
  10. == "An HTTP toolkit that probes services, web servers, and other valuable metadata."
  11. )
  12. def test_category():
  13. assert tool.category() == "Web technologies enumeration"
  14. def test_image():
  15. assert tool.get_image() == "projectdiscovery/httpx"
  16. def test_install():
  17. tool.install()
  18. assert tool.is_installed() == True
  19. def test_version():
  20. tool.install()
  21. version = tool.version()
  22. # Check that version follows the expected format: v followed by digits and dots
  23. assert re.match(r"^v[\d\.]+$", version)
  24. def test_launch():
  25. assert True
  26. results = tool.launch("https://alliage.io")
  27. print(results)
  28. assert isinstance(results, List)
  29. def test_launch_unreached_host():
  30. assert True
  31. results = tool.launch("https://this-is-not-a-valid-domain.local")
  32. assert isinstance(results, List)
  33. assert len(results) == 0