Lets make a simple port scanner with opens a full TCP connection to detect if a port is open or not.
This is not the best way to scan because it makes a lot of noise, some other ways are Half TCP (TCP SYN) and TCP FIN.
Code in python::
import socket
i = “127.0.0.1″
for p in range(19, 26):
spy = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
spy.connect((i, p)
import socket
i = “127.0.0.1″
for p in range(19, 26):
spy = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
spy.connect((i, p)