mirror of
https://github.com/bettercap/bettercap
synced 2025-07-30 03:29:57 -07:00
misc: small fix or general refactoring i did not bother commenting
This commit is contained in:
parent
e5f645d771
commit
f9489a8d4e
3 changed files with 22 additions and 5 deletions
23
build.sh
23
build.sh
|
@ -7,7 +7,7 @@ bin_dep() {
|
||||||
which $BIN > /dev/null || { echo "@ Dependency $BIN not found !"; exit 1; }
|
which $BIN > /dev/null || { echo "@ Dependency $BIN not found !"; exit 1; }
|
||||||
}
|
}
|
||||||
|
|
||||||
vm_dep() {
|
host_dep() {
|
||||||
HOST=$1
|
HOST=$1
|
||||||
ping -c 1 $HOST > /dev/null || { echo "@ Virtual machine host $HOST not visible !"; exit 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() {
|
build_macos_amd64() {
|
||||||
vm_dep 'osxvm'
|
host_dep 'osxvm'
|
||||||
|
|
||||||
DIR=/Users/evilsocket/gocode/src/github.com/bettercap/bettercap
|
DIR=/Users/evilsocket/gocode/src/github.com/bettercap/bettercap
|
||||||
OUTPUT=$1
|
OUTPUT=$1
|
||||||
|
@ -130,7 +130,7 @@ build_macos_amd64() {
|
||||||
}
|
}
|
||||||
|
|
||||||
build_windows_amd64() {
|
build_windows_amd64() {
|
||||||
vm_dep 'winvm'
|
host_dep 'winvm'
|
||||||
|
|
||||||
DIR=c:/Users/evilsocket/gopath/src/github.com/bettercap/bettercap
|
DIR=c:/Users/evilsocket/gopath/src/github.com/bettercap/bettercap
|
||||||
OUTPUT=$1
|
OUTPUT=$1
|
||||||
|
@ -145,10 +145,27 @@ build_windows_amd64() {
|
||||||
scp -C winvm:$DIR/$OUTPUT . > /dev/null
|
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
|
rm -rf $BUILD_FOLDER
|
||||||
mkdir $BUILD_FOLDER
|
mkdir $BUILD_FOLDER
|
||||||
cd $BUILD_FOLDER
|
cd $BUILD_FOLDER
|
||||||
|
|
||||||
|
build_android_arm bettercap_android_arm_$VERSION
|
||||||
build_linux_amd64 bettercap_linux_amd64_$VERSION
|
build_linux_amd64 bettercap_linux_amd64_$VERSION
|
||||||
build_linux_arm7 bettercap_linux_arm7_$VERSION
|
build_linux_arm7 bettercap_linux_arm7_$VERSION
|
||||||
build_linux_mips bettercap_linux_mips_$VERSION
|
build_linux_mips bettercap_linux_mips_$VERSION
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
package network
|
package network
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/bettercap/bettercap/core"
|
"github.com/bettercap/bettercap/core"
|
||||||
|
@ -25,7 +24,7 @@ func FindGateway(iface *Endpoint) (*Endpoint, error) {
|
||||||
// we have the address, now we need its mac
|
// we have the address, now we need its mac
|
||||||
mac, err := ArpLookup(iface.Name(), gateway, false)
|
mac, err := ArpLookup(iface.Name(), gateway, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("%s\n", err)
|
return nil, err
|
||||||
}
|
}
|
||||||
return NewEndpoint(gateway, mac), nil
|
return NewEndpoint(gateway, mac), nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ import (
|
||||||
"github.com/bettercap/bettercap/core"
|
"github.com/bettercap/bettercap/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Hi, i'm Android and my mum said I'm special.
|
||||||
func FindGateway(iface *Endpoint) (*Endpoint, error) {
|
func FindGateway(iface *Endpoint) (*Endpoint, error) {
|
||||||
output, err := core.Exec("getprop", []string{"net.dns1"})
|
output, err := core.Exec("getprop", []string{"net.dns1"})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue