Saturday, March 28, 2020

How to creat a live pentration tool for port scanning and ip finding using pyton programming

Making Your Port Scanner


port scanning is a method in which we can assess which of ports is open and which is the ports is closed
A port scanner allow you to look at the hosts and services that are attached to them. 

source code:

import socket
from datetime import datetime
target=input("Enter the target:")
print("_*"*60)
ip=socket.gethostbyname(target)
print(ip)
t1=datetime.now()
    
for port in range(1,500):
        
    sock=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
    result=sock.connect_ex((ip,port))
    if result==0:
        
        print(f"port open:{port}")
    
    sock.close()
t2=datetime.now()
print(f"time{t2-t1}")
       
    
--------------------------------------------------------------------------------------------------------


No comments:

Post a Comment

Python Happy Birthday Program

import turtle from random import randint , choice width = 700 height = 500 S = turtle . Screen () S . setup ( width , height ) S . bg...