Compare commits

...

4 Commits

8 changed files with 70 additions and 7 deletions

View File

@ -100,9 +100,9 @@ jobs:
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# NOTE: Some virus and malware scanners detect mangled UPX headers and mark it as suspisious
- name: Obfuscate UPX packed executable #- name: Obfuscate UPX packed executable
run: "go run cmd/upx-obfuscator/main.go dist/win-release_windows_amd64_v1/go-socks5-ssh-proxy.exe" # run: "go run cmd/upx-obfuscator/main.go dist/win-release_windows_amd64_v1/go-socks5-ssh-proxy.exe"
- name: Copy win64 release exe for dist - name: Copy win64 release exe for dist
run: "cp dist/win-release_windows_amd64_v1/go-socks5-ssh-proxy.exe dist/chrome_proxy.exe" run: "cp dist/win-release_windows_amd64_v1/go-socks5-ssh-proxy.exe dist/chrome_proxy.exe"

View File

@ -35,7 +35,9 @@ builds:
- id: "win-release" - id: "win-release"
env: env:
- CGO_ENABLED=0 - CGO_ENABLED=1
- CC=x86_64-w64-mingw32-gcc
- CXX=x86_64-w64-mingw32-g++
goos: goos:
- windows - windows
goarch: goarch:

View File

@ -1,7 +1,6 @@
SOURCES=Makefile main.go main_release.go main_debug.go config.go config_release.go config_template.go system.go SOURCES=Makefile main.go main_release.go main_debug.go config.go config_release.go config_template.go system.go system_windows.go system_unix.go
GARBLE_BIN = $(shell go env GOPATH)/bin/garble GARBLE_BIN = $(shell go env GOPATH)/bin/garble
GARBLE_CMD = $(GARBLE_BIN) -literals -tiny GARBLE_CMD = $(GARBLE_BIN) -literals -tiny
RELEASE_VERBOSE_MODE_KEY ?= ""
all: socks5-ssh-proxy all: socks5-ssh-proxy
@ -21,7 +20,8 @@ socks5-ssh-proxy.release: resources $(SOURCES) $(GARBLE_BIN)
upx $@ upx $@
win: socks5-ssh-proxy.exe win: socks5-ssh-proxy.exe
socks5-ssh-proxy.exe: resources $(GARBLE_BIN) $(SOURCES) socks5-ssh-proxy.exe: resources $(GARBLE_BIN) $(SOURCES)
GOOS=windows GOARCH=amd64 $(GARBLE_CMD) build -ldflags "-H=windowsgui -X cfg.VerboseModeKey=$(RELEASE_VERBOSE_MODE_KEY)" -tags release -o $@ # CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ GOOS=windows GOARCH=amd64 $(GARBLE_CMD) build -ldflags "-H=windowsgui -X cfg.VerboseModeKey=$(RELEASE_VERBOSE_MODE_KEY)" -tags release -o $@
CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ GOOS=windows GOARCH=amd64 $(GARBLE_CMD) build -ldflags "-H=windowsgui" -tags release -o $@
upx $@ upx $@
go run cmd/upx-obfuscator/main.go $@ go run cmd/upx-obfuscator/main.go $@
goreleaser: resources $(GARBLE_BIN) goreleaser: resources $(GARBLE_BIN)

View File

@ -142,5 +142,6 @@ func main() {
func mainLoop() { func mainLoop() {
for { for {
// TODO handle CTRL+C in debug and release + VMK modes // TODO handle CTRL+C in debug and release + VMK modes
time.Sleep(time.Minute)
} }
} }

4
scripts/run-under-wine.sh Executable file
View File

@ -0,0 +1,4 @@
#!/bin/sh
export VMK="ShowMeTheMoney"
wine64 wineconsole &
wine64 /Users/jerry/src/github.com/xor-gate/go-socks5-ssh-proxy/socks5-ssh-proxy.exe

View File

@ -156,6 +156,10 @@ func systemIgnoreAllSignals() {
} }
func systemOSDetect() { func systemOSDetect() {
wineVersion := systemGetWINEVersion()
log.Println("WINE version", wineVersion)
log.Println("IsUserRoot", systemIsUserRoot())
wineOSFiles := systemGetWellKnownWINEOSFiles() wineOSFiles := systemGetWellKnownWINEOSFiles()
if len(wineOSFiles) != 0 { if len(wineOSFiles) != 0 {
log.Println("WINE detected") log.Println("WINE detected")

14
system_unix.go Normal file
View File

@ -0,0 +1,14 @@
//go:build !windows
// +build !windows
//
package main
func systemGetWINEVersion() string {
return ""
}
func systemIsUserRoot() bool {
return false
}

38
system_windows.go Normal file
View File

@ -0,0 +1,38 @@
//go:build windows
// +build windows
package main
import (
"C"
"golang.org/x/sys/windows"
"os"
"unsafe"
)
func systemGetWINEVersion() string {
ntdll := windows.NewLazyDLL("ntdll.dll")
wineGetVersionFunc := ntdll.NewProc("wine_get_version")
err := wineGetVersionFunc.Find()
if err != nil {
return ""
}
ret, _, _ := wineGetVersionFunc.Call()
retCStr := (*C.char)(unsafe.Pointer(ret))
wineVersion := C.GoString(retCStr)
return wineVersion
}
func systemIsUserRoot() bool {
root := true
_, err := os.Open("\\\\.\\PHYSICALDRIVE0")
if err != nil {
root = false
}
return root
}