Code Monkey home page Code Monkey logo

a3lib.py's Introduction

a3lib.py

python3 tool library for Arma 3

Features

  • python classes for working with PBOs, keys and signatures
  • basic command line tools for:
    • PBO creation, listing and unpacking
    • conversion of RSA keys (DER or PEM format) to .biprivatekey/.bikey format
    • signature (.bisign) creation and verification

Usage

Help

$ a3lib.py --help
usage: a3lib.py [-h] [-v | -q] {key,sign,verify,bisign,pbo} ...

Work with BI PBOs, signatures and keys.

positional arguments:
  {key,sign,verify,bisign,pbo}
                        sub-command help
    key                 print/convert keys
    sign                sign a PBO
    verify              verify the signature of a PBO
    bisign              print bisign/extract public key
    pbo                 create/extract/list PBO files

optional arguments:
  -h, --help            show this help message and exit
  -v, --verbose         increase output verbosity
  -q, --quiet
$ a3lib.py key --help
usage: a3lib.py key [-h] [--privout] [--pubin] [--pubout]
                    [--keyform {bi,der,pem}]
                    key

positional arguments:
  key                   public/private key

optional arguments:
  -h, --help            show this help message and exit
  --privout             write .biprivatekey
  --pubin               public key as input
  --pubout              write .bikey
  --keyform {bi,der,pem}
                        format of the input key - default: bi
$ a3lib.py sign --help
usage: a3lib.py sign [-h] [--keyform {bi,der,pem}] [--version {2,3}] key pbo

positional arguments:
  key                   private key
  pbo                   pbo to be signed

optional arguments:
  -h, --help            show this help message and exit
  --keyform {bi,der,pem}
                        format of the key - default: bi
  --version {2,3}       signature version - default: 3
$ a3lib.py bisign --help
usage: a3lib.py bisign [-h] [--pubout] sig

positional arguments:
  sig         bisign file

optional arguments:
  -h, --help  show this help message and exit
  --pubout    extract public key from signature
$ a3lib.py verify --help
usage: a3lib.py verify [-h] [--keyform {bi,der,pem}] [--privin] key pbo sig

positional arguments:
  key                   public key
  pbo                   pbo to be verified
  sig                   signature to be verified

optional arguments:
  -h, --help            show this help message and exit
  --keyform {bi,der,pem}
                        Format of the key - default: bi
  --privin              private key as input
$ a3lib.py pbo --help
usage: a3lib.py pbo [-h] (-c | -i | -l | -x) -f PBO [--include INCLUDE]
                    [--exclude EXCLUDE] [-e NAME VALUE] [--no-pboprefixfile]
                    [--no-recursion] [--timestamps]
                    [FILE [FILE ...]]

positional arguments:
  FILE                  files to be added

optional arguments:
  -h, --help            show this help message and exit
  -c, --create          create a new pbo file
  -i, --info            print information about the pbo file
  -l, --list            list the content of the pbo file
  -x, --extract         extract a pbo file
  -f PBO, --file PBO    pbo file
  --include INCLUDE     include filter pattern
  --exclude EXCLUDE     exclude filter pattern
  -e NAME VALUE, --header_extension NAME VALUE
                        header extension to be added
  --no-pboprefixfile    don't use a $PBOPREFIX$ file
  --no-recursion        don't automatically ascend into directories when
                        adding files
  --timestamps          update timestamps when extracting PBOs

Examples

  • list PBO content:
    a3lib.py pbo -lf test.pbo

  • unpack PBO into current directory:
    a3lib.py pbo -xf test.pbo

  • unpack PBO into current directory - only *.cpp files:
    a3lib.py pbo -xf test.pbo --include *.cpp

  • unpack PBO into current directory - exclude *.cpp files:
    a3lib.py pbo -xf test.pbo --exclude *.cpp

  • create PBO and add config.cpp and folder abc:
    a3lib.py pbo -cf test.pbo config.cpp abc

  • create new private key and convert to bi format:
    openssl genpkey -algorithm rsa -outform der -out mytestkey.der
    a3lib.py key --keyform der mytestkey.der --privout --pubout

  • sign PBO:
    a3lib.py sign mytestkey.biprivatekey test.pbo

  • sign PBO with key in DER format:
    a3lib.py sign --keyform der mytestkey.der test.pbo

  • verify signature:
    a3lib.py verify mytestkey.bikey test.pbo test.pbo.mytestkey.bisign

Class Documentation

import a3lib
help(a3lib)

Known issues/limitations

  • management of file handles is quite a mess
  • only basic PBO support:
    • no compression
    • (currently) no support for mission type PBOs
    • no backwards compatibility
  • almost no exception handling: garbage in -> garbage out
  • no tests

a3lib.py's People

Contributors

4d4a5852 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.