Little helper to create tar balls of an executable together with its ELF shared library dependencies.

Little helper to create tar balls of an executable together with its ELF shared library dependencies. This is useful for prototyping with gokrazy: https://gokrazy.org/prototyping/

Installation

go install github.com/gokrazy/freeze/cmd/...@latest

Usage

Let’s assume you want to try the upcoming Linux ksmbd feature.

On Linux, build ksmbd-tools:

$ git clone https://github.com/cifsd-team/ksmbd-tools
$ cd ksmbd-tools
$ ./autogen.sh
$ ./configure 
$ make -j8
$ freeze control/ksmbd.control
[…]
2021/10/24 15:29:33 Download freeze1373262977.tar to your gokrazy device and run:
	LD_LIBRARY_PATH=$PWD ./ld-linux-x86-64.so.2 ./ksmbd.control

Then, on your gokrazy device, e.g. via breakglass:

$ cd /tmp
$ wget http://10.0.0.76:4080/freeze1373262977.tar
$ tar xf freeze1373262977.tar 
$ cd freeze1373262977/
$ LD_LIBRARY_PATH=$PWD ./ld-linux-x86-64.so.2 ./ksmbd.control
Usage: ksmbd.control
	-s | --shutdown
	-d | --debug=all or [smb, auth, etc...]
	-c | --ksmbd-version
	-V | --version
Similar Resources

💪 Helper Utils For The Go: string, array/slice, map, format, cli, env, filesystem, test and more.

💪 Helper Utils For The Go: string, array/slice, map, format, cli, env, filesystem, test and more.

💪 Helper Utils For The Go: string, array/slice, map, format, cli, env, filesystem, test and more. Go 的一些工具函数,格式化,特殊处理,常用信息获取等等

Jan 6, 2023

Go-path - A helper package that provides utilities for parsing and using ipfs paths

go-path is a helper package that provides utilities for parsing and using ipfs paths

Jan 18, 2022

Helper functions for common scenarios, using Go generics.

zeroflucs generics When writing Go code for Go 1.17 or below, we've all written more than our fair share of methods to check "does this slice contain

Feb 18, 2022

A full-featured license tool to check and fix license headers and resolve dependencies' licenses.

A full-featured license tool to check and fix license headers and resolve dependencies' licenses.

SkyWalking Eyes A full-featured license tool to check and fix license headers and resolve dependencies' licenses. Usage You can use License-Eye in Git

Dec 26, 2022

The main goal of this code is to create a basic dnstap printing tool based on the golang-dnstap library.

dnstap-parse The main goal of this code is to create a basic dnstap printing tool based on the golang-dnstap library. The output is supposed to mimic

Nov 14, 2021

A fully Go userland with Linux bootloaders! u-root can create a one-binary root file system (initramfs) containing a busybox-like set of tools written in Go.

u-root Description u-root embodies four different projects. Go versions of many standard Linux tools, such as ls, cp, or shutdown. See cmds/core for m

Dec 29, 2022

A program to create assembly 8086 strings to print without using any printing/strings related function but only mov-xchg-int and loops

Assembly String builder tool A program to create assembly 8086 strings to print without using any printing/strings related function but only mov-xchg-

Feb 1, 2022

Create deep copies (clones) of your maps and slices without using reflection.

DeepCopy DeepCopy helps you create deep copies (clones) of your maps and slices. Create deep copies (clones) of your objects The package is based on t

Nov 20, 2022

Govalid is a data validation library that can validate most data types supported by golang

Govalid is a data validation library that can validate most data types supported by golang. Custom validators can be used where the supplied ones are not enough.

Apr 22, 2022
Comments
  • [comment] same need, same solution

    [comment] same need, same solution

    I came across the same need when packaging a python application into a standalone folder.

    I used the same trick : embed libs given by ldd with the exe into a tarball. Work pretty well.

    Since I'm more a shell guy than a go guy, I used the following:

    # cd into dist folder
    ldd $1       |  # list shared libs
      awk '$2 == "=>" { print $3 }' |  # format ldd output
      sort -u    |  # remove duplicated
      tar c -T - |  # tar from file list from stdin
      tar x         # untar in current folder
    
  • support cross compilation

    support cross compilation

    The tc example on https://gokrazy.org/prototyping/ uses cross compilation.

    freeze should work out of the box with binaries that are not for the host architecture.

  • Refactor the way dependencies are foudn?

    Refactor the way dependencies are foudn?

    There are a couple of issues with the FindShLibs() function:

    • Some executables like /usr/sbin/nft b0rk at no arguments passed and exit with an exit status of 1. I kid you not 🤦‍♂️ Whoever designed the nft tool this way, shame 😅
    • Furthermore, I found that the LD_TRACE_LOADED_OBJECTS=1 seems to be a GNU LIBC thing only? This does not work on Alpine for example which uses musl? (I could be wrong) but I wasn't able to use freeze on Alpine.
  • libresolv / libnss are not frozen (for iperf3, or wget)

    libresolv / libnss are not frozen (for iperf3, or wget)

    When name resolution (via getaddrinfo) is broken due to lack of libnss*.so and libresolv*.so, iperf3 fails to start with an opaque error message (iperf3: error - unable to send control message: Bad file descriptor).

    Looks like libnss_dns* and libresolv* are the minimum files we need for name resolution to work.

Related tags
Elf binary infector written in Golang

Elf binary infector written in Golang. It can be used for infecting executables of type ET_DYN and ET_EXEC with a payload of your creation. Utilizing the classic elf text segment padding algorithm by Silvio Cesar, your payload (parasite) will run before native functionality of the binary effectively backooring the binary.

Dec 30, 2022
A helper function to create a pointer to a new object in Go 1.18+
A helper function to create a pointer to a new object in Go 1.18+

A helper function to create a pointer to a new object in Go 1.18+

Nov 9, 2022
GoDynamic can load and run Golang dynamic library compiled by -buildmode=shared -linkshared

GoDynamic can load and run Golang dynamic library compiled by -buildmode=shared -linkshared How does it work? GoDynamic works like a dynamic

Sep 30, 2022
Go API backed by the native Dart Sass Embedded executable.

This is a Go API backed by the native Dart Sass Embedded executable. The primary motivation for this project is to provide SCSS support to Hugo. I wel

Jan 5, 2023
ms - 'my story' creates a secure password string which can be memorized with a technique shared by Max.

On 23.12.21 20:22, Stefan Claas wrote: [...] > > Yes, I am aware of that, but how can one memorize a key when traveling > and not taking any devices

Dec 24, 2021
Helper library for full uint64 randomness, pool backed for efficient concurrency

fastrand64-go Helper library for full uint64 randomness, pool backed for efficient concurrency Inspired by https://github.com/valyala/fastrand which i

Dec 5, 2021
A well tested and comprehensive Golang statistics library package with no dependencies.

Stats - Golang Statistics Package A well tested and comprehensive Golang statistics library / package / module with no dependencies. If you have any s

Dec 30, 2022
Little Bug Bounty & Hacking Tools⚔️

Little Bug Bounty & Hacking Tools ⚔️

Jan 7, 2023
eac3to wrapper that fixes its bug 288

eac3to-wrapper eac3to-wrapper aims to fix eac3to's long standing bug 288. To build, first install Go from golang.org/dl, then: go build -ldflags "-X m

Jun 7, 2022
tfu is a Terraform helper to update the providers of Terraform

tfu (speak 'TF-up') tfu is a Terraform helper to update the providers of Terraform Works only starting from version Terraform 0.13+ Nothing more nothi

Apr 26, 2022