Skip to content

Latest commit

History

13 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

identifybin

A small package used to identify the OS and Architecture of a binary from a few bytes of a file, made as a support package for github.com/earentir/gitearelease

Usage/Examples

Check version of current and compare to latest release

import (
"fmt""github.com/earentir/identifybin"
)
funccheckVersion() {
// Get OS of attachment binaryurl:="https://github.com/earentir/subscan/releases/download/v0.1.5/subscan"byteCount:=int64(256) // number of bytes to downloadbytes, err:=identifybin.DownloadFirstNBytes(url, byteCount)
iferr!=nil {
fmt.Println("Error:", err)
break
}
binType, err:=identifybin.DetectOSAndArch(bytes)
iferr!=nil {
fmt.Println("Error:", err)
break
}
fmt.Printf("%s %s %s\n", binType.OperatingSystem, binType.Arch, binType.Endianess)
}

Func Reference

DetectOSAndArch

funcDetectOSAndArch(inputinterface{}) (BinaryType, error)
ParameterTypeDescription
inputstring or []byteRequired

DetectOSAndArch will either take a byte array or a string and then detect the OS and Architecture of that file

DownloadFirstNBytes

funcDownloadFirstNBytes(urlstring, byteCountint64) ([]byte, error)
ParameterTypeDescription
urlstringRequired
byteCountint64Required

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

Dependancies & Documentation

Go Mod

Go Reference

Dependancies

Authors

License

I will always follow the Linux Kernel License as primary, if you require any other OPEN license please let me know and I will try to accomodate it.

License

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages