{"id":17260650,"url":"https://github.com/williballenthin/python-dotnet-binaryformat","last_synced_at":"2025-04-14T06:42:25.632Z","repository":{"id":140857938,"uuid":"147398911","full_name":"williballenthin/python-dotnet-binaryformat","owner":"williballenthin","description":"Pure Python parser for data encoded by .NET's BinaryFormatter","archived":false,"fork":false,"pushed_at":"2018-09-04T19:20:49.000Z","size":16,"stargazers_count":50,"open_issues_count":1,"forks_count":6,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-05T15:47:14.561Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/williballenthin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2018-09-04T19:10:11.000Z","updated_at":"2024-12-17T11:49:49.000Z","dependencies_parsed_at":"2023-05-04T22:27:41.494Z","dependency_job_id":null,"html_url":"https://github.com/williballenthin/python-dotnet-binaryformat","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/williballenthin%2Fpython-dotnet-binaryformat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/williballenthin%2Fpython-dotnet-binaryformat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/williballenthin%2Fpython-dotnet-binaryformat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/williballenthin%2Fpython-dotnet-binaryformat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/williballenthin","download_url":"https://codeload.github.com/williballenthin/python-dotnet-binaryformat/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248837260,"owners_count":21169373,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-15T07:48:55.517Z","updated_at":"2025-04-14T06:42:25.603Z","avatar_url":"https://github.com/williballenthin.png","language":"Python","readme":"# python-dotnet-binaryformat\nPure Python parser for data encoded by .NET's BinaryFormatter\n\nStructures implemented using the documentation available from Microsoft [here](https://winprotocoldoc.blob.core.windows.net/productionwindowsarchives/MS-NRBF/%5bMS-NRBF%5d.pdf). Not all of these structures are implemented - just what I've seen in real-life so far. Please open issues against this repo if you encounter `NotImplementedError` and can provide a sample buffer.\n\n\n## scripts\n\n### extract_pe.py\n\nSearches for embedded byte arrays that begin with `MZ` and write them to a file named after their MD5 hash.\n\n\nExample::\n\n```\nλ python scripts/extract_pe.py tests/data/dntojscript.bin -v\nINFO:__main__:record 32: found array\nINFO:__main__:record 32: found byte array\nINFO:__main__:record 32: found PE byte array\nINFO:__main__:writing PE to cd040cc16144ff4a91b333f3f0cb06ca.bin\n```\n\n\n### show_structure.py\n\nParse the serialized data and show its structure in a tree-like format.\n\nExample::\n\n```\nλ python scripts/show_structure.py tests/data/dntojscript.bin -v\n00000000 (6418) SerializedData: SerializedData\n00000000 (17)   0: SerializationHeaderRecord\n00000000 (01)     RecordTypeEnum: SerializedStreamHeader (0x00000000)\n00000001 (04)     RootId: 0x00000001 (1)\n00000005 (04)     HeaderId: 0xffffffff (4294967295)\n00000009 (04)     MajorVersion: 0x00000001 (1)\n0000000d (04)     MinorVersion: 0x00000000 (0)\n00000011 (204)   1: SystemClassWithMembersAndTypes\n00000011 (01)     RecordTypeEnum: SystemClassWithMembersAndTypes (0x00000004)\n00000012 (68)     ClassInfo: ClassInfo\n00000012 (04)       ObjectId: 0x00000001 (1)\n00000016 (35)       Name: LengthPrefixedString: System.DelegateSerializationHolder\n00000039 (04)       MemberCount: 0x00000003 (3)\n0000003d (25)       MemberNames: VArray\n0000003d (09)         0: LengthPrefixedString: Delegate\n00000046 (08)         1: LengthPrefixedString: target0\n0000004e (08)         2: LengthPrefixedString: method0\n00000056 (135)     MemberTypeInfo: MemberTypeInfo\n00000056 (03)       BinaryTypeEnums: VArray\n00000056 (01)         0: SystemClass (0x00000003)\n00000057 (01)         1: SystemClass (0x00000003)\n00000058 (01)         2: SystemClass (0x00000003)\n00000059 (132)       AdditionalInfos: VArray\n00000059 (49)         0: LengthPrefixedString: System.DelegateSerializationHolder+DelegateEntry\n0000008a (35)         1: LengthPrefixedString: System.DelegateSerializationHolder\n000000ad (48)         2: LengthPrefixedString: System.Reflection.MemberInfoSerializationHolder\n000000dd (05)   2: MemberReference\n000000dd (01)     RecordTypeEnum: MemberReference (0x00000009)\n000000de (04)     IdRef: 0x00000002 (2)\n000000e2 (05)   3: MemberReference\n000000e2 (01)     RecordTypeEnum: MemberReference (0x00000009)\n000000e3 (04)     IdRef: 0x00000003 (3)\n000000e7 (05)   4: MemberReference\n000000e7 (01)     RecordTypeEnum: MemberReference (0x00000009)\n000000e8 (04)     IdRef: 0x00000004 (4)\n000000ec (194)   5: SystemClassWithMembersAndTypes\n000000ec (01)     RecordTypeEnum: SystemClassWithMembersAndTypes (0x00000004)\n000000ed (137)     ClassInfo: ClassInfo\n000000ed (04)       ObjectId: 0x00000002 (2)\n000000f1 (49)       Name: LengthPrefixedString: System.DelegateSerializationHolder+DelegateEntry\n00000122 (04)       MemberCount: 0x00000007 (7)\n00000126 (80)       MemberNames: VArray\n00000126 (05)         0: LengthPrefixedString: type\n0000012b (09)         1: LengthPrefixedString: assembly\n00000134 (07)         2: LengthPrefixedString: target\n0000013b (19)         3: LengthPrefixedString: targetTypeAssembly\n0000014e (15)         4: LengthPrefixedString: targetTypeName\n0000015d (11)         5: LengthPrefixedString: methodName\n00000168 (14)         6: LengthPrefixedString: delegateEntry\n00000176 (56)     MemberTypeInfo: MemberTypeInfo\n00000176 (07)       BinaryTypeEnums: VArray\n00000176 (01)         0: String (0x00000001)\n00000177 (01)         1: String (0x00000001)\n00000178 (01)         2: Object (0x00000002)\n00000179 (01)         3: String (0x00000001)\n0000017a (01)         4: String (0x00000001)\n0000017b (01)         5: String (0x00000001)\n0000017c (01)         6: SystemClass (0x00000003)\n0000017d (49)       AdditionalInfos: VArray\n0000017d (49)         0: LengthPrefixedString: System.DelegateSerializationHolder+DelegateEntry\n000001ae (53)   6: BinaryObjectString\n000001ae (01)     RecordTypeEnum: BinaryObjectString (0x00000006)\n000001af (04)     ObjectId: 0x00000005 (5)\n000001b3 (48)     Value: LengthPrefixedString: System.Runtime.Remoting.Messaging.HeaderHandler\n000001e3 (81)   7: BinaryObjectString\n000001e3 (01)     RecordTypeEnum: BinaryObjectString (0x00000006)\n000001e4 (04)     ObjectId: 0x00000006 (6)\n000001e8 (76)     Value: LengthPrefixedString: mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\n00000234 (13)   8: BinaryObjectString\n00000234 (01)     RecordTypeEnum: BinaryObjectString (0x00000006)\n00000235 (04)     ObjectId: 0x00000007 (7)\n00000239 (08)     Value: LengthPrefixedString: target0\n00000241 (05)   9: MemberReference\n00000241 (01)     RecordTypeEnum: MemberReference (0x00000009)\n00000242 (04)     IdRef: 0x00000006 (6)\n00000246 (21)   10: BinaryObjectString\n00000246 (01)     RecordTypeEnum: BinaryObjectString (0x00000006)\n00000247 (04)     ObjectId: 0x00000009 (9)\n0000024b (16)     Value: LengthPrefixedString: System.Delegate\n0000025b (19)   11: BinaryObjectString\n0000025b (01)     RecordTypeEnum: BinaryObjectString (0x00000006)\n0000025c (04)     ObjectId: 0x0000000a (10)\n00000260 (14)     Value: LengthPrefixedString: DynamicInvoke\n0000026e (01)   12: ObjectNull\n0000026e (01)     RecordTypeEnum: ObjectNull (0x0000000a)\n0000026f (170)   13: SystemClassWithMembersAndTypes\n0000026f (01)     RecordTypeEnum: SystemClassWithMembersAndTypes (0x00000004)\n00000270 (68)     ClassInfo: ClassInfo\n00000270 (04)       ObjectId: 0x00000003 (3)\n00000274 (35)       Name: LengthPrefixedString: System.DelegateSerializationHolder\n00000297 (04)       MemberCount: 0x00000003 (3)\n0000029b (25)       MemberNames: VArray\n0000029b (09)         0: LengthPrefixedString: Delegate\n000002a4 (08)         1: LengthPrefixedString: target0\n000002ac (08)         2: LengthPrefixedString: method0\n000002b4 (101)     MemberTypeInfo: MemberTypeInfo\n000002b4 (03)       BinaryTypeEnums: VArray\n000002b4 (01)         0: SystemClass (0x00000003)\n000002b5 (01)         1: PrimitiveArray (0x00000007)\n000002b6 (01)         2: SystemClass (0x00000003)\n000002b7 (98)       AdditionalInfos: VArray\n000002b7 (49)         0: LengthPrefixedString: System.DelegateSerializationHolder+DelegateEntry\n000002e8 (01)         1: Byte (0x00000002)\n000002e9 (48)         2: LengthPrefixedString: System.Reflection.MemberInfoSerializationHolder\n00000319 (05)   14: MemberReference\n00000319 (01)     RecordTypeEnum: MemberReference (0x00000009)\n0000031a (04)     IdRef: 0x0000000b (11)\n0000031e (05)   15: MemberReference\n0000031e (01)     RecordTypeEnum: MemberReference (0x00000009)\n0000031f (04)     IdRef: 0x0000000c (12)\n00000323 (05)   16: MemberReference\n00000323 (01)     RecordTypeEnum: MemberReference (0x00000009)\n00000324 (04)     IdRef: 0x0000000d (13)\n00000328 (144)   17: SystemClassWithMembersAndTypes\n00000328 (01)     RecordTypeEnum: SystemClassWithMembersAndTypes (0x00000004)\n00000329 (122)     ClassInfo: ClassInfo\n00000329 (04)       ObjectId: 0x00000004 (4)\n0000032d (48)       Name: LengthPrefixedString: System.Reflection.MemberInfoSerializationHolder\n0000035d (04)       MemberCount: 0x00000006 (6)\n00000361 (66)       MemberNames: VArray\n00000361 (05)         0: LengthPrefixedString: Name\n00000366 (13)         1: LengthPrefixedString: AssemblyName\n00000373 (10)         2: LengthPrefixedString: ClassName\n0000037d (10)         3: LengthPrefixedString: Signature\n00000387 (11)         4: LengthPrefixedString: MemberType\n00000392 (17)         5: LengthPrefixedString: GenericArguments\n000003a3 (21)     MemberTypeInfo: MemberTypeInfo\n000003a3 (06)       BinaryTypeEnums: VArray\n000003a3 (01)         0: String (0x00000001)\n000003a4 (01)         1: String (0x00000001)\n000003a5 (01)         2: String (0x00000001)\n000003a6 (01)         3: String (0x00000001)\n000003a7 (01)         4: Primitive (0x00000000)\n000003a8 (01)         5: SystemClass (0x00000003)\n000003a9 (15)       AdditionalInfos: VArray\n000003a9 (01)         0: Int32 (0x00000008)\n000003aa (14)         1: LengthPrefixedString: System.Type[]\n000003b8 (05)   18: MemberReference\n000003b8 (01)     RecordTypeEnum: MemberReference (0x00000009)\n000003b9 (04)     IdRef: 0x0000000a (10)\n000003bd (05)   19: MemberReference\n000003bd (01)     RecordTypeEnum: MemberReference (0x00000009)\n000003be (04)     IdRef: 0x00000006 (6)\n000003c2 (05)   20: MemberReference\n000003c2 (01)     RecordTypeEnum: MemberReference (0x00000009)\n000003c3 (04)     IdRef: 0x00000009 (9)\n000003c7 (50)   21: BinaryObjectString\n000003c7 (01)     RecordTypeEnum: BinaryObjectString (0x00000006)\n000003c8 (04)     ObjectId: 0x00000011 (17)\n000003cc (45)     Value: LengthPrefixedString: System.Object DynamicInvoke(System.Object[])\n000003f9 (04)   22: MemberPrimitiveTyped\n000003f9 (01)     RecordTypeEnum: MemberPrimitiveTyped (0x00000008)\n000003fa (01)     PrimitiveTypeEnum: 0 (0x00000000)\n000003fb (02)     Value: 0x00000000 (0)\n000003fd (00)     _eof: \n000003fd (01)   23: ObjectNull\n000003fd (01)     RecordTypeEnum: ObjectNull (0x0000000a)\n000003fe (09)   24: ClassWithId\n000003fe (01)     RecordTypeEnum: ClassWithId (0x00000001)\n000003ff (04)     ObjectId: 0x0000000b (11)\n00000403 (04)     MetadataId: 0x00000002 (2)\n00000407 (38)   25: BinaryObjectString\n00000407 (01)     RecordTypeEnum: BinaryObjectString (0x00000006)\n00000408 (04)     ObjectId: 0x00000012 (18)\n0000040c (33)     Value: LengthPrefixedString: System.Xml.Schema.XmlValueGetter\n0000042d (83)   26: BinaryObjectString\n0000042d (01)     RecordTypeEnum: BinaryObjectString (0x00000006)\n0000042e (04)     ObjectId: 0x00000013 (19)\n00000432 (78)     Value: LengthPrefixedString: System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\n00000480 (13)   27: BinaryObjectString\n00000480 (01)     RecordTypeEnum: BinaryObjectString (0x00000006)\n00000481 (04)     ObjectId: 0x00000014 (20)\n00000485 (08)     Value: LengthPrefixedString: target0\n0000048d (05)   28: MemberReference\n0000048d (01)     RecordTypeEnum: MemberReference (0x00000009)\n0000048e (04)     IdRef: 0x00000006 (6)\n00000492 (32)   29: BinaryObjectString\n00000492 (01)     RecordTypeEnum: BinaryObjectString (0x00000006)\n00000493 (04)     ObjectId: 0x00000016 (22)\n00000497 (27)     Value: LengthPrefixedString: System.Reflection.Assembly\n000004b2 (10)   30: BinaryObjectString\n000004b2 (01)     RecordTypeEnum: BinaryObjectString (0x00000006)\n000004b3 (04)     ObjectId: 0x00000017 (23)\n000004b7 (05)     Value: LengthPrefixedString: Load\n000004bc (01)   31: ObjectNull\n000004bc (01)     RecordTypeEnum: ObjectNull (0x0000000a)\n000004bd (5130)   32: ArraySinglePrimitive\n000004bd (01)     RecordTypeEnum: ArraySinglePrimitive (0x0000000f)\n000004be (08)     ArrayInfo: ArrayInfo\n000004be (04)       ObjectId: 0x0000000c (12)\n000004c2 (04)       Length: 0x00001400 (5120)\n000004c6 (01)     PrimitiveTypeEnum: Byte (0x00000002)\n000004c7 (5120)     Value: 4d5a90000300000004000000ffff0000b80000000000000040...\n000018c7 (00)     _eof: \n000018c7 (09)   33: ClassWithId\n000018c7 (01)     RecordTypeEnum: ClassWithId (0x00000001)\n000018c8 (04)     ObjectId: 0x0000000d (13)\n000018cc (04)     MetadataId: 0x00000004 (4)\n000018d0 (05)   34: MemberReference\n000018d0 (01)     RecordTypeEnum: MemberReference (0x00000009)\n000018d1 (04)     IdRef: 0x00000017 (23)\n000018d5 (05)   35: MemberReference\n000018d5 (01)     RecordTypeEnum: MemberReference (0x00000009)\n000018d6 (04)     IdRef: 0x00000006 (6)\n000018da (05)   36: MemberReference\n000018da (01)     RecordTypeEnum: MemberReference (0x00000009)\n000018db (04)     IdRef: 0x00000016 (22)\n000018df (45)   37: BinaryObjectString\n000018df (01)     RecordTypeEnum: BinaryObjectString (0x00000006)\n000018e0 (04)     ObjectId: 0x0000001a (26)\n000018e4 (40)     Value: LengthPrefixedString: System.Reflection.Assembly Load(Byte[])\n0000190c (04)   38: MemberPrimitiveTyped\n0000190c (01)     RecordTypeEnum: MemberPrimitiveTyped (0x00000008)\n0000190d (01)     PrimitiveTypeEnum: 0 (0x00000000)\n0000190e (02)     Value: 0x00000000 (0)\n00001910 (00)     _eof: \n00001910 (01)   39: ObjectNull\n00001910 (01)     RecordTypeEnum: ObjectNull (0x0000000a)\n00001911 (01)   40: MessageEnd\n00001911 (01)     RecordTypeEnum: MessageEnd (0x0000000b)\n```\n","funding_links":[],"categories":["Operating Systems"],"sub_categories":["Windows"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwilliballenthin%2Fpython-dotnet-binaryformat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwilliballenthin%2Fpython-dotnet-binaryformat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwilliballenthin%2Fpython-dotnet-binaryformat/lists"}