fscan内网资产扫描并输出报告
  

Hacking 327

{{ttag.title}}

fscan介绍
一款内网综合扫描工具,方便一键自动化、全方位漏扫扫描。
支持主机存活探测、端口扫描、常见服务的爆破、ms17010redis批量写公钥、计划任务反弹shell、读取win网卡信息、web指纹识别、web漏洞扫描、netbios探测、域控识别等功能。
fscan开源,github上游详细的说明,详见:https://github.com/shadow1ng/fscan
使用说明(Linux)
· 指定单个IP
./fscan -h 192.168.160.1
· 指定网段
./fscan -h 192.168.75.0/24
· 将扫描结果保存到指定文件(默认保存到:result.txt
./fscan -h 192.168.75.0/24 -o 192-168-75-0-24.txt
· 扫描结果样例
   ___                              _      / _ \     ___  ___ _ __ __ _  ___| | __  / /_\/____/ __|/ __| '__/ _` |/ __| |/ // /_\\_____\__ \ (__| | | (_| | (__|   <    \____/     |___/\___|_|  \__,_|\___|_|\_\                        fscan version: 1.8.4start infoscan192.168.160.1:8089 open192.168.160.1:9000 open192.168.160.1:22 open192.168.160.1:80 open192.168.160.1:8008 open192.168.160.1:3306 open192.168.160.1:9001 open192.168.160.1:8012 open192.168.160.1:8443 open192.168.160.1:8083 open
  • alive ports len is: 10start vulscan
  • WebTitle http://192.168.160.1      code:307 len:61     title:None 跳转url: http://192.168.22.68:9001
  • WebTitle http://192.168.160.1:9000 code:307 len:61     title:None 跳转url: http://192.168.160.1:9001
  • WebTitle http://192.168.22.68:9001 code:200 len:1310   title:MinIO Console
  • WebTitle http://192.168.160.1:9001 code:200 len:1310   title:MinIO Console
  • WebTitle http://192.168.160.1:8089 code:403 len:555    title:403 Forbidden
  • WebTitle http://192.168.160.1:8012 code:302 len:0      title:None 跳转url: http://192.168.160.1:8012/index
  • WebTitle http://192.168.160.1:8012/index code:200 len:12409  title:kkFileView演示首页
  • WebTitle http://192.168.160.1:9001 code:200 len:1310   title:MinIO Console
  • WebTitle https://192.168.160.1:8083 code:502 len:559    title:502 Bad Gateway
  • WebTitle https://192.168.160.1:8443 code:404 len:232    title:404 Not Found
  • WebTitle http://192.168.160.1:8008 code:404 len:232    title:404 Not Found[+] SSH 192.168.12.20:22:root root[+] SSH 192.168.12.19:22:root root[+] SSH 192.168.12.18:22:root root[+] PocScan https://192.168.69.58:8443 poc-yaml-springboot-cve-2021-21234 spring3[+] PocScan https://192.168.69.61:8443 poc-yaml-springboot-cve-2021-21234 spring3[+] PocScan http://192.168.69.58:18000 poc-yaml-springboot-cve-2021-21234 spring3
  • 输出报告
    可以看出来,fscan扫出来的内容包含很多描述性的INFO级别日志,如何提取出主要信息并输出报告。
    可以结合Python + Pandas的形式利用正则表达式提取出主要信息再通过Pandas导出Excel
    · 首先要有Python3.5+Python环境
    · 安装pandas
    pip install pandas
    · 代码部分
    #!/usr/bin/env python# -*- coding:utf-8 -*-# @Time2024/6/27 14:35# @SoftwarePyCharm__author__ = "JentZhang"
    import re
    import pandas
    def extract_info(text):
        # 匹配SSH类型的文本    pattern = re.compile(r'\[\+\] (.+) (http://|https://)?([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})(\d+))?.*')
        match = pattern.search(text)
        if match:        return {            '类型': match.group(1),            'IP': match.group(3),            '端口': match.group(5)        }
        return None
    def extract_lines(filepath, start_msg='[+]'):    """    抽取扫描结果中的指定行    :param filepath:    :param start_msg:    :return:    """    matching_lines = []    with open(filepath, 'r', encoding='utf-8') as file:        for line in file:            if line.startswith(start_msg):                matching_lines.append(line.strip())    return matching_lines
    def export_to_excel(data, filename):    """    导出数据到excel    :param data:    :param filename:    :return:    """    df = pandas.DataFrame(data)    df.to_excel(f"{filename}资产测绘.xlsx", index=False)
    def analysis_data(file_data):    """    分析扫描的文件数据    :param file_data:    :return:    """    res = []    for i in file_data:        # print(f"before: {i}")        info = extract_info(i)        if info:            info["扫描结果"] = i            res.append(info)            # print(f"after: {info}")    return res
    if __name__ == '__main__':    # files = ["10_139_0_0_23.txt", "10_139_162_0_23.txt", "10_139_176_0_21.txt"]    files = ["172_16_0_0_16.txt"]    for file in files:  # 循环便利扫描的结果文件,分析出结果并导出Excel        d = extract_lines(file)        export_to_excel(analysis_data(d), file.split(".")[0])
    · 报告样式
    file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml9540\wps1.png

    打赏鼓励作者,期待更多好文!

    打赏
    暂无人打赏

    发表新帖
    热门标签
    全部标签>
    【 社区to talk】
    每日一问
    新版本体验
    标准化排查
    纪元平台
    功能体验
    GIF动图学习
    信服课堂视频
    安全效果
    产品连连看
    技术笔记
    解决方案
    答题自测
    2023技术争霸赛专题
    高手请过招
    产品解析
    秒懂零信任
    安装部署配置
    排障笔记本
    技术晨报
    平台使用
    每周精选
    故障笔记
    社区新周刊
    畅聊IT
    专家问答
    技术圆桌
    在线直播
    MVP
    网络基础知识
    升级
    安全攻防
    上网策略
    测试报告
    日志审计
    问题分析处理
    流量管理
    每日一记
    运维工具
    用户认证
    原创分享
    sangfor周刊
    VPN 对接
    项目案例
    SANGFOR资讯
    专家分享
    技术顾问
    信服故事
    SDP百科
    功能咨询
    终端接入
    授权
    设备维护
    资源访问
    地址转换
    虚拟机
    存储
    迁移
    产品预警公告
    玩转零信任
    S豆商城资讯
    技术争霸赛
    「智能机器人」
    追光者计划
    卧龙计划
    华北区拉练
    天逸直播
    以战代练
    技术盲盒
    山东区技术晨报
    文档捉虫
    齐鲁TV
    华北区交付直播
    2024年技术争霸赛
    北京区每日一练
    场景专题
    排障那些事
    西北区每日一问
    升级&主动服务
    高频问题集锦
    POC测试案例
    全能先锋系列
    云化安全能力
    专家说
    热门活动
    产品动态
    行业实践
    关键解决方案

    本版版主

    37
    63
    0

    发帖

    粉丝

    关注

    本版热帖

    本版达人