当前位置: 首页 > news >正文

python端口扫描

扫描所有端口

import socket, threading, os, timedef port_thread(ip, start, step, timeout):for port in range(start, start + step):s = socket.socket()s.settimeout(timeout)try:s.connect((ip, port))print(f"port[{port}] 可用")except Exception as e:# print(f'\rport[{port}] 连接异常[{e}]', end='')passfinally:s.close()def port_scan(ip, start=1, end=65536, step=100, timeout=0.5):for p in range(start, end, step):threading.Thread(target=port_thread, args=(ip, p, step, timeout)).start()if __name__ == '__main__':ip = '192.168.110.130'port_scan(ip=ip, timeout=0.2)

扫描常见端口

def port_scan(ip, timeout=0.5):port_list = [7, 21, 22, 23, 25, 43, 53, 67, 68, 69, 79, 80, 81, 88, 109, 110, 113, 119, 123, 135, 135,137, 138, 139, 143, 161, 162, 179, 194, 220, 389, 443, 445, 465, 513, 520, 520, 546, 547,554, 563, 631, 636, 991, 993, 995, 1080, 1194, 1433, 1434, 1494, 1521, 1701, 1723, 1755,1812, 1813, 1863, 3269, 3306, 3307, 3389, 3544, 4369, 5060, 5061, 5355, 5432, 5671, 5672, 6379,7001, 8080, 8081, 8088, 8443, 8883, 8888, 9443, 9988, 9988, 15672, 50389, 50636, 61613, 61614]for port in port_list:s = socket.socket()s.settimeout(timeout)try:s.connect((ip, port))print(f"port[{port}] 可用")except Exception as e:# print(f'\rport[{port}] 连接异常[{e}]', end='')passfinally:s.close()if __name__ == '__main__':ip = '192.168.110.130'port_scan(ip=ip, timeout=0.2)
http://www.lryc.cn/news/179756.html

相关文章:

  • 国庆第二天
  • Java安全之servlet内存马分析
  • 2023年第二十届中国研究生数学建模竞赛总结与分享
  • Web前端-Vue2+Vue3基础入门到实战项目-Day1(初始Vue, Vue指令, 小黑记事本)
  • Sentinel学习(2)——sentinel的使用,引入依赖和配置 对消费者进行流控 对生产者进行熔断降级
  • springboot 简单配置mongodb多数据源
  • 西门子S7-1200使用LRCF通信库与安川机器人进行EthernetIP通信的具体方法示例
  • pytorch第一天(tensor数据和csv数据的预处理)lm老师版
  • CSP-J第二轮试题-2021年-1.2题
  • 怒刷LeetCode的第16天(Java版)
  • 让大脑自由
  • Arcgis克里金插值报错:ERROR 010079: 无法估算半变异函数。 执行(Kriging)失败。
  • Docker Compose安装
  • 机器人过程自动化(RPA)入门 7. 处理用户事件和助手机器人
  • 在linux下预览markdown的方法,转换成html和pdf
  • AIOT入门指南:探索人工智能与物联网的交汇点
  • CCC数字钥匙设计【NFC】 --车主配对流程介绍
  • 一站式开源持续测试平台 MerterSphere 之测试跟踪操作详解
  • 自然语言处理状况简介
  • python爬虫基于管道持久化存储操作
  • 【MySQL】数据类型(二)
  • 基于Matlab实现连续模型求解方法
  • Tomcat 与 JDK 对应版本关系
  • iOS自动化测试方案(二):Xcode开发者工具构建WDA应用到iphone
  • IDEA的Maven换源
  • 步进电机只响不转
  • 使用select实现服务器并发
  • 【Python】基于OpenCV人脸追踪、手势识别控制的求实之路FPS游戏操作
  • 力扣 -- 718. 最长重复子数组
  • MP、MybatisPlus、联表查询、自定义sql、Constants.WRAPPER、ew (二)