Git Product home page Git Product logo

Comments (3)

K0lb3 avatar K0lb3 commented on May 20, 2024

Thanks for the report.
The fix you proposed wouldn't fix the root of the issue,
which is probably a false flag detection.
I will look into it in the coming days.

from unitypy.

K0lb3 avatar K0lb3 commented on May 20, 2024

I noticed that the data in question is compressed via lzma.FORMAT_ALONE which is the legacy lzma format.

So I checked how the properties are encoded in that format and found the following code

void DecodeProperties(const Byte *properties)
  {
    unsigned d = properties[0];
    if (d >= (9 * 5 * 5))
      throw "Incorrect LZMA properties";
    lc = d % 9;
    d /= 9;
    pb = d / 5;
    lp = d % 5;
    dictSizeInProperties = 0;
    for (int i = 0; i < 4; i++)
      dictSizeInProperties |= (UInt32)properties[i + 1] << (8 * i);
    dictSize = dictSizeInProperties;
    if (dictSize < LZMA_DIC_MIN)
      dictSize = LZMA_DIC_MIN;
  }

which is pretty much the same as the current python code besides the min dict size.

So it's better to simply use lzma.decompress(data, format = lzma.FORMAT_ALONE) .

I'm going to run some tests now to confirm this.

from unitypy.

K0lb3 avatar K0lb3 commented on May 20, 2024

Hm,
according to my tests it's not exactly the same.
I found a good way to identify the compression format tho.

When the ALONE format is used, data[5] equals 255,
if the specific compressor is used, it equals 0.

I'm going to run some further tests and so how it goes with that.

from unitypy.

Related Issues (20)

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.