November 2017
Intermediate to advanced
226 pages
5h 59m
English
We can create a simple port scanner with the socket module, following are the steps:
import socket,sys,os
Import the socket module along with the sys and os modules
host = 'example.com' open_ports =[] start_port = 1 end_port = 10
Here we define the starting and ending ports that we plan to scan
ip = socket.gethostbyname(host)
Here we use the gethostbyname method in the socket module. This will return the IP of the domain
def probe_port(host, port, result = 1): try: sockObj = socket.socket(socket.AF_INET, ...
Read now
Unlock full access