Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for electron ASAR archives #1746

Open
Tracked by #1825
pombredanne opened this issue Oct 4, 2019 · 10 comments
Open
Tracked by #1825

Add support for electron ASAR archives #1746

pombredanne opened this issue Oct 4, 2019 · 10 comments

Comments

@pombredanne
Copy link
Member

pombredanne commented Oct 4, 2019

Description

This is the format used by Electron apps.
This is defined here https://github.com/electron/asar
See these Python libs:

See also libarchive/libarchive#1259

@adityaviki
Copy link
Contributor

on it :)

@adityaviki
Copy link
Contributor

Hi! @pombredanne
Since, neither 7zip nor libarchive supports ASAR archives, we'll probably have to create another extractor. Can you provide any pointer on how to do that?

From what I can think of , we can package official asar libarary into a binary file or use one of its python implementation or maybe create our own python asar library for extraction.

@pombredanne
Copy link
Member Author

@adityaviki the general approach would be to copy something such as any of https://github.com/nexB/scancode-toolkit/blob/develop/src/extractcode/libarchive2.py https://github.com/nexB/scancode-toolkit/blob/develop/src/extractcode/sevenzip.py or https://github.com/nexB/scancode-toolkit/blob/develop/src/extractcode/patch.py ... e.g. a module that has these functions in the same way other modules expose these functions

  • def extract(location, target_dir):

This would Extract files from an archive file at `location` in the `target_dir`. Return a list of warning messages if any or an empty list. Raise Exceptions on errors.

  • def is_rar(location) that would Return True if the file at location is an ASAR archive.

And optionally:

  • def list_entries(location):
    This would Return an archive entries list for the archive file at `location`.

And this would use and invoke the best one of the Python libraries above.

@adityaviki
Copy link
Contributor

adityaviki commented Oct 11, 2019

@pombredanne I looked at the python ASAR libraries that you linked.
All of them are pretty similar. None of them provide a function to list the content of the archive and don't work on Python 2.7.x

So here's what I can do

  • Modify the chosen library to work with python 2.7.x .
  • Implement a function to list the content of the archive.
  • Create a builtin plugin for the said library (similar to scancode-toolkit/plugins-builtin/extractcode_libarchive-*)
  • Create a module similar to libarchive2 containing functions def extract(location, target_dir):, def list_entries(location): and def is_rar(location).

@pombredanne
Copy link
Member Author

Actually having a quick look,https://github.com/leovoel/BeautifulDiscord/blob/master/beautifuldiscord/asar.pyand https://github.com/AS1337/asarPy seem all to be derived from the older https://github.com/Photonios/pyasar

The WTPFL license is not great as a license though so I asked @Photonios for a possible change at Photonios/pyasar#3

@pombredanne
Copy link
Member Author

There is also a possible Go-based util we could reuse (though this would mean a native) https://github.com/layeh/asar/

@mjherzog
Copy link
Member

Are we at a point where we can use a Python 3 only solution?

@pombredanne
Copy link
Member Author

@mjherzog re

Are we at a point where we can use a Python 3 only solution?

I would not go there fully yet.

@vk-mittal14
Copy link

hi, I am new to open source. I was looking at some good first issues. Can I work on this?

@SidharajYadav
Copy link

hi sir,
I am new to open source.
I was looking at some good first issues.
Can I work on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants