当前位置: IT大杂烩 > Ubuntu  > mac开启22端口

mac开启22端口

www.someabcd.com  网友分享于:Jun 8, 2018 5:51:59 PM

标签:python

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

mac开启22端口

标签:python

发布此文章仅为传递网友分享,不代表本站观点,若侵权请联系我们删除,本站将不对此承担任何责任。
Copyright ©2018  IT大杂烩  版权所有  京ICP备11030978号-1 网站地图