From 344d874c024592804ed973cbed5b5e4fe1d00cfc Mon Sep 17 00:00:00 2001 From: Steven Polley Date: Thu, 18 Apr 2024 09:39:05 -0600 Subject: [PATCH] minor formatting changes --- hypd/cmd/defaultconfig.go | 1 - hypd/cmd/secret.go | 10 ---------- hypd/cmd/server.go | 2 -- hypd/server/packet.go | 3 --- 4 files changed, 16 deletions(-) diff --git a/hypd/cmd/defaultconfig.go b/hypd/cmd/defaultconfig.go index d05e868..170adfc 100644 --- a/hypd/cmd/defaultconfig.go +++ b/hypd/cmd/defaultconfig.go @@ -31,5 +31,4 @@ hypd generate defaultconfig | tee hypdconfig.json`, func init() { generateCmd.AddCommand(defaultconfigCmd) - } diff --git a/hypd/cmd/secret.go b/hypd/cmd/secret.go index 7452a45..ae02a44 100644 --- a/hypd/cmd/secret.go +++ b/hypd/cmd/secret.go @@ -31,14 +31,4 @@ hypd generate secret > hyp.secret`, func init() { generateCmd.AddCommand(secretCmd) - - // Here you will define your flags and configuration settings. - - // Cobra supports Persistent Flags which will work for this command - // and all subcommands, e.g.: - // secretCmd.PersistentFlags().String("foo", "", "A help for foo") - - // Cobra supports local flags which will only run when this command - // is called directly, e.g.: - // secretCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") } diff --git a/hypd/cmd/server.go b/hypd/cmd/server.go index 8f9ddf3..b539b91 100644 --- a/hypd/cmd/server.go +++ b/hypd/cmd/server.go @@ -37,7 +37,6 @@ Example Usage: hypd server /etc/hyp/hypdconfig.json `, Run: func(cmd *cobra.Command, args []string) { - currentUser, err := user.Current() if err != nil { panic(fmt.Errorf("could not determine current user: %w", err)) @@ -54,7 +53,6 @@ Example Usage: if err != nil { panic(fmt.Errorf("failed to start packet server: %w", err)) } - }, } diff --git a/hypd/server/packet.go b/hypd/server/packet.go index a90b4f0..a8d2414 100644 --- a/hypd/server/packet.go +++ b/hypd/server/packet.go @@ -50,7 +50,6 @@ var ( // it sets up the pcap on the capture device and starts a goroutine // to rotate the knock sequence func PacketServer(config *configuration.HypdConfiguration) error { - iface, err := net.InterfaceByName(config.NetworkInterface) if err != nil { log.Fatalf("lookup network iface %q: %v", config.NetworkInterface, err) @@ -148,8 +147,6 @@ func handleKnock(knockEvent hyp_bpfKnockData) { } // if it's wrong, reset progress - // TBD: vulnerable to sweep attack - this won't be triggered if a wrong packet doesn't match BPF filter - // TBD: make the sweep attack fix on by default, but configurable to be off to allow for limited BPF filter for extremely low overhead as compromise. if knockEvent.Dstport != client.Sequence[client.Progress] { delete(clients, knockEvent.Srcip) fmt.Printf("port '%d' is in sequence, but came at unexpected order - resetting progress", knockEvent.Dstport)