-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathfrmMain.frm
331 lines (306 loc) · 10.9 KB
/
frmMain.frm
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
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form frmMain
Caption = "filerecon"
ClientHeight = 3990
ClientLeft = 60
ClientTop = 630
ClientWidth = 4455
Icon = "frmMain.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 3990
ScaleWidth = 4455
StartUpPosition = 3 'Windows Default
Begin VB.Frame Frame1
Height = 2775
Left = 120
TabIndex = 2
Top = 1080
Width = 3375
Begin VB.TextBox txtDescription
Height = 615
Left = 1080
Locked = -1 'True
MaxLength = 256
MultiLine = -1 'True
TabIndex = 14
Top = 2040
Width = 2175
End
Begin VB.TextBox txtAccuracy
Height = 285
Left = 1080
Locked = -1 'True
MaxLength = 64
TabIndex = 13
Top = 1680
Width = 2175
End
Begin VB.TextBox txtLength
Height = 285
Left = 1080
Locked = -1 'True
MaxLength = 32
TabIndex = 12
Top = 1320
Width = 2175
End
Begin VB.TextBox txtPattern
Height = 285
Left = 1080
Locked = -1 'True
MaxLength = 128
TabIndex = 11
Top = 960
Width = 2175
End
Begin VB.TextBox txtType
Height = 285
Left = 1080
Locked = -1 'True
MaxLength = 64
TabIndex = 10
Top = 600
Width = 2175
End
Begin VB.TextBox txtPosition
Height = 285
Left = 1080
Locked = -1 'True
MaxLength = 64
TabIndex = 9
Top = 240
Width = 2175
End
Begin VB.Label Label6
Caption = "Description"
Height = 255
Left = 120
TabIndex = 8
Top = 2040
Width = 975
End
Begin VB.Label Label5
Caption = "Accuracy"
Height = 255
Left = 120
TabIndex = 7
Top = 1680
Width = 975
End
Begin VB.Label Label4
Caption = "Length"
Height = 255
Left = 120
TabIndex = 6
Top = 1320
Width = 975
End
Begin VB.Label Label3
Caption = "Pattern"
Height = 255
Left = 120
TabIndex = 5
Top = 960
Width = 975
End
Begin VB.Label Label2
Caption = "Type"
Height = 255
Left = 120
TabIndex = 4
Top = 600
Width = 975
End
Begin VB.Label Label1
Caption = "Position"
Height = 255
Left = 120
TabIndex = 3
Top = 240
Width = 975
End
End
Begin MSComDlg.CommonDialog cdgFileOpen
Left = 3840
Top = 960
_ExtentX = 847
_ExtentY = 847
_Version = 393216
CancelError = -1 'True
DialogTitle = "Open File For Analysis"
Filter = "All Files|*.*"
End
Begin VB.ListBox lstResults
Height = 840
ItemData = "frmMain.frx":08CA
Left = 120
List = "frmMain.frx":08CC
Sorted = -1 'True
TabIndex = 1
Top = 120
Width = 3375
End
Begin VB.CommandButton cmdOpen
Height = 735
Left = 3600
Picture = "frmMain.frx":08CE
Style = 1 'Graphical
TabIndex = 0
ToolTipText = "Open and analyze a file..."
Top = 120
Width = 735
End
Begin VB.Menu mnuFile
Caption = "&File"
Begin VB.Menu mnuFileExitItem
Caption = "Exit"
Shortcut = ^Q
End
End
Begin VB.Menu mnuHelp
Caption = "&Help"
Begin VB.Menu mnuHelpAboutItem
Caption = "&About"
Shortcut = {F1}
End
Begin VB.Menu mnuHelpSep1
Caption = "-"
End
Begin VB.Menu mnuHelpUpdatesItem
Caption = "&Check for Updates..."
End
Begin VB.Menu mnuHelpWebsiteItem
Caption = "&filerecon Home Page..."
End
End
End
Attribute VB_Name = "frmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub cmdOpen_Click()
Call OpenDialog
End Sub
Public Sub OpenDialog()
Dim sFileName As String
cdgFileOpen.InitDir = App.Path
On Error GoTo Cancel
cdgFileOpen.ShowOpen
sFileName = cdgFileOpen.FileName
If LenB(sFileName) Then
If (Dir$(sFileName) <> "") Then
Call IdentifyFile(ReadFile(sFileName))
Me.Caption = APP_NAME & " - " & sFileName
Exit Sub
End If
End If
Cancel:
End Sub
Private Sub Form_Load()
Me.Caption = APP_NAME
End Sub
Private Sub Form_Resize()
If Me.WindowState <> vbMinimized Then
Me.Height = 4680
Me.Width = 4575
End If
End Sub
Private Sub ShowHitDetails(ByRef sSearch As String)
Dim sMagicDatabase() As String
Dim iMagicDatabaseCount As Integer
Dim sMagicDatabaseEntry() As String
Dim i As Integer
Dim iMagicDatabaseEntryStringLength As Integer
Dim sMagicDatabaseEntryPosition As String
Dim sMagicDatabaseEntryPositionType As String
Dim sMagicDatabaseEntryType As String
Dim iMagicDatabaseEntryType As Integer
Dim sMagicDatabaseEntryTypeDetail As String
Dim sMagicDatabaseEntryString As String
Dim sMagicDatabaseEntryDescription As String
Dim sMagicDatabaseEntryAccuracy As String
sMagicDatabase = Split(ReadFile(App.Path & "\magicdatabase.txt"), vbCrLf, , vbBinaryCompare)
iMagicDatabaseCount = UBound(sMagicDatabase)
'On Error Resume Next
For i = 0 To iMagicDatabaseCount
If LenB(sMagicDatabase(i)) Then
If Mid$(sMagicDatabase(i), 1, 1) <> "#" Then
sMagicDatabaseEntry = Split(sMagicDatabase(i), vbTab, , vbBinaryCompare)
If (UBound(sMagicDatabaseEntry) = 3) Then
If (sMagicDatabaseEntry(3) = sSearch) Then
sMagicDatabaseEntryPosition = sMagicDatabaseEntry(0)
sMagicDatabaseEntryType = sMagicDatabaseEntry(1)
sMagicDatabaseEntryString = sMagicDatabaseEntry(2)
sMagicDatabaseEntryDescription = sMagicDatabaseEntry(3)
iMagicDatabaseEntryStringLength = Len(sMagicDatabaseEntryString)
If Mid$(sMagicDatabaseEntryPosition, 1, 1) = ">" Then
iMagicDatabaseEntryType = 3
sMagicDatabaseEntryPositionType = "undefined range"
ElseIf InStrB(2, sMagicDatabaseEntryPosition, "-", vbBinaryCompare) Then
iMagicDatabaseEntryType = 2
sMagicDatabaseEntryPositionType = "defined range"
Else
iMagicDatabaseEntryType = 1
sMagicDatabaseEntryPositionType = "exact position"
sMagicDatabaseEntryPosition = sMagicDatabaseEntryPosition & "-" & sMagicDatabaseEntryPosition + iMagicDatabaseEntryStringLength
End If
If (sMagicDatabaseEntryType = "s") Then
sMagicDatabaseEntryTypeDetail = "string"
Else
sMagicDatabaseEntryTypeDetail = "unknown"
End If
If (iMagicDatabaseEntryStringLength > 3) Then
If (iMagicDatabaseEntryType = 1) Then
sMagicDatabaseEntryAccuracy = "high"
Else
sMagicDatabaseEntryAccuracy = "medium"
End If
ElseIf (iMagicDatabaseEntryStringLength > 1) Then
If (iMagicDatabaseEntryType = 1) Then
sMagicDatabaseEntryAccuracy = "medium"
Else
sMagicDatabaseEntryAccuracy = "low"
End If
Else
sMagicDatabaseEntryAccuracy = "low"
End If
txtPosition.Text = sMagicDatabaseEntryPosition & " (" & sMagicDatabaseEntryPositionType & ")"
txtType.Text = sMagicDatabaseEntryTypeDetail & " (" & sMagicDatabaseEntryType & ")"
txtPattern.Text = sMagicDatabaseEntryString
txtLength.Text = iMagicDatabaseEntryStringLength & " bytes"
txtAccuracy.Text = sMagicDatabaseEntryAccuracy & " (" & iMagicDatabaseEntryType & ")"
txtDescription.Text = sMagicDatabaseEntryDescription
Exit Sub
End If
End If
End If
End If
Next i
End Sub
Private Sub lstResults_Click()
Call ShowHitDetails(lstResults.Text)
End Sub
Private Sub mnuFileExitItem_Click()
Unload Me
End Sub
Private Sub mnuHelpAboutItem_Click()
frmAbout.Show vbModal, frmMain
End Sub
Private Sub mnuHelpUpdatesItem_Click()
Call OpenUpdateWebsite
End Sub
Private Sub mnuHelpWebsiteItem_Click()
Call OpenProjectWebsite
End Sub
Public Sub ResetResultDetails()
txtPosition.Text = vbNullString
txtType.Text = vbNullString
txtPattern.Text = vbNullString
txtLength.Text = vbNullString
txtAccuracy.Text = vbNullString
txtDescription.Text = vbNullString
End Sub