Reformat code

This commit is contained in:
2023-09-02 23:49:02 +02:00
parent 1989ae996f
commit 21c956c545
26 changed files with 102 additions and 101 deletions

View File

@@ -1,16 +1,16 @@
package dhcpv4
import (
"github.com/maride/pancap/output"
"github.com/google/gopacket"
"github.com/google/gopacket/layers"
"github.com/maride/pancap/output"
)
type Protocol struct {
hostnames []hostname
hostnames []hostname
networkSetup map[layers.DHCPOpt][]byte
requestMAC []string
responses []dhcpResponse
requestMAC []string
responses []dhcpResponse
}
// Checks if the given packet is a DHCP packet we can process

View File

@@ -1,9 +1,8 @@
package dhcpv4
type dhcpResponse struct {
destMACAddr string
newIPAddr string
destMACAddr string
newIPAddr string
serverMACAddr string
askedFor bool
askedFor bool
}

View File

@@ -1,8 +1,8 @@
package dhcpv4
type hostname struct {
hostname string
hostname string
requestedByMAC string
granted bool
granted bool
deniedHostname string
}

View File

@@ -2,8 +2,8 @@ package dhcpv4
import (
"fmt"
"github.com/maride/pancap/common"
"github.com/google/gopacket/layers"
"github.com/maride/pancap/common"
"log"
)

View File

@@ -12,13 +12,13 @@ import (
var (
watchedOpts = []layers.DHCPOpt{
layers.DHCPOptSubnetMask, // Option 1
layers.DHCPOptRouter, // Option 3
layers.DHCPOptDNS, // Option 6
layers.DHCPOptSubnetMask, // Option 1
layers.DHCPOptRouter, // Option 3
layers.DHCPOptDNS, // Option 6
layers.DHCPOptBroadcastAddr, // Option 28
layers.DHCPOptNTPServers, // Option 42
layers.DHCPOptLeaseTime, // Option 51
layers.DHCPOptT1, // Option 58
layers.DHCPOptNTPServers, // Option 42
layers.DHCPOptLeaseTime, // Option 51
layers.DHCPOptT1, // Option 58
}
)
@@ -126,7 +126,7 @@ func formatDate(rawDate []byte) (string, bool) {
intDate := binary.LittleEndian.Uint32(rawDate)
seconds := intDate % 60
minutes := intDate / 60 % 60
hours := intDate / 60 / 60 % 60
hours := intDate / 60 / 60 % 60
formattedDate := ""
// Check which words we need to pick

View File

@@ -2,8 +2,8 @@ package dhcpv4
import (
"fmt"
"github.com/maride/pancap/common"
"github.com/google/gopacket/layers"
"github.com/maride/pancap/common"
)
// Processes the DHCP request packet handed over

View File

@@ -2,8 +2,8 @@ package dhcpv4
import (
"fmt"
"github.com/maride/pancap/common"
"github.com/google/gopacket/layers"
"github.com/maride/pancap/common"
"log"
)