repochecker/ip-inspector: gofmt + CI
This commit is contained in:
parent
f1a2e6c360
commit
83be5595ba
5 changed files with 12 additions and 16 deletions
|
|
@ -1,12 +1,12 @@
|
|||
# IP-INSPECTOR
|
||||
# PCAP-INSPECTOR
|
||||
|
||||
Inspects pcap and pcapng files for packets with ip src and ip dst using private IPs
|
||||
|
||||
Set VERBOSE_PCAP_CHECK environment variable to enable verbose mode
|
||||
Set `VERBOSE_PCAP_CHECK` environment variable to enable verbose mode
|
||||
|
||||
## Build library
|
||||
|
||||
go build -o ip-inspector -buildmode=plugin main.go files.go
|
||||
go build -o pcap-inspector -buildmode=plugin .
|
||||
|
||||
## Requirement
|
||||
|
||||
|
|
@ -15,4 +15,4 @@ github.com/google/gopacket
|
|||
## TODO
|
||||
|
||||
Custom rules on packet filtering
|
||||
Handle log files
|
||||
Handle log files
|
||||
|
|
|
|||
|
|
@ -31,9 +31,7 @@ type PcapNgReader struct {
|
|||
*pcapgo.NgReader
|
||||
}
|
||||
|
||||
//
|
||||
// Impl interface for reading pcap and pcapng data
|
||||
//
|
||||
func (pcapReader *PcapReader) ReadPacketData() (data []byte, ci gopacket.CaptureInfo, err error) {
|
||||
return pcapReader.Reader.ReadPacketData()
|
||||
}
|
||||
|
|
@ -42,12 +40,9 @@ func (pcapNGReader *PcapNgReader) ReadPacketData() (data []byte, ci gopacket.Cap
|
|||
return pcapNGReader.NgReader.ReadPacketData()
|
||||
}
|
||||
|
||||
//
|
||||
// Iterate thought each packet to find potentialy unwanted packets
|
||||
// TODO: Allow custom rules to specify what is a unwanted packet
|
||||
//
|
||||
func CheckPcap(pcapReader PcapPacketDataReader, pcapName string) (errs []error) {
|
||||
|
||||
warningFlows := make(map[gopacket.Flow]([]time.Time))
|
||||
|
||||
//
|
||||
|
|
@ -63,7 +58,7 @@ func CheckPcap(pcapReader PcapPacketDataReader, pcapName string) (errs []error)
|
|||
if packetNetworkLayer == nil {
|
||||
continue
|
||||
}
|
||||
|
||||
|
||||
flow := packetNetworkLayer.NetworkFlow()
|
||||
|
||||
ENDPOINT_SELECTION:
|
||||
|
|
@ -117,7 +112,7 @@ func CheckTextFile(fd *os.File) (errs []error) {
|
|||
func InspectFileForIPAddr(file *fic.EFile, exceptions *sync.CheckExceptions) (errs []error) {
|
||||
i, ok := sync.GlobalImporter.(sync.LocalImporter)
|
||||
if !ok {
|
||||
log.Printf("Unable to load `ip-inspector.so` as the current Importer is not a LocalImporter (%T).", sync.GlobalImporter)
|
||||
log.Printf("Unable to load `pcap-inspector.so` as the current Importer is not a LocalImporter (%T).", sync.GlobalImporter)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,10 +4,6 @@ import (
|
|||
"srs.epita.fr/fic-server/admin/sync"
|
||||
)
|
||||
|
||||
var hooks *sync.CheckHooks
|
||||
|
||||
func RegisterChecksHooks(h *sync.CheckHooks) {
|
||||
hooks = h
|
||||
|
||||
h.RegisterFileHook(InspectFileForIPAddr)
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue