Skip to main content

Deserek (from polish: (diminutive) dessert)

NO MORE NEED TO USE JAVA to produce java-serilized stuff !

image

Python code to Serialize and Unserialize java binary serialization format. For reading/writing uses https://github.com/k3idii/bytewirez

This code prints A LOT of debug message (for now). It makes understanding the format easier.

And you can alway do 2>/dev/null...

Usage:

python deserek.py binar-or-base64-file [options]

The obvious: deserializaton :

# python deserek.py examples/ysoserial_url/payload_url.txt  --out [format]

Where format :

  • json == json
  • yaml == yaml (from json)
  • python == output valid python code
  • simple == dump as simple object (dicts) <-- best for reading

Example:

# python deserek.py examples/ysoserial_url/payload_url.txt  --out python > tmp.py

# python tmp.py 2>/dev/null | xxd
00000000: aced 0005 7372 0011 6a61 7661 2e75 7469  ....sr..java.uti
00000010: 6c2e 4861 7368 4d61 7005 07da c1c3 1660  l.HashMap......`
00000020: d103 0002 4600 0a6c 6f61 6446 6163 746f  ....F..loadFacto
00000030: 7249 0009 7468 7265 7368 6f6c 6478 703f  rI..thresholdxp?
00000040: 4000 0000 0000 0c77 0800 0000 1000 0000  @......w........
00000050: 0173 7200 0c6a 6176 612e 6e65 742e 5552  .sr..java.net.UR
00000060: 4c96 2537 361a fce4 7203 0007 4900 0868  L.%76...r...I..h
00000070: 6173 6843 6f64 6549 0004 706f 7274 4c00  ashCodeI..portL.
00000080: 0961 7574 686f 7269 7479 7400 124c 6a61  .authorityt..Lja
00000090: 7661 2f6c 616e 672f 5374 7269 6e67 3b4c  va/lang/String;L
000000a0: 0004 6669 6c65 7100 7e00 034c 0004 686f  ..fileq.~..L..ho
000000b0: 7374 7100 7e00 034c 0008 7072 6f74 6f63  stq.~..L..protoc
000000c0: 6f6c 7100 7e00 034c 0003 7265 6671 007e  olq.~..L..refq.~
000000d0: 0003 7870 ffff ffff ffff ffff 7400 1074  ..xp........t..t
000000e0: 6573 742e 6578 616d 706c 652e 636f 6d74  est.example.comt
000000f0: 0001 2f71 007e 0005 7400 0468 7474 7070  ../q.~..t..httpp
00000100: 7874 0018 6874 7470 3a2f 2f74 6573 742e  xt..http://test.
00000110: 6578 616d 706c 652e 636f 6d2f 78         example.com/x

# python tmp.py > test.bin
#java -cp jv DeSerial test.bin 
Working on it ... 
{http://test.example.com/=http://test.example.com/}

( Native java deserialization code here: [https://github.com/k3idii/JavaSerializationTestSuit] )

test stability :

This mode test if serialization and deserialization is "stable" - if the binary output of serialization of unserialized data is same :)

# python deserek.py examples/ysoserial_url/payload_url.txt  --test
  (...)
UNSERILIZED !
  (...)
Testing serialization : 
  (...)
SERIALIZED :  LEN1=285 , LEN2=285 
  (...)
TEST serialization from python code ...
  (...)
SERIALIZED :  LEN1=285 , LEN2=285 

If you see this message means that (de)serializator is stable !

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

deserek-0.2.1.tar.gz (20.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

deserek-0.2.1-py3-none-any.whl (20.3 kB view details)

Uploaded Python 3

File details

Details for the file deserek-0.2.1.tar.gz.

File metadata

  • Download URL: deserek-0.2.1.tar.gz
  • Upload date:
  • Size: 20.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for deserek-0.2.1.tar.gz
Algorithm Hash digest
SHA256 13371516276535668278d6086ec76c6c50efa5cfb32a76f22d66fe9c6117da21
MD5 e1733de5bdd0aba77dbaf321c4b59473
BLAKE2b-256 e2906b2014c1c8a911e3ba6ec4c894697bc3f8419469e0d41cf3d8761df710cc

See more details on using hashes here.

Provenance

The following attestation bundles were made for deserek-0.2.1.tar.gz:

Publisher: publish.yml on k3idii/Deserek

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file deserek-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: deserek-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 20.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for deserek-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d66100f5d679924a11c6a2b7bf76306740a946528ab8be2d99abddb2f2677602
MD5 8f31b737048d714785da14ad92eb095d
BLAKE2b-256 afc9216bb28cbdbc3f0058907717bc43058dc9b7dfd4385d04a59616ff663a0c

See more details on using hashes here.

Provenance

The following attestation bundles were made for deserek-0.2.1-py3-none-any.whl:

Publisher: publish.yml on k3idii/Deserek

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page