使用python實(shí)現(xiàn)掃描端口示例
python最簡(jiǎn)潔易懂的掃描端口代碼.運(yùn)行絕對(duì)會(huì)很有驚奇感
from threading import Thread, activeCount
import socket
import os
def test_port(dst,port):
os.system('title '+str(port))
cli_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
indicator = cli_sock.connect_ex((dst, port))
if indicator == 0:
print(port)
cli_sock.close()
except:
pass
if __name__=='__main__':
dst = '192.168.0.22'
i = 0
while i < 65536:
if activeCount() <= 200:
Thread(target = test_port, args = (dst, i)).start()
i = i + 1
while True:
if activeCount() == 2:
break
input('Finished scanning.')
相關(guān)文章
Pycharm中運(yùn)行程序在Python?console中執(zhí)行,不是直接Run問題
這篇文章主要介紹了Pycharm中運(yùn)行程序在Python?console中執(zhí)行,不是直接Run問題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2022-07-07Python+OpenCV圖像處理——實(shí)現(xiàn)輪廓發(fā)現(xiàn)
這篇文章主要介紹了Python+OpenCV實(shí)現(xiàn)輪廓發(fā)現(xiàn),幫助大家更好的利用python處理圖片,感興趣的朋友可以了解下2020-10-10Python中Matplotlib的點(diǎn)、線形狀、顏色以及繪制散點(diǎn)圖
與線型圖類似的是,散點(diǎn)圖也是一個(gè)個(gè)點(diǎn)集構(gòu)成的,下面這篇文章主要給大家介紹了關(guān)于Python中Matplotlib的點(diǎn)、線形狀、顏色以及繪制散點(diǎn)圖的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),需要的朋友可以參考下2022-04-04對(duì)numpy中二進(jìn)制格式的數(shù)據(jù)存儲(chǔ)與讀取方法詳解
今天小編就為大家分享一篇對(duì)numpy中二進(jìn)制格式的數(shù)據(jù)存儲(chǔ)與讀取方法詳解,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧2018-11-11