Skip to content

Commit

Permalink
Add install script
Browse files Browse the repository at this point in the history
  • Loading branch information
xiam committed Oct 5, 2016
1 parent 1c344fa commit 4ee0847
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 4 deletions.
22 changes: 19 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,26 @@ decrypted, intercepted and recorded.
This is the development repository, check out the [https://hyperfox.org][1]
site for usage information.

## Getting Hyperfox
## Get `hyperfox`

See the [download](https://hyperfox.org/download) page for binary builds and
compilation instructions.
You can install arpfox to `/usr/local/bin` with the following command (requires
admin privileges):

```
curl -sL 'https://raw.githubusercontent.com/malfunkt/hyperfox/master/install.sh' | sh
```

You can also grab the latest release from our [releases
page](https://github.com/malfunkt/hyperfox/releases) and install it manually into
another location.

## Build it yourself

In order to build `arpfox` you'll need Go and a C compiler:

```
go install github.com/malfunkt/hyperfox
```

## A common example: hyperfox with arpfox on Linux

Expand Down
60 changes: 60 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/bin/sh

WORK_DIR=/tmp
BIN_DIR=/usr/local/bin

arch() {
ARCH=$(uname -m)
case $ARCH in
x86_64) ARCH=amd64;;
esac
}

os() {
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
}

download() {
LATEST_RELEASE_JSON="https://api.github.com/repos/malfunkt/hyperfox/releases/latest"
DOWNLOAD_URL=$(curl --silent -L $LATEST_RELEASE_JSON | grep browser_download_url | sed s/'^.*: "'//g | sed s/'"$'//g | grep "$OS.*$ARCH")

if [ -z "$DOWNLOAD_URL" ]; then
curl --silent -L $LATEST_RELEASE_JSON;
echo "Github API is not working right now. Please try again later.";
exit 1
fi;

BASENAME=$(basename $DOWNLOAD_URL)

wget $DOWNLOAD_URL -O $WORK_DIR/$BASENAME

case $BASENAME in
*.bz2)
bzip2 -d $WORK_DIR/$BASENAME
FILENAME=$WORK_DIR/hyperfox_${OS}_${ARCH}
;;
*.gz)
gzip -dfv $WORK_DIR/$BASENAME
FILENAME=$WORK_DIR/hyperfox_${OS}_${ARCH}
;;
*.zip)
unzip -d $WORK_DIR -o $WORK_DIR/$BASENAME
FILENAME=$WORK_DIR/hyperfox_${OS}_${ARCH}.exe
;;
*)
echo "Don't know how to handle downloaded file $BASENAME" && exit 1
;;
esac

if [ -z "$FILENAME" ]; then
echo "Could not install." && exit 1
fi;

echo "This script needs root privileges in order to install into $BIN_DIR."
sudo install -c -m 0755 $FILENAME $BIN_DIR/hyperfox
rm $FILENAME
}

arch
os
download
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import (
"upper.io/db.v2"
)

const version = "1.0"
const version = "1.9.7"

const (
defaultAddress = `0.0.0.0`
Expand Down

0 comments on commit 4ee0847

Please sign in to comment.