[WIP] AppleTalk
This commit is contained in:
parent
62162d8c95
commit
a03a02e3d8
2 changed files with 23 additions and 1 deletions
|
@ -4,8 +4,11 @@ import (
|
|||
"fmt"
|
||||
|
||||
"github.com/google/gopacket/pcap"
|
||||
"github.com/sfiera/multitalk/pkg/ethernet"
|
||||
)
|
||||
|
||||
var MulticastDst = ethernet.Addr{0x09, 0x00, 0x07, 0xff, 0xff, 0xff}
|
||||
|
||||
// StartPcap opens an AppleTalk and AARP listening session on a network device.
|
||||
func StartPcap(device string) (*pcap.Handle, error) {
|
||||
handle, err := pcap.OpenLive(device, 4096, true, pcap.BlockForever)
|
||||
|
|
21
main.go
21
main.go
|
@ -32,6 +32,8 @@ import (
|
|||
|
||||
"gitea.drjosh.dev/josh/jrouter/atalk"
|
||||
"gitea.drjosh.dev/josh/jrouter/aurp"
|
||||
"github.com/sfiera/multitalk/pkg/aarp"
|
||||
"github.com/sfiera/multitalk/pkg/ddp"
|
||||
"github.com/sfiera/multitalk/pkg/ethertalk"
|
||||
)
|
||||
|
||||
|
@ -166,7 +168,24 @@ func main() {
|
|||
continue
|
||||
}
|
||||
|
||||
log.Printf("Read packet %s -> %s payload %x", pkt.Src, pkt.Dst, pkt.Payload)
|
||||
switch pkt.SNAPProto {
|
||||
case ethertalk.AARPProto:
|
||||
var aapkt aarp.Packet
|
||||
if err := aarp.Unmarshal(pkt.Payload, &aapkt); err != nil {
|
||||
log.Printf("Couldn't unmarshal AARP packet: %v", err)
|
||||
continue
|
||||
}
|
||||
log.Printf("Read AARP packet %v", aapkt)
|
||||
|
||||
case ethertalk.AppleTalkProto:
|
||||
var ddpkt ddp.ExtPacket
|
||||
if err := ddp.ExtUnmarshal(pkt.Payload, &ddpkt); err != nil {
|
||||
log.Printf("Couldn't unmarshal DDP packet: %v", err)
|
||||
continue
|
||||
}
|
||||
log.Printf("Read AppleTalk packet %v", ddpkt)
|
||||
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
|
|
Loading…
Reference in a new issue