The first step for any potential hackers is almost always trying to learn which service is open on the network, so they can concentrate their effort on the attack. Of course, we need to open certain ports in order to service our customer; that is part of the risk we need to accept. But we should also close any other open port that needlessly expose a larger attack surface. We can use Scapy to do a simple TCP open port scan to scan our own host.
We can send a SYN packet and see whether the server will return with SYN-ACK:
>>> p = sr1(IP(dst="10.0.0.14")/TCP(sport=666,dport=23,flags="S"))>>> p.show()###[ IP ]### version= 4L ihl= 5L tos= 0x0 len= 40 id= 25373 flags= DF frag= 0L ttl= 62 proto= tcp chksum= 0xc59b src= 10.0.0.14 ...