mirror of
https://github.com/bettercap/bettercap
synced 2025-08-20 05:23:19 -07:00
build.bat, colour in vscode and Windows Terminal
This commit is contained in:
parent
e224eea8c6
commit
409ba219dd
4 changed files with 35 additions and 2 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -14,3 +14,5 @@ stage/
|
||||||
|
|
||||||
/snap
|
/snap
|
||||||
.idea
|
.idea
|
||||||
|
|
||||||
|
bettercap.exe
|
16
build.bat
Normal file
16
build.bat
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
@ECHO OFF
|
||||||
|
set TARGET_OS=windows
|
||||||
|
set TARGET_ARCH=amd64
|
||||||
|
set OUTPUT=bettercap.exe
|
||||||
|
|
||||||
|
rem CGO_CFLAGS="-I/Path-to-winpcap-x64-include-dir -I/Path-to-libusb-1.0-x64-include-dir"
|
||||||
|
set CGO_CFLAGS="-I/c/src/vcpkg/packages/winpcap_x64-windows-static/include -I/c/src/vcpkg/packages/libusb_x64-windows-static/include/libusb-1.0"
|
||||||
|
|
||||||
|
rem CGO_LDFLAGS="-L/Path-to-winpcap-x64-lib-dir -L/Path-to-libusb-1.0-x64-lib-dir"
|
||||||
|
set CGO_LDFLAGS="-L/c/src/vcpkg/packages/winpcap_x64-windows-static/lib -L/c/src/vcpkg/packages/libusb_x64-windows-static/lib"
|
||||||
|
|
||||||
|
rem Get deps
|
||||||
|
go get ./...
|
||||||
|
|
||||||
|
rem Build
|
||||||
|
go build -o bettercap.exe .
|
2
main.go
2
main.go
|
@ -25,7 +25,7 @@ func main() {
|
||||||
}
|
}
|
||||||
defer sess.Close()
|
defer sess.Close()
|
||||||
|
|
||||||
if !tui.Effects() {
|
if !session.Effects() {
|
||||||
if *sess.Options.NoColors {
|
if *sess.Options.NoColors {
|
||||||
fmt.Printf("\n\nWARNING: Terminal colors have been disabled, view will be very limited.\n\n")
|
fmt.Printf("\n\nWARNING: Terminal colors have been disabled, view will be very limited.\n\n")
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -94,13 +94,28 @@ type Session struct {
|
||||||
script *Script
|
script *Script
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func Effects() bool {
|
||||||
|
if wterm, exists := os.LookupEnv("WT_SESSION"); exists && wterm != "" {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
if vterm := os.Getenv("TERM_PROGRAM"); vterm == "vscode" {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
if term := os.Getenv("TERM"); term == "" {
|
||||||
|
return false
|
||||||
|
} else if term == "dumb" {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
func New() (*Session, error) {
|
func New() (*Session, error) {
|
||||||
opts, err := core.ParseOptions()
|
opts, err := core.ParseOptions()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if *opts.NoColors || !tui.Effects() {
|
if *opts.NoColors || !Effects() {
|
||||||
tui.Disable()
|
tui.Disable()
|
||||||
log.NoEffects = true
|
log.NoEffects = true
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue