asnmap.py 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import re
  2. from typing import Dict
  3. from tools.network.asnmap import AsnmapTool
  4. tool = AsnmapTool()
  5. def test_name():
  6. assert tool.name() == "asnmap"
  7. def test_description():
  8. assert tool.description() == "ASN mapping and network reconnaissance tool."
  9. def test_category():
  10. assert tool.category() == "ASN discovery"
  11. def test_image():
  12. assert tool.get_image() == "projectdiscovery/asnmap"
  13. def test_install():
  14. tool.install()
  15. assert tool.is_installed() == True
  16. def test_version():
  17. tool.install()
  18. version = tool.version()
  19. # Check that version follows the expected format: v followed by digits and dots
  20. assert re.match(r"^v[\d\.]+$", version)
  21. def test_launch_no_api_key():
  22. import pytest
  23. with pytest.raises(KeyError, match="Missing key"):
  24. tool.launch("alliage.io", "domain")
  25. def test_launch_wrong_type():
  26. import pytest
  27. with pytest.raises(ValueError, match="Invalid type: 'domains'"):
  28. tool.launch("alliage.io", "domains")
  29. def test_launch():
  30. results = tool.launch("alliage.io", "domain")
  31. assert isinstance(results, Dict)