fscan内网资产扫描并输出陈诉

去皮卡多  金牌会员 | 2024-6-28 17:27:50 | 来自手机 | 显示全部楼层 | 阅读模式
打印 上一主题 下一主题

主题 918|帖子 918|积分 2754

fscan内网资产扫描并输出陈诉

fscan介绍

一款内网综合扫描工具,方便一键自动化、全方位漏扫扫描。
支持主机存活探测、端口扫描、常见服务的爆破、ms17010、redis批量写公钥、计划任务反弹shell、读取win网卡信息、web指纹识别、web漏洞扫描、netbios探测、域控识别等功能。
fscan开源,github上游详细的说明,详见:https://github.com/shadow1ng/fscan
使用说明(Linux)


  • 指定单个IP
  1. ./fscan -h 192.168.160.1
复制代码

  • 指定网段
  1. ./fscan -h 192.168.75.0/24
复制代码

  • 将扫描结果保存到指定文件(默认保存到:result.txt)
  1. ./fscan -h 192.168.75.0/24 -o 192-168-75-0-24.txt
复制代码

  • 扫描结果样例
  1.    ___                              _   
  2.   / _ \     ___  ___ _ __ __ _  ___| | __
  3. / /_\/____/ __|/ __| '__/ _` |/ __| |/ /
  4. / /_\\_____\__ \ (__| | | (_| | (__|   <   
  5. \____/     |___/\___|_|  \__,_|\___|_|\_\   
  6.                      fscan version: 1.8.4
  7. start infoscan
  8. 192.168.160.1:8089 open
  9. 192.168.160.1:9000 open
  10. 192.168.160.1:22 open
  11. 192.168.160.1:80 open
  12. 192.168.160.1:8008 open
  13. 192.168.160.1:3306 open
  14. 192.168.160.1:9001 open
  15. 192.168.160.1:8012 open
  16. 192.168.160.1:8443 open
  17. 192.168.160.1:8083 open
  18. [*] alive ports len is: 10
  19. start vulscan
  20. [*] WebTitle http://192.168.160.1      code:307 len:61     title:None 跳转url: http://192.168.22.68:9001
  21. [*] WebTitle http://192.168.160.1:9000 code:307 len:61     title:None 跳转url: http://192.168.160.1:9001
  22. [*] WebTitle http://192.168.22.68:9001 code:200 len:1310   title:MinIO Console
  23. [*] WebTitle http://192.168.160.1:9001 code:200 len:1310   title:MinIO Console
  24. [*] WebTitle http://192.168.160.1:8089 code:403 len:555    title:403 Forbidden
  25. [*] WebTitle http://192.168.160.1:8012 code:302 len:0      title:None 跳转url: http://192.168.160.1:8012/index
  26. [*] WebTitle http://192.168.160.1:8012/index code:200 len:12409  title:kkFileView演示首页
  27. [*] WebTitle http://192.168.160.1:9001 code:200 len:1310   title:MinIO Console
  28. [*] WebTitle https://192.168.160.1:8083 code:502 len:559    title:502 Bad Gateway
  29. [*] WebTitle https://192.168.160.1:8443 code:404 len:232    title:404 Not Found
  30. [*] WebTitle http://192.168.160.1:8008 code:404 len:232    title:404 Not Found
  31. [+] SSH 192.168.12.20:22:root root
  32. [+] SSH 192.168.12.19:22:root root
  33. [+] SSH 192.168.12.18:22:root root
  34. [+] PocScan https://192.168.69.58:8443 poc-yaml-springboot-cve-2021-21234 spring3
  35. [+] PocScan https://192.168.69.61:8443 poc-yaml-springboot-cve-2021-21234 spring3
  36. [+] PocScan http://192.168.69.58:18000 poc-yaml-springboot-cve-2021-21234 spring3
复制代码
输出陈诉

可以看出来,fscan扫出来的内容包含很多描述性的INFO级别日志,如何提取出主要信息并输出陈诉。
可以结合Python + Pandas的情势利用正则表达式提取出主要信息再通过Pandas导出Excel。

  • 首先要有Python3.5+的Python情况
  • 安装pandas
  1. pip install pandas
复制代码

  • 代码部门
  1. #!/usr/bin/env python
  2. # -*- coding:utf-8 -*-
  3. # @Time:2024/6/27 14:35
  4. # @Software:PyCharm
  5. __author__ = "JentZhang"
  6. import re
  7. import pandas
  8. def extract_info(text):
  9.     # 匹配SSH类型的文本
  10.     pattern = re.compile(r'\[\+\] (.+) (http://|https://)?([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})(:(\d+))?.*')
  11.     match = pattern.search(text)
  12.     if match:
  13.         return {
  14.             '类型': match.group(1),
  15.             'IP': match.group(3),
  16.             '端口': match.group(5)
  17.         }
  18.     return None
  19. def extract_lines(filepath, start_msg='[+]'):
  20.     """
  21.     抽取扫描结果中的指定行
  22.     :param filepath:
  23.     :param start_msg:
  24.     :return:
  25.     """
  26.     matching_lines = []
  27.     with open(filepath, 'r', encoding='utf-8') as file:
  28.         for line in file:
  29.             if line.startswith(start_msg):
  30.                 matching_lines.append(line.strip())
  31.     return matching_lines
  32. def export_to_excel(data, filename):
  33.     """
  34.     导出数据到excel
  35.     :param data:
  36.     :param filename:
  37.     :return:
  38.     """
  39.     df = pandas.DataFrame(data)
  40.     df.to_excel(f"{filename}资产测绘.xlsx", index=False)
  41. def analysis_data(file_data):
  42.     """
  43.     分析扫描的文件数据
  44.     :param file_data:
  45.     :return:
  46.     """
  47.     res = []
  48.     for i in file_data:
  49.         # print(f"before: {i}")
  50.         info = extract_info(i)
  51.         if info:
  52.             info["扫描结果"] = i
  53.             res.append(info)
  54.             # print(f"after: {info}")
  55.     return res
  56. if __name__ == '__main__':
  57.     # files = ["10_139_0_0_23.txt", "10_139_162_0_23.txt", "10_139_176_0_21.txt"]
  58.     files = ["172_16_0_0_16.txt"]
  59.     for file in files:  # 循环便利扫描的结果文件,分析出结果并导出Excel
  60.         d = extract_lines(file)
  61.         export_to_excel(analysis_data(d), file.split(".")[0])
复制代码

  • 陈诉样式


免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
回复

使用道具 举报

0 个回复

倒序浏览

快速回复

您需要登录后才可以回帖 登录 or 立即注册

本版积分规则

去皮卡多

金牌会员
这个人很懒什么都没写!
快速回复 返回顶部 返回列表