Code Monkey home page Code Monkey logo

acefile's Introduction

acefile - read/test/extract ACE 1.0 and 2.0 archives in pure python

Copyright (C) 2017-2019, Daniel Roethlisberger.
https://www.roe.ch/acefile

Synopsis

pip install acefile

# python library
import acefile
with acefile.open('example.ace') as f:
    f.extractall()

# unace utility
acefile-unace -x example.ace

Overview

This single-file, pure python 3, no-dependencies implementation is intended to be used as a library, but also provides a stand-alone unace utility. As mostly pure-python implementation, it is significantly slower than native implementations, but more robust against vulnerabilities.

This implementation supports up to version 2.0 of the ACE archive format, including the EXE, DELTA, PIC and SOUND modes of ACE 2.0, password protected archives and multi-volume archives. It does not support writing to archives. It is an implementation from scratch, based on the 1998 document titled "Technical information of the archiver ACE v1.2" by Marcel Lemke, using unace 2.5 and WinAce 2.69 by Marcel Lemke as reference implementations.

For more information, API documentation, source code, packages and release notifications, refer to:

Requirements

Python 3. No other dependencies.

Installation

pip install acefile

The acefile package includes an optional acebitstream module that implements the bit stream class in c, resulting in a 50% speedup. It is automatically used wherever it builds cleanly, but is not required.

Library usage examples

Extract all files in the archive, with directories, to current working dir:

import acefile
with acefile.open('example.ace') as f:
    f.extractall()

Walk all files in the archive and test each one of them:

import acefile
with acefile.open('example.ace') as f:
    for member in f:
        if member.is_dir():
            continue
        if f.test(member):
            print("CRC OK:     %s" % member.filename)
        else:
            print("CRC FAIL:   %s" % member.filename)

In-memory decompression of a specific archive member:

import acefile
import io

filelike = io.BytesIO(b'\x73\x83\x31\x00\x00\x00\x90**ACE**\x14\x14' ...)
with acefile.open(filelike) as f:
    data = f.read('example.txt')

Handle archives potentially containing large members in chunks to avoid fully reading them into memory:

import acefile

with acefile.open('large.ace') as fi:
    with open('large.iso', 'wb') as fo:
        for block in fi.readblocks('large.iso'):
            fo.write(block)

Check the API documentation for a complete description of the API.

Utility usage examples

Extract all files in the archive, with directories, to current working dir:

acefile-unace -x example.ace

Test all files in the archive, verbosely:

acefile-unace -tv example.ace

List archive contents, verbosely:

acefile-unace -lv example.ace

Check usage for more functionality:

acefile-unace -h

Credits

Marcel Lemke for designing the ACE archive format and ACE compression and decompression algorithms.

acefile's People

Contributors

droe avatar flautossec avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

acefile's Issues

Native bit stream implementation for speedup

Significant speedups seem possible by simply adding or using a native c implementation for the low level bit stream manipulations. Ideally that would be optional, in order to still have the pure python portability benefit.

NT security information decoding, NT attributes

WinAce has the capability to add NT security information for each file to the archive. For archive forensics, Acefile should be able to decode that information in --headers/dumpheaders() and optionally write it to the filesystem on extraction. Also, on Windows, the file attributes should be restored as far as it makes sense on extraction, perhaps optionally as well.

Parse RECOVERY headers

RECOVERY headers (RECOVERY32, RECOVERY64A and RECOVERY64B) are currently skipped without parsing them; beyond checking the header CRC, they are completely unused and inaccessible through the API. Acefile could at least fully parse them.

Restore NTFS streams on Windows

NTFS streams seem to be handled by archiving them using a special filename. This needs to be investigated (need sample files!) and implemented as appropriate.

Not preserving original file dates

Dunno about Linux behavior, but in MacOS is uses the extract time and date for both Creation and Modification Date; should only do this with the latter and preserve the original file dates as the former, the way other tools do (or at least do this by default; there could be an option to force them to "now").

Multivolume archive support

Multivolume archives are currently not supported. Both the library and the CLI client need support for multivolume archives. This needs careful design of the high-level API and CLI behaviour to support multivolume archives cleanly, and low-level support for proper continuation from one file to another.

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.