姊妹篇:[https][tls] 如何使用wireshark查看tls/https加密消息

一,编译,启用strongswan的save-keys plugin

./configure --prefix=/root/OUTPUT --exec-prefix=/root/OUTPUT --enable-save-keys  CFLAGS="-g -O0"

运行之前验证一下,是否加载了这个插件

[root@T9 OUTPUT]# ./sbin/swanctl --stat |grep save
loaded plugins: charon aes save-keys des rc2 sha2 sha1 md5 mgf1 random nonce x509 revocation constraints pubkey
pkcs1 pkcs7 pkcs8 pkcs12 pgp dnskey sshkey pem fips-prf gmp curve25519 xcbc cmac hmac attr kernel-netlink
resolve socket-default stroke vici updown xauth-generic counters

二,增加如下配置

charon {
load_modular = yes
plugins {
include strongswan.d/charon/*.conf
save-keys {
esp = yes
ike = yes
load = yes
wireshark_keys = /root/OUTPUT/etc/keys
}
}

详细的解释,可以查man手册

       charon.plugins.save-keys.esp [no]
Whether to save ESP keys.
charon.plugins.save-keys.ike [no]
Whether to save IKE keys.
charon.plugins.save-keys.load [no]
Whether to load the plugin.
charon.plugins.save-keys.wireshark_keys []
Directory where the keys are stored in the format supported by Wireshark. IKEv1 keys are stored in the ikev1_decryption_table file.
IKEv2 keys are stored in the ikev2_decryption_table file.
Keys for ESP CHILD_SAs are stored in the esp_sa file.

三,正常运行之后,这个目录下,就会存着key了,同时把包抓下来

./sbin/swanctl --load-all
./sbin/ipsec up net-net

查看保存的key

[root@T9 OUTPUT]# ll etc/keys/
total
-rw-r--r-- root root Dec : esp_sa
-rw-r--r-- root root Dec : ikev2_decryption_table

四,配置wireshark

IKE:

edit->preferences->protocols->ISAKMP->IKEv2 Decryption Table->Edit

如图,看见这后边有个蓝色的文件名。

用前边获得的那个文件覆盖它。

cp ikev2_decryption_table /home/tong/.config/wireshark/ikev2_decryption_table

ESP:

edit->preferences->protocols->ESP->Edit

然后点加号,编辑

或者。直接cp进去到配置目录

cp esp_sa /home/tong/.config/wireshark/

五。用wirshark再次打开之前抓到的pcap包。

好了。现在的IKEV2和ESP都是解密过的了。

[ipsec][strongswan] 使用wireshark查看strongswan ipsec esp ikev1 ikev2的加密内容的更多相关文章

  1. [https][tls] 如何使用wireshark查看tls/https加密消息--使用keylog

    姊妹篇: [ipsec][strongswan] 使用wireshark查看strongswan ipsec esp ikev1 ikev2的加密内容 [https][tls] 如何使用wiresha ...

  2. tcpdump抓包和scp导出以及wireshark查看

    [命令和工具] tcpdump scp wireshark  (1)tcpdump sudo tcpdump -i eth0 -w /home/tcpdump/1.pcap host 10.214.1 ...

  3. [https][tls] 如何使用wireshark查看tls/https加密消息--使用私钥

    之前总结了使用keylog进行https流量分析的方法: [https][tls] 如何使用wireshark查看tls/https加密消息--使用keylog 今天总结一下使用服务器端证书私钥进行h ...

  4. Wireshark 查看指定进程的网络包

    Wireshark 查看指定进程的网络包 打开任务管理器,右键筛选列,选中PID(进程标识符): 找到该进程对应的PID,如1200: 在cmd中执行netstat -ano|findstr 1200 ...

  5. SQL点点滴滴_查看所有存储过程或视图的位置及内容

    代码:select a.name,a.[type],b.[definition] from sys.all_objects a,sys.sql_modules b where a.is_ms_ship ...

  6. Visual Studio Code 帮助查看器,指定的用于安装帮助内容的位置无效,或者您无权访问该位置

    今天有个C# 类库文件里面的属性想要了解下,想到了Vs的帮助文档,其实也就是微软的MSDN:提示帮助查看器,指定的用于安装帮助内容的位置无效,或者您无权访问该位置: 最近两天vs也没有更新,并且也没有 ...

  7. 下面哪些命令可以查看file1文件的第300-500行的内容?

    下面哪些命令可以查看file1文件的第300-500行的内容? cat file1 | tail -n +300 | head -n 200 cat file1| head -n 500 | tail ...

  8. [ipsec] 特别硬核的ike/ipsec NAT穿越机制分析

    〇 前言 这怕是最后一篇关于IKE,IPSEC的文字了,因为不能没完没了. 所以,我一直在想这个标题该叫什么.总的来说可以将其概括为:IKE NAT穿越机制的分析. 但是,同时它也回答了以下问题: ( ...

  9. Wireshark查看https的通讯

    如果有服务端的证书,那我们可以分析web下https的通讯情况,在特别的场景下有一定的用处,如外部审计 如下是在wireshark或tshark中配置查看https的设置 wireshark验证 ts ...

随机推荐

  1. Spring注解@Configuration和Java Config

    1.从Spring 3起,JavaConfig功能已经包含在Spring核心模块,它允许开发者将bean定义和在Spring配置XML文件到Java类中.但是,仍然允许使用经典的XML方式来定义bea ...

  2. POJ 1410 Intersection (线段和矩形相交)

    题目: Description You are to write a program that has to decide whether a given line segment intersect ...

  3. 【原创】大数据基础之Zookeeper(4)应用场景

    1 集群配置管理 应用服务器的配置通常会放到properties文件中,格式为: system1.module2.prop3=value4 然后启动的时候加载,这样带来的问题是启动后无法修改,想修改必 ...

  4. 实现JWT刷新机制以及让过期时间更精确

      借助accessToken和refreshToken实现   accessToken控制刷新间隔,refreshToken控制最长过期时间   Min过期时间 = refreshToken过期时间 ...

  5. 关于eclipse从svn导入项目

    第一次直接从eclipse svn资源库输入svn url直接将项目下载到workspace结果,web项目成了Java项目,这样操作是错误的 正确的操作应该是: file,import ,找到svn ...

  6. js 读取文件

    读取文本文件 读取文本文件: <input type="file" id="file1" accept="*" /> </ ...

  7. 微信小程序换皮肤,动态切换菜单栏和导航栏的样式,动态修改TabBar和NavigationBar

    在做微信小程序换皮肤的时候,需要动态修改菜单栏(TabBar)和导航栏(NavigationBar) 但是在小程序中它们的样式是写在app.json里面,而且app.json是静态编译,运行时哪怕你修 ...

  8. H5测试与PC端测试不同的点

    1.通过H5网页(非手机的返回功能)的返回功能可以返回,不会出现无法返回的情况. 2.横屏竖屏相互切换,能自适应,并且布局不会乱掉: 3.为能在不同分辨率的手机上能更好的展示,建议采用响应式设计(如: ...

  9. Kali Linux常用服务配置教程DHCP服务原理

    Kali Linux常用服务配置教程DHCP服务原理 动态主机配置协议(Dynamic Host Configuration Protocol,简称DHCP)是一个局域网的网络协议,基于UDP协议工作 ...

  10. pandas 数据处理实例

    描述:行标签为日期,列标签为时间,表哥的值是 float 的数值# 一. 读取 csv 文件df=pd.read_csv("delay_3.csv",encoding = &quo ...