-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathmain.py
More file actions
431 lines (383 loc) · 20.1 KB
/
Copy pathmain.py
File metadata and controls
431 lines (383 loc) · 20.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
import sys
import typing as t
from pathlib import Path
from types import TracebackType
import wx
from wx.lib.embeddedimage import PyEmbeddedImage
import construct_editor.gallery.example_cmd_resp
import construct_editor.gallery.example_ipstack
import construct_editor.gallery.example_pe32coff
import construct_editor.gallery.test_aligned
import construct_editor.gallery.test_array
import construct_editor.gallery.test_bits_swapped_bitwise
import construct_editor.gallery.test_bitwise
import construct_editor.gallery.test_bytes_greedybytes
import construct_editor.gallery.test_checksum
import construct_editor.gallery.test_compressed
import construct_editor.gallery.test_computed
import construct_editor.gallery.test_const
import construct_editor.gallery.test_dataclass_bit_struct
import construct_editor.gallery.test_dataclass_struct
import construct_editor.gallery.test_enum
import construct_editor.gallery.test_fixedsized
import construct_editor.gallery.test_flag
import construct_editor.gallery.test_flagsenum
import construct_editor.gallery.test_focusedseq
import construct_editor.gallery.test_greedyrange
import construct_editor.gallery.test_ifthenelse
import construct_editor.gallery.test_ifthenelse_nested_switch
import construct_editor.gallery.test_nullstripped
import construct_editor.gallery.test_nullterminated
import construct_editor.gallery.test_padded
import construct_editor.gallery.test_padded_string
import construct_editor.gallery.test_pass
import construct_editor.gallery.test_pointer_peek_seek_tell
import construct_editor.gallery.test_renamed
import construct_editor.gallery.test_select
import construct_editor.gallery.test_select_complex
import construct_editor.gallery.test_stringencodded
import construct_editor.gallery.test_switch
import construct_editor.gallery.test_switch_dataclass
import construct_editor.gallery.test_tenum
import construct_editor.gallery.test_tflagsenum
import construct_editor.gallery.test_timestamp
from construct_editor.wx_widgets import WxConstructHexEditor
from construct_editor.wx_widgets.wx_exception_dialog import (
ExceptionInfo,
WxExceptionDialog,
)
class ConstructGalleryFrame(wx.Frame):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.SetTitle("Construct Gallery")
width, height = wx.GetDisplaySize()
self.SetSize(int(width * 90 / 100), int(height * 90 / 100))
self.SetIcon(icon.GetIcon())
self.Center()
# show uncatched exceptions in a dialog...
sys.excepthook = self.on_uncaught_exception
self.main_panel = ConstructGallery(self)
self.status_bar: wx.StatusBar = self.CreateStatusBar()
def on_uncaught_exception(
self, etype: t.Type[BaseException], value: BaseException, trace: TracebackType
):
"""
Handler for all unhandled exceptions.
:param `etype`: the exception type (`SyntaxError`, `ZeroDivisionError`, etc...);
:type `etype`: `Exception`
:param string `value`: the exception error message;
:param string `trace`: the traceback header, if any (otherwise, it prints the
standard Python header: ``Traceback (most recent call last)``.
"""
dial = WxExceptionDialog(
None, "Uncaught Exception...", ExceptionInfo(etype, value, trace)
)
dial.ShowModal()
dial.Destroy()
class ConstructGallery(wx.Panel):
def __init__(self, parent: ConstructGalleryFrame):
super().__init__(parent)
# Define all galleries ############################################
self.construct_gallery = {
"################ EXAMPLES ################": None,
"Example: pe32coff": construct_editor.gallery.example_pe32coff.gallery_item,
"Example: ipstack": construct_editor.gallery.example_ipstack.gallery_item,
"Example: Cmd/Resp": construct_editor.gallery.example_cmd_resp.gallery_item,
"################ TESTS ####################": None,
# "## bytes and bits ################": None,
"Test: Bytes/GreedyBytes": construct_editor.gallery.test_bytes_greedybytes.gallery_item,
# "## integers and floats ###########": None,
# "Test: FormatField (TODO)": None,
# "Test: BytesInteger (TODO)": None,
# "Test: BitsInteger (TODO)": None,
"Test: Bitwiese": construct_editor.gallery.test_bitwise.gallery_item,
"Test: BitsSwapped/Bitwiese": construct_editor.gallery.test_bits_swapped_bitwise.gallery_item,
"## strings #######################": None,
"Test: StringEncoded": construct_editor.gallery.test_stringencodded.gallery_item,
"Test: PaddedString": construct_editor.gallery.test_padded_string.gallery_item,
"## mappings ######################": None,
"Test: Flag": construct_editor.gallery.test_flag.gallery_item,
"Test: Enum": construct_editor.gallery.test_enum.gallery_item,
"Test: FlagsEnum": construct_editor.gallery.test_flagsenum.gallery_item,
"Test: TEnum": construct_editor.gallery.test_tenum.gallery_item,
"Test: TFlagsEnum": construct_editor.gallery.test_tflagsenum.gallery_item,
# "Test: Mapping (TODO)": None,
"## structures and sequences ######": None,
# "Test: Struct (TODO)": None,
# "Test: Sequence (TODO)": None,
"Test: DataclassStruct": construct_editor.gallery.test_dataclass_struct.gallery_item,
"Test: DataclassBitStruct": construct_editor.gallery.test_dataclass_bit_struct.gallery_item,
"## arrays ranges and repeaters ######": None,
"Test: Array": construct_editor.gallery.test_array.gallery_item,
"Test: GreedyRange": construct_editor.gallery.test_greedyrange.gallery_item,
# "Test: RepeatUntil (TODO)": None,
"## specials ##########################": None,
"Test: Renamed": construct_editor.gallery.test_renamed.gallery_item,
"## miscellaneous ##########################": None,
"Test: Const": construct_editor.gallery.test_const.gallery_item,
"Test: Computed": construct_editor.gallery.test_computed.gallery_item,
# "Test: Index (TODO)": None,
# "Test: Rebuild (TODO)": None,
# "Test: Default (TODO)": None,
# "Test: Check (TODO)": None,
# "Test: Error (TODO)": None,
"Test: FocusedSeq": construct_editor.gallery.test_focusedseq.gallery_item,
# "Test: Pickled (TODO)": None,
# "Test: Numpy (TODO)": None,
# "Test: NamedTuple (TODO)": None,
"Test: TimestampAdapter": construct_editor.gallery.test_timestamp.gallery_item,
# "Test: Hex (TODO)": None,
# "Test: HexDump (TODO)": None,
"## conditional ##########################": None,
# "Test: Union (TODO)": None,
"Test: Select": construct_editor.gallery.test_select.gallery_item,
"Test: Select (Complex)": construct_editor.gallery.test_select_complex.gallery_item,
"Test: IfThenElse": construct_editor.gallery.test_ifthenelse.gallery_item,
"Test: IfThenElse (Nested Switch)": construct_editor.gallery.test_ifthenelse_nested_switch.gallery_item,
"Test: Switch": construct_editor.gallery.test_switch.gallery_item,
"Test: Switch (Dataclass)": construct_editor.gallery.test_switch_dataclass.gallery_item,
# "Test: StopIf (TODO)": None,
"## alignment and padding ##########################": None,
"Test: Padded": construct_editor.gallery.test_padded.gallery_item,
"Test: Aligned": construct_editor.gallery.test_aligned.gallery_item,
"## stream manipulation ##########################": None,
"Test: Pointer/Peek/Seek/Tell": construct_editor.gallery.test_pointer_peek_seek_tell.gallery_item,
"Test: Pass": construct_editor.gallery.test_pass.gallery_item,
# "Test: Terminated (TODO)": None,
"## tunneling and byte/bit swapping ##########################": None,
# "Test: RawCopy (TODO)": None,
# "Test: Prefixed (TODO)": None,
"Test: FixedSized": construct_editor.gallery.test_fixedsized.gallery_item,
"Test: NullTerminated": construct_editor.gallery.test_nullterminated.gallery_item,
"Test: NullStripped": construct_editor.gallery.test_nullstripped.gallery_item,
# "Test: RestreamData (TODO)": None,
# "Test: Transformed (TODO)": None,
# "Test: Restreamed (TODO)": None,
# "Test: ProcessXor (TODO)": None,
# "Test: ProcessRotateLeft (TODO)": None,
"Test: Checksum": construct_editor.gallery.test_checksum.gallery_item,
"Test: Compressed": construct_editor.gallery.test_compressed.gallery_item,
# "Test: CompressedLZ4 (TODO)": None,
# "Test: Rebuffered (TODO)": None,
# "## lazy equivalents ##########################": None,
# "Test: Lazy (TODO)": None,
# "Test: LazyStruct (TODO)": None,
# "Test: LazyArray (TODO)": None,
# "Test: LazyBound (TODO)": None,
# "## adapters and validators ##########################": None,
# "Test: ExprAdapter (TODO)": None,
# "Test: ExprSymmetricAdapter (TODO)": None,
# "Test: ExprValidator (TODO)": None,
# "Test: Slicing (TODO)": None,
# "Test: Indexing (TODO)": None,
}
self.gallery_selection = 1
default_gallery = list(self.construct_gallery.keys())[self.gallery_selection]
default_gallery_item = self.construct_gallery[default_gallery]
# Define GUI elements #############################################
self.sizer = wx.BoxSizer(wx.HORIZONTAL)
vsizer = wx.BoxSizer(wx.VERTICAL)
# gallery selctor
self.gallery_selector_lbx = wx.ListBox(
self,
wx.ID_ANY,
wx.DefaultPosition,
wx.DefaultSize,
list(self.construct_gallery.keys()),
0,
name="gallery_selector",
)
self.gallery_selector_lbx.SetStringSelection(default_gallery)
vsizer.Add(self.gallery_selector_lbx, 1, wx.ALL, 1)
# reload btn
self.reload_btn = wx.Button(
self, wx.ID_ANY, "Reload", wx.DefaultPosition, wx.DefaultSize, 0
)
vsizer.Add(self.reload_btn, 0, wx.ALL | wx.EXPAND, 1)
# line
vsizer.Add(wx.StaticLine(self), 0, wx.TOP | wx.BOTTOM | wx.EXPAND, 5)
# clear binary
self.clear_binary_btn = wx.Button(
self, wx.ID_ANY, "Clear Binary", wx.DefaultPosition, wx.DefaultSize, 0
)
vsizer.Add(self.clear_binary_btn, 0, wx.ALL | wx.EXPAND, 1)
# example selctor
self.example_selector_lbx = wx.ListBox(
self,
wx.ID_ANY,
wx.DefaultPosition,
wx.Size(-1, 100),
list(default_gallery_item.example_binarys.keys()),
0,
name="gallery_selector",
)
if len(default_gallery_item.example_binarys) > 0:
self.example_selector_lbx.SetStringSelection(
list(default_gallery_item.example_binarys.keys())[0]
)
vsizer.Add(self.example_selector_lbx, 0, wx.ALL | wx.EXPAND, 1)
# load binary from file
self.load_binary_file_btn = wx.Button(
self,
wx.ID_ANY,
"Load Binary from File",
wx.DefaultPosition,
wx.DefaultSize,
0,
)
vsizer.Add(self.load_binary_file_btn, 0, wx.ALL | wx.EXPAND, 1)
self.sizer.Add(vsizer, 0, wx.ALL | wx.EXPAND, 0)
self.sizer.Add(
wx.StaticLine(self, style=wx.LI_VERTICAL),
0,
wx.LEFT | wx.RIGHT | wx.EXPAND,
5,
)
# construct hex editor
self.construct_hex_editor = WxConstructHexEditor(
self,
construct=default_gallery_item.construct,
contextkw=default_gallery_item.contextkw,
)
# self.construct_hex_editor.construct_editor.expand_all()
self.sizer.Add(self.construct_hex_editor, 1, wx.ALL | wx.EXPAND, 0)
self.SetSizer(self.sizer)
# Connect Events ##################################################
self.gallery_selector_lbx.Bind(
wx.EVT_LISTBOX, self.on_gallery_selection_changed
)
self.reload_btn.Bind(wx.EVT_BUTTON, self.on_gallery_selection_changed)
self.clear_binary_btn.Bind(wx.EVT_BUTTON, self.on_clear_binary_clicked)
self.example_selector_lbx.Bind(
wx.EVT_LISTBOX, self.on_example_selection_changed
)
self.load_binary_file_btn.Bind(wx.EVT_BUTTON, self.on_load_binary_file_clicked)
# Emulate Selection Click
self.on_gallery_selection_changed(None)
def on_gallery_selection_changed(self, event):
selection = self.gallery_selector_lbx.GetStringSelection()
gallery_item = self.construct_gallery[selection]
if gallery_item is None:
self.gallery_selector_lbx.SetSelection(
self.gallery_selection
) # restore old selection
return
# save currently shown selection
self.gallery_selection = self.gallery_selector_lbx.GetSelection()
self.example_selector_lbx.Clear()
if len(gallery_item.example_binarys) > 0:
self.example_selector_lbx.InsertItems(
list(gallery_item.example_binarys.keys()), 0
)
self.example_selector_lbx.SetStringSelection(
list(gallery_item.example_binarys.keys())[0]
)
example = self.example_selector_lbx.GetStringSelection()
example_binary = self.construct_gallery[selection].example_binarys[example]
else:
example_binary = bytes(0)
self.Freeze()
self.construct_hex_editor.change_construct(gallery_item.construct)
self.construct_hex_editor.change_contextkw(gallery_item.contextkw)
self.construct_hex_editor.binary = example_binary
self.construct_hex_editor.construct_editor.expand_all()
self.Thaw()
def on_clear_binary_clicked(self, event):
self.example_selector_lbx.SetSelection(wx.NOT_FOUND)
self.construct_hex_editor.binary = bytes()
self.construct_hex_editor.construct_editor.expand_all()
def on_example_selection_changed(self, event):
selection = self.gallery_selector_lbx.GetStringSelection()
example = self.example_selector_lbx.GetStringSelection()
example_binary = self.construct_gallery[selection].example_binarys[example]
# Set example binary
self.construct_hex_editor.binary = example_binary
self.construct_hex_editor.construct_editor.expand_all()
def on_load_binary_file_clicked(self, event):
with wx.FileDialog(
self,
"Open binary file",
wildcard="binary files (*.*)|*.*",
style=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST,
) as fileDialog:
if fileDialog.ShowModal() == wx.ID_CANCEL:
return # the user changed their mind
# Proceed loading the file chosen by the user
pathname = Path(fileDialog.GetPath())
with open(pathname, "rb") as file:
self.construct_hex_editor.binary = file.read()
self.construct_hex_editor.refresh()
icon = PyEmbeddedImage(
b"iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAACBj"
b"SFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QA/wD/AP+g"
b"vaeTAAAAB3RJTUUH5QMVEwoXzWaNiAAACetJREFUWMPFl3tQVNcdxz/37oNlF3mJoAS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R6PbIss3jxYiRJwmg0Yutz4Xa7"
b"uXDpsvvjHdsP9XS1n42IMF0eHAzYHyxeowAY9LpLDc236+Nio+fPnfVTZFlG0zQURUHTNEKh"
b"UPhyMRInsiyHLx8And29IiY2ju1/2P3d3z8/dngw4K82W6Jq/T7vAOO0Mf+GG36zNf5O6533"
b"IyIiH42KslgQQh61Thq9/f5XVVWV7u5Oe0N9baXd1vWtLOuaLFEWq8ftHuJH2rh/x0uW5uqa"
b"Gm4kDzgdkwAj/1sTsiy7jcaIrsHBgPu/Lf4340NlvbmvI1QAAAAldEVYdGRhdGU6Y3JlYXRl"
b"ADIwMjEtMDMtMjFUMTk6MTA6MjIrMDA6MDDMGKfHAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDIx"
b"LTAzLTIxVDE5OjEwOjIyKzAwOjAwvUUfewAAAABJRU5ErkJggg=="
)
def main():
if sys.platform == "win32":
# Windows Icon fix: https://stackoverflow.com/a/1552105
import ctypes
myappid = "timrid.construct_hex_editor"
ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(myappid)
inspect = False
if inspect is True:
import wx.lib.mixins.inspection as wit
app = wit.InspectableApp()
else:
wit = None
app = wx.App(False)
frame = ConstructGalleryFrame(None)
frame.Show(True)
if wit is not None:
wit.InspectionTool().Show()
app.MainLoop()
if __name__ == "__main__":
main()