2019-03-23 22:02:55 +00:00
|
|
|
import socket
|
2019-07-05 14:26:25 +00:00
|
|
|
from core.prototypes.AbstractScanner import AbstractScanner
|
2019-03-23 22:02:55 +00:00
|
|
|
|
|
|
|
class CoreModel(AbstractScanner):
|
2019-11-13 16:15:54 +00:00
|
|
|
def __init__(self, timeout:"timeout"):
|
2019-03-23 22:02:55 +00:00
|
|
|
self.defSocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
|
|
self.defSocket.settimeout(int(timeout))
|
|
|
|
|
2019-07-05 14:26:25 +00:00
|
|
|
def scan_address(self, host:'ipv4_str', port:'port') -> {'scan_result'}:
|
|
|
|
result = dict()
|
2019-03-23 22:02:55 +00:00
|
|
|
if not host: raise Exception
|
2019-07-05 14:26:25 +00:00
|
|
|
result["scan_result"] = self.defSocket.connect_ex((host, port))
|
2019-03-23 22:02:55 +00:00
|
|
|
self.defSocket.close()
|
|
|
|
return result
|