首页 编程 Python 查看内容

ChatGPT实践:扫描指定网段显示运行IIS的主机

2023-2-14 13:30 |原作者: 猿哥 2830 0

摘要: import socket # Specify the target subnet subnet = 10.0.0.0/24 # Create a socket object s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # Connect the socket to the port where the IIS server ...
关键词: socket quot server running request IIS 10.0 data address Connect

import socket

# Specify the target subnet
subnet = "10.0.0.0/24"

# Create a socket object
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

# Connect the socket to the port where the IIS server is listening
server_address = ('10.0.0.1', 80)
s.connect(server_address)

# Send HTTP GET request
request = "GET / HTTP/1.1\r\nHost: 10.0.0.1\r\n\r\n"
s.sendall(request)

# Receive data
data = s.recv(1024)

# Check whether the server is running IIS
if "Server: Microsoft-IIS" in data:
    print("Host is running IIS")
else:
    print("Host is not running IIS")

# Close the socket
s.close()


声明:文章版权归原作者所有 部分文章转自互联网 如有侵权请联系 [邮箱地址] 删除

路过

雷人

握手

鲜花

鸡蛋

最新评论

返回顶部