HomePROYECTOS

W1chSystem2 OS port scan

Aug 23 20221 min read
PythonTools
wichsystem

Script realizado por S4vitar, modificado por mi agregando una función para analizar los puertos abiertos.

El codigo completo se encuentra en GitHub

Herramienta sencilal.

python
1#!/usr/bin/python3
2#coding: utf-8
3
4import re, sys, subprocess
5
6print("W1hchSystem2")
7
8#Usage python3 wh1chSystem.py 10.10.10.205
9
10ip = re.compile("\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}")
11
12def dato_erroneo():
13
14  if len(sys.argv) != 2 or sys.argv[1]
15 != ip:
16   print("\n[!] Usage: python3 " 
17   + sys.argv[0] + " <ip-direction>\n")
18   sys.exit(1)
19
20def get_ttl(ip_address):
21
22 proc = subprocess.Popen(["/usr/bin/ping 
23 -c 1 %s" % 
24 ip_address, ""], stdout=subprocess.PIPE, 
25 shell=True)
26 
27 (out,err) = proc.communicate()
28
29 out = out.split()
30 out = out[12].decode('utf-8')
31
32 try:
33
34  ttl_value = re.findall(r"\d{1,3}", 
35  out)[0]
36  
37  return ttl_value
38
39 except IndexError:
40   
41  if ttl_value is IndexError:
42   print("Machine out of order")
43   sys.exit(1)
44
45
46def get_os(ttl):
47
48 ttl = int(ttl)
49
50 if ttl >=0 and ttl <=64:
51  return "Linux"
52 
53 elif ttl >= 65 and ttl <= 128:
54  return "Windows"
55  
56 else:
57  return "Not Found"
58

Share this article

© 2026