mirror of
https://github.com/ChronosX88/PyNesca.git
synced 2024-11-22 13:12:18 +00:00
15 lines
529 B
Python
15 lines
529 B
Python
import socket
|
|
from core.prototypes.AbstractScanner import AbstractScanner
|
|
|
|
class CoreModel(AbstractScanner):
|
|
def __init__(self, timeout):
|
|
self.defSocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
self.defSocket.settimeout(int(timeout))
|
|
|
|
def scan_address(self, host:'ipv4_str', port:'port') -> {'scan_result'}:
|
|
result = dict()
|
|
if not host: raise Exception
|
|
result["scan_result"] = self.defSocket.connect_ex((host, port))
|
|
self.defSocket.close()
|
|
return result
|