ipsw

package module
v0.0.0-...-91a3ab6 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2021 License: MIT Imports: 20 Imported by: 1

README

go-ipsw

Common utilities for dealing with Apple Software files in Golang.

for v1, check out the v1 branch

Documentation

Index

Constants

View Source
const (
	BuildManifestFilename = "BuildManifest.plist"
	RestoreFilename       = "Restore.plist"
)
View Source
const (
	NorContainer   ImageContainer = 0x696D6733 // img3
	Img3Container  ImageContainer = 0x496D6733 // Img3
	X8900Container ImageContainer = 0x30303938 // 8900
	Img2CVontainer ImageContainer = 0x494D4732 // IMG2

	DataElement ElementType = 0x44415441 // DATA
	TypeElement ElementType = 0x54595045 // TYPE
	KbagElement ElementType = 0x4B424147 // KBAG
	ShshElement ElementType = 0x53485348 // SHSH
	CertElement ElementType = 0x43455254 // CERT
	ChipElement ElementType = 0x43484950 // CHIP
	ProdElement ElementType = 0x50524F44 // PROD
	SdomElement ElementType = 0x53444F4D // SDOM
	BordElement ElementType = 0x424F5244 // BORD
	SepoElement ElementType = 0x5345504F // SEPO
	EcidElement ElementType = 0x45434944 // ECID
)
View Source
const OTABuildManifestFilename = "AssetData/boot/BuildManifest.plist"

Variables

View Source
var MaxDownloadTries = 10

Functions

func DownloadFile

func DownloadFile(resource, file string, w io.Writer) error

func FindElement

func FindElement(data *bufio.Reader, signature ElementType, out interface{}) error

func KBag

func KBag(data *bufio.Reader) (string, error)

KBag finds the kbag for a byte array.

func NewiTunesVersionMaster

func NewiTunesVersionMaster(url string) (*iTunesVersionMaster, error)

NewiTunesVersionMaster creates a new iTunesVersionMaster struct, parsed and ready to use

Types

type BuildIdentity

type BuildIdentity struct {
	ApChipID                           string // these are ints really
	ApBoardID                          string
	ApSecurityDomain                   string
	BbChipID                           string
	BbProvisioningManifestKeyHash      []byte
	BbActivationManifestKeyHash        []byte
	BbCalibrationManifestKeyHash       []byte
	BbFactoryActivationManifestKeyHash []byte
	BbFDRSecurityKeyHash               []byte
	Info                               BuildIdentityInfo
	Manifest                           BuildIdentityManifest `plist:"Manifest"`
	// RawManifest                        interface{}           `plist:"Manifest"`
	UniqueBuildID []byte
	BbSkeyId      []byte
}

type BuildIdentityInfo

type BuildIdentityInfo struct {
	BuildNumber     string
	BuildTrain      string
	DeviceClass     string
	Variant         string
	RestoreBehavior string
}

type BuildIdentityManifest

type BuildIdentityManifest map[string]Manifest

type BuildInformation

type BuildInformation struct {
	Restore              *IndividualBuild
	Update               *IndividualBuild
	SameAs               BuildNumber
	OfferRestoreAsUpdate bool
}

type BuildManifest

type BuildManifest struct {
	BuildIdentities       []BuildIdentity
	SupportedProductTypes []string
	ProductVersion        string
	ProductBuildVersion   string
}

type BuildNumber

type BuildNumber string

func (BuildNumber) String

func (b BuildNumber) String() string

type Device

type Device struct {
	Identifier  Identifier
	BDID        int
	BoardConfig string
	CPID        int
	Platform    string
	SCEP        int
}

type ElementType

type ElementType uint32

type HTTPClient

type HTTPClient interface {
	Do(*http.Request) (*http.Response, error)
	Get(string) (*http.Response, error)
	Head(string) (*http.Response, error)
	Post(string, string, io.Reader) (*http.Response, error)
	PostForm(string, url.Values) (*http.Response, error)
}

HTTPClient is a wrapper for client

var DefaultClient HTTPClient = &http.Client{
	Timeout: 30 * time.Second,
}

type IPSW

type IPSW struct {
	Identifier string
	BuildID    string
	Resource   string
	// contains filtered or unexported fields
}

func NewIPSW

func NewIPSW(identifier, build, resource string) *IPSW

func NewIPSWWithIdentifierBuild

func NewIPSWWithIdentifierBuild(client *api.IPSWClient, identifier, build string) (*IPSW, error)

func (IPSW) Baseband

func (i IPSW) Baseband() (string, error)

func (*IPSW) BuildManifest

func (i *IPSW) BuildManifest() (*BuildManifest, error)

func (*IPSW) Headers

func (i *IPSW) Headers() (http.Header, error)

func (*IPSW) PlistFromZip

func (i *IPSW) PlistFromZip(name string, out interface{}) error

func (*IPSW) RawManifest

func (i *IPSW) RawManifest() (map[string]interface{}, error)

func (*IPSW) RestorePlist

func (i *IPSW) RestorePlist() (*Restore, error)

type Identifier

type Identifier string

func (Identifier) String

func (i Identifier) String() string

type Image

type Image struct {
	Info struct {
		Path string `plist:"Path"`
	} `plist:"Info"`
}

type ImageContainer

type ImageContainer int

type ImageElementHeader

type ImageElementHeader struct {
	Signature, FullSize, DataSize uint32
}

type ImageHeader

type ImageHeader struct {
	Signature, FullSize, DataSize, ShshOffset, ImageType uint32
}

type ImageKbagElement

type ImageKbagElement struct {
	Header       ImageElementHeader
	State, IType uint32
	IV           [16]byte
	Key          [32]byte
}

type IndividualBuild

type IndividualBuild struct {
	BuildVersion     BuildNumber
	DocumentationURL string
	FirmwareURL      string
	FirmwareSHA1     string
	ProductVersion   string
}

type Manifest

type Manifest struct {
	Info ManifestInfo
}

type ManifestInfo

type ManifestInfo struct {
	Path string
}

type OTABuildIdentity

type OTABuildIdentity struct {
	ApChipID         string                `plist:"ApChipID"`
	ApBoardID        string                `plist:"ApBoardID"`
	ApSecurityDomain string                `plist:"ApSecurityDomain"`
	UniqueBuildID    []byte                `plist:"UniqueBuildID"`
	Manifest         map[string]*Image     `plist:"Manifest"`
	Info             *OTABuildIdentityInfo `plist:"Info"`
}

type OTABuildIdentityInfo

type OTABuildIdentityInfo struct {
	DeviceClass string `plist:"DeviceClass"`
}

type OTABuildManifest

type OTABuildManifest struct {
	BuildIdentities       []*OTABuildIdentity `plist:"BuildIdentities"`
	SupportedProductTypes []Identifier        `plist:"SupportedProductTypes"`
	ProductVersion        string              `plist:"ProductVersion"`
	ProductBuildVersion   string              `plist:"ProductBuildVersion"`
}

func (*OTABuildManifest) DeviceByIdentifier

func (m *OTABuildManifest) DeviceByIdentifier(identifier Identifier) (*Device, error)

type OTAFirmware

type OTAFirmware struct {
	BuildID               string       `plist:"Build"`
	InstallationSize      string       `plist:"InstallationSize"`
	Version               string       `plist:"OSVersion"`
	PrerequisiteBuild     string       `plist:"PrerequisiteBuild"`
	PrerequisiteOSVersion string       `plist:"PrerequisiteOSVersion"`
	ReleaseType           string       `plist:"ReleaseType"`
	DocumentationID       string       `plist:"SUDocumentationID"`
	SupportedDevices      []Identifier `plist:"SupportedDevices"`
	DownloadSize          int          `plist:"_DownloadSize"`
	UnarchivedSize        int          `plist:"_UnarchivedSize"`
	BaseURL               string       `plist:"__BaseURL"`
	RelativePath          string       `plist:"__RelativePath"`
	MarketingVersion      string       `plist:"MarketingVersion"` // for watches
}

Firmware release

func (*OTAFirmware) GetURL

func (o *OTAFirmware) GetURL() string

type OTAXML

type OTAXML struct {
	Assets []*OTAFirmware
}

func NewOTAXML

func NewOTAXML(src string) (*OTAXML, error)

NewOTAXML generates a new OTA XML struct

type OTAZip

type OTAZip struct {
	*IPSW
	// contains filtered or unexported fields
}

func NewOTAZip

func NewOTAZip(identifier, build, resource string) *OTAZip

func (*OTAZip) BuildManifest

func (z *OTAZip) BuildManifest() (*OTABuildManifest, error)

type Restore

type Restore struct {
	DeviceClass           string
	Devices               []*Device `plist:"DeviceMap"`
	ProductBuildVersion   string
	ProductType           Identifier
	ProductVersion        string
	SupportedProductTypes []Identifier
}

func (*Restore) DeviceByIdentifier

func (r *Restore) DeviceByIdentifier(identifier Identifier) (*Device, error)

type SHSHDevice

type SHSHDevice struct {
	BoardConfig string           `json:"board"`
	Identifier  string           `json:"model"`
	CPID        int              `json:"cpid,string"`
	BDID        int              `json:"bdid,string"`
	Platform    string           `json:"platform"`
	Firmwares   []*SigningStatus `json:"firmwares"`
}

type SHSHJSON

type SHSHJSON map[Identifier]*SHSHDevice

func NewSHSHJSON

func NewSHSHJSON(sourceURL string) (SHSHJSON, error)

NewSHSHJSON returns a new instance of SHSHJSON

type SigningStatus

type SigningStatus struct {
	BuildID string `json:"build"`
	Version string `json:"version"`
	Signing bool   `json:"signing"`
	Started string `json:"started"`
	Stopped string `json:"stopped"`
}

Firmware is a change to signing window firmware

type VersionWrapper

type VersionWrapper struct {
	MobileDeviceSoftwareVersions map[Identifier]map[BuildNumber]*BuildInformation
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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