forked from SECFORCE/sparta
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPort.py
38 lines (26 loc) · 955 Bytes
/
Port.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/python
__author__ = 'SECFORCE'
__version__= '0.1'
import parsers.Service as Service
import parsers.Script as Script
class Port:
portId = ''
protocol= ''
state=''
def __init__( self, PortNode ):
if not (PortNode is None):
self.port_node = PortNode
self.portId = PortNode.getAttribute('portid')
self.protocol = PortNode.getAttribute('protocol')
self.state = PortNode.getElementsByTagName('state')[0].getAttribute('state')
def get_service( self ):
service_node = self.port_node.getElementsByTagName('service')
if len(service_node) > 0:
return Service.Service(service_node[0])
return None
def get_scripts( self ):
scripts = [ ]
for script_node in self.port_node.getElementsByTagName('script'):
scr = Script.Script(script_node)
scripts.append(scr)
return scripts