Open all PORTS

This multi threaded python script can be used to open a certain range of TCP port of a PC.
If you are conducting network security scans,then its very important to check if your ISP's firewall is filtering any packet/ports or not.Your scan result may contain false+ve if your ISP is blocking any malicious packets.
So you can use the script to open all ports of a sample target and probe the target with various crafted packets.(ex. Nmap,Nessus)
If the scan result returns the expected result,Then its fine,but if you get some ports are closed but,you know that its open then its a thing to worry for security scanning.
You have to change the 2nd last line to select the tcp PORT range.

Here is the python script:

import socket
import thread
from threading import *
def handler(clientsock,addr):
    while 1:
        data = clientsock.recv(BUFSIZ)
        if not data:
            break
def openport(PORT):
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    HOST = socket.gethostname()
    #PORT = 1234
    BUFSIZ = 1024
    s.bind((HOST,PORT))
    s.listen(5)
    print 'Listening on port :',PORT
    while 1:
        print 'Waiting for connection:'
        clientsock, addr = s.accept()
        print 'Connected with: ', addr
        thread.start_new_thread(handler, (clientsock, addr))
        for P in range(1,5):    #The port range to open
            thread.start_new_thread(openport, (P,))

Comments

  1. WBBSE 10th Question Paper 2022 Blueprint, Students can Download Question Paper and Prepare yourself under these Sample Paper because these Question Paper will be valid for Annual Examination of session 2022 also, WBBSE 10th Solved Question Paper 2022 Question Pattern is very helpful for the students to know the 10th Exam Past Year Question Paper analysis. Students can Download WB 10th Question Paper 2022 utilize the Previous Exam paper for the Reference for final Examination, Steady the repeated questions from WB 10th Model Question Paper 2022 Practice on those is the better way to get the good Grade.

    ReplyDelete

Post a Comment