misc: small fix or general refactoring i did not bother commenting

This commit is contained in:
evilsocket 2018-02-25 06:50:31 +01:00
parent e5f645d771
commit f9489a8d4e
3 changed files with 22 additions and 5 deletions

View file

@ -7,7 +7,7 @@ bin_dep() {
which $BIN > /dev/null || { echo "@ Dependency $BIN not found !"; exit 1; }
}
vm_dep() {
host_dep() {
HOST=$1
ping -c 1 $HOST > /dev/null || { echo "@ Virtual machine host $HOST not visible !"; exit 1; }
}
@ -114,7 +114,7 @@ build_linux_mips64le() {
}
build_macos_amd64() {
vm_dep 'osxvm'
host_dep 'osxvm'
DIR=/Users/evilsocket/gocode/src/github.com/bettercap/bettercap
OUTPUT=$1
@ -130,7 +130,7 @@ build_macos_amd64() {
}
build_windows_amd64() {
vm_dep 'winvm'
host_dep 'winvm'
DIR=c:/Users/evilsocket/gopath/src/github.com/bettercap/bettercap
OUTPUT=$1
@ -145,10 +145,27 @@ build_windows_amd64() {
scp -C winvm:$DIR/$OUTPUT . > /dev/null
}
build_android_arm() {
host_dep 'shield'
DIR=/data/data/com.termux/files/home/go/src/github.com/bettercap/bettercap
OUTPUT=$1
echo "@ Updating repo on Android host ..."
ssh -p 8022 root@shield "cd $DIR && rm bettercap && git pull" > /dev/null
echo "@ Building $OUTPUT ..."
ssh -p 8022 root@shield "cd $DIR && go build -o $OUTPUT ." > /dev/null
echo "@ Downloading $OUTPUT ..."
scp -C -P 8022 root@shield:$DIR/$OUTPUT . > /dev/null
}
rm -rf $BUILD_FOLDER
mkdir $BUILD_FOLDER
cd $BUILD_FOLDER
build_android_arm bettercap_android_arm_$VERSION
build_linux_amd64 bettercap_linux_amd64_$VERSION
build_linux_arm7 bettercap_linux_arm7_$VERSION
build_linux_mips bettercap_linux_mips_$VERSION

View file

@ -3,7 +3,6 @@
package network
import (
"fmt"
"strings"
"github.com/bettercap/bettercap/core"
@ -25,7 +24,7 @@ func FindGateway(iface *Endpoint) (*Endpoint, error) {
// we have the address, now we need its mac
mac, err := ArpLookup(iface.Name(), gateway, false)
if err != nil {
fmt.Printf("%s\n", err)
return nil, err
}
return NewEndpoint(gateway, mac), nil
}

View file

@ -4,6 +4,7 @@ import (
"github.com/bettercap/bettercap/core"
)
// Hi, i'm Android and my mum said I'm special.
func FindGateway(iface *Endpoint) (*Endpoint, error) {
output, err := core.Exec("getprop", []string{"net.dns1"})
if err != nil {