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

Consider using my parser instead #8

Open
KOLANICH opened this issue Aug 9, 2018 · 4 comments
Open

Consider using my parser instead #8

KOLANICH opened this issue Aug 9, 2018 · 4 comments

Comments

@KOLANICH
Copy link

KOLANICH commented Aug 9, 2018

https://github.com/kaitai-io/kaitai_struct_formats/blob/master/hardware/mifare/mifare_classic.ksy

Obviously it needs compilation, you can read how to do it in
https://github.com/KOLANICH/MFCTool.py/blob/master/setup.py#L16L31

Please note that kaitaiStructCompile.py is unstable and has unstaboe API, it is likely to be changed in a week.

For example I gonna default

"flags": ["--python-package", "."],

and move them into a separate place in config dict

@zhovner
Copy link
Owner

zhovner commented Aug 9, 2018

I don't get how to run it.
Can you write step-by-step tutorial?

@KOLANICH
Copy link
Author

KOLANICH commented Aug 9, 2018

1 you need to compile the description into python code. You need to install the compiler first, how to do it on linux you can see in https://github.com/KOLANICH/MFCTool.py/blob/master/.ci/setupKS.sh .
For windows you need to download and install (or unpack for example with lessmsi, but if you do it, don't forget to set the env variable KAITAI_STRUCT_ROOT) the nightly msi from appveyor:

pip install --upgrade git+https://github.com/KOLANICH/appveyor-artifacts.git
appveyor-artifacts -n kaitai-struct-compiler -o GreyCat -b master

(of course browser can also be used)

2 git clone https://github.com/kaitai-io/kaitai_struct_formats.git ksf
3 compile the stuff: ksc --target=python ksf/hardware/mifare/mifare_classic.ksy
4 ipython, then from mifare_classic import *, then d=MifareClassic.from_file("./test.mfd"), then get you familiar with the objects hierarchy. You may need my fork of the runtime since I have added __repr__ into it, but it is still not merged into upstream.
5 once you have integrated the code into your code, you can put into setup.py the linked snippet (don't forget to add the lib into setup_requires and the link to a repo into dependency_links) and the parser would be freshly compiled from the fresh definition from the repo during the build of the package. But this lib is very unstable and very unfinished, I have significantly improved it in my local repo, but the changes are not yet ready to be published.

@zhovner
Copy link
Owner

zhovner commented Aug 9, 2018

Wow, so complicated :)

Maybe it is possible to use it in web ide?
I've try with no luck. What i'm doing wrong?

@KOLANICH
Copy link
Author

KOLANICH commented Aug 9, 2018

WebIDE (even /devel) has an obsolete version, use python shell for now.

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

No branches or pull requests

2 participants