identifybin

package module
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 20, 2024 License: GPL-2.0 Imports: 7 Imported by: 1

README

identifybin

Example:

url := "https://yoururltoafilehere"
byteCount := int64(256) //number of bytes to download
bytes, err := idbin.DownloadFirstNBytes(url, byteCount)
if err != nil {
    fmt.Println("Error:", err)
    return
}
fmt.Printf("Downloaded %d bytes: %v\n", len(bytes), bytes)

// operatingSystem, arch, err := detectOSAndArch(os.Args[1]) //You can directly pass a file path to detectOSAndArch
   operatingSystem, arch, err := idbin.DetectOSAndArch(bytes) //Or you can pass the bytes of a file
if err != nil {
	fmt.Println("Error:", err)
       	return
}
fmt.Printf("Operating System: %s\nArch: %s\n", operatingSystem, arch)

Documentation

Overview

Package identifybin is a package for identifying the operating system, architecture, and endianess of a binary.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DownloadFirstNBytes

func DownloadFirstNBytes(url string, byteCount int64) ([]byte, error)

DownloadFirstNBytes downloads the first N bytes of a file from a URL.

Types

type BinaryType

type BinaryType struct {
	OperatingSystem string
	Arch            string
	Endianess       string
}

BinaryType is the type of binary

func DetectOSAndArch

func DetectOSAndArch(input interface{}) (BinaryType, error)

DetectOSAndArch downloads the first n bytes of a file

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL