Code Monkey home page Code Monkey logo

89luca89 / pakkero Goto Github PK

View Code? Open in Web Editor NEW
233.0 233.0 39.0 1.66 MB

Pakkero is a binary packer written in Go made for fun and educational purpose. Its main goal is to take in input a program file (elf binary, script, even appimage) and compress it, protect it from tampering and intrusion.

License: GNU General Public License v3.0

Makefile 3.76% Go 95.56% Dockerfile 0.68%
compression elf elf-binaries encryption golang launcher packer payload protector upx

pakkero's People

Contributors

89luca89 avatar alegrey91 avatar fossabot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

pakkero's Issues

License Question

If I use your project to pack my own binary, does it then also have to apply to the GPL-3.0 License? Or is this only the case if I e.g. directly include the source code into my own go project.

Thanks in advance and your great work!

Not working with WSL

I built a binary for GOOS=linux GOARCH=amd64, packed it (compression, random offset, no dependency), and then moved the output to a windows machine running WSL ubuntu 20.04 (same as the machine it was built and packed on).

When it's run the only output is "Segmentation Fault". It runs fine on ubuntu.

runtime error when running ObfuscateStrings

Hi

I get the following runtime panic when running on any file (shell, binary etc).
It happens on both the version downloaded with go get and one build manually from the source.

→ Obfuscating Launcher Stub...panic: runtime error: slice bounds out of range [-1:]

goroutine 1 [running]:
github.com/89luca89/pakkero/internal/pakkero.ObfuscateStrings(0xc0000b8e54, 0x3, 0xc0000b8e54, 0x3)
	/home/xxx/go/pkg/mod/github.com/89luca89/[email protected]/internal/pakkero/obfuscation.go:251 +0x88f

I think the issue is that the return value of strings.Index is not checked here https://github.com/89luca89/pakkero/blob/0.7.0/internal/pakkero/obfuscation.go#L254
It returns -1 which fails on the next slice.

I'm not familiar with the code much yet so I'm not sure why this would fail

Happy idea?

Thanks

Not working

I'm trying to use pakkero on ubuntu 21.04 and amd ryzen 7, but only getting errors after trying to open packed binary.
For example, i'm trying to do make test, the log is here:

make test
rm -rf dist/;
go build -i \
        -gcflags="-N" \
        -gcflags="-nolocalimports" \
        -gcflags="-pack" \
        -gcflags="-trimpath=." \
        -asmflags="-trimpath=." \
        -gcflags="-trimpath=$GOPATH/src/" \
        -asmflags="-trimpath=$GOPATH/src/" \
        -ldflags="-X github.com/89luca89/pakkero/internal/pakkero.LauncherStub=$(base64 -w0 data/launcher.go) -s" \
        -o dist/pakkero;
go: -i flag is deprecated
strip \
        -sxXwSgd \
        --remove-section=.bss \
        --remove-section=.comment \
        --remove-section=.eh_frame \
        --remove-section=.eh_frame_hdr \
        --remove-section=.fini \
        --remove-section=.fini_array \
        --remove-section=.gnu.build.attributes \
        --remove-section=.gnu.hash \
        --remove-section=.gnu.version \
        --remove-section=.got \
        --remove-section=.note.ABI-tag \
        --remove-section=.note.gnu.build-id \
        --remove-section=.note.go.buildid \
        --remove-section=.shstrtab \
        --remove-section=.typelink \
        dist/pakkero
dist/pakkero \
        -file /usr/bin/echo \
        -o /tmp/test.enc \
        -offset 2850000 \
        -enable-stdout \
        -register-dep /usr/bin/bash;
 → Randomizing offset...                [ OK ]
 → Registering Dependencies...          [ OK ]
 → Creating Launcher Stub...            [ OK ]
 → Obfuscating Launcher Stub...         [ OK ]
 → Compiling Launcher...                [ OK ]
 → Stripping Launcher...                [ OK ]
 → Compressing Launcher...              [ SKIPPING ]
 → Cleaning up...                       [ OK ]
 → Verifying input offset...            [ OK ]
 → Adding garbage...                    [ OK ]
 → Reading payload...                   [ OK ]
 → Compressing payload...               [ OK ]
 → Encrypting payload...                [ OK ]
 → Adding garbage to payload...         [ OK ]
sync;
for i in $(seq 1 20); do /tmp/test.enc $i; done;
make: *** [Makefile:64: test] Error 1
yartsevilya@yartsevilya-hp:~/go/pkg/mod/github.com/89luca89/[email protected]$ /tmp/test.enc
 error: unexpected signal during  execution
[signal SIGSEGV: segmentation violation code=0x80 addr=0x0 pc=0x4028f4]

 stack:
({0x4ca63d?, 0xc000391ed0?})
        :992 +0x71
()
        :802 +0x3a9
indexbytebody()
        :35 +0x14
(0xc00045f800)
        :415 +0x31
(0xc00045f800)
        :440 +0x7d
(0xc000038b38)
        :296 +0x45
(0xc000038b38, 0x10000)
        :1141 +0x8a
(0xc00008b6c0, 0xc000394af8?)
        :558 +0xef
()
        :469 +0x25
()
        :469 +0x49

goroutine 26 [GC assist marking]:
()
        :436 fp=0xc000394ae8 sp=0xc000394ae0 pc=0x45ab00
(0xc00008b6c0)
        :468 +0x18b fp=0xc000394b48 sp=0xc000394ae8 pc=0x41a5eb
(0x140, 0x0, 0x0)
        :973 +0x11f fp=0xc000394bc0 sp=0xc000394b48 pc=0x40b51f
(0x50)
        :301 +0x10a fp=0xc000394c18 sp=0xc000394bc0 pc=0x44b50a
(0xc000394cc8, {0x4cd6d0, 0x96})
        :197 +0xca fp=0xc000394c60 sp=0xc000394c18 pc=0x44b0ca
()
        ./launcher.go:697 +0x357 fp=0xc000394e78 sp=0xc000394c60 pc=0x4a34b7
()
        ./launcher.go:133 +0x1e5 fp=0xc000394fe0 sp=0xc000394e78 pc=0x49b925
()
        :1571 +0x1 fp=0xc000394fe8 sp=0xc000394fe0 pc=0x45cbe1
created by 
        ./launcher.go:574 +0x189

goroutine 1 [runnable]:
()
        :308 +0x3f
()
        :50 +0xdb
({0xc0000ce070, 0xd})
        ./launcher.go:225 +0x158
()
        ./launcher.go:328 +0x699
()
        ./launcher.go:575 +0x19a
()
        :250 +0x212
()
        :1571 +0x1

goroutine 2 [force gc (idle)]:
(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
        :361 +0xd6
(...)
        :367
()
        :301 +0xad
()
        :1571 +0x1

goroutine 3 [GC sweep wait]:
(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
        :361 +0xd6
(...)
        :367
(0x0?)
        :278 +0x8e
()
        :177 +0x26
()
        :1571 +0x1

goroutine 4 [runnable]:
(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
        :361 +0xd6
(...)
        :367
(0x0?)
        :272 +0xec
()
        :178 +0x26
()
        :1571 +0x1

goroutine 18 [sys]:
(0x0?, 0x0?)
        :235 +0x34
()
        :151 +0x2f
()
        :23 +0x19
()
        :1571 +0x1

goroutine 19 [chan receive]:
(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
        :361 +0xd6
(0xc0000bc120, 0xc000056fa0, 0x1)
        :577 +0x56c
(0x0?, 0x0?)
        :440 +0x18
(0xc0000bc120)
        ./launcher.go:46 +0x32
()
        ./launcher.go:572 +0x2b
()
        :1571 +0x1

goroutine 5 [GC worker (idle)]:
(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
        :361 +0xd6
()
        :1207 +0xe5
()
        :1571 +0x1

goroutine 50 [GC worker (idle)]:
(0x1?, 0x1?, 0xd0?, 0x8f?, 0x49c0fd?)
        :361 +0xd6
()
        :1207 +0xe5
()
        :1571 +0x1

goroutine 6 [GC worker (idle)]:
(0x4ccbcc?, 0x82?, 0xa5?, 0xd5?, 0x95?)
        :361 +0xd6
()
        :1207 +0xe5
()
        :1571 +0x1

goroutine 25 [runnable]:
()
        :308 +0x3f
()
        :50 +0xdb
({0xc0001b0050, 0xd})
        ./launcher.go:225 +0x134
()
        ./launcher.go:328 +0x699
()
        :1571 +0x1

goroutine 49 [GC worker (idle)]:
(0xac?, 0xc0000d8fd0?, 0x15?, 0xc2?, 0x5644d8?)
        :361 +0xd6
()
        :1207 +0xe5
()
        :1571 +0x1

goroutine 33 [GC worker (idle)]:
(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
        :361 +0xd6
()
        :1207 +0xe5
()
        :1571 +0x1

goroutine 34 [GC worker (idle)]:
(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
        :361 +0xd6
()
        :1207 +0xe5
()
        :1571 +0x1

goroutine 35 [GC worker (idle)]:
(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
        :361 +0xd6
()
        :1207 +0xe5
()
        :1571 +0x1

goroutine 7 [GC worker (idle)]:
(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
        :361 +0xd6
()
        :1207 +0xe5
()
        :1571 +0x1

goroutine 36 [GC worker (idle)]:
(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
        :361 +0xd6
()
        :1207 +0xe5
()
        :1571 +0x1

goroutine 37 [GC worker (idle)]:
(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
        :361 +0xd6
()
        :1207 +0xe5
()
        :1571 +0x1

goroutine 51 [GC worker (idle)]:
(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
        :361 +0xd6
()
        :1207 +0xe5
()
        :1571 +0x1

goroutine 52 [GC worker (idle)]:
(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
        :361 +0xd6
()
        :1207 +0xe5
()
        :1571 +0x1

goroutine 53 [GC worker (idle)]:
(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
        :361 +0xd6
()
        :1207 +0xe5
()
        :1571 +0x1

goroutine 8 [GC worker (idle)]:
(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
        :361 +0xd6
()
        :1207 +0xe5
()
        :1571 +0x1

goroutine 9 [GC worker (idle)]:
(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
        :361 +0xd6
()
        :1207 +0xe5
()
        :1571 +0x1

goroutine 38 [GC worker (idle)]:
(0x59fe60?, 0x1?, 0x5a?, 0xb4?, 0x0?)
        :361 +0xd6
()
        :1207 +0xe5
()
        :1571 +0x1

Error while compressing launcher

$ pakkero --file whoami -o test -c
 → Randomizing offset...		[ OK ]
 → Registering Dependencies...		[ OK ]
 → Creating Launcher Stub...		[ OK ]
 → Obfuscating Launcher Stub...		[ OK ]
 → Compiling Launcher...		[ OK ]
 → Stripping Launcher...		[ OK ]
 → Compressing Launcher...failed to execute command /home/user/.local/bin/upx test: exit status 1
                       Ultimate Packer for eXecutables
                          Copyright (C) 1996 - 2022
UPX 4.0.1       Markus Oberhumer, Laszlo Molnar & John Reiser   Nov 16th 2022

        File size         Ratio      Format      Name
   --------------------   ------   -----------   -----------
upx: test: CantPackException: span unexpected NULL pointer; take care!

Packed 1 file: 0 ok, 1 error.

		[ ERR ]
		[ ERR ]
 → Cleaning up...			[ OK ]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.