zhovner / mfdread

Mifare 1k/4k dumps parser in human readable format
306 stars 51 forks source link

Consider using my parser instead #8

Open KOLANICH opened 6 years ago

KOLANICH commented 6 years ago

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 commented 6 years ago

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

KOLANICH commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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