V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
The Go Programming Language
http://golang.org/
Go Playground
Go Projects
Revel Web Framework
MartinWu
0D

如何获取包的原 IP 跟目标 IP?

  •  
  •   MartinWu ·
    Martwu · Apr 14, 2020 · 1997 views
    This topic created in 2204 days ago, the information mentioned may be changed or developed.
    我现在只知道可以通过 pcap 来抓包,然后包里 ethernet.DstMAC.String()来获取目标的 MAC 地址。那如何可以拿到对应的 IP 呢?
    4 replies    2020-04-15 11:22:40 +08:00
    Nitroethane
        1
    Nitroethane  
       Apr 15, 2020 via iPhone
    如果是用 Go 的话,Google 开发了一个包叫 gopacket,可以看一下
    songn80
        2
    songn80  
       Apr 15, 2020
    建议学习一下流量包的格式,一层层解开
    MartinWu
        3
    MartinWu  
    OP
       Apr 15, 2020
    @Nitroethane #1 嗯嗯,正在使用这个。
    MartinWu
        4
    MartinWu  
    OP
       Apr 15, 2020
    @songn80 #2 好,感谢你的建议。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1374 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 17:14 · PVG 01:14 · LAX 10:14 · JFK 13:14
    ♥ Do have faith in what you're doing.