如何利用Python实现一个安全工具
Admin 2022-08-19 群英技术资讯 523 次浏览
#!/usr/bin/python3 # -*- coding: utf-8 -*- from socket import * def portScanner(host,port): try: s = socket(AF_INET,SOCK_STREAM) s.connect((host,port)) print('[+] %d open' % port) s.close() except: print('[-] %d close' % port) def main(): setdefaulttimeout(1) for p in range(1,1024): portScanner('192.168.0.100',p) if __name__ == '__main__': main()
说明:
#!/usr/bin/python3 # -*- coding: utf-8 -*- from socket import * import threading lock = threading.Lock() openNum = 0 threads = [] def portScanner(host,port): global openNum try: s = socket(AF_INET,SOCK_STREAM) s.connect((host,port)) lock.acquire() openNum+=1 print('[+] %d open' % port) lock.release() s.close() except: pass def main(): setdefaulttimeout(1) for p in range(1,1024): t = threading.Thread(target=portScanner,args=('192.168.0.100',p)) threads.append(t) t.start() for t in threads: t.join() print('[*] The scan is complete!') print('[*] A total of %d open port ' % (openNum)) if __name__ == '__main__': main()
说明:
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:mmqy2019@163.com进行举报,并提供相关证据,查实之后,将立刻删除涉嫌侵权内容。
猜你喜欢
这篇文章主要介绍pytorch中常用损失函数以及用法,对新手学习pytorch中损失函数有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章能有所收获,接下来小编带着大家一起了解看看。
这篇文章给大家分享的是有关python算法的内容,主要介绍python实现二分查找和选择排序。小编觉得挺实用的,因此分享给大家做个参考,感兴趣的朋友一起跟随小编看看吧。
这篇文章主要介绍了python删除csv文件中的某几列或行,主要介绍了python对csv删除的方法,感兴趣的同学可以参考学习
这篇文章主要介绍了pandas读取excel时获取读取进度的实现,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
python怎样实现九宫格图片?我们常常能在朋友圈看到一张图片分成九宫格的图片,很多朋友都觉得挺有意思的,那么这是怎样做的呢?下面我们就来看看用Python怎样实现九宫格图片功能。
成为群英会员,开启智能安全云计算之旅
立即注册Copyright © QY Network Company Ltd. All Rights Reserved. 2003-2020 群英 版权所有
增值电信经营许可证 : B1.B2-20140078 粤ICP备09006778号 域名注册商资质 粤 D3.1-20240008