Compare commits
No commits in common. "3ae568639e67420177a0e3bf70e2551113c01514" and "3ff47dfa190b84b80315473b2635b55d6768a0aa" have entirely different histories.
3ae568639e
...
3ff47dfa19
@ -31,14 +31,8 @@ Example usage:
|
|||||||
`,
|
`,
|
||||||
Args: cobra.ExactArgs(1),
|
Args: cobra.ExactArgs(1),
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
|
|
||||||
// load secret and generate ports using secret and current time
|
// load secret and generate ports using secret and current time
|
||||||
secretFilePath, err := cmd.Flags().GetString("secret")
|
secretBytes, err := os.ReadFile("hyp.secret")
|
||||||
if err != nil {
|
|
||||||
panic(fmt.Errorf("failed to parse command flag 'secret': %w", err))
|
|
||||||
}
|
|
||||||
|
|
||||||
secretBytes, err := os.ReadFile(secretFilePath)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("failed to read file 'hyp.secret': %v", err)
|
log.Fatalf("failed to read file 'hyp.secret': %v", err)
|
||||||
}
|
}
|
||||||
@ -62,6 +56,4 @@ Example usage:
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
rootCmd.AddCommand(knockCmd)
|
rootCmd.AddCommand(knockCmd)
|
||||||
|
|
||||||
knockCmd.PersistentFlags().String("secret", "hyp.secret", "Path to the file containing the hyp secret.")
|
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ var (
|
|||||||
sharedSecret string // base32 encoded shared secret used for totp
|
sharedSecret string // base32 encoded shared secret used for totp
|
||||||
)
|
)
|
||||||
|
|
||||||
// PacketServer is the main function when operating in server mode
|
// packetServer is the main function when operating in server mode
|
||||||
// it sets up the pcap on the capture device and starts a goroutine
|
// it sets up the pcap on the capture device and starts a goroutine
|
||||||
// to rotate the knock sequence
|
// to rotate the knock sequence
|
||||||
func PacketServer(captureDevice string) error {
|
func PacketServer(captureDevice string) error {
|
||||||
@ -50,7 +50,7 @@ func PacketServer(captureDevice string) error {
|
|||||||
knockSequences = []KnockSequence{}
|
knockSequences = []KnockSequence{}
|
||||||
|
|
||||||
// Open pcap handle on device
|
// Open pcap handle on device
|
||||||
handle, err := pcap.OpenLive(captureDevice, 126, true, pcap.BlockForever)
|
handle, err := pcap.OpenLive(captureDevice, 1600, true, pcap.BlockForever)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to open pcap on capture device: %w", err)
|
return fmt.Errorf("failed to open pcap on capture device: %w", err)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user