go_lang中的“制作” TLS客户端Hello

我是go编程语言的新手,我自己使用Google的“ gopacket”库编写了以太网框架。 我已经成功地在用户空间中实现了基本的TCP功能以用于教学目的,并且可以成功地与Web服务器发起三向握手。</ p>

现在,我想在此和我的基础上发起TLS握手 问题在于,go中所有现有的TLS库都使用套接字或Conn接口来启动TLS连接。 是否有一些简单的方法可以随时处理可用于TCP段的有效负载的TLS客户端原始消息?</ p>

我不想实现像数据传输或 随你。 如果我能够将Client-Hello发送到服务器并在结束连接之前查看答复是足够的。</ p>

谢谢您对A的任何建议 新手去。 :-)</ p>
</ div>

展开原文

原文

I am new in the go programming language and I am crafting Ethernet frames myself with the "gopacket" library of Google. I have successfully implemented basic TCP functionality in userspace for educational purposes and I can successfully initiate 3-way-handshakes with Webservers.

Now I would like initiate a TLS handshake on top of this and my problem is that all existing TLS libraries in go use sockets or the Conn interface to initiate TLS connections. Is there some easy way to craft a raw TLS Client Hello message in go that I could use as a payload for my TCP segments?

I do not want to implement fancy things like data transmissions or whatever. It is enough if I would be able to send a Client-Hello to a server and see what the reply looks like before ending the connection.

Thank you for any advices you may have for a newbie in go. :-)

2个回答



我要说的一种方法是模拟您提供给TLS库的 Conn </ code> 拦截呼叫并转发/中继它们,或者...您通过查看例如 handshake_client.go
,然后复制所需的任何内容(遗憾的是,该方法仅是私有的)。 </ p>

我个人可能会选择 Conn </ code>方法。 </ p>
</ div>

展开原文

原文

I'd say one way would be to mock a Conn you feed to the TLS library so you can intercept the calls and forward/relay them or... you do this the manual way by looking at for example handshake_client.go and copy whatever you need (the methods it contains are sadly private only).

Personally I'd probably go for the Conn approach.



我尝试了两种方法,但都没有成功。</ p>

最后,我选择了 最丑陋的解决方案,但有一个适用于我的简单方案的解决方案:我通过Wireshark捕获了TLS客户端Hello,并将其硬编码为十六进制的字节数组。</ p>
</ div>

展开原文

原文

I tried both ways but they were not successfull.

In the end I have chosen the most ugly solution but a one working out for my simple scenario: I captured a TLS Client Hello via Wireshark, and hard coded it in go as a byte array in hex.

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐