diff options
author | hklbgd <hklbgd_assange@oosm.org> | 2019-06-01 21:11:43 +0200 |
---|---|---|
committer | hklbgd <hklbgd_assange@oosm.org> | 2019-06-01 21:11:43 +0200 |
commit | efcf9ac3de59e6651bd7e732f778506d9b1d3d80 (patch) | |
tree | 8b3dd4e97831338c8e0b2cb5cbbf0121fc7e95bb /tmap | |
parent | 4b1e385c02c00d7cc2a22fedb176e4db6032daba (diff) |
add getPortInfo function
Diffstat (limited to 'tmap')
-rwxr-xr-x | tmap | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -9,6 +9,28 @@ import threading VERSION='1.2.1' +def getPortInfo(port, portfile): + """ + Get info about service commonly used on this port + """ + ## Read every line until EOF + while (line = f.readline()) != '': + ## Don't read lines that are commented out + if line[0] == '#': + pass + + ## Split line using tab as delimiter and read the port number + split_line = line.split('\t') + portnum = split_line[1].split('/')[0] + + ## If portnum equals port return the name of service + if int(portnum) != port: + pass + else: + return split_line[0] + return "portinfo_error" + + def getBanner(host, port, wait, notor): """ Receive first 80 bytes from port, return string of received data |