From cfbe9632dc6c7dff19bea8acfcdc04cac7140b2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Nieto?= Date: Sun, 26 Apr 2020 21:08:46 -0500 Subject: [PATCH] add -v option --- README.md | 4 ++-- main.go | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 35e16a4..2bc7a17 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ host, this is an [ancient technique](http://insecure.org/sploits/arp.games.html) known as [ARP spoofing](https://en.wikipedia.org/wiki/ARP_spoofing). -## Get `arpfox` +## Installing `arpfox` You can install arpfox to `/usr/local/bin` with the following command (requires admin privileges): @@ -26,7 +26,7 @@ You can also grab the latest release from our [releases page](https://github.com/malfunkt/arpfox/releases) and install it on a different location. -## Build it yourself +### Building `arpfox` from source In order to build `arpfox` from source you'll need Go, a C compiler and libpcap's development files: diff --git a/main.go b/main.go index 572b1cc..6a4e185 100644 --- a/main.go +++ b/main.go @@ -40,6 +40,8 @@ import ( "github.com/malfunkt/iprange" ) +const version = "1.0.0" + func defaultInterface() string { switch runtime.GOOS { case "freebsd", "linux": @@ -58,11 +60,17 @@ var ( flagListInterfaces = flag.Bool("l", false, `List available interfaces and exit.`) flagWaitInterval = flag.Float64("w", 2, `Wait seconds between every broadcast, must be a value greater than 0.1.`) flagHelp = flag.Bool("h", false, `Print usage instructions and exit.`) + flagVersion = flag.Bool("v", false, `Print software version and exit.`) ) func main() { flag.Parse() + if *flagVersion { + fmt.Printf("%v\n", version) + os.Exit(0) + } + if *flagHelp { fmt.Println("arpfox sends specially crafted ARP packets to a given host on a LAN in order") fmt.Println("to poison its ARP cache table.")