Skip to content
KitploitKITPLOIT
工具博客
提交
工具博客
提交

黑客、渗透测试和网络安全工具,武装您的安全武器库!

Kitploit 是一个黑客、网络安全和渗透测试工具的目录。发现最新的项目更新,查找漏洞、分析系统、自动化测试并加强你的安全。

··订阅源·联系·隐私·© 2026 Kitploit

工具目录

分类

查看所有分类
Loading categories
tsharkVM — tshark + ELK 分析虚拟机 | Kitploit
工具/GitHubGitHub/h21lab/tsharkvm
数据包嗅探与分析漏洞分析网络安全入侵检测学习与教育日志分析
GitHubh21lab/tsharkvm

tsharkVM

tshark + ELK 分析虚拟机

查看仓库
681876个月前Kitploit 审核通过

最受欢迎

查看全部 →

发现我们社区最常用的工具。

探索所有工具

浏览我们的工具集合

查看所有工具 →
分享
网站

💡 更新:tshark-opensearch

最新应用 tshark-opensearch 现已可用。

您可以在 https://github.com/h21-lab/apps-collection-info 仓库中找到它。 👉 获取访问权限

tshark ELK 虚拟机设备

该项目构建了一台可用于分析 tshark -T ek (ndjson) 输出的虚拟机。 该虚拟设备使用 vagrant 构建,构建的 Debian 系统预装了 ELK 栈并已配置完成。

VM 启动后,流程很简单:

  • 解码后的 pcap 文件(tshark -T ek 输出 / ndjson)通过 TCP/17570 发送到 VM
  • VM 中的 ELK 栈会处理并索引数据
  • VM 中运行着 Kibana,可通过 http://127.0.0.1:15601/app/kibana#/dashboards 访问

从 Ubuntu 桌面构建 VM 的步骤

克隆源代码

root@kitploit:~
git clone https://github.com/H21lab/tsharkVM.git

构建 tshark VM

root@kitploit:~
sudo apt update
sudo apt install tshark virtualbox vagrant
vagrant plugin install vagrant-disksize
vagrant plugin install vagrant-scp
bash ./build.sh

将 pcap 文件上传到 VM

root@kitploit:~
# 将你的 pcap 文件复制到 ./Trace 目录

# 上传 pcap 文件(保留文件名)
bash upload_pcaps_with_filenames.sh

# 或者使用 vagrant scp 将 ndjson 文件复制到 /home/vagrant/input

# 或者上传 pcap 文件(不保留文件名)
bash upload_pcaps.sh

# 或者直接通过 tshark 向 127.0.0.1 17570/tcp 发送
tshark -r trace.pcapng -x -T ek > /dev/tcp/localhost/17570

使用浏览器打开 Kibana

root@kitploit:~
firefox http://127.0.0.1:15601/app/kibana#/dashboards

打开主仪表板,将时间窗口调大(例如最近 100 年),即可看到示例 pcap 数据。

SSH 登录 VM

root@kitploit:~
cd ./VM
vagrant ssh

删除 VM

root@kitploit:~
cd ./VM
vagrant destroy default

启动 VM

root@kitploit:~
cd ./VM
vagrant up

停止 VM

root@kitploit:~
cd ./VM
vagrant halt

SSH 登录 VM 并检查 ELK 是否正常运行

root@kitploit:~
cd ./VM
vagrant ssh
sudo systemctl status kibana.service
sudo systemctl status elasticsearch.service
sudo systemctl status logstash.service

Elasticsearch 映射模板

项目中包含了一个简单的 Elasticsearch 映射模板,该模板针对 frame,eth,ip,udp,tcp,dhcp 协议生成。 为了高效处理其他协议,可能需要按照以下方式更新映射模板:

root@kitploit:~
# 1. 通过选择所需协议创建自定义映射
tshark -G elastic-mapping --elastic-mapping-filter frame,eth,ip,udp,tcp,dns > ./Kibana/custom_tshark_mapping.json

# 2. 对映射进行去重和后处理,以适配当前 Elasticsearch 版本
ruby ./Public/process_tshark_mapping_json.rb

# 3. 将文件上传到 vagrant VM
cd VM
vagrant upload ../Kibana/custom_tshark_mapping_deduplicated.json /home/vagrant/tsharkVM/Kibana/custom_tshark_mapping_deduplicated.json
cd ..

# 4. 连接 VM 并将模板上传到 Elasticsearch
cd VM
vagrant ssh
cd tsharkVM/Kibana
curl -X PUT "localhost:9200/_index_template/packets_template" -H 'Content-Type: application/json' -d@custom_tshark_mapping_deduplicated.json

另一种方法是使用动态映射。请参见模板 ./Kibana/template_tshark_mapping_dynamic.json。并根据映射需求及使用的 pcap 文件,考虑将 numeric_detection 参数设置为 true 或 false。按照上述类似方式将模板上传到 Elasticsearch。

局限

tshark -G elastic-mapping --elastic-mapping-filter 生成的映射可能已过时,未能正确跟随 Elasticsearch 的变化,且输出可能存在重复。需要手动配置和后处理映射模板。

程序按“原样”分发,希望它有用,但不提供任何担保。

许可证

本项目提供的源代码默认采用 Apache License v2.0。

simple-NIDS 采用 AGPLv3(自由开源 GNU Affero GPL v3.0)许可证。

此外,请分别参考所安装软件的各自许可证和使用条款(参见 Wireshark、Elastic 及其他软件的许可证)。

致谢

特别感谢为 Wireshark 开发提供帮助或以其他方式为这项工作做出贡献的人士:

  • Anders Broman
  • Alexis La Goutte
  • Christoph Wurm
  • Dario Lombardo
  • Vic Hargrave

./Traces 子文件夹中的示例 pcap 文件下载自 https://wiki.wireshark.org/SampleCaptures

由 Martin Kacer 创建

版权所有 2021 H21 lab,保留所有权利,https://www.h21lab.com

下载工具