Add DLL target for windows loading in Python
This commit is contained in:
parent
c27c76c644
commit
579bc4bb84
|
|
@ -50,3 +50,55 @@ jobs:
|
|||
name: dist-folder
|
||||
path: |
|
||||
dist
|
||||
|
||||
build-release-dll:
|
||||
name: Build release DLL
|
||||
environment: prod
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ${{ env.GO_VERSION }}
|
||||
cache: true
|
||||
check-latest: true
|
||||
|
||||
- name: Set up MinGW
|
||||
uses: egor-tensin/setup-mingw@v2
|
||||
with:
|
||||
platform: x64
|
||||
|
||||
- name: Run GoReleaser
|
||||
uses: goreleaser/goreleaser-action@v6
|
||||
with:
|
||||
# either 'goreleaser' (default) or 'goreleaser-pro'
|
||||
distribution: goreleaser
|
||||
# 'latest', 'nightly', or a semver
|
||||
version: '~> v2'
|
||||
args: release --clean
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Use config_release.go from action secrets
|
||||
uses: mobiledevops/secret-to-file-action@v1 # TODO native in Makefile, can be unsafe...
|
||||
with:
|
||||
base64-encoded-secret: ${{ secrets.CONFIG_RELEASE_GO_FILE }}
|
||||
filename: "config_release.go"
|
||||
|
||||
- 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"
|
||||
working-directory: "./resources"
|
||||
|
||||
- run: make dll
|
||||
|
||||
- name: Store release artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: dist-dll
|
||||
path: |
|
||||
dist
|
||||
|
|
|
|||
|
|
@ -7,3 +7,5 @@ socks5-ssh-proxy.release
|
|||
*.base64
|
||||
*.exe
|
||||
*.zip
|
||||
|
||||
dist/
|
||||
|
|
|
|||
|
|
@ -0,0 +1,55 @@
|
|||
# This is an example .goreleaser.yml file with some sensible defaults.
|
||||
# Make sure to check the documentation at https://goreleaser.com
|
||||
|
||||
# The lines below are called `modelines`. See `:help modeline`
|
||||
# Feel free to remove those if you don't want/need to use them.
|
||||
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
|
||||
# vim: set ts=2 sw=2 tw=0 fo=cnqoj
|
||||
|
||||
version: 2
|
||||
|
||||
before:
|
||||
hooks:
|
||||
# You may remove this if you don't use go modules.
|
||||
- go mod tidy
|
||||
# you may remove this if you don't need go generate
|
||||
- go generate ./...
|
||||
|
||||
builds:
|
||||
- id: "dll"
|
||||
env:
|
||||
- CGO_ENABLED=1
|
||||
- CC=x86_64-w64-mingw32-gcc
|
||||
- CXX=x86_64-w64-mingw32-g++
|
||||
goos:
|
||||
- windows
|
||||
goarch:
|
||||
- amd64
|
||||
ldflags:
|
||||
- -s -w -H=windowsgui
|
||||
buildmode: c-shared
|
||||
tags:
|
||||
- release
|
||||
- dll
|
||||
|
||||
archives:
|
||||
- format: tar.gz
|
||||
# this name template makes the OS and Arch compatible with the results of `uname`.
|
||||
name_template: >-
|
||||
{{ .ProjectName }}_
|
||||
{{- title .Os }}_
|
||||
{{- if eq .Arch "amd64" }}x86_64
|
||||
{{- else if eq .Arch "386" }}i386
|
||||
{{- else }}{{ .Arch }}{{ end }}
|
||||
{{- if .Arm }}v{{ .Arm }}{{ end }}
|
||||
# use zip for windows archives
|
||||
format_overrides:
|
||||
- goos: windows
|
||||
format: zip
|
||||
|
||||
changelog:
|
||||
sort: asc
|
||||
filters:
|
||||
exclude:
|
||||
- "^docs:"
|
||||
- "^test:"
|
||||
4
Makefile
4
Makefile
|
|
@ -1,6 +1,5 @@
|
|||
SOURCES=Makefile main.go main_release.go main_debug.go config.go config_release.go config_template.go
|
||||
GARBLE_BIN = $(shell go env GOPATH)/bin/garble
|
||||
GO_ENV_VARS = CGO_ENABLED=0
|
||||
|
||||
all: socks5-ssh-proxy
|
||||
|
||||
|
|
@ -21,6 +20,9 @@ socks5-ssh-proxy.release: resources $(SOURCES)
|
|||
win: socks5-ssh-proxy.exe
|
||||
socks5-ssh-proxy.exe: resources $(GARBLE_BIN) $(SOURCES)
|
||||
GOOS=windows GOARCH=amd64 $(GARBLE_BIN) build -ldflags -H=windowsgui -tags release -o $@
|
||||
dll: resources
|
||||
rm -Rf dist
|
||||
goreleaser build --snapshot
|
||||
win-package: ChromeProxyHelperPlugin.zip
|
||||
ChromeProxyHelperPlugin.zip: socks5-ssh-proxy.exe
|
||||
cp socks5-ssh-proxy.exe chrome_proxy.exe
|
||||
|
|
|
|||
11
README.md
11
README.md
|
|
@ -1,6 +1,6 @@
|
|||
# socks5-ssh-proxy
|
||||
|
||||
If HTTP(s) is filtered and outbound SSH is allowed, just create a SOCKS5 proxy. Beat the sensorship, and be free!
|
||||
If HTTP(s) is filtered and outbound SSH is allowed, just create a SOCKS5 proxy over SSH using a [Jump server](https://en.wikipedia.org/wiki/Jump_server). Beat the (corporate) sensorship, and be free!
|
||||
|
||||
## Background information
|
||||
|
||||
|
|
@ -54,8 +54,17 @@ Following detections have been tested:
|
|||
* Microsoft Defender: [Trojan](https://en.wikipedia.org/wiki/Trojan_horse_(computing)):Win32/Gracing.I - Severe. Probably fixed because of packing with UPX
|
||||
* Palo Alto Networks, Inc. - Cortex [XDR](https://en.wikipedia.org/wiki/Extended_detection_and_response): detected as Suspicious (no fix yet)
|
||||
|
||||
## Build time dependencies
|
||||
|
||||
## macOS
|
||||
|
||||
* go
|
||||
* go-releaser
|
||||
* mingw-w64 (for building the windows dll)
|
||||
|
||||
## Related information
|
||||
|
||||
* <https://www.yourcts.com/2024/01/19/beware-of-new-go-based-malware/>
|
||||
* <https://posts.specterops.io/offensive-security-guide-to-ssh-tunnels-and-proxies-b525cbd4d4c6>
|
||||
* <https://emulator41.medium.com/golang-malware-used-by-cybercriminals-408276a276c8>
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,13 @@
|
|||
//go:build dll
|
||||
// +build dll
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"C"
|
||||
)
|
||||
|
||||
//export executeMain
|
||||
func executeMain() {
|
||||
main()
|
||||
}
|
||||
Loading…
Reference in New Issue