mac开启22端口
选择System prefrence -> sharing , 将remote login打开
测试是否打开
import
socket
s = socket.socket()
s.connect((‘127.0.0.1‘,22))
s.send(‘scan‘)
banner = s.recv(1024)
print
banner
端口扫描
import
socket
for
port
in range(20,25):
try:
s = socket.socket()
print
"[+] Attempting to connect to 127.0.0.1: "
+ str(port)
s.connect((‘127.0.0.1‘, port))
s.send(‘scan‘)
banner = s.recv(1024)
if banner:
print
"[+] Port " + str(port) +
" open: \n"
+ banner
s.close()
except:
pass
时间: 2024-10-01 06:25:26