Browse Source

removed Status class

Marius Schwarz 4 years ago
parent
commit
a54d32e6fe
1 changed files with 3 additions and 18 deletions
  1. 3 18
      nmap-to-json.py

+ 3 - 18
nmap-to-json.py

@@ -39,25 +39,10 @@ class Port:
                 }
 
 
-# Enum to represent the Host Status Field
-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 to represent all the host attributes
 class Host:
     ip = ""
-    status = None
+    status = ""
     hostname = ""
     ports = [] # Array of Port() items
 
@@ -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