https://github.com/alegrey91/go-upx
Go command-line wrapper library for upx utility
https://github.com/alegrey91/go-upx
binding bindings golang golang-library golang-module malware-detection packer security-tools upx
Last synced: 16 days ago
JSON representation
Go command-line wrapper library for upx utility
- Host: GitHub
- URL: https://github.com/alegrey91/go-upx
- Owner: alegrey91
- License: mit
- Created: 2023-01-07T15:37:04.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-01-22T10:50:43.000Z (over 2 years ago)
- Last Synced: 2025-03-25T21:13:39.981Z (about 1 month ago)
- Topics: binding, bindings, golang, golang-library, golang-module, malware-detection, packer, security-tools, upx
- Language: Go
- Homepage: https://pkg.go.dev/github.com/alegrey91/go-upx
- Size: 1.3 MB
- Stars: 13
- Watchers: 3
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-upx

 [](https://pkg.go.dev/github.com/alegrey91/go-upx)
**go-upx** is a command-line wrapper library for `upx` utility.
For package reference, visit [https://pkg.go.dev/github.com/alegrey91/go-upx](https://pkg.go.dev/github.com/alegrey91/go-upx).
## What is UPX
UPX is a free, secure, portable, extendable, high-performance executable packer for several executable formats. More info at [https://upx.github.io/](https://upx.github.io/).
## Why
The idea was to create a nice interface for this utility in my favorite programming language. So you can automate tasks in a bigger project that makes use of the utility.
## Install
To install the module, run the following command:
```sh
go get github.com/alegrey91/go-upx
```## Example
Let's see how you can use `go-upx` to compress a file from a Go program:
```golang
import (
...
"github.com/alegrey91/go-upx"
)...
// UPX options definition
options := goupx.Options{
Output: "/tmp/file",
Force: true,
Verbose: false,
CompressionTuningOpt: goupx.CompressionTuningOptions{
Brute: 1,
},
}// command execution
upx := goupx.NewUPX()
_, err := upx.Compress("/path/to/file/to_be_compressed", 9, options)
if err != nil {
fmt.Println(err)
}// display the results
fmt.Println(upx.CmdExecution.GetFormat())
fmt.Println(upx.CmdExecution.GetOriginalFileSize())
fmt.Println(upx.CmdExecution.GetCompressedFileSize())
fmt.Println(upx.CmdExecution.GetRatio())
fmt.Println(upx.CmdExecution.GetFormat())
fmt.Println(upx.CmdExecution.GetName())...
```Here you can find more code examples here: [examples](https://github.com/alegrey91/go-upx/tree/main/examples)
## Test
To test the code locally, run the following command:
```sh
go test -v .
```## License
**go-upx** is available under [MIT](https://github.com/alegrey91/go-upx/blob/main/LICENSE) license.