Socket
Socket
Sign inDemoInstall

github.com/accrescent/apkstat

Package Overview
Dependencies
0
Alerts
File Explorer

Install Socket

Detect and block malicious and high-risk dependencies

Install

    github.com/accrescent/apkstat

Package apk implements a parser for Android APKs. The APK type represents an APK file and is the API most users should use. You can open an APK file with apk.Open, or if you want more control over resource resolution, apk.OpenWithConfig. Most information about an APK is contained in its manifest. The Manifest() method will return an APK's Manifest. BUG(lberrymage): Some resource table references in binary XML are incorrectly parsed as empty strings.


Version published

Readme

Source

apkstat

An APK parsing tool and library for Go.

Usage

CLI

apkstat is a basic CLI tool for printing APK manifests and binary XML files.

Usage of apkstat:
  -apk string
        APK to print binary XML from
  -xml string
        binary XML file to print (Android manifest is default)
  -xmlres string
        well-known XML resource to print. Must be one of 'network-security' or 'extraction-rules'

-apk must be specified. If -xml is specified, apkstat will attempt to print that file in the APK ZIP hierarchy. If it isn't, apkstat will pretty print the Android manifest. If -xmlres is specified, it will pretty print the given XML resource.

Library

The main entry point for apkstat is the APK type, which you can create an instance of with the apk.Open and apk.OpenWithConfig functions.

If you need to do lower-level parsing (which is usually unnecessary), you can open resource tables and Android binary XML files directly with NewResTable() and NewXMLFile() respectively.

Example usage:

package main

import (
	"fmt"

	"github.com/accrescent/apkstat"
)

func main() {
	apk, err := apk.Open("accrescent.apk")
	if err != nil {
		panic(err)
	}

	manifest := apk.Manifest()

	fmt.Println("App ID:", manifest.Package)
	fmt.Println("App version code:", manifest.VersionCode)
	fmt.Println("App version name:", manifest.VersionName)
	for _, p := range *manifest.UsesPermissions {
		fmt.Println("Requested permission:", p.Name)
	}
}

License

apkstat is licensed under the ISC license. However, parts of it are based on code from the Android Open Source Project and the androidbinary library by Ichinose Shogo which are licensed under the Apache 2.0 and MIT licenses respectively.

FAQs

Last updated on 01 Jun 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc