forked from sandia-minimega/discovery
-
Notifications
You must be signed in to change notification settings - Fork 0
/
icmp4.go
42 lines (39 loc) · 1.46 KB
/
icmp4.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Copyright 2018 National Technology & Engineering Solutions of Sandia, LLC
// (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S.
// Government retains certain rights in this software.
package main
import (
"github.com/google/gopacket/layers"
)
func (s *State) HandleICMPv4() {
switch s.icmp4.TypeCode {
case layers.ICMPv4TypeEchoRequest:
//fmt.Printf("ICMPv4 ping -- %v -> %v %v\n", s.ip4.SrcIP, s.ip4.DstIP, s.ip4.TTL)
// TODO: Ping/pong => connectivity testing, useful?
case layers.ICMPv4TypeEchoReply:
//fmt.Printf("ICMPv4 pong -- %v -> %v %v\n", s.ip4.SrcIP, s.ip4.DstIP, s.ip4.TTL)
// TODO: Ping/pong => connectivity testing, useful?
case layers.ICMPv4TypeTimeExceeded:
//fmt.Printf("ICMPv4 time exceeded -- %v -> %v %v\n", s.ip4.SrcIP, s.ip4.DstIP, s.ip4.TTL)
switch uint8(s.icmp4.TypeCode) {
case layers.ICMPv4CodeTTLExceeded:
// TODO: maybe interesting
}
case layers.ICMPv4TypeDestinationUnreachable:
//fmt.Printf("ICMPv4 destination unreachable -- %v -> %v %v\n", s.ip4.SrcIP, s.ip4.DstIP, s.icmp4.TypeCode)
switch uint8(s.icmp4.TypeCode) {
case layers.ICMPv4CodeNet:
// TODO: maybe interesting
case layers.ICMPv4CodeHost:
// TODO: maybe interesting
case layers.ICMPv4CodePort:
// TODO: maybe interesting
case layers.ICMPv4CodeFragmentationNeeded:
// TODO: maybe interesting
case layers.ICMPv4CodeNetUnknown:
// TODO: maybe interesting
case layers.ICMPv4CodeHostUnknown:
// TODO: maybe interesting
}
}
}