|
@@ -39,25 +39,10 @@ class Port:
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
-class Status(Enum):
|
|
|
- Up = 1
|
|
|
- Down = 2
|
|
|
- Unknown = 3
|
|
|
-
|
|
|
- def from_string(status):
|
|
|
- if status.lower() == "up":
|
|
|
- return Status.Up
|
|
|
- if status.lower() == "down":
|
|
|
- return Status.Down
|
|
|
- if status.lower() == "unknown":
|
|
|
- return Status.Unknown
|
|
|
-
|
|
|
-
|
|
|
|
|
|
class Host:
|
|
|
ip = ""
|
|
|
- status = None
|
|
|
+ status = ""
|
|
|
hostname = ""
|
|
|
ports = []
|
|
|
|
|
@@ -66,7 +51,7 @@ class Host:
|
|
|
"ip":self.ip,
|
|
|
"hostname":self.hostname,
|
|
|
"ports":[port.todict(full) for port in self.ports],
|
|
|
- "status":str(self.status.value)
|
|
|
+ "status":self.status
|
|
|
}
|
|
|
|
|
|
|
|
@@ -118,7 +103,7 @@ def parse_ports_field(host, field):
|
|
|
return host
|
|
|
|
|
|
def parse_status_field(host, field):
|
|
|
- host.status = Status.from_string(field)
|
|
|
+ host.status = field
|
|
|
return host
|
|
|
|
|
|
|