MCPcopy Create free account
hub / github.com/CScorza/IntelOSINT / scan_ip_services

Method scan_ip_services

IntelOSINT.py:12474–12508  ·  view source on GitHub ↗
(self, ip)

Source from the content-addressed store, hash-verified

12472
12473
12474 def scan_ip_services(self, ip):
12475 ip = ip.strip()
12476 services = []
12477 common_ports = {
12478 80: "HTTP",
12479 443: "HTTPS",
12480 22: "SSH",
12481 25: "SMTP",
12482 110: "POP3",
12483 143: "IMAP",
12484 3306: "MySQL",
12485 5432: "PostgreSQL",
12486 8080: "HTTP-Alt"
12487 }
12488 for port, name in common_ports.items():
12489 try:
12490 family = socket.AF_INET6 if ":" in ip else socket.AF_INET
12491 s = socket.socket(family, socket.SOCK_STREAM)
12492 s.settimeout(0.5)
12493 result = s.connect_ex((ip, port))
12494 s.close()
12495 if result == 0:
12496 services.append({"port": port, "service": name})
12497 except:
12498 continue
12499 try:
12500 hostnames = []
12501 try:
12502 rev = socket.gethostbyaddr(ip)
12503 hostnames = list({rev[0], *rev[1]})
12504 except:
12505 hostnames = []
12506 return services, hostnames
12507 except:
12508 return services, []
12509
12510 def _domain_only(self, target):
12511 return target.replace("https://", "").replace("http://", "").split('/')[0].strip()

Callers 3

build_ip_graphMethod · 0.95
searchFunction · 0.80
ip_whoisFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected