python渗透测试问题

问题描述

我在关注 youtube 渗透测试教程 一切都很好,但突然繁荣。 所以这是他的教程中的问题,portscanner 显示了横幅,但在我的 portscanner 中,它不显示横幅。

这是代码

from IPy import IP
import socket

def scan(target):
    converted_ip = check_ip(target)
    print('\n' + '>> Scanning target ' + str(target))
    for port in range(1,100):
        scan_port(converted_ip,port)

def check_ip(ip):
    try:
        IP(ip)
        return(ip)
    except ValueError:
        return socket.gethostbyname(ip)

def get_banner(s):
    return s.recv(1024)

def scan_port(ipaddress,port):
    try:
        sock = socket.socket()
        sock.settimeout(0.5)
        sock.connect((ipaddress,port))
        try:
            banner = get_banner(sock)
            print('>> Port ' + str(port) + ' is open : ' + str(banner.decode().strip('\n')))
        except:
            print('>> Port ' + str(port) + ' is open')
    except:
        pass

targets = input('<< Enter target/s to scan(split targets with,): ')

if ',' in targets:
    for ipadd in targets.split(','):
        scan(ipadd.strip(' '))
else:
    scan(targets)

我能看到的唯一区别是他在虚拟机上使用了 kali linux,但我使用的是 strait ubuntu 20.04 LTS,这有什么区别吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)