polyfile-weave 0.5.5__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of polyfile-weave might be problematic. Click here for more details.

Files changed (585) hide show
  1. polyfile/__init__.py +15 -0
  2. polyfile/__main__.py +394 -0
  3. polyfile/arithmetic.py +27 -0
  4. polyfile/ast.py +114 -0
  5. polyfile/debugger.py +1039 -0
  6. polyfile/expressions.py +346 -0
  7. polyfile/fileutils.py +343 -0
  8. polyfile/html.py +135 -0
  9. polyfile/http/__init__.py +1 -0
  10. polyfile/http/defacto.py +37 -0
  11. polyfile/http/deprecated.py +51 -0
  12. polyfile/http/experimental.py +67 -0
  13. polyfile/http/http_11.py +548 -0
  14. polyfile/http/matcher.py +37 -0
  15. polyfile/http/structured_headers.py +48 -0
  16. polyfile/iterators.py +72 -0
  17. polyfile/jpeg.py +24 -0
  18. polyfile/kaitai/__init__.py +0 -0
  19. polyfile/kaitai/compiler.py +156 -0
  20. polyfile/kaitai/parser.py +312 -0
  21. polyfile/kaitai/parsers/__init__.py +0 -0
  22. polyfile/kaitai/parsers/aix_utmp.py +116 -0
  23. polyfile/kaitai/parsers/allegro_dat.py +367 -0
  24. polyfile/kaitai/parsers/andes_firmware.py +64 -0
  25. polyfile/kaitai/parsers/android_bootldr_asus.py +105 -0
  26. polyfile/kaitai/parsers/android_bootldr_huawei.py +181 -0
  27. polyfile/kaitai/parsers/android_bootldr_qcom.py +217 -0
  28. polyfile/kaitai/parsers/android_dto.py +138 -0
  29. polyfile/kaitai/parsers/android_img.py +319 -0
  30. polyfile/kaitai/parsers/android_nanoapp_header.py +83 -0
  31. polyfile/kaitai/parsers/android_opengl_shaders_cache.py +151 -0
  32. polyfile/kaitai/parsers/android_sparse.py +237 -0
  33. polyfile/kaitai/parsers/android_super.py +401 -0
  34. polyfile/kaitai/parsers/apm_partition_table.py +196 -0
  35. polyfile/kaitai/parsers/apple_single_double.py +180 -0
  36. polyfile/kaitai/parsers/asn1_der.py +235 -0
  37. polyfile/kaitai/parsers/au.py +138 -0
  38. polyfile/kaitai/parsers/avantes_roh60.py +112 -0
  39. polyfile/kaitai/parsers/avi.py +296 -0
  40. polyfile/kaitai/parsers/bcd.py +111 -0
  41. polyfile/kaitai/parsers/bitcoin_transaction.py +210 -0
  42. polyfile/kaitai/parsers/blender_blend.py +334 -0
  43. polyfile/kaitai/parsers/bmp.py +780 -0
  44. polyfile/kaitai/parsers/bson.py +411 -0
  45. polyfile/kaitai/parsers/btrfs_stream.py +318 -0
  46. polyfile/kaitai/parsers/bytes_with_io.py +27 -0
  47. polyfile/kaitai/parsers/chrome_pak.py +194 -0
  48. polyfile/kaitai/parsers/code_6502.py +456 -0
  49. polyfile/kaitai/parsers/compressed_resource.py +217 -0
  50. polyfile/kaitai/parsers/cpio_old_le.py +154 -0
  51. polyfile/kaitai/parsers/cramfs.py +344 -0
  52. polyfile/kaitai/parsers/creative_voice_file.py +342 -0
  53. polyfile/kaitai/parsers/dbf.py +274 -0
  54. polyfile/kaitai/parsers/dcmp_0.py +664 -0
  55. polyfile/kaitai/parsers/dcmp_1.py +422 -0
  56. polyfile/kaitai/parsers/dcmp_2.py +312 -0
  57. polyfile/kaitai/parsers/dcmp_variable_length_integer.py +66 -0
  58. polyfile/kaitai/parsers/dex.py +1086 -0
  59. polyfile/kaitai/parsers/dicom.py +4370 -0
  60. polyfile/kaitai/parsers/dime_message.py +201 -0
  61. polyfile/kaitai/parsers/dns_packet.py +569 -0
  62. polyfile/kaitai/parsers/doom_wad.py +654 -0
  63. polyfile/kaitai/parsers/dos_datetime.py +191 -0
  64. polyfile/kaitai/parsers/dos_mz.py +172 -0
  65. polyfile/kaitai/parsers/ds_store.py +513 -0
  66. polyfile/kaitai/parsers/dtb.py +310 -0
  67. polyfile/kaitai/parsers/dune_2_pak.py +126 -0
  68. polyfile/kaitai/parsers/edid.py +472 -0
  69. polyfile/kaitai/parsers/efivar_signature_list.py +331 -0
  70. polyfile/kaitai/parsers/elf.py +2482 -0
  71. polyfile/kaitai/parsers/ethernet_frame.py +114 -0
  72. polyfile/kaitai/parsers/exif.py +723 -0
  73. polyfile/kaitai/parsers/ext2.py +537 -0
  74. polyfile/kaitai/parsers/fallout2_dat.py +187 -0
  75. polyfile/kaitai/parsers/fallout_dat.py +156 -0
  76. polyfile/kaitai/parsers/fasttracker_xm_module.py +558 -0
  77. polyfile/kaitai/parsers/ftl_dat.py +90 -0
  78. polyfile/kaitai/parsers/genmidi_op2.py +161 -0
  79. polyfile/kaitai/parsers/gettext_mo.py +541 -0
  80. polyfile/kaitai/parsers/gif.py +492 -0
  81. polyfile/kaitai/parsers/gimp_brush.py +244 -0
  82. polyfile/kaitai/parsers/glibc_utmp.py +114 -0
  83. polyfile/kaitai/parsers/gltf_binary.py +132 -0
  84. polyfile/kaitai/parsers/google_protobuf.py +151 -0
  85. polyfile/kaitai/parsers/gpt_partition_table.py +175 -0
  86. polyfile/kaitai/parsers/gran_turismo_vol.py +140 -0
  87. polyfile/kaitai/parsers/grub2_font.py +337 -0
  88. polyfile/kaitai/parsers/gzip.py +232 -0
  89. polyfile/kaitai/parsers/hashcat_restore.py +60 -0
  90. polyfile/kaitai/parsers/hccap.py +111 -0
  91. polyfile/kaitai/parsers/hccapx.py +103 -0
  92. polyfile/kaitai/parsers/heaps_pak.py +177 -0
  93. polyfile/kaitai/parsers/heroes_of_might_and_magic_agg.py +116 -0
  94. polyfile/kaitai/parsers/heroes_of_might_and_magic_bmp.py +34 -0
  95. polyfile/kaitai/parsers/icmp_packet.py +136 -0
  96. polyfile/kaitai/parsers/ico.py +129 -0
  97. polyfile/kaitai/parsers/id3v1_1.py +220 -0
  98. polyfile/kaitai/parsers/id3v2_3.py +324 -0
  99. polyfile/kaitai/parsers/id3v2_4.py +423 -0
  100. polyfile/kaitai/parsers/ines.py +282 -0
  101. polyfile/kaitai/parsers/ipv4_packet.py +158 -0
  102. polyfile/kaitai/parsers/ipv6_packet.py +55 -0
  103. polyfile/kaitai/parsers/iso9660.py +544 -0
  104. polyfile/kaitai/parsers/java_class.py +1113 -0
  105. polyfile/kaitai/parsers/jpeg.py +361 -0
  106. polyfile/kaitai/parsers/luks.py +149 -0
  107. polyfile/kaitai/parsers/lzh.py +165 -0
  108. polyfile/kaitai/parsers/mac_os_resource_snd.py +493 -0
  109. polyfile/kaitai/parsers/mach_o.py +3033 -0
  110. polyfile/kaitai/parsers/mach_o_fat.py +92 -0
  111. polyfile/kaitai/parsers/magicavoxel_vox.py +391 -0
  112. polyfile/kaitai/parsers/manifest.json +1 -0
  113. polyfile/kaitai/parsers/mbr_partition_table.py +119 -0
  114. polyfile/kaitai/parsers/mcap.py +1015 -0
  115. polyfile/kaitai/parsers/microsoft_cfb.py +293 -0
  116. polyfile/kaitai/parsers/microsoft_network_monitor_v2.py +309 -0
  117. polyfile/kaitai/parsers/microsoft_pe.py +765 -0
  118. polyfile/kaitai/parsers/mifare_classic.py +706 -0
  119. polyfile/kaitai/parsers/minecraft_nbt.py +449 -0
  120. polyfile/kaitai/parsers/monomakh_sapr_chg.py +69 -0
  121. polyfile/kaitai/parsers/mozilla_mar.py +239 -0
  122. polyfile/kaitai/parsers/mp4.py +333 -0
  123. polyfile/kaitai/parsers/msgpack.py +467 -0
  124. polyfile/kaitai/parsers/nitf.py +1189 -0
  125. polyfile/kaitai/parsers/nt_mdt_pal.py +155 -0
  126. polyfile/kaitai/parsers/ogg.py +118 -0
  127. polyfile/kaitai/parsers/openpgp_message.py +993 -0
  128. polyfile/kaitai/parsers/packet_ppi.py +515 -0
  129. polyfile/kaitai/parsers/pcap.py +344 -0
  130. polyfile/kaitai/parsers/pcf_font.py +506 -0
  131. polyfile/kaitai/parsers/pcx.py +195 -0
  132. polyfile/kaitai/parsers/pcx_dcx.py +79 -0
  133. polyfile/kaitai/parsers/phar_without_stub.py +399 -0
  134. polyfile/kaitai/parsers/php_serialized_value.py +505 -0
  135. polyfile/kaitai/parsers/png.py +721 -0
  136. polyfile/kaitai/parsers/protocol_body.py +260 -0
  137. polyfile/kaitai/parsers/psx_tim.py +104 -0
  138. polyfile/kaitai/parsers/python_pickle.py +718 -0
  139. polyfile/kaitai/parsers/python_pyc_27.py +510 -0
  140. polyfile/kaitai/parsers/quake_mdl.py +441 -0
  141. polyfile/kaitai/parsers/quake_pak.py +112 -0
  142. polyfile/kaitai/parsers/quicktime_mov.py +634 -0
  143. polyfile/kaitai/parsers/rar.py +265 -0
  144. polyfile/kaitai/parsers/regf.py +569 -0
  145. polyfile/kaitai/parsers/renderware_binary_stream.py +877 -0
  146. polyfile/kaitai/parsers/resource_fork.py +611 -0
  147. polyfile/kaitai/parsers/respack.py +57 -0
  148. polyfile/kaitai/parsers/riff.py +409 -0
  149. polyfile/kaitai/parsers/rpm.py +964 -0
  150. polyfile/kaitai/parsers/rtcp_payload.py +579 -0
  151. polyfile/kaitai/parsers/rtp_packet.py +150 -0
  152. polyfile/kaitai/parsers/rtpdump.py +115 -0
  153. polyfile/kaitai/parsers/ruby_marshal.py +423 -0
  154. polyfile/kaitai/parsers/s3m.py +493 -0
  155. polyfile/kaitai/parsers/saints_row_2_vpp_pc.py +254 -0
  156. polyfile/kaitai/parsers/shapefile_index.py +174 -0
  157. polyfile/kaitai/parsers/shapefile_main.py +893 -0
  158. polyfile/kaitai/parsers/some_ip.py +209 -0
  159. polyfile/kaitai/parsers/some_ip_container.py +37 -0
  160. polyfile/kaitai/parsers/some_ip_sd.py +86 -0
  161. polyfile/kaitai/parsers/some_ip_sd_entries.py +160 -0
  162. polyfile/kaitai/parsers/some_ip_sd_options.py +374 -0
  163. polyfile/kaitai/parsers/specpr.py +404 -0
  164. polyfile/kaitai/parsers/sqlite3.py +472 -0
  165. polyfile/kaitai/parsers/ssh_public_key.py +252 -0
  166. polyfile/kaitai/parsers/standard_midi_file.py +390 -0
  167. polyfile/kaitai/parsers/stl.py +111 -0
  168. polyfile/kaitai/parsers/sudoers_ts.py +201 -0
  169. polyfile/kaitai/parsers/swf.py +406 -0
  170. polyfile/kaitai/parsers/systemd_journal.py +361 -0
  171. polyfile/kaitai/parsers/tcp_segment.py +57 -0
  172. polyfile/kaitai/parsers/tga.py +213 -0
  173. polyfile/kaitai/parsers/tls_client_hello.py +293 -0
  174. polyfile/kaitai/parsers/tr_dos_image.py +322 -0
  175. polyfile/kaitai/parsers/tsm.py +198 -0
  176. polyfile/kaitai/parsers/ttf.py +1847 -0
  177. polyfile/kaitai/parsers/udp_datagram.py +42 -0
  178. polyfile/kaitai/parsers/uefi_te.py +236 -0
  179. polyfile/kaitai/parsers/uimage.py +198 -0
  180. polyfile/kaitai/parsers/utf8_string.py +137 -0
  181. polyfile/kaitai/parsers/vfat.py +410 -0
  182. polyfile/kaitai/parsers/vlq_base128_be.py +104 -0
  183. polyfile/kaitai/parsers/vlq_base128_le.py +129 -0
  184. polyfile/kaitai/parsers/vmware_vmdk.py +167 -0
  185. polyfile/kaitai/parsers/vp8_ivf.py +112 -0
  186. polyfile/kaitai/parsers/warcraft_2_pud.py +423 -0
  187. polyfile/kaitai/parsers/wav.py +1014 -0
  188. polyfile/kaitai/parsers/websocket.py +167 -0
  189. polyfile/kaitai/parsers/windows_evt_log.py +304 -0
  190. polyfile/kaitai/parsers/windows_lnk_file.py +467 -0
  191. polyfile/kaitai/parsers/windows_minidump.py +575 -0
  192. polyfile/kaitai/parsers/windows_resource_file.py +243 -0
  193. polyfile/kaitai/parsers/windows_shell_items.py +190 -0
  194. polyfile/kaitai/parsers/windows_systemtime.py +52 -0
  195. polyfile/kaitai/parsers/wmf.py +502 -0
  196. polyfile/kaitai/parsers/xar.py +181 -0
  197. polyfile/kaitai/parsers/xwd.py +189 -0
  198. polyfile/kaitai/parsers/zip.py +685 -0
  199. polyfile/kaitai/parsers/zisofs.py +158 -0
  200. polyfile/kaitai/parsers/zx_spectrum_tap.py +184 -0
  201. polyfile/kaitaimatcher.py +113 -0
  202. polyfile/languagematcher.py +217 -0
  203. polyfile/logger.py +135 -0
  204. polyfile/magic.py +2983 -0
  205. polyfile/magic_defs/COPYING +29 -0
  206. polyfile/magic_defs/__init__.py +0 -0
  207. polyfile/magic_defs/acorn +102 -0
  208. polyfile/magic_defs/adi +13 -0
  209. polyfile/magic_defs/adventure +122 -0
  210. polyfile/magic_defs/aes +29 -0
  211. polyfile/magic_defs/algol68 +35 -0
  212. polyfile/magic_defs/allegro +9 -0
  213. polyfile/magic_defs/alliant +18 -0
  214. polyfile/magic_defs/alpha +32 -0
  215. polyfile/magic_defs/amanda +12 -0
  216. polyfile/magic_defs/amigaos +218 -0
  217. polyfile/magic_defs/android +259 -0
  218. polyfile/magic_defs/animation +1197 -0
  219. polyfile/magic_defs/aout +46 -0
  220. polyfile/magic_defs/apache +28 -0
  221. polyfile/magic_defs/apl +7 -0
  222. polyfile/magic_defs/apple +773 -0
  223. polyfile/magic_defs/application +7 -0
  224. polyfile/magic_defs/applix +13 -0
  225. polyfile/magic_defs/apt +52 -0
  226. polyfile/magic_defs/archive +2586 -0
  227. polyfile/magic_defs/aria +38 -0
  228. polyfile/magic_defs/arm +50 -0
  229. polyfile/magic_defs/asf +132 -0
  230. polyfile/magic_defs/assembler +18 -0
  231. polyfile/magic_defs/asterix +18 -0
  232. polyfile/magic_defs/att3b +41 -0
  233. polyfile/magic_defs/audio +1291 -0
  234. polyfile/magic_defs/avm +33 -0
  235. polyfile/magic_defs/basis +18 -0
  236. polyfile/magic_defs/beetle +7 -0
  237. polyfile/magic_defs/ber +65 -0
  238. polyfile/magic_defs/bflt +14 -0
  239. polyfile/magic_defs/bhl +10 -0
  240. polyfile/magic_defs/bioinformatics +178 -0
  241. polyfile/magic_defs/biosig +154 -0
  242. polyfile/magic_defs/blackberry +8 -0
  243. polyfile/magic_defs/blcr +25 -0
  244. polyfile/magic_defs/blender +50 -0
  245. polyfile/magic_defs/blit +24 -0
  246. polyfile/magic_defs/bm +10 -0
  247. polyfile/magic_defs/bout +11 -0
  248. polyfile/magic_defs/bsdi +33 -0
  249. polyfile/magic_defs/bsi +10 -0
  250. polyfile/magic_defs/btsnoop +13 -0
  251. polyfile/magic_defs/burp +7 -0
  252. polyfile/magic_defs/bytecode +41 -0
  253. polyfile/magic_defs/c-lang +110 -0
  254. polyfile/magic_defs/c64 +531 -0
  255. polyfile/magic_defs/cad +437 -0
  256. polyfile/magic_defs/cafebabe +107 -0
  257. polyfile/magic_defs/cbor +21 -0
  258. polyfile/magic_defs/ccf +14 -0
  259. polyfile/magic_defs/cddb +12 -0
  260. polyfile/magic_defs/chord +15 -0
  261. polyfile/magic_defs/cisco +12 -0
  262. polyfile/magic_defs/citrus +12 -0
  263. polyfile/magic_defs/clarion +27 -0
  264. polyfile/magic_defs/claris +48 -0
  265. polyfile/magic_defs/clipper +65 -0
  266. polyfile/magic_defs/clojure +30 -0
  267. polyfile/magic_defs/coff +98 -0
  268. polyfile/magic_defs/commands +201 -0
  269. polyfile/magic_defs/communications +22 -0
  270. polyfile/magic_defs/compress +461 -0
  271. polyfile/magic_defs/console +1213 -0
  272. polyfile/magic_defs/convex +69 -0
  273. polyfile/magic_defs/coverage +91 -0
  274. polyfile/magic_defs/cracklib +14 -0
  275. polyfile/magic_defs/crypto +31 -0
  276. polyfile/magic_defs/csv +8 -0
  277. polyfile/magic_defs/ctags +6 -0
  278. polyfile/magic_defs/ctf +23 -0
  279. polyfile/magic_defs/cubemap +8 -0
  280. polyfile/magic_defs/cups +56 -0
  281. polyfile/magic_defs/dact +11 -0
  282. polyfile/magic_defs/database +886 -0
  283. polyfile/magic_defs/dataone +47 -0
  284. polyfile/magic_defs/dbpf +15 -0
  285. polyfile/magic_defs/der +146 -0
  286. polyfile/magic_defs/diamond +12 -0
  287. polyfile/magic_defs/dif +33 -0
  288. polyfile/magic_defs/diff +41 -0
  289. polyfile/magic_defs/digital +59 -0
  290. polyfile/magic_defs/dolby +69 -0
  291. polyfile/magic_defs/dsf +25 -0
  292. polyfile/magic_defs/dump +96 -0
  293. polyfile/magic_defs/dwarfs +45 -0
  294. polyfile/magic_defs/dyadic +61 -0
  295. polyfile/magic_defs/ebml +8 -0
  296. polyfile/magic_defs/edid +11 -0
  297. polyfile/magic_defs/editors +43 -0
  298. polyfile/magic_defs/efi +15 -0
  299. polyfile/magic_defs/elf +379 -0
  300. polyfile/magic_defs/encore +22 -0
  301. polyfile/magic_defs/epoc +62 -0
  302. polyfile/magic_defs/erlang +21 -0
  303. polyfile/magic_defs/espressif +57 -0
  304. polyfile/magic_defs/esri +28 -0
  305. polyfile/magic_defs/etf +33 -0
  306. polyfile/magic_defs/fcs +9 -0
  307. polyfile/magic_defs/filesystems +2694 -0
  308. polyfile/magic_defs/finger +16 -0
  309. polyfile/magic_defs/firmware +133 -0
  310. polyfile/magic_defs/flash +62 -0
  311. polyfile/magic_defs/flif +36 -0
  312. polyfile/magic_defs/fonts +449 -0
  313. polyfile/magic_defs/forth +82 -0
  314. polyfile/magic_defs/fortran +9 -0
  315. polyfile/magic_defs/frame +62 -0
  316. polyfile/magic_defs/freebsd +164 -0
  317. polyfile/magic_defs/fsav +128 -0
  318. polyfile/magic_defs/fusecompress +12 -0
  319. polyfile/magic_defs/games +696 -0
  320. polyfile/magic_defs/gcc +17 -0
  321. polyfile/magic_defs/gconv +10 -0
  322. polyfile/magic_defs/gentoo +85 -0
  323. polyfile/magic_defs/geo +166 -0
  324. polyfile/magic_defs/geos +20 -0
  325. polyfile/magic_defs/gimp +77 -0
  326. polyfile/magic_defs/git +13 -0
  327. polyfile/magic_defs/glibc +21 -0
  328. polyfile/magic_defs/gnome +59 -0
  329. polyfile/magic_defs/gnu +173 -0
  330. polyfile/magic_defs/gnumeric +8 -0
  331. polyfile/magic_defs/gpt +240 -0
  332. polyfile/magic_defs/gpu +28 -0
  333. polyfile/magic_defs/grace +21 -0
  334. polyfile/magic_defs/graphviz +12 -0
  335. polyfile/magic_defs/gringotts +48 -0
  336. polyfile/magic_defs/guile +13 -0
  337. polyfile/magic_defs/hardware +12 -0
  338. polyfile/magic_defs/hitachi-sh +30 -0
  339. polyfile/magic_defs/hp +433 -0
  340. polyfile/magic_defs/human68k +26 -0
  341. polyfile/magic_defs/ibm370 +52 -0
  342. polyfile/magic_defs/ibm6000 +35 -0
  343. polyfile/magic_defs/icc +214 -0
  344. polyfile/magic_defs/iff +80 -0
  345. polyfile/magic_defs/images +4210 -0
  346. polyfile/magic_defs/inform +9 -0
  347. polyfile/magic_defs/intel +310 -0
  348. polyfile/magic_defs/interleaf +9 -0
  349. polyfile/magic_defs/island +10 -0
  350. polyfile/magic_defs/ispell +63 -0
  351. polyfile/magic_defs/isz +15 -0
  352. polyfile/magic_defs/java +52 -0
  353. polyfile/magic_defs/javascript +171 -0
  354. polyfile/magic_defs/jpeg +252 -0
  355. polyfile/magic_defs/json +8 -0
  356. polyfile/magic_defs/karma +9 -0
  357. polyfile/magic_defs/kde +11 -0
  358. polyfile/magic_defs/keepass +20 -0
  359. polyfile/magic_defs/kerberos +45 -0
  360. polyfile/magic_defs/kicad +85 -0
  361. polyfile/magic_defs/kml +34 -0
  362. polyfile/magic_defs/lammps +64 -0
  363. polyfile/magic_defs/lecter +6 -0
  364. polyfile/magic_defs/lex +12 -0
  365. polyfile/magic_defs/lif +50 -0
  366. polyfile/magic_defs/linux +557 -0
  367. polyfile/magic_defs/lisp +78 -0
  368. polyfile/magic_defs/llvm +22 -0
  369. polyfile/magic_defs/locoscript +12 -0
  370. polyfile/magic_defs/lua +31 -0
  371. polyfile/magic_defs/luks +126 -0
  372. polyfile/magic_defs/m4 +11 -0
  373. polyfile/magic_defs/mach +303 -0
  374. polyfile/magic_defs/macintosh +505 -0
  375. polyfile/magic_defs/macos +7 -0
  376. polyfile/magic_defs/magic +10 -0
  377. polyfile/magic_defs/magic.mgc +0 -0
  378. polyfile/magic_defs/mail.news +132 -0
  379. polyfile/magic_defs/make +21 -0
  380. polyfile/magic_defs/map +413 -0
  381. polyfile/magic_defs/maple +109 -0
  382. polyfile/magic_defs/marc21 +30 -0
  383. polyfile/magic_defs/mathcad +8 -0
  384. polyfile/magic_defs/mathematica +188 -0
  385. polyfile/magic_defs/matroska +17 -0
  386. polyfile/magic_defs/mcrypt +52 -0
  387. polyfile/magic_defs/measure +44 -0
  388. polyfile/magic_defs/mercurial +13 -0
  389. polyfile/magic_defs/metastore +8 -0
  390. polyfile/magic_defs/meteorological +53 -0
  391. polyfile/magic_defs/microfocus +21 -0
  392. polyfile/magic_defs/mime +9 -0
  393. polyfile/magic_defs/mips +120 -0
  394. polyfile/magic_defs/mirage +8 -0
  395. polyfile/magic_defs/misctools +140 -0
  396. polyfile/magic_defs/mkid +11 -0
  397. polyfile/magic_defs/mlssa +8 -0
  398. polyfile/magic_defs/mmdf +6 -0
  399. polyfile/magic_defs/modem +92 -0
  400. polyfile/magic_defs/modulefile +9 -0
  401. polyfile/magic_defs/motorola +71 -0
  402. polyfile/magic_defs/mozilla +37 -0
  403. polyfile/magic_defs/msdos +2304 -0
  404. polyfile/magic_defs/msooxml +68 -0
  405. polyfile/magic_defs/msvc +222 -0
  406. polyfile/magic_defs/msx +309 -0
  407. polyfile/magic_defs/mup +24 -0
  408. polyfile/magic_defs/music +17 -0
  409. polyfile/magic_defs/nasa +7 -0
  410. polyfile/magic_defs/natinst +24 -0
  411. polyfile/magic_defs/ncr +49 -0
  412. polyfile/magic_defs/neko +12 -0
  413. polyfile/magic_defs/netbsd +251 -0
  414. polyfile/magic_defs/netscape +26 -0
  415. polyfile/magic_defs/netware +11 -0
  416. polyfile/magic_defs/news +13 -0
  417. polyfile/magic_defs/nifty +202 -0
  418. polyfile/magic_defs/nim-lang +29 -0
  419. polyfile/magic_defs/nitpicker +14 -0
  420. polyfile/magic_defs/numpy +9 -0
  421. polyfile/magic_defs/oasis +12 -0
  422. polyfile/magic_defs/ocaml +14 -0
  423. polyfile/magic_defs/octave +6 -0
  424. polyfile/magic_defs/ole2compounddocs +760 -0
  425. polyfile/magic_defs/olf +98 -0
  426. polyfile/magic_defs/openfst +17 -0
  427. polyfile/magic_defs/opentimestamps +16 -0
  428. polyfile/magic_defs/oric +16 -0
  429. polyfile/magic_defs/os2 +186 -0
  430. polyfile/magic_defs/os400 +39 -0
  431. polyfile/magic_defs/os9 +80 -0
  432. polyfile/magic_defs/osf1 +10 -0
  433. polyfile/magic_defs/palm +156 -0
  434. polyfile/magic_defs/parix +13 -0
  435. polyfile/magic_defs/parrot +22 -0
  436. polyfile/magic_defs/pascal +39 -0
  437. polyfile/magic_defs/pbf +11 -0
  438. polyfile/magic_defs/pbm +8 -0
  439. polyfile/magic_defs/pc88 +24 -0
  440. polyfile/magic_defs/pc98 +77 -0
  441. polyfile/magic_defs/pci_ids +116 -0
  442. polyfile/magic_defs/pcjr +8 -0
  443. polyfile/magic_defs/pdf +51 -0
  444. polyfile/magic_defs/pdp +42 -0
  445. polyfile/magic_defs/perl +100 -0
  446. polyfile/magic_defs/pgf +52 -0
  447. polyfile/magic_defs/pgp +581 -0
  448. polyfile/magic_defs/pgp-binary-keys +388 -0
  449. polyfile/magic_defs/pkgadd +7 -0
  450. polyfile/magic_defs/plan9 +25 -0
  451. polyfile/magic_defs/playdate +57 -0
  452. polyfile/magic_defs/plus5 +18 -0
  453. polyfile/magic_defs/pmem +46 -0
  454. polyfile/magic_defs/polyfile_zip +5 -0
  455. polyfile/magic_defs/polyml +23 -0
  456. polyfile/magic_defs/printer +269 -0
  457. polyfile/magic_defs/project +10 -0
  458. polyfile/magic_defs/psdbms +14 -0
  459. polyfile/magic_defs/psl +14 -0
  460. polyfile/magic_defs/pulsar +13 -0
  461. polyfile/magic_defs/puzzle +17 -0
  462. polyfile/magic_defs/pwsafe +14 -0
  463. polyfile/magic_defs/pyramid +12 -0
  464. polyfile/magic_defs/python +305 -0
  465. polyfile/magic_defs/qt +30 -0
  466. polyfile/magic_defs/revision +66 -0
  467. polyfile/magic_defs/riff +840 -0
  468. polyfile/magic_defs/rinex +44 -0
  469. polyfile/magic_defs/ringdove +45 -0
  470. polyfile/magic_defs/rpi +52 -0
  471. polyfile/magic_defs/rpm +45 -0
  472. polyfile/magic_defs/rpmsg +7 -0
  473. polyfile/magic_defs/rst +11 -0
  474. polyfile/magic_defs/rtf +94 -0
  475. polyfile/magic_defs/ruby +55 -0
  476. polyfile/magic_defs/rust +21 -0
  477. polyfile/magic_defs/sc +7 -0
  478. polyfile/magic_defs/sccs +24 -0
  479. polyfile/magic_defs/scientific +144 -0
  480. polyfile/magic_defs/securitycerts +6 -0
  481. polyfile/magic_defs/selinux +24 -0
  482. polyfile/magic_defs/sendmail +37 -0
  483. polyfile/magic_defs/sequent +42 -0
  484. polyfile/magic_defs/sereal +35 -0
  485. polyfile/magic_defs/sgi +144 -0
  486. polyfile/magic_defs/sgml +161 -0
  487. polyfile/magic_defs/sharc +23 -0
  488. polyfile/magic_defs/sinclair +40 -0
  489. polyfile/magic_defs/sisu +18 -0
  490. polyfile/magic_defs/sketch +6 -0
  491. polyfile/magic_defs/smalltalk +25 -0
  492. polyfile/magic_defs/smile +34 -0
  493. polyfile/magic_defs/sniffer +482 -0
  494. polyfile/magic_defs/softquad +40 -0
  495. polyfile/magic_defs/sosi +40 -0
  496. polyfile/magic_defs/spec +21 -0
  497. polyfile/magic_defs/spectrum +184 -0
  498. polyfile/magic_defs/sql +288 -0
  499. polyfile/magic_defs/ssh +39 -0
  500. polyfile/magic_defs/ssl +20 -0
  501. polyfile/magic_defs/statistics +45 -0
  502. polyfile/magic_defs/subtitle +38 -0
  503. polyfile/magic_defs/sun +141 -0
  504. polyfile/magic_defs/svf +5 -0
  505. polyfile/magic_defs/sylk +36 -0
  506. polyfile/magic_defs/symbos +42 -0
  507. polyfile/magic_defs/sysex +429 -0
  508. polyfile/magic_defs/tcl +29 -0
  509. polyfile/magic_defs/teapot +6 -0
  510. polyfile/magic_defs/terminfo +63 -0
  511. polyfile/magic_defs/tex +141 -0
  512. polyfile/magic_defs/tgif +7 -0
  513. polyfile/magic_defs/ti-8x +239 -0
  514. polyfile/magic_defs/timezone +42 -0
  515. polyfile/magic_defs/tplink +95 -0
  516. polyfile/magic_defs/troff +38 -0
  517. polyfile/magic_defs/tuxedo +8 -0
  518. polyfile/magic_defs/typeset +8 -0
  519. polyfile/magic_defs/uf2 +72 -0
  520. polyfile/magic_defs/unicode +15 -0
  521. polyfile/magic_defs/unisig +12 -0
  522. polyfile/magic_defs/unknown +34 -0
  523. polyfile/magic_defs/usd +21 -0
  524. polyfile/magic_defs/uterus +16 -0
  525. polyfile/magic_defs/uuencode +28 -0
  526. polyfile/magic_defs/vacuum-cleaner +54 -0
  527. polyfile/magic_defs/varied.out +46 -0
  528. polyfile/magic_defs/varied.script +21 -0
  529. polyfile/magic_defs/vax +32 -0
  530. polyfile/magic_defs/vicar +17 -0
  531. polyfile/magic_defs/virtual +307 -0
  532. polyfile/magic_defs/virtutech +12 -0
  533. polyfile/magic_defs/visx +32 -0
  534. polyfile/magic_defs/vms +30 -0
  535. polyfile/magic_defs/vmware +6 -0
  536. polyfile/magic_defs/vorbis +155 -0
  537. polyfile/magic_defs/vxl +14 -0
  538. polyfile/magic_defs/warc +16 -0
  539. polyfile/magic_defs/weak +16 -0
  540. polyfile/magic_defs/web +18 -0
  541. polyfile/magic_defs/webassembly +17 -0
  542. polyfile/magic_defs/windows +1811 -0
  543. polyfile/magic_defs/wireless +7 -0
  544. polyfile/magic_defs/wordprocessors +630 -0
  545. polyfile/magic_defs/wsdl +23 -0
  546. polyfile/magic_defs/x68000 +25 -0
  547. polyfile/magic_defs/xdelta +13 -0
  548. polyfile/magic_defs/xenix +106 -0
  549. polyfile/magic_defs/xilinx +58 -0
  550. polyfile/magic_defs/xo65 +37 -0
  551. polyfile/magic_defs/xwindows +43 -0
  552. polyfile/magic_defs/yara +17 -0
  553. polyfile/magic_defs/zfs +96 -0
  554. polyfile/magic_defs/zilog +12 -0
  555. polyfile/magic_defs/zip +126 -0
  556. polyfile/magic_defs/zyxel +17 -0
  557. polyfile/nes.py +144 -0
  558. polyfile/nitf.py +15 -0
  559. polyfile/pdf.py +1264 -0
  560. polyfile/pickles.py +45 -0
  561. polyfile/polyfile.py +409 -0
  562. polyfile/profiling.py +115 -0
  563. polyfile/repl.py +624 -0
  564. polyfile/search.py +310 -0
  565. polyfile/serialization.py +323 -0
  566. polyfile/structmatcher.py +46 -0
  567. polyfile/structs.py +281 -0
  568. polyfile/templates/download.js +162 -0
  569. polyfile/templates/hexdump.css +268 -0
  570. polyfile/templates/hexdump.js +756 -0
  571. polyfile/templates/jquery-3.4.1.min.js +2 -0
  572. polyfile/templates/template.html +119 -0
  573. polyfile/wildcards.py +62 -0
  574. polyfile/zipmatcher.py +183 -0
  575. polyfile_weave-0.5.5.dist-info/METADATA +173 -0
  576. polyfile_weave-0.5.5.dist-info/RECORD +585 -0
  577. polyfile_weave-0.5.5.dist-info/WHEEL +5 -0
  578. polyfile_weave-0.5.5.dist-info/entry_points.txt +2 -0
  579. polyfile_weave-0.5.5.dist-info/licenses/LICENSE +202 -0
  580. polyfile_weave-0.5.5.dist-info/top_level.txt +2 -0
  581. polymerge/__init__.py +1 -0
  582. polymerge/__main__.py +296 -0
  583. polymerge/cfg.py +127 -0
  584. polymerge/polymerge.py +227 -0
  585. polymerge/polytracker.py +190 -0
@@ -0,0 +1,1189 @@
1
+ # This is a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild
2
+
3
+ from pkg_resources import parse_version
4
+ import kaitaistruct
5
+ from kaitaistruct import KaitaiStruct, KaitaiStream, BytesIO
6
+ import collections
7
+
8
+
9
+ if parse_version(kaitaistruct.__version__) < parse_version('0.9'):
10
+ raise Exception("Incompatible Kaitai Struct Python API: 0.9 or later is required, but you have %s" % (kaitaistruct.__version__))
11
+
12
+ class Nitf(KaitaiStruct):
13
+ """The NITF (National Image Transition Format) format is a file format developed by the U.S. Government for
14
+ storing imagery, e.g. from satellites.
15
+
16
+ According to the [foreword of the specification](https://web.archive.org/web/20181105050336/https://www.gwg.nga.mil/ntb/baseline/docs/2500c/2500C.pdf):
17
+ > The National Imagery Transmission Format Standard (NITFS) is the suite of standards for formatting digital
18
+ > imagery and imagery-related products and exchanging them among members of the Intelligence Community (IC) as
19
+ > defined by the Executive Order 12333, and other United States Government departments and agencies."
20
+
21
+ This implementation is set to version format (`file_version`) of 02.10 and `standard_type` of `BF01`.
22
+ It was implemented by [River Loop Security](https://www.riverloopsecurity.com/).
23
+
24
+ .. seealso::
25
+ Source - https://web.archive.org/web/20181105050336/https://www.gwg.nga.mil/ntb/baseline/docs/2500c/2500C.pdf
26
+ """
27
+ SEQ_FIELDS = ["header", "image_segments", "graphics_segments", "text_segments", "data_extension_segments", "reserved_extension_segments"]
28
+ def __init__(self, _io, _parent=None, _root=None):
29
+ self._io = _io
30
+ self._parent = _parent
31
+ self._root = _root if _root else self
32
+ self._debug = collections.defaultdict(dict)
33
+
34
+ def _read(self):
35
+ self._debug['header']['start'] = self._io.pos()
36
+ self.header = Nitf.Header(self._io, self, self._root)
37
+ self.header._read()
38
+ self._debug['header']['end'] = self._io.pos()
39
+ self._debug['image_segments']['start'] = self._io.pos()
40
+ self.image_segments = [None] * (int(self.header.num_image_segments))
41
+ for i in range(int(self.header.num_image_segments)):
42
+ if not 'arr' in self._debug['image_segments']:
43
+ self._debug['image_segments']['arr'] = []
44
+ self._debug['image_segments']['arr'].append({'start': self._io.pos()})
45
+ _t_image_segments = Nitf.ImageSegment(i, self._io, self, self._root)
46
+ _t_image_segments._read()
47
+ self.image_segments[i] = _t_image_segments
48
+ self._debug['image_segments']['arr'][i]['end'] = self._io.pos()
49
+
50
+ self._debug['image_segments']['end'] = self._io.pos()
51
+ self._debug['graphics_segments']['start'] = self._io.pos()
52
+ self.graphics_segments = [None] * (int(self.header.num_graphics_segments))
53
+ for i in range(int(self.header.num_graphics_segments)):
54
+ if not 'arr' in self._debug['graphics_segments']:
55
+ self._debug['graphics_segments']['arr'] = []
56
+ self._debug['graphics_segments']['arr'].append({'start': self._io.pos()})
57
+ _t_graphics_segments = Nitf.GraphicsSegment(i, self._io, self, self._root)
58
+ _t_graphics_segments._read()
59
+ self.graphics_segments[i] = _t_graphics_segments
60
+ self._debug['graphics_segments']['arr'][i]['end'] = self._io.pos()
61
+
62
+ self._debug['graphics_segments']['end'] = self._io.pos()
63
+ self._debug['text_segments']['start'] = self._io.pos()
64
+ self.text_segments = [None] * (int(self.header.num_text_files))
65
+ for i in range(int(self.header.num_text_files)):
66
+ if not 'arr' in self._debug['text_segments']:
67
+ self._debug['text_segments']['arr'] = []
68
+ self._debug['text_segments']['arr'].append({'start': self._io.pos()})
69
+ _t_text_segments = Nitf.TextSegment(i, self._io, self, self._root)
70
+ _t_text_segments._read()
71
+ self.text_segments[i] = _t_text_segments
72
+ self._debug['text_segments']['arr'][i]['end'] = self._io.pos()
73
+
74
+ self._debug['text_segments']['end'] = self._io.pos()
75
+ self._debug['data_extension_segments']['start'] = self._io.pos()
76
+ self.data_extension_segments = [None] * (int(self.header.num_data_extension))
77
+ for i in range(int(self.header.num_data_extension)):
78
+ if not 'arr' in self._debug['data_extension_segments']:
79
+ self._debug['data_extension_segments']['arr'] = []
80
+ self._debug['data_extension_segments']['arr'].append({'start': self._io.pos()})
81
+ _t_data_extension_segments = Nitf.DataExtensionSegment(i, self._io, self, self._root)
82
+ _t_data_extension_segments._read()
83
+ self.data_extension_segments[i] = _t_data_extension_segments
84
+ self._debug['data_extension_segments']['arr'][i]['end'] = self._io.pos()
85
+
86
+ self._debug['data_extension_segments']['end'] = self._io.pos()
87
+ self._debug['reserved_extension_segments']['start'] = self._io.pos()
88
+ self.reserved_extension_segments = [None] * (int(self.header.num_reserved_extension))
89
+ for i in range(int(self.header.num_reserved_extension)):
90
+ if not 'arr' in self._debug['reserved_extension_segments']:
91
+ self._debug['reserved_extension_segments']['arr'] = []
92
+ self._debug['reserved_extension_segments']['arr'].append({'start': self._io.pos()})
93
+ _t_reserved_extension_segments = Nitf.ReservedExtensionSegment(i, self._io, self, self._root)
94
+ _t_reserved_extension_segments._read()
95
+ self.reserved_extension_segments[i] = _t_reserved_extension_segments
96
+ self._debug['reserved_extension_segments']['arr'][i]['end'] = self._io.pos()
97
+
98
+ self._debug['reserved_extension_segments']['end'] = self._io.pos()
99
+
100
+ class ReservedExtensionSegment(KaitaiStruct):
101
+ SEQ_FIELDS = ["reserved_sub_header", "reserved_data_field"]
102
+ def __init__(self, idx, _io, _parent=None, _root=None):
103
+ self._io = _io
104
+ self._parent = _parent
105
+ self._root = _root if _root else self
106
+ self.idx = idx
107
+ self._debug = collections.defaultdict(dict)
108
+
109
+ def _read(self):
110
+ self._debug['reserved_sub_header']['start'] = self._io.pos()
111
+ self._raw_reserved_sub_header = self._io.read_bytes(int(self._parent.header.lrnfo[self.idx].length_reserved_extension_subheader))
112
+ _io__raw_reserved_sub_header = KaitaiStream(BytesIO(self._raw_reserved_sub_header))
113
+ self.reserved_sub_header = Nitf.ReservedSubHeader(_io__raw_reserved_sub_header, self, self._root)
114
+ self.reserved_sub_header._read()
115
+ self._debug['reserved_sub_header']['end'] = self._io.pos()
116
+ self._debug['reserved_data_field']['start'] = self._io.pos()
117
+ self.reserved_data_field = self._io.read_bytes(int(self._parent.header.lrnfo[self.idx].length_reserved_extension_segment))
118
+ self._debug['reserved_data_field']['end'] = self._io.pos()
119
+
120
+
121
+ class ImageComment(KaitaiStruct):
122
+ SEQ_FIELDS = ["_unnamed0"]
123
+ def __init__(self, _io, _parent=None, _root=None):
124
+ self._io = _io
125
+ self._parent = _parent
126
+ self._root = _root if _root else self
127
+ self._debug = collections.defaultdict(dict)
128
+
129
+ def _read(self):
130
+ self._debug['_unnamed0']['start'] = self._io.pos()
131
+ self._unnamed0 = (self._io.read_bytes(80)).decode(u"UTF-8")
132
+ self._debug['_unnamed0']['end'] = self._io.pos()
133
+
134
+
135
+ class LengthReservedInfo(KaitaiStruct):
136
+ SEQ_FIELDS = ["length_reserved_extension_subheader", "length_reserved_extension_segment"]
137
+ def __init__(self, _io, _parent=None, _root=None):
138
+ self._io = _io
139
+ self._parent = _parent
140
+ self._root = _root if _root else self
141
+ self._debug = collections.defaultdict(dict)
142
+
143
+ def _read(self):
144
+ self._debug['length_reserved_extension_subheader']['start'] = self._io.pos()
145
+ self.length_reserved_extension_subheader = (self._io.read_bytes(4)).decode(u"UTF-8")
146
+ self._debug['length_reserved_extension_subheader']['end'] = self._io.pos()
147
+ self._debug['length_reserved_extension_segment']['start'] = self._io.pos()
148
+ self.length_reserved_extension_segment = (self._io.read_bytes(7)).decode(u"UTF-8")
149
+ self._debug['length_reserved_extension_segment']['end'] = self._io.pos()
150
+
151
+
152
+ class Tre(KaitaiStruct):
153
+ SEQ_FIELDS = ["extension_type_id", "edata_length", "edata"]
154
+ def __init__(self, _io, _parent=None, _root=None):
155
+ self._io = _io
156
+ self._parent = _parent
157
+ self._root = _root if _root else self
158
+ self._debug = collections.defaultdict(dict)
159
+
160
+ def _read(self):
161
+ self._debug['extension_type_id']['start'] = self._io.pos()
162
+ self.extension_type_id = (self._io.read_bytes(6)).decode(u"UTF-8")
163
+ self._debug['extension_type_id']['end'] = self._io.pos()
164
+ self._debug['edata_length']['start'] = self._io.pos()
165
+ self.edata_length = (self._io.read_bytes(5)).decode(u"UTF-8")
166
+ self._debug['edata_length']['end'] = self._io.pos()
167
+ self._debug['edata']['start'] = self._io.pos()
168
+ self.edata = (self._io.read_bytes(int(self.edata_length))).decode(u"UTF-8")
169
+ self._debug['edata']['end'] = self._io.pos()
170
+
171
+
172
+ class BandInfo(KaitaiStruct):
173
+ SEQ_FIELDS = ["representation", "subcategory", "img_filter_condition", "img_filter_code", "num_luts", "num_lut_entries", "luts"]
174
+ def __init__(self, _io, _parent=None, _root=None):
175
+ self._io = _io
176
+ self._parent = _parent
177
+ self._root = _root if _root else self
178
+ self._debug = collections.defaultdict(dict)
179
+
180
+ def _read(self):
181
+ self._debug['representation']['start'] = self._io.pos()
182
+ self.representation = (self._io.read_bytes(2)).decode(u"UTF-8")
183
+ self._debug['representation']['end'] = self._io.pos()
184
+ self._debug['subcategory']['start'] = self._io.pos()
185
+ self.subcategory = (self._io.read_bytes(6)).decode(u"UTF-8")
186
+ self._debug['subcategory']['end'] = self._io.pos()
187
+ self._debug['img_filter_condition']['start'] = self._io.pos()
188
+ self.img_filter_condition = self._io.read_bytes(1)
189
+ self._debug['img_filter_condition']['end'] = self._io.pos()
190
+ if not self.img_filter_condition == b"\x4E":
191
+ raise kaitaistruct.ValidationNotEqualError(b"\x4E", self.img_filter_condition, self._io, u"/types/band_info/seq/2")
192
+ self._debug['img_filter_code']['start'] = self._io.pos()
193
+ self.img_filter_code = (self._io.read_bytes(3)).decode(u"UTF-8")
194
+ self._debug['img_filter_code']['end'] = self._io.pos()
195
+ self._debug['num_luts']['start'] = self._io.pos()
196
+ self.num_luts = (self._io.read_bytes(1)).decode(u"UTF-8")
197
+ self._debug['num_luts']['end'] = self._io.pos()
198
+ if int(self.num_luts) != 0:
199
+ self._debug['num_lut_entries']['start'] = self._io.pos()
200
+ self.num_lut_entries = (self._io.read_bytes(5)).decode(u"UTF-8")
201
+ self._debug['num_lut_entries']['end'] = self._io.pos()
202
+
203
+ self._debug['luts']['start'] = self._io.pos()
204
+ self.luts = [None] * (int(self.num_luts))
205
+ for i in range(int(self.num_luts)):
206
+ if not 'arr' in self._debug['luts']:
207
+ self._debug['luts']['arr'] = []
208
+ self._debug['luts']['arr'].append({'start': self._io.pos()})
209
+ self.luts[i] = self._io.read_bytes(int(self.num_lut_entries))
210
+ self._debug['luts']['arr'][i]['end'] = self._io.pos()
211
+
212
+ self._debug['luts']['end'] = self._io.pos()
213
+
214
+
215
+ class ImageSegment(KaitaiStruct):
216
+ SEQ_FIELDS = ["image_sub_header", "image_data_mask", "image_data_field"]
217
+ def __init__(self, idx, _io, _parent=None, _root=None):
218
+ self._io = _io
219
+ self._parent = _parent
220
+ self._root = _root if _root else self
221
+ self.idx = idx
222
+ self._debug = collections.defaultdict(dict)
223
+
224
+ def _read(self):
225
+ self._debug['image_sub_header']['start'] = self._io.pos()
226
+ self.image_sub_header = Nitf.ImageSubHeader(self._io, self, self._root)
227
+ self.image_sub_header._read()
228
+ self._debug['image_sub_header']['end'] = self._io.pos()
229
+ if self.has_mask:
230
+ self._debug['image_data_mask']['start'] = self._io.pos()
231
+ self.image_data_mask = Nitf.ImageDataMask(self._io, self, self._root)
232
+ self.image_data_mask._read()
233
+ self._debug['image_data_mask']['end'] = self._io.pos()
234
+
235
+ if self.has_mask:
236
+ self._debug['image_data_field']['start'] = self._io.pos()
237
+ self.image_data_field = self._io.read_bytes((int(self._parent.header.linfo[self.idx].length_image_segment) - self.image_data_mask.total_size))
238
+ self._debug['image_data_field']['end'] = self._io.pos()
239
+
240
+
241
+ @property
242
+ def has_mask(self):
243
+ if hasattr(self, '_m_has_mask'):
244
+ return self._m_has_mask if hasattr(self, '_m_has_mask') else None
245
+
246
+ self._m_has_mask = (self.image_sub_header.img_compression)[0:2] == u"MM"
247
+ return self._m_has_mask if hasattr(self, '_m_has_mask') else None
248
+
249
+
250
+ class TextSegment(KaitaiStruct):
251
+ SEQ_FIELDS = ["text_sub_header", "text_data_field"]
252
+ def __init__(self, idx, _io, _parent=None, _root=None):
253
+ self._io = _io
254
+ self._parent = _parent
255
+ self._root = _root if _root else self
256
+ self.idx = idx
257
+ self._debug = collections.defaultdict(dict)
258
+
259
+ def _read(self):
260
+ self._debug['text_sub_header']['start'] = self._io.pos()
261
+ self.text_sub_header = self._io.read_bytes(1)
262
+ self._debug['text_sub_header']['end'] = self._io.pos()
263
+ self._debug['text_data_field']['start'] = self._io.pos()
264
+ self.text_data_field = self._io.read_bytes(int(self._parent.header.ltnfo[self.idx].length_text_segment))
265
+ self._debug['text_data_field']['end'] = self._io.pos()
266
+
267
+
268
+ class GraphicSubHeader(KaitaiStruct):
269
+ SEQ_FIELDS = ["file_part_type_sy", "graphic_id", "graphic_name", "graphic_classification", "encryption", "graphic_type", "reserved1", "graphic_display_level", "graphic_attachment_level", "graphic_location", "first_graphic_bound_loc", "graphic_color", "second_graphic_bound_loc", "reserved2", "graphics_extended_sub_header"]
270
+ def __init__(self, _io, _parent=None, _root=None):
271
+ self._io = _io
272
+ self._parent = _parent
273
+ self._root = _root if _root else self
274
+ self._debug = collections.defaultdict(dict)
275
+
276
+ def _read(self):
277
+ self._debug['file_part_type_sy']['start'] = self._io.pos()
278
+ self.file_part_type_sy = self._io.read_bytes(2)
279
+ self._debug['file_part_type_sy']['end'] = self._io.pos()
280
+ if not self.file_part_type_sy == b"\x53\x59":
281
+ raise kaitaistruct.ValidationNotEqualError(b"\x53\x59", self.file_part_type_sy, self._io, u"/types/graphic_sub_header/seq/0")
282
+ self._debug['graphic_id']['start'] = self._io.pos()
283
+ self.graphic_id = (self._io.read_bytes(10)).decode(u"UTF-8")
284
+ self._debug['graphic_id']['end'] = self._io.pos()
285
+ self._debug['graphic_name']['start'] = self._io.pos()
286
+ self.graphic_name = (self._io.read_bytes(20)).decode(u"UTF-8")
287
+ self._debug['graphic_name']['end'] = self._io.pos()
288
+ self._debug['graphic_classification']['start'] = self._io.pos()
289
+ self.graphic_classification = Nitf.Clasnfo(self._io, self, self._root)
290
+ self.graphic_classification._read()
291
+ self._debug['graphic_classification']['end'] = self._io.pos()
292
+ self._debug['encryption']['start'] = self._io.pos()
293
+ self.encryption = Nitf.Encrypt(self._io, self, self._root)
294
+ self.encryption._read()
295
+ self._debug['encryption']['end'] = self._io.pos()
296
+ self._debug['graphic_type']['start'] = self._io.pos()
297
+ self.graphic_type = self._io.read_bytes(1)
298
+ self._debug['graphic_type']['end'] = self._io.pos()
299
+ if not self.graphic_type == b"\x43":
300
+ raise kaitaistruct.ValidationNotEqualError(b"\x43", self.graphic_type, self._io, u"/types/graphic_sub_header/seq/5")
301
+ self._debug['reserved1']['start'] = self._io.pos()
302
+ self.reserved1 = (self._io.read_bytes(13)).decode(u"UTF-8")
303
+ self._debug['reserved1']['end'] = self._io.pos()
304
+ self._debug['graphic_display_level']['start'] = self._io.pos()
305
+ self.graphic_display_level = (self._io.read_bytes(3)).decode(u"UTF-8")
306
+ self._debug['graphic_display_level']['end'] = self._io.pos()
307
+ self._debug['graphic_attachment_level']['start'] = self._io.pos()
308
+ self.graphic_attachment_level = (self._io.read_bytes(3)).decode(u"UTF-8")
309
+ self._debug['graphic_attachment_level']['end'] = self._io.pos()
310
+ self._debug['graphic_location']['start'] = self._io.pos()
311
+ self.graphic_location = (self._io.read_bytes(10)).decode(u"UTF-8")
312
+ self._debug['graphic_location']['end'] = self._io.pos()
313
+ self._debug['first_graphic_bound_loc']['start'] = self._io.pos()
314
+ self.first_graphic_bound_loc = (self._io.read_bytes(10)).decode(u"UTF-8")
315
+ self._debug['first_graphic_bound_loc']['end'] = self._io.pos()
316
+ self._debug['graphic_color']['start'] = self._io.pos()
317
+ self.graphic_color = (self._io.read_bytes(1)).decode(u"UTF-8")
318
+ self._debug['graphic_color']['end'] = self._io.pos()
319
+ self._debug['second_graphic_bound_loc']['start'] = self._io.pos()
320
+ self.second_graphic_bound_loc = (self._io.read_bytes(10)).decode(u"UTF-8")
321
+ self._debug['second_graphic_bound_loc']['end'] = self._io.pos()
322
+ self._debug['reserved2']['start'] = self._io.pos()
323
+ self.reserved2 = (self._io.read_bytes(2)).decode(u"UTF-8")
324
+ self._debug['reserved2']['end'] = self._io.pos()
325
+ self._debug['graphics_extended_sub_header']['start'] = self._io.pos()
326
+ self.graphics_extended_sub_header = Nitf.TreHeader(self._io, self, self._root)
327
+ self.graphics_extended_sub_header._read()
328
+ self._debug['graphics_extended_sub_header']['end'] = self._io.pos()
329
+
330
+
331
+ class Clasnfo(KaitaiStruct):
332
+ SEQ_FIELDS = ["security_class", "security_system", "codewords", "control_and_handling", "releaseability", "declass_type", "declass_date", "declass_exemption", "downgrade", "downgrade_date", "class_text", "class_authority_type", "class_authority", "class_reason", "source_date", "control_number"]
333
+ def __init__(self, _io, _parent=None, _root=None):
334
+ self._io = _io
335
+ self._parent = _parent
336
+ self._root = _root if _root else self
337
+ self._debug = collections.defaultdict(dict)
338
+
339
+ def _read(self):
340
+ self._debug['security_class']['start'] = self._io.pos()
341
+ self.security_class = (self._io.read_bytes(1)).decode(u"UTF-8")
342
+ self._debug['security_class']['end'] = self._io.pos()
343
+ self._debug['security_system']['start'] = self._io.pos()
344
+ self.security_system = (self._io.read_bytes(2)).decode(u"UTF-8")
345
+ self._debug['security_system']['end'] = self._io.pos()
346
+ self._debug['codewords']['start'] = self._io.pos()
347
+ self.codewords = (self._io.read_bytes(11)).decode(u"UTF-8")
348
+ self._debug['codewords']['end'] = self._io.pos()
349
+ self._debug['control_and_handling']['start'] = self._io.pos()
350
+ self.control_and_handling = (self._io.read_bytes(2)).decode(u"UTF-8")
351
+ self._debug['control_and_handling']['end'] = self._io.pos()
352
+ self._debug['releaseability']['start'] = self._io.pos()
353
+ self.releaseability = (self._io.read_bytes(20)).decode(u"UTF-8")
354
+ self._debug['releaseability']['end'] = self._io.pos()
355
+ self._debug['declass_type']['start'] = self._io.pos()
356
+ self.declass_type = (self._io.read_bytes(2)).decode(u"UTF-8")
357
+ self._debug['declass_type']['end'] = self._io.pos()
358
+ self._debug['declass_date']['start'] = self._io.pos()
359
+ self.declass_date = (self._io.read_bytes(8)).decode(u"UTF-8")
360
+ self._debug['declass_date']['end'] = self._io.pos()
361
+ self._debug['declass_exemption']['start'] = self._io.pos()
362
+ self.declass_exemption = (self._io.read_bytes(4)).decode(u"UTF-8")
363
+ self._debug['declass_exemption']['end'] = self._io.pos()
364
+ self._debug['downgrade']['start'] = self._io.pos()
365
+ self.downgrade = (self._io.read_bytes(1)).decode(u"UTF-8")
366
+ self._debug['downgrade']['end'] = self._io.pos()
367
+ self._debug['downgrade_date']['start'] = self._io.pos()
368
+ self.downgrade_date = (self._io.read_bytes(8)).decode(u"UTF-8")
369
+ self._debug['downgrade_date']['end'] = self._io.pos()
370
+ self._debug['class_text']['start'] = self._io.pos()
371
+ self.class_text = (self._io.read_bytes(43)).decode(u"UTF-8")
372
+ self._debug['class_text']['end'] = self._io.pos()
373
+ self._debug['class_authority_type']['start'] = self._io.pos()
374
+ self.class_authority_type = (self._io.read_bytes(1)).decode(u"UTF-8")
375
+ self._debug['class_authority_type']['end'] = self._io.pos()
376
+ self._debug['class_authority']['start'] = self._io.pos()
377
+ self.class_authority = (self._io.read_bytes(40)).decode(u"UTF-8")
378
+ self._debug['class_authority']['end'] = self._io.pos()
379
+ self._debug['class_reason']['start'] = self._io.pos()
380
+ self.class_reason = (self._io.read_bytes(1)).decode(u"UTF-8")
381
+ self._debug['class_reason']['end'] = self._io.pos()
382
+ self._debug['source_date']['start'] = self._io.pos()
383
+ self.source_date = (self._io.read_bytes(8)).decode(u"UTF-8")
384
+ self._debug['source_date']['end'] = self._io.pos()
385
+ self._debug['control_number']['start'] = self._io.pos()
386
+ self.control_number = (self._io.read_bytes(15)).decode(u"UTF-8")
387
+ self._debug['control_number']['end'] = self._io.pos()
388
+
389
+
390
+ class LengthGraphicInfo(KaitaiStruct):
391
+ SEQ_FIELDS = ["length_graphic_subheader", "length_graphic_segment"]
392
+ def __init__(self, _io, _parent=None, _root=None):
393
+ self._io = _io
394
+ self._parent = _parent
395
+ self._root = _root if _root else self
396
+ self._debug = collections.defaultdict(dict)
397
+
398
+ def _read(self):
399
+ self._debug['length_graphic_subheader']['start'] = self._io.pos()
400
+ self.length_graphic_subheader = (self._io.read_bytes(4)).decode(u"UTF-8")
401
+ self._debug['length_graphic_subheader']['end'] = self._io.pos()
402
+ self._debug['length_graphic_segment']['start'] = self._io.pos()
403
+ self.length_graphic_segment = (self._io.read_bytes(6)).decode(u"UTF-8")
404
+ self._debug['length_graphic_segment']['end'] = self._io.pos()
405
+
406
+
407
+ class Encrypt(KaitaiStruct):
408
+ SEQ_FIELDS = ["_unnamed0"]
409
+ def __init__(self, _io, _parent=None, _root=None):
410
+ self._io = _io
411
+ self._parent = _parent
412
+ self._root = _root if _root else self
413
+ self._debug = collections.defaultdict(dict)
414
+
415
+ def _read(self):
416
+ self._debug['_unnamed0']['start'] = self._io.pos()
417
+ self._unnamed0 = (self._io.read_bytes(1)).decode(u"UTF-8")
418
+ self._debug['_unnamed0']['end'] = self._io.pos()
419
+
420
+
421
+ class ImageDataMask(KaitaiStruct):
422
+ SEQ_FIELDS = ["blocked_img_data_offset", "bmrlnth", "tmrlnth", "tpxcdlnth", "tpxcd", "bmrbnd", "tmrbnd"]
423
+ def __init__(self, _io, _parent=None, _root=None):
424
+ self._io = _io
425
+ self._parent = _parent
426
+ self._root = _root if _root else self
427
+ self._debug = collections.defaultdict(dict)
428
+
429
+ def _read(self):
430
+ self._debug['blocked_img_data_offset']['start'] = self._io.pos()
431
+ self.blocked_img_data_offset = self._io.read_u4be()
432
+ self._debug['blocked_img_data_offset']['end'] = self._io.pos()
433
+ self._debug['bmrlnth']['start'] = self._io.pos()
434
+ self.bmrlnth = self._io.read_u2be()
435
+ self._debug['bmrlnth']['end'] = self._io.pos()
436
+ self._debug['tmrlnth']['start'] = self._io.pos()
437
+ self.tmrlnth = self._io.read_u2be()
438
+ self._debug['tmrlnth']['end'] = self._io.pos()
439
+ self._debug['tpxcdlnth']['start'] = self._io.pos()
440
+ self.tpxcdlnth = self._io.read_u2be()
441
+ self._debug['tpxcdlnth']['end'] = self._io.pos()
442
+ self._debug['tpxcd']['start'] = self._io.pos()
443
+ self.tpxcd = self._io.read_bytes(self.tpxcd_size)
444
+ self._debug['tpxcd']['end'] = self._io.pos()
445
+ if self.has_bmr:
446
+ self._debug['bmrbnd']['start'] = self._io.pos()
447
+ self.bmrbnd = [None] * (self.bmrtmr_count)
448
+ for i in range(self.bmrtmr_count):
449
+ if not 'arr' in self._debug['bmrbnd']:
450
+ self._debug['bmrbnd']['arr'] = []
451
+ self._debug['bmrbnd']['arr'].append({'start': self._io.pos()})
452
+ self.bmrbnd[i] = self._io.read_u4be()
453
+ self._debug['bmrbnd']['arr'][i]['end'] = self._io.pos()
454
+
455
+ self._debug['bmrbnd']['end'] = self._io.pos()
456
+
457
+ if self.has_tmr:
458
+ self._debug['tmrbnd']['start'] = self._io.pos()
459
+ self.tmrbnd = [None] * (self.bmrtmr_count)
460
+ for i in range(self.bmrtmr_count):
461
+ if not 'arr' in self._debug['tmrbnd']:
462
+ self._debug['tmrbnd']['arr'] = []
463
+ self._debug['tmrbnd']['arr'].append({'start': self._io.pos()})
464
+ self.tmrbnd[i] = self._io.read_u4be()
465
+ self._debug['tmrbnd']['arr'][i]['end'] = self._io.pos()
466
+
467
+ self._debug['tmrbnd']['end'] = self._io.pos()
468
+
469
+
470
+ @property
471
+ def has_bmr(self):
472
+ if hasattr(self, '_m_has_bmr'):
473
+ return self._m_has_bmr if hasattr(self, '_m_has_bmr') else None
474
+
475
+ self._m_has_bmr = self.bmrlnth != 0
476
+ return self._m_has_bmr if hasattr(self, '_m_has_bmr') else None
477
+
478
+ @property
479
+ def has_tmr(self):
480
+ if hasattr(self, '_m_has_tmr'):
481
+ return self._m_has_tmr if hasattr(self, '_m_has_tmr') else None
482
+
483
+ self._m_has_tmr = self.tmrlnth != 0
484
+ return self._m_has_tmr if hasattr(self, '_m_has_tmr') else None
485
+
486
+ @property
487
+ def tmrbnd_size(self):
488
+ if hasattr(self, '_m_tmrbnd_size'):
489
+ return self._m_tmrbnd_size if hasattr(self, '_m_tmrbnd_size') else None
490
+
491
+ self._m_tmrbnd_size = ((self.bmrtmr_count * 4) if self.has_tmr else 0)
492
+ return self._m_tmrbnd_size if hasattr(self, '_m_tmrbnd_size') else None
493
+
494
+ @property
495
+ def tpxcd_size(self):
496
+ if hasattr(self, '_m_tpxcd_size'):
497
+ return self._m_tpxcd_size if hasattr(self, '_m_tpxcd_size') else None
498
+
499
+ self._m_tpxcd_size = (self.tpxcdlnth if (self.tpxcdlnth % 8) == 0 else (self.tpxcdlnth + (8 - (self.tpxcdlnth % 8)))) // 8
500
+ return self._m_tpxcd_size if hasattr(self, '_m_tpxcd_size') else None
501
+
502
+ @property
503
+ def total_size(self):
504
+ if hasattr(self, '_m_total_size'):
505
+ return self._m_total_size if hasattr(self, '_m_total_size') else None
506
+
507
+ self._m_total_size = ((((((4 + 2) + 2) + 2) + self.tpxcd_size) + self.bmrbnd_size) + self.tmrbnd_size)
508
+ return self._m_total_size if hasattr(self, '_m_total_size') else None
509
+
510
+ @property
511
+ def bmrbnd_size(self):
512
+ if hasattr(self, '_m_bmrbnd_size'):
513
+ return self._m_bmrbnd_size if hasattr(self, '_m_bmrbnd_size') else None
514
+
515
+ self._m_bmrbnd_size = ((self.bmrtmr_count * 4) if self.has_bmr else 0)
516
+ return self._m_bmrbnd_size if hasattr(self, '_m_bmrbnd_size') else None
517
+
518
+ @property
519
+ def bmrtmr_count(self):
520
+ if hasattr(self, '_m_bmrtmr_count'):
521
+ return self._m_bmrtmr_count if hasattr(self, '_m_bmrtmr_count') else None
522
+
523
+ self._m_bmrtmr_count = ((int(self._parent.image_sub_header.num_blocks_per_row) * int(self._parent.image_sub_header.num_blocks_per_col)) * (1 if self._parent.image_sub_header.img_mode != u"S" else (int(self._parent.image_sub_header.num_bands) if int(self._parent.image_sub_header.num_bands) != 0 else int(self._parent.image_sub_header.num_multispectral_bands))))
524
+ return self._m_bmrtmr_count if hasattr(self, '_m_bmrtmr_count') else None
525
+
526
+
527
+ class GraphicsSegment(KaitaiStruct):
528
+ SEQ_FIELDS = ["graphic_sub_header", "graphic_data_field"]
529
+ def __init__(self, idx, _io, _parent=None, _root=None):
530
+ self._io = _io
531
+ self._parent = _parent
532
+ self._root = _root if _root else self
533
+ self.idx = idx
534
+ self._debug = collections.defaultdict(dict)
535
+
536
+ def _read(self):
537
+ self._debug['graphic_sub_header']['start'] = self._io.pos()
538
+ self.graphic_sub_header = Nitf.GraphicSubHeader(self._io, self, self._root)
539
+ self.graphic_sub_header._read()
540
+ self._debug['graphic_sub_header']['end'] = self._io.pos()
541
+ self._debug['graphic_data_field']['start'] = self._io.pos()
542
+ self.graphic_data_field = self._io.read_bytes(int(self._parent.header.lnnfo[self.idx].length_graphic_segment))
543
+ self._debug['graphic_data_field']['end'] = self._io.pos()
544
+
545
+
546
+ class DataSubHeader(KaitaiStruct):
547
+ SEQ_FIELDS = ["des_base", "overflowed_header_type", "data_item_overflowed", "des_defined_subheader_fields_len", "desshf", "des_defined_data_field"]
548
+ def __init__(self, _io, _parent=None, _root=None):
549
+ self._io = _io
550
+ self._parent = _parent
551
+ self._root = _root if _root else self
552
+ self._debug = collections.defaultdict(dict)
553
+
554
+ def _read(self):
555
+ self._debug['des_base']['start'] = self._io.pos()
556
+ self.des_base = Nitf.DataSubHeaderBase(self._io, self, self._root)
557
+ self.des_base._read()
558
+ self._debug['des_base']['end'] = self._io.pos()
559
+ if self.tre_ofl:
560
+ self._debug['overflowed_header_type']['start'] = self._io.pos()
561
+ self.overflowed_header_type = (self._io.read_bytes(6)).decode(u"UTF-8")
562
+ self._debug['overflowed_header_type']['end'] = self._io.pos()
563
+
564
+ if self.tre_ofl:
565
+ self._debug['data_item_overflowed']['start'] = self._io.pos()
566
+ self.data_item_overflowed = (self._io.read_bytes(3)).decode(u"UTF-8")
567
+ self._debug['data_item_overflowed']['end'] = self._io.pos()
568
+
569
+ self._debug['des_defined_subheader_fields_len']['start'] = self._io.pos()
570
+ self.des_defined_subheader_fields_len = (self._io.read_bytes(4)).decode(u"UTF-8")
571
+ self._debug['des_defined_subheader_fields_len']['end'] = self._io.pos()
572
+ self._debug['desshf']['start'] = self._io.pos()
573
+ self.desshf = (self._io.read_bytes(int(self.des_defined_subheader_fields_len))).decode(u"UTF-8")
574
+ self._debug['desshf']['end'] = self._io.pos()
575
+ self._debug['des_defined_data_field']['start'] = self._io.pos()
576
+ self.des_defined_data_field = (self._io.read_bytes_full()).decode(u"UTF-8")
577
+ self._debug['des_defined_data_field']['end'] = self._io.pos()
578
+
579
+ @property
580
+ def tre_ofl(self):
581
+ if hasattr(self, '_m_tre_ofl'):
582
+ return self._m_tre_ofl if hasattr(self, '_m_tre_ofl') else None
583
+
584
+ self._m_tre_ofl = self.des_base.desid == u"TRE_OVERFLOW"
585
+ return self._m_tre_ofl if hasattr(self, '_m_tre_ofl') else None
586
+
587
+
588
+ class DataExtensionSegment(KaitaiStruct):
589
+ SEQ_FIELDS = ["data_sub_header", "data_data_field"]
590
+ def __init__(self, idx, _io, _parent=None, _root=None):
591
+ self._io = _io
592
+ self._parent = _parent
593
+ self._root = _root if _root else self
594
+ self.idx = idx
595
+ self._debug = collections.defaultdict(dict)
596
+
597
+ def _read(self):
598
+ self._debug['data_sub_header']['start'] = self._io.pos()
599
+ self._raw_data_sub_header = self._io.read_bytes(int(self._parent.header.ldnfo[self.idx].length_data_extension_subheader))
600
+ _io__raw_data_sub_header = KaitaiStream(BytesIO(self._raw_data_sub_header))
601
+ self.data_sub_header = Nitf.DataSubHeader(_io__raw_data_sub_header, self, self._root)
602
+ self.data_sub_header._read()
603
+ self._debug['data_sub_header']['end'] = self._io.pos()
604
+ self._debug['data_data_field']['start'] = self._io.pos()
605
+ self.data_data_field = self._io.read_bytes(int(self._parent.header.ldnfo[self.idx].length_data_extension_segment))
606
+ self._debug['data_data_field']['end'] = self._io.pos()
607
+
608
+
609
+ class DataSubHeaderTre(KaitaiStruct):
610
+ SEQ_FIELDS = ["des_base", "overflowed_header_type", "data_item_overflowed", "des_defined_subheader_fields_len", "des_defined_data_field"]
611
+ def __init__(self, _io, _parent=None, _root=None):
612
+ self._io = _io
613
+ self._parent = _parent
614
+ self._root = _root if _root else self
615
+ self._debug = collections.defaultdict(dict)
616
+
617
+ def _read(self):
618
+ self._debug['des_base']['start'] = self._io.pos()
619
+ self.des_base = Nitf.DataSubHeaderBase(self._io, self, self._root)
620
+ self.des_base._read()
621
+ self._debug['des_base']['end'] = self._io.pos()
622
+ if self.des_base.desid == u"TRE_OVERFLOW":
623
+ self._debug['overflowed_header_type']['start'] = self._io.pos()
624
+ self.overflowed_header_type = (self._io.read_bytes(6)).decode(u"UTF-8")
625
+ self._debug['overflowed_header_type']['end'] = self._io.pos()
626
+
627
+ if self.des_base.desid == u"TRE_OVERFLOW":
628
+ self._debug['data_item_overflowed']['start'] = self._io.pos()
629
+ self.data_item_overflowed = (self._io.read_bytes(3)).decode(u"UTF-8")
630
+ self._debug['data_item_overflowed']['end'] = self._io.pos()
631
+
632
+ self._debug['des_defined_subheader_fields_len']['start'] = self._io.pos()
633
+ self.des_defined_subheader_fields_len = (self._io.read_bytes(4)).decode(u"UTF-8")
634
+ self._debug['des_defined_subheader_fields_len']['end'] = self._io.pos()
635
+ self._debug['des_defined_data_field']['start'] = self._io.pos()
636
+ self.des_defined_data_field = (self._io.read_bytes(int(self.des_defined_subheader_fields_len))).decode(u"UTF-8")
637
+ self._debug['des_defined_data_field']['end'] = self._io.pos()
638
+
639
+
640
+ class ImageSubHeader(KaitaiStruct):
641
+ SEQ_FIELDS = ["file_part_type", "image_id_1", "image_date_time", "target_id", "image_id_2", "image_security_classification", "encryption", "image_source", "num_sig_rows", "num_sig_cols", "pixel_value_type", "image_representation", "image_category", "actual_bits_per_pixel_per_band", "pixel_justification", "image_coordinate_rep", "image_geo_loc", "num_img_comments", "img_comments", "img_compression", "compression_rate_code", "num_bands", "num_multispectral_bands", "bands", "img_sync_code", "img_mode", "num_blocks_per_row", "num_blocks_per_col", "num_pixels_per_block_horz", "num_pixels_per_block_vert", "num_pixels_per_band", "img_display_level", "attachment_level", "img_location", "img_magnification", "user_def_img_data_len", "user_def_overflow", "user_def_img_data", "image_extended_sub_header"]
642
+ def __init__(self, _io, _parent=None, _root=None):
643
+ self._io = _io
644
+ self._parent = _parent
645
+ self._root = _root if _root else self
646
+ self._debug = collections.defaultdict(dict)
647
+
648
+ def _read(self):
649
+ self._debug['file_part_type']['start'] = self._io.pos()
650
+ self.file_part_type = self._io.read_bytes(2)
651
+ self._debug['file_part_type']['end'] = self._io.pos()
652
+ if not self.file_part_type == b"\x49\x4D":
653
+ raise kaitaistruct.ValidationNotEqualError(b"\x49\x4D", self.file_part_type, self._io, u"/types/image_sub_header/seq/0")
654
+ self._debug['image_id_1']['start'] = self._io.pos()
655
+ self.image_id_1 = (self._io.read_bytes(10)).decode(u"UTF-8")
656
+ self._debug['image_id_1']['end'] = self._io.pos()
657
+ self._debug['image_date_time']['start'] = self._io.pos()
658
+ self.image_date_time = Nitf.DateTime(self._io, self, self._root)
659
+ self.image_date_time._read()
660
+ self._debug['image_date_time']['end'] = self._io.pos()
661
+ self._debug['target_id']['start'] = self._io.pos()
662
+ self.target_id = (self._io.read_bytes(17)).decode(u"UTF-8")
663
+ self._debug['target_id']['end'] = self._io.pos()
664
+ self._debug['image_id_2']['start'] = self._io.pos()
665
+ self.image_id_2 = (self._io.read_bytes(80)).decode(u"UTF-8")
666
+ self._debug['image_id_2']['end'] = self._io.pos()
667
+ self._debug['image_security_classification']['start'] = self._io.pos()
668
+ self.image_security_classification = Nitf.Clasnfo(self._io, self, self._root)
669
+ self.image_security_classification._read()
670
+ self._debug['image_security_classification']['end'] = self._io.pos()
671
+ self._debug['encryption']['start'] = self._io.pos()
672
+ self.encryption = Nitf.Encrypt(self._io, self, self._root)
673
+ self.encryption._read()
674
+ self._debug['encryption']['end'] = self._io.pos()
675
+ self._debug['image_source']['start'] = self._io.pos()
676
+ self.image_source = (self._io.read_bytes(42)).decode(u"UTF-8")
677
+ self._debug['image_source']['end'] = self._io.pos()
678
+ self._debug['num_sig_rows']['start'] = self._io.pos()
679
+ self.num_sig_rows = (self._io.read_bytes(8)).decode(u"UTF-8")
680
+ self._debug['num_sig_rows']['end'] = self._io.pos()
681
+ self._debug['num_sig_cols']['start'] = self._io.pos()
682
+ self.num_sig_cols = (self._io.read_bytes(8)).decode(u"UTF-8")
683
+ self._debug['num_sig_cols']['end'] = self._io.pos()
684
+ self._debug['pixel_value_type']['start'] = self._io.pos()
685
+ self.pixel_value_type = (self._io.read_bytes(3)).decode(u"UTF-8")
686
+ self._debug['pixel_value_type']['end'] = self._io.pos()
687
+ self._debug['image_representation']['start'] = self._io.pos()
688
+ self.image_representation = (self._io.read_bytes(8)).decode(u"UTF-8")
689
+ self._debug['image_representation']['end'] = self._io.pos()
690
+ self._debug['image_category']['start'] = self._io.pos()
691
+ self.image_category = (self._io.read_bytes(8)).decode(u"UTF-8")
692
+ self._debug['image_category']['end'] = self._io.pos()
693
+ self._debug['actual_bits_per_pixel_per_band']['start'] = self._io.pos()
694
+ self.actual_bits_per_pixel_per_band = (self._io.read_bytes(2)).decode(u"UTF-8")
695
+ self._debug['actual_bits_per_pixel_per_band']['end'] = self._io.pos()
696
+ self._debug['pixel_justification']['start'] = self._io.pos()
697
+ self.pixel_justification = (self._io.read_bytes(1)).decode(u"UTF-8")
698
+ self._debug['pixel_justification']['end'] = self._io.pos()
699
+ self._debug['image_coordinate_rep']['start'] = self._io.pos()
700
+ self.image_coordinate_rep = (self._io.read_bytes(1)).decode(u"UTF-8")
701
+ self._debug['image_coordinate_rep']['end'] = self._io.pos()
702
+ self._debug['image_geo_loc']['start'] = self._io.pos()
703
+ self.image_geo_loc = (self._io.read_bytes(60)).decode(u"UTF-8")
704
+ self._debug['image_geo_loc']['end'] = self._io.pos()
705
+ self._debug['num_img_comments']['start'] = self._io.pos()
706
+ self.num_img_comments = (self._io.read_bytes(1)).decode(u"UTF-8")
707
+ self._debug['num_img_comments']['end'] = self._io.pos()
708
+ self._debug['img_comments']['start'] = self._io.pos()
709
+ self.img_comments = [None] * (int(self.num_img_comments))
710
+ for i in range(int(self.num_img_comments)):
711
+ if not 'arr' in self._debug['img_comments']:
712
+ self._debug['img_comments']['arr'] = []
713
+ self._debug['img_comments']['arr'].append({'start': self._io.pos()})
714
+ _t_img_comments = Nitf.ImageComment(self._io, self, self._root)
715
+ _t_img_comments._read()
716
+ self.img_comments[i] = _t_img_comments
717
+ self._debug['img_comments']['arr'][i]['end'] = self._io.pos()
718
+
719
+ self._debug['img_comments']['end'] = self._io.pos()
720
+ self._debug['img_compression']['start'] = self._io.pos()
721
+ self.img_compression = (self._io.read_bytes(2)).decode(u"UTF-8")
722
+ self._debug['img_compression']['end'] = self._io.pos()
723
+ self._debug['compression_rate_code']['start'] = self._io.pos()
724
+ self.compression_rate_code = (self._io.read_bytes(4)).decode(u"UTF-8")
725
+ self._debug['compression_rate_code']['end'] = self._io.pos()
726
+ self._debug['num_bands']['start'] = self._io.pos()
727
+ self.num_bands = (self._io.read_bytes(1)).decode(u"UTF-8")
728
+ self._debug['num_bands']['end'] = self._io.pos()
729
+ if int(self.num_bands) == 0:
730
+ self._debug['num_multispectral_bands']['start'] = self._io.pos()
731
+ self.num_multispectral_bands = (self._io.read_bytes(5)).decode(u"UTF-8")
732
+ self._debug['num_multispectral_bands']['end'] = self._io.pos()
733
+
734
+ self._debug['bands']['start'] = self._io.pos()
735
+ self.bands = [None] * ((int(self.num_bands) if int(self.num_bands) != 0 else int(self.num_multispectral_bands)))
736
+ for i in range((int(self.num_bands) if int(self.num_bands) != 0 else int(self.num_multispectral_bands))):
737
+ if not 'arr' in self._debug['bands']:
738
+ self._debug['bands']['arr'] = []
739
+ self._debug['bands']['arr'].append({'start': self._io.pos()})
740
+ _t_bands = Nitf.BandInfo(self._io, self, self._root)
741
+ _t_bands._read()
742
+ self.bands[i] = _t_bands
743
+ self._debug['bands']['arr'][i]['end'] = self._io.pos()
744
+
745
+ self._debug['bands']['end'] = self._io.pos()
746
+ self._debug['img_sync_code']['start'] = self._io.pos()
747
+ self.img_sync_code = (self._io.read_bytes(1)).decode(u"UTF-8")
748
+ self._debug['img_sync_code']['end'] = self._io.pos()
749
+ self._debug['img_mode']['start'] = self._io.pos()
750
+ self.img_mode = (self._io.read_bytes(1)).decode(u"UTF-8")
751
+ self._debug['img_mode']['end'] = self._io.pos()
752
+ self._debug['num_blocks_per_row']['start'] = self._io.pos()
753
+ self.num_blocks_per_row = (self._io.read_bytes(4)).decode(u"UTF-8")
754
+ self._debug['num_blocks_per_row']['end'] = self._io.pos()
755
+ self._debug['num_blocks_per_col']['start'] = self._io.pos()
756
+ self.num_blocks_per_col = (self._io.read_bytes(4)).decode(u"UTF-8")
757
+ self._debug['num_blocks_per_col']['end'] = self._io.pos()
758
+ self._debug['num_pixels_per_block_horz']['start'] = self._io.pos()
759
+ self.num_pixels_per_block_horz = (self._io.read_bytes(4)).decode(u"UTF-8")
760
+ self._debug['num_pixels_per_block_horz']['end'] = self._io.pos()
761
+ self._debug['num_pixels_per_block_vert']['start'] = self._io.pos()
762
+ self.num_pixels_per_block_vert = (self._io.read_bytes(4)).decode(u"UTF-8")
763
+ self._debug['num_pixels_per_block_vert']['end'] = self._io.pos()
764
+ self._debug['num_pixels_per_band']['start'] = self._io.pos()
765
+ self.num_pixels_per_band = (self._io.read_bytes(2)).decode(u"UTF-8")
766
+ self._debug['num_pixels_per_band']['end'] = self._io.pos()
767
+ self._debug['img_display_level']['start'] = self._io.pos()
768
+ self.img_display_level = (self._io.read_bytes(3)).decode(u"UTF-8")
769
+ self._debug['img_display_level']['end'] = self._io.pos()
770
+ self._debug['attachment_level']['start'] = self._io.pos()
771
+ self.attachment_level = (self._io.read_bytes(3)).decode(u"UTF-8")
772
+ self._debug['attachment_level']['end'] = self._io.pos()
773
+ self._debug['img_location']['start'] = self._io.pos()
774
+ self.img_location = (self._io.read_bytes(10)).decode(u"UTF-8")
775
+ self._debug['img_location']['end'] = self._io.pos()
776
+ self._debug['img_magnification']['start'] = self._io.pos()
777
+ self.img_magnification = (self._io.read_bytes(4)).decode(u"UTF-8")
778
+ self._debug['img_magnification']['end'] = self._io.pos()
779
+ self._debug['user_def_img_data_len']['start'] = self._io.pos()
780
+ self.user_def_img_data_len = (self._io.read_bytes(5)).decode(u"UTF-8")
781
+ self._debug['user_def_img_data_len']['end'] = self._io.pos()
782
+ if int(self.user_def_img_data_len) != 0:
783
+ self._debug['user_def_overflow']['start'] = self._io.pos()
784
+ self.user_def_overflow = (self._io.read_bytes(3)).decode(u"UTF-8")
785
+ self._debug['user_def_overflow']['end'] = self._io.pos()
786
+
787
+ if int(self.user_def_img_data_len) > 2:
788
+ self._debug['user_def_img_data']['start'] = self._io.pos()
789
+ self.user_def_img_data = [None] * ((int(self.user_def_img_data_len) - 3))
790
+ for i in range((int(self.user_def_img_data_len) - 3)):
791
+ if not 'arr' in self._debug['user_def_img_data']:
792
+ self._debug['user_def_img_data']['arr'] = []
793
+ self._debug['user_def_img_data']['arr'].append({'start': self._io.pos()})
794
+ self.user_def_img_data[i] = self._io.read_u1()
795
+ self._debug['user_def_img_data']['arr'][i]['end'] = self._io.pos()
796
+
797
+ self._debug['user_def_img_data']['end'] = self._io.pos()
798
+
799
+ self._debug['image_extended_sub_header']['start'] = self._io.pos()
800
+ self.image_extended_sub_header = Nitf.TreHeader(self._io, self, self._root)
801
+ self.image_extended_sub_header._read()
802
+ self._debug['image_extended_sub_header']['end'] = self._io.pos()
803
+
804
+
805
+ class ReservedSubHeader(KaitaiStruct):
806
+ SEQ_FIELDS = ["file_part_type_re", "res_type_id", "res_version", "reclasnfo", "res_user_defined_subheader_length", "res_user_defined_subheader_fields", "res_user_defined_data"]
807
+ def __init__(self, _io, _parent=None, _root=None):
808
+ self._io = _io
809
+ self._parent = _parent
810
+ self._root = _root if _root else self
811
+ self._debug = collections.defaultdict(dict)
812
+
813
+ def _read(self):
814
+ self._debug['file_part_type_re']['start'] = self._io.pos()
815
+ self.file_part_type_re = self._io.read_bytes(2)
816
+ self._debug['file_part_type_re']['end'] = self._io.pos()
817
+ if not self.file_part_type_re == b"\x52\x45":
818
+ raise kaitaistruct.ValidationNotEqualError(b"\x52\x45", self.file_part_type_re, self._io, u"/types/reserved_sub_header/seq/0")
819
+ self._debug['res_type_id']['start'] = self._io.pos()
820
+ self.res_type_id = (self._io.read_bytes(25)).decode(u"UTF-8")
821
+ self._debug['res_type_id']['end'] = self._io.pos()
822
+ self._debug['res_version']['start'] = self._io.pos()
823
+ self.res_version = (self._io.read_bytes(2)).decode(u"UTF-8")
824
+ self._debug['res_version']['end'] = self._io.pos()
825
+ self._debug['reclasnfo']['start'] = self._io.pos()
826
+ self.reclasnfo = Nitf.Clasnfo(self._io, self, self._root)
827
+ self.reclasnfo._read()
828
+ self._debug['reclasnfo']['end'] = self._io.pos()
829
+ self._debug['res_user_defined_subheader_length']['start'] = self._io.pos()
830
+ self.res_user_defined_subheader_length = (self._io.read_bytes(4)).decode(u"UTF-8")
831
+ self._debug['res_user_defined_subheader_length']['end'] = self._io.pos()
832
+ self._debug['res_user_defined_subheader_fields']['start'] = self._io.pos()
833
+ self.res_user_defined_subheader_fields = (self._io.read_bytes(int(self.res_user_defined_subheader_length))).decode(u"UTF-8")
834
+ self._debug['res_user_defined_subheader_fields']['end'] = self._io.pos()
835
+ self._debug['res_user_defined_data']['start'] = self._io.pos()
836
+ self.res_user_defined_data = (self._io.read_bytes_full()).decode(u"UTF-8")
837
+ self._debug['res_user_defined_data']['end'] = self._io.pos()
838
+
839
+
840
+ class DataSubHeaderBase(KaitaiStruct):
841
+ SEQ_FIELDS = ["file_part_type_de", "desid", "data_definition_version", "declasnfo"]
842
+ def __init__(self, _io, _parent=None, _root=None):
843
+ self._io = _io
844
+ self._parent = _parent
845
+ self._root = _root if _root else self
846
+ self._debug = collections.defaultdict(dict)
847
+
848
+ def _read(self):
849
+ self._debug['file_part_type_de']['start'] = self._io.pos()
850
+ self.file_part_type_de = self._io.read_bytes(2)
851
+ self._debug['file_part_type_de']['end'] = self._io.pos()
852
+ if not self.file_part_type_de == b"\x44\x45":
853
+ raise kaitaistruct.ValidationNotEqualError(b"\x44\x45", self.file_part_type_de, self._io, u"/types/data_sub_header_base/seq/0")
854
+ self._debug['desid']['start'] = self._io.pos()
855
+ self.desid = (self._io.read_bytes(25)).decode(u"UTF-8")
856
+ self._debug['desid']['end'] = self._io.pos()
857
+ self._debug['data_definition_version']['start'] = self._io.pos()
858
+ self.data_definition_version = (self._io.read_bytes(2)).decode(u"UTF-8")
859
+ self._debug['data_definition_version']['end'] = self._io.pos()
860
+ self._debug['declasnfo']['start'] = self._io.pos()
861
+ self.declasnfo = Nitf.Clasnfo(self._io, self, self._root)
862
+ self.declasnfo._read()
863
+ self._debug['declasnfo']['end'] = self._io.pos()
864
+
865
+
866
+ class TextSubHeader(KaitaiStruct):
867
+ SEQ_FIELDS = ["text_date_time", "text_title", "text_security_class", "encryp", "text_format", "text_extended_sub_header"]
868
+ def __init__(self, _io, _parent=None, _root=None):
869
+ self._io = _io
870
+ self._parent = _parent
871
+ self._root = _root if _root else self
872
+ self._debug = collections.defaultdict(dict)
873
+
874
+ def _read(self):
875
+ self._debug['text_date_time']['start'] = self._io.pos()
876
+ self.text_date_time = (self._io.read_bytes(14)).decode(u"UTF-8")
877
+ self._debug['text_date_time']['end'] = self._io.pos()
878
+ self._debug['text_title']['start'] = self._io.pos()
879
+ self.text_title = (self._io.read_bytes(80)).decode(u"UTF-8")
880
+ self._debug['text_title']['end'] = self._io.pos()
881
+ self._debug['text_security_class']['start'] = self._io.pos()
882
+ self.text_security_class = Nitf.Clasnfo(self._io, self, self._root)
883
+ self.text_security_class._read()
884
+ self._debug['text_security_class']['end'] = self._io.pos()
885
+ self._debug['encryp']['start'] = self._io.pos()
886
+ self.encryp = Nitf.Encrypt(self._io, self, self._root)
887
+ self.encryp._read()
888
+ self._debug['encryp']['end'] = self._io.pos()
889
+ self._debug['text_format']['start'] = self._io.pos()
890
+ self.text_format = (self._io.read_bytes(3)).decode(u"UTF-8")
891
+ self._debug['text_format']['end'] = self._io.pos()
892
+ self._debug['text_extended_sub_header']['start'] = self._io.pos()
893
+ self.text_extended_sub_header = Nitf.TreHeader(self._io, self, self._root)
894
+ self.text_extended_sub_header._read()
895
+ self._debug['text_extended_sub_header']['end'] = self._io.pos()
896
+
897
+
898
+ class DateTime(KaitaiStruct):
899
+ SEQ_FIELDS = ["_unnamed0"]
900
+ def __init__(self, _io, _parent=None, _root=None):
901
+ self._io = _io
902
+ self._parent = _parent
903
+ self._root = _root if _root else self
904
+ self._debug = collections.defaultdict(dict)
905
+
906
+ def _read(self):
907
+ self._debug['_unnamed0']['start'] = self._io.pos()
908
+ self._unnamed0 = (self._io.read_bytes(14)).decode(u"UTF-8")
909
+ self._debug['_unnamed0']['end'] = self._io.pos()
910
+
911
+
912
+ class Header(KaitaiStruct):
913
+ SEQ_FIELDS = ["file_profile_name", "file_version", "complexity_level", "standard_type", "originating_station_id", "file_date_time", "file_title", "file_security", "file_copy_number", "file_num_of_copys", "encryption", "file_bg_color", "originator_name", "originator_phone", "file_length", "file_header_length", "num_image_segments", "linfo", "num_graphics_segments", "lnnfo", "reserved_numx", "num_text_files", "ltnfo", "num_data_extension", "ldnfo", "num_reserved_extension", "lrnfo", "user_defined_header", "extended_header"]
914
+ def __init__(self, _io, _parent=None, _root=None):
915
+ self._io = _io
916
+ self._parent = _parent
917
+ self._root = _root if _root else self
918
+ self._debug = collections.defaultdict(dict)
919
+
920
+ def _read(self):
921
+ self._debug['file_profile_name']['start'] = self._io.pos()
922
+ self.file_profile_name = self._io.read_bytes(4)
923
+ self._debug['file_profile_name']['end'] = self._io.pos()
924
+ if not self.file_profile_name == b"\x4E\x49\x54\x46":
925
+ raise kaitaistruct.ValidationNotEqualError(b"\x4E\x49\x54\x46", self.file_profile_name, self._io, u"/types/header/seq/0")
926
+ self._debug['file_version']['start'] = self._io.pos()
927
+ self.file_version = self._io.read_bytes(5)
928
+ self._debug['file_version']['end'] = self._io.pos()
929
+ if not self.file_version == b"\x30\x32\x2E\x31\x30":
930
+ raise kaitaistruct.ValidationNotEqualError(b"\x30\x32\x2E\x31\x30", self.file_version, self._io, u"/types/header/seq/1")
931
+ self._debug['complexity_level']['start'] = self._io.pos()
932
+ self.complexity_level = self._io.read_bytes(2)
933
+ self._debug['complexity_level']['end'] = self._io.pos()
934
+ self._debug['standard_type']['start'] = self._io.pos()
935
+ self.standard_type = self._io.read_bytes(4)
936
+ self._debug['standard_type']['end'] = self._io.pos()
937
+ if not self.standard_type == b"\x42\x46\x30\x31":
938
+ raise kaitaistruct.ValidationNotEqualError(b"\x42\x46\x30\x31", self.standard_type, self._io, u"/types/header/seq/3")
939
+ self._debug['originating_station_id']['start'] = self._io.pos()
940
+ self.originating_station_id = (self._io.read_bytes(10)).decode(u"UTF-8")
941
+ self._debug['originating_station_id']['end'] = self._io.pos()
942
+ self._debug['file_date_time']['start'] = self._io.pos()
943
+ self.file_date_time = Nitf.DateTime(self._io, self, self._root)
944
+ self.file_date_time._read()
945
+ self._debug['file_date_time']['end'] = self._io.pos()
946
+ self._debug['file_title']['start'] = self._io.pos()
947
+ self.file_title = (self._io.read_bytes(80)).decode(u"UTF-8")
948
+ self._debug['file_title']['end'] = self._io.pos()
949
+ self._debug['file_security']['start'] = self._io.pos()
950
+ self.file_security = Nitf.Clasnfo(self._io, self, self._root)
951
+ self.file_security._read()
952
+ self._debug['file_security']['end'] = self._io.pos()
953
+ self._debug['file_copy_number']['start'] = self._io.pos()
954
+ self.file_copy_number = (self._io.read_bytes(5)).decode(u"UTF-8")
955
+ self._debug['file_copy_number']['end'] = self._io.pos()
956
+ self._debug['file_num_of_copys']['start'] = self._io.pos()
957
+ self.file_num_of_copys = (self._io.read_bytes(5)).decode(u"UTF-8")
958
+ self._debug['file_num_of_copys']['end'] = self._io.pos()
959
+ self._debug['encryption']['start'] = self._io.pos()
960
+ self.encryption = Nitf.Encrypt(self._io, self, self._root)
961
+ self.encryption._read()
962
+ self._debug['encryption']['end'] = self._io.pos()
963
+ self._debug['file_bg_color']['start'] = self._io.pos()
964
+ self.file_bg_color = self._io.read_bytes(3)
965
+ self._debug['file_bg_color']['end'] = self._io.pos()
966
+ self._debug['originator_name']['start'] = self._io.pos()
967
+ self.originator_name = (self._io.read_bytes(24)).decode(u"UTF-8")
968
+ self._debug['originator_name']['end'] = self._io.pos()
969
+ self._debug['originator_phone']['start'] = self._io.pos()
970
+ self.originator_phone = (self._io.read_bytes(18)).decode(u"UTF-8")
971
+ self._debug['originator_phone']['end'] = self._io.pos()
972
+ self._debug['file_length']['start'] = self._io.pos()
973
+ self.file_length = (self._io.read_bytes(12)).decode(u"UTF-8")
974
+ self._debug['file_length']['end'] = self._io.pos()
975
+ self._debug['file_header_length']['start'] = self._io.pos()
976
+ self.file_header_length = (self._io.read_bytes(6)).decode(u"UTF-8")
977
+ self._debug['file_header_length']['end'] = self._io.pos()
978
+ self._debug['num_image_segments']['start'] = self._io.pos()
979
+ self.num_image_segments = (self._io.read_bytes(3)).decode(u"UTF-8")
980
+ self._debug['num_image_segments']['end'] = self._io.pos()
981
+ self._debug['linfo']['start'] = self._io.pos()
982
+ self.linfo = [None] * (int(self.num_image_segments))
983
+ for i in range(int(self.num_image_segments)):
984
+ if not 'arr' in self._debug['linfo']:
985
+ self._debug['linfo']['arr'] = []
986
+ self._debug['linfo']['arr'].append({'start': self._io.pos()})
987
+ _t_linfo = Nitf.LengthImageInfo(self._io, self, self._root)
988
+ _t_linfo._read()
989
+ self.linfo[i] = _t_linfo
990
+ self._debug['linfo']['arr'][i]['end'] = self._io.pos()
991
+
992
+ self._debug['linfo']['end'] = self._io.pos()
993
+ self._debug['num_graphics_segments']['start'] = self._io.pos()
994
+ self.num_graphics_segments = (self._io.read_bytes(3)).decode(u"UTF-8")
995
+ self._debug['num_graphics_segments']['end'] = self._io.pos()
996
+ self._debug['lnnfo']['start'] = self._io.pos()
997
+ self.lnnfo = [None] * (int(self.num_graphics_segments))
998
+ for i in range(int(self.num_graphics_segments)):
999
+ if not 'arr' in self._debug['lnnfo']:
1000
+ self._debug['lnnfo']['arr'] = []
1001
+ self._debug['lnnfo']['arr'].append({'start': self._io.pos()})
1002
+ _t_lnnfo = Nitf.LengthGraphicInfo(self._io, self, self._root)
1003
+ _t_lnnfo._read()
1004
+ self.lnnfo[i] = _t_lnnfo
1005
+ self._debug['lnnfo']['arr'][i]['end'] = self._io.pos()
1006
+
1007
+ self._debug['lnnfo']['end'] = self._io.pos()
1008
+ self._debug['reserved_numx']['start'] = self._io.pos()
1009
+ self.reserved_numx = (self._io.read_bytes(3)).decode(u"UTF-8")
1010
+ self._debug['reserved_numx']['end'] = self._io.pos()
1011
+ self._debug['num_text_files']['start'] = self._io.pos()
1012
+ self.num_text_files = (self._io.read_bytes(3)).decode(u"UTF-8")
1013
+ self._debug['num_text_files']['end'] = self._io.pos()
1014
+ self._debug['ltnfo']['start'] = self._io.pos()
1015
+ self.ltnfo = [None] * (int(self.num_text_files))
1016
+ for i in range(int(self.num_text_files)):
1017
+ if not 'arr' in self._debug['ltnfo']:
1018
+ self._debug['ltnfo']['arr'] = []
1019
+ self._debug['ltnfo']['arr'].append({'start': self._io.pos()})
1020
+ _t_ltnfo = Nitf.LengthTextInfo(self._io, self, self._root)
1021
+ _t_ltnfo._read()
1022
+ self.ltnfo[i] = _t_ltnfo
1023
+ self._debug['ltnfo']['arr'][i]['end'] = self._io.pos()
1024
+
1025
+ self._debug['ltnfo']['end'] = self._io.pos()
1026
+ self._debug['num_data_extension']['start'] = self._io.pos()
1027
+ self.num_data_extension = (self._io.read_bytes(3)).decode(u"UTF-8")
1028
+ self._debug['num_data_extension']['end'] = self._io.pos()
1029
+ self._debug['ldnfo']['start'] = self._io.pos()
1030
+ self.ldnfo = [None] * (int(self.num_data_extension))
1031
+ for i in range(int(self.num_data_extension)):
1032
+ if not 'arr' in self._debug['ldnfo']:
1033
+ self._debug['ldnfo']['arr'] = []
1034
+ self._debug['ldnfo']['arr'].append({'start': self._io.pos()})
1035
+ _t_ldnfo = Nitf.LengthDataInfo(self._io, self, self._root)
1036
+ _t_ldnfo._read()
1037
+ self.ldnfo[i] = _t_ldnfo
1038
+ self._debug['ldnfo']['arr'][i]['end'] = self._io.pos()
1039
+
1040
+ self._debug['ldnfo']['end'] = self._io.pos()
1041
+ self._debug['num_reserved_extension']['start'] = self._io.pos()
1042
+ self.num_reserved_extension = (self._io.read_bytes(3)).decode(u"UTF-8")
1043
+ self._debug['num_reserved_extension']['end'] = self._io.pos()
1044
+ self._debug['lrnfo']['start'] = self._io.pos()
1045
+ self.lrnfo = [None] * (int(self.num_reserved_extension))
1046
+ for i in range(int(self.num_reserved_extension)):
1047
+ if not 'arr' in self._debug['lrnfo']:
1048
+ self._debug['lrnfo']['arr'] = []
1049
+ self._debug['lrnfo']['arr'].append({'start': self._io.pos()})
1050
+ _t_lrnfo = Nitf.LengthReservedInfo(self._io, self, self._root)
1051
+ _t_lrnfo._read()
1052
+ self.lrnfo[i] = _t_lrnfo
1053
+ self._debug['lrnfo']['arr'][i]['end'] = self._io.pos()
1054
+
1055
+ self._debug['lrnfo']['end'] = self._io.pos()
1056
+ self._debug['user_defined_header']['start'] = self._io.pos()
1057
+ self.user_defined_header = Nitf.TreHeader(self._io, self, self._root)
1058
+ self.user_defined_header._read()
1059
+ self._debug['user_defined_header']['end'] = self._io.pos()
1060
+ self._debug['extended_header']['start'] = self._io.pos()
1061
+ self.extended_header = Nitf.TreHeader(self._io, self, self._root)
1062
+ self.extended_header._read()
1063
+ self._debug['extended_header']['end'] = self._io.pos()
1064
+
1065
+
1066
+ class DataSubHeaderStreaming(KaitaiStruct):
1067
+ """Streaming file Header Data Extension Segment Subheader."""
1068
+ SEQ_FIELDS = ["des_base", "des_defined_subheader_fields_len", "sfh_l1", "sfh_delim1", "sfh_dr", "sfh_delim2", "sfh_l2"]
1069
+ def __init__(self, _io, _parent=None, _root=None):
1070
+ self._io = _io
1071
+ self._parent = _parent
1072
+ self._root = _root if _root else self
1073
+ self._debug = collections.defaultdict(dict)
1074
+
1075
+ def _read(self):
1076
+ self._debug['des_base']['start'] = self._io.pos()
1077
+ self.des_base = Nitf.DataSubHeaderBase(self._io, self, self._root)
1078
+ self.des_base._read()
1079
+ self._debug['des_base']['end'] = self._io.pos()
1080
+ self._debug['des_defined_subheader_fields_len']['start'] = self._io.pos()
1081
+ self.des_defined_subheader_fields_len = (self._io.read_bytes(4)).decode(u"UTF-8")
1082
+ self._debug['des_defined_subheader_fields_len']['end'] = self._io.pos()
1083
+ self._debug['sfh_l1']['start'] = self._io.pos()
1084
+ self.sfh_l1 = (self._io.read_bytes(7)).decode(u"UTF-8")
1085
+ self._debug['sfh_l1']['end'] = self._io.pos()
1086
+ self._debug['sfh_delim1']['start'] = self._io.pos()
1087
+ self.sfh_delim1 = self._io.read_u4be()
1088
+ self._debug['sfh_delim1']['end'] = self._io.pos()
1089
+ self._debug['sfh_dr']['start'] = self._io.pos()
1090
+ self.sfh_dr = [None] * (int(self.sfh_l1))
1091
+ for i in range(int(self.sfh_l1)):
1092
+ if not 'arr' in self._debug['sfh_dr']:
1093
+ self._debug['sfh_dr']['arr'] = []
1094
+ self._debug['sfh_dr']['arr'].append({'start': self._io.pos()})
1095
+ self.sfh_dr[i] = self._io.read_u1()
1096
+ self._debug['sfh_dr']['arr'][i]['end'] = self._io.pos()
1097
+
1098
+ self._debug['sfh_dr']['end'] = self._io.pos()
1099
+ self._debug['sfh_delim2']['start'] = self._io.pos()
1100
+ self.sfh_delim2 = self._io.read_u4be()
1101
+ self._debug['sfh_delim2']['end'] = self._io.pos()
1102
+ self._debug['sfh_l2']['start'] = self._io.pos()
1103
+ self.sfh_l2 = (self._io.read_bytes(7)).decode(u"UTF-8")
1104
+ self._debug['sfh_l2']['end'] = self._io.pos()
1105
+
1106
+
1107
+ class TreHeader(KaitaiStruct):
1108
+ SEQ_FIELDS = ["header_data_length", "header_overflow", "header_data"]
1109
+ def __init__(self, _io, _parent=None, _root=None):
1110
+ self._io = _io
1111
+ self._parent = _parent
1112
+ self._root = _root if _root else self
1113
+ self._debug = collections.defaultdict(dict)
1114
+
1115
+ def _read(self):
1116
+ self._debug['header_data_length']['start'] = self._io.pos()
1117
+ self.header_data_length = (self._io.read_bytes(5)).decode(u"UTF-8")
1118
+ self._debug['header_data_length']['end'] = self._io.pos()
1119
+ if int(self.header_data_length) != 0:
1120
+ self._debug['header_overflow']['start'] = self._io.pos()
1121
+ self.header_overflow = (self._io.read_bytes(3)).decode(u"UTF-8")
1122
+ self._debug['header_overflow']['end'] = self._io.pos()
1123
+
1124
+ if int(self.header_data_length) > 2:
1125
+ self._debug['header_data']['start'] = self._io.pos()
1126
+ self.header_data = [None] * ((int(self.header_data_length) - 3))
1127
+ for i in range((int(self.header_data_length) - 3)):
1128
+ if not 'arr' in self._debug['header_data']:
1129
+ self._debug['header_data']['arr'] = []
1130
+ self._debug['header_data']['arr'].append({'start': self._io.pos()})
1131
+ self.header_data[i] = self._io.read_u1()
1132
+ self._debug['header_data']['arr'][i]['end'] = self._io.pos()
1133
+
1134
+ self._debug['header_data']['end'] = self._io.pos()
1135
+
1136
+
1137
+
1138
+ class LengthImageInfo(KaitaiStruct):
1139
+ SEQ_FIELDS = ["length_image_subheader", "length_image_segment"]
1140
+ def __init__(self, _io, _parent=None, _root=None):
1141
+ self._io = _io
1142
+ self._parent = _parent
1143
+ self._root = _root if _root else self
1144
+ self._debug = collections.defaultdict(dict)
1145
+
1146
+ def _read(self):
1147
+ self._debug['length_image_subheader']['start'] = self._io.pos()
1148
+ self.length_image_subheader = (self._io.read_bytes(6)).decode(u"UTF-8")
1149
+ self._debug['length_image_subheader']['end'] = self._io.pos()
1150
+ self._debug['length_image_segment']['start'] = self._io.pos()
1151
+ self.length_image_segment = (self._io.read_bytes(10)).decode(u"UTF-8")
1152
+ self._debug['length_image_segment']['end'] = self._io.pos()
1153
+
1154
+
1155
+ class LengthDataInfo(KaitaiStruct):
1156
+ SEQ_FIELDS = ["length_data_extension_subheader", "length_data_extension_segment"]
1157
+ def __init__(self, _io, _parent=None, _root=None):
1158
+ self._io = _io
1159
+ self._parent = _parent
1160
+ self._root = _root if _root else self
1161
+ self._debug = collections.defaultdict(dict)
1162
+
1163
+ def _read(self):
1164
+ self._debug['length_data_extension_subheader']['start'] = self._io.pos()
1165
+ self.length_data_extension_subheader = (self._io.read_bytes(4)).decode(u"UTF-8")
1166
+ self._debug['length_data_extension_subheader']['end'] = self._io.pos()
1167
+ self._debug['length_data_extension_segment']['start'] = self._io.pos()
1168
+ self.length_data_extension_segment = (self._io.read_bytes(9)).decode(u"UTF-8")
1169
+ self._debug['length_data_extension_segment']['end'] = self._io.pos()
1170
+
1171
+
1172
+ class LengthTextInfo(KaitaiStruct):
1173
+ SEQ_FIELDS = ["length_text_subheader", "length_text_segment"]
1174
+ def __init__(self, _io, _parent=None, _root=None):
1175
+ self._io = _io
1176
+ self._parent = _parent
1177
+ self._root = _root if _root else self
1178
+ self._debug = collections.defaultdict(dict)
1179
+
1180
+ def _read(self):
1181
+ self._debug['length_text_subheader']['start'] = self._io.pos()
1182
+ self.length_text_subheader = (self._io.read_bytes(4)).decode(u"UTF-8")
1183
+ self._debug['length_text_subheader']['end'] = self._io.pos()
1184
+ self._debug['length_text_segment']['start'] = self._io.pos()
1185
+ self.length_text_segment = (self._io.read_bytes(5)).decode(u"UTF-8")
1186
+ self._debug['length_text_segment']['end'] = self._io.pos()
1187
+
1188
+
1189
+