Skip to content

Commit efb45ee

Browse files
authored
Update README.md
1 parent 5791026 commit efb45ee

File tree

1 file changed

+0
-45
lines changed

1 file changed

+0
-45
lines changed

README.md

-45
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,3 @@
11
# Python-
2-
Python的小项目记录我成长的点滴
32

43
扫描ç段存活主机
5-
6-
import threading
7-
import Queue
8-
import subprocess
9-
import sys
10-
11-
class Ping(threading.Thread):
12-
13-
def __init__(self,queue):
14-
threading.Thread.__init__(self)
15-
self._queue = queue
16-
17-
def run(self):
18-
result = []
19-
while not self._queue.empty():
20-
ip = self._queue.get()
21-
result = subprocess.Popen('ping -n 2 %s'%ip,stdout=subprocess.PIPE)
22-
data = result.stdout.read().decode('gbk')
23-
if "TTL" in data:
24-
print(ip)
25-
26-
27-
28-
def main():
29-
30-
threads = []
31-
threads_count = 50
32-
queue = Queue.Queue()
33-
34-
for i in range(1,255):
35-
queue.put('106.75.137.' + str(i))
36-
37-
for i in range(threads_count):
38-
threads.append(Ping(queue))
39-
40-
for i in threads:
41-
i.start()
42-
43-
for i in threads:
44-
i.join()
45-
46-
if __name__ == "__main__":
47-
48-
main()

0 commit comments

Comments
 (0)