-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathfrmReport.frm
368 lines (342 loc) · 11.4 KB
/
frmReport.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
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
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form frmReport
BorderStyle = 1 'Fixed Single
Caption = "Report Generation"
ClientHeight = 3510
ClientLeft = 45
ClientTop = 330
ClientWidth = 4470
Icon = "frmReport.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3510
ScaleWidth = 4470
StartUpPosition = 1 'CenterOwner
Begin MSComDlg.CommonDialog cdgReportSaveAs
Left = 120
Top = 2880
_ExtentX = 847
_ExtentY = 847
_Version = 393216
CancelError = -1 'True
DefaultExt = "HTML Report (*.html)|*.html"
DialogTitle = "Save Report As"
FileName = "127.0.0.1-80.html"
Filter = "HTML Report (*.html)|*.html|XML Report (*.xml)|*.xml|TXT Report (*.txt)|*.txt|CSV Report (*.csv)|*.csv"
End
Begin VB.Frame fraFrame
Caption = "Hitlist Size"
Height = 735
Index = 1
Left = 2280
TabIndex = 15
Top = 120
Width = 2055
Begin VB.TextBox txtHitlistSize
Height = 285
Left = 120
MaxLength = 3
TabIndex = 6
Text = "20"
Top = 360
Width = 615
End
Begin VB.Label Label1
Caption = "Items"
Height = 255
Left = 840
TabIndex = 16
Top = 360
Width = 975
End
End
Begin VB.Frame fraFrame
Caption = "Format"
Height = 1695
Index = 2
Left = 2280
TabIndex = 14
Top = 960
Width = 2055
Begin VB.OptionButton optCsv
Caption = "CS&V"
Height = 255
Left = 120
TabIndex = 10
Top = 1320
Width = 1695
End
Begin VB.OptionButton optXML
Caption = "&XML"
Height = 255
Left = 120
TabIndex = 8
Top = 600
Width = 1695
End
Begin VB.OptionButton optTXT
Caption = "T&XT"
Height = 255
Left = 120
TabIndex = 9
Top = 960
Width = 1695
End
Begin VB.OptionButton optHTML
Caption = "&HTML"
Height = 255
Left = 120
TabIndex = 7
Top = 240
Value = -1 'True
Width = 1695
End
End
Begin VB.Frame fraFrame
Caption = "Details"
Height = 2535
Index = 0
Left = 120
TabIndex = 13
Top = 120
Width = 2055
Begin VB.CheckBox chkResponses
Caption = "&Responses"
Height = 255
Left = 120
TabIndex = 4
ToolTipText = "All gathered responses"
Top = 1800
Value = 1 'Checked
Width = 1695
End
Begin VB.CheckBox chkPreamble
Caption = "&Preamble"
Height = 255
Left = 120
TabIndex = 0
ToolTipText = "Additional information about the scan"
Top = 360
Value = 1 'Checked
Width = 1695
End
Begin VB.CheckBox chkContents
Caption = "Con&tents"
Height = 255
Left = 120
TabIndex = 1
ToolTipText = "Table of Contents"
Top = 720
Value = 1 'Checked
Width = 1695
End
Begin VB.CheckBox chkDetails
Caption = "&Details"
Height = 255
Left = 120
TabIndex = 5
ToolTipText = "Fingerprint details"
Top = 2160
Value = 1 'Checked
Width = 1695
End
Begin VB.CheckBox chkMatches
Caption = "&Matches"
Height = 255
Left = 120
TabIndex = 3
ToolTipText = "A list of the best matches"
Top = 1440
Value = 1 'Checked
Width = 1695
End
Begin VB.CheckBox chkSummary
Caption = "Summar&y"
Height = 255
Left = 120
TabIndex = 2
ToolTipText = "Text summarizing the results"
Top = 1080
Value = 1 'Checked
Width = 1695
End
End
Begin VB.CommandButton cmdCancel
Cancel = -1 'True
Caption = "&Cancel"
Height = 615
Left = 2280
Picture = "frmReport.frx":038A
Style = 1 'Graphical
TabIndex = 12
ToolTipText = "Cancel Report Generation"
Top = 2760
Width = 1212
End
Begin VB.CommandButton cmdSave
Caption = "&Save"
Default = -1 'True
Height = 615
Left = 960
Picture = "frmReport.frx":0772
Style = 1 'Graphical
TabIndex = 11
ToolTipText = "Save Report"
Top = 2760
Width = 1212
End
End
Attribute VB_Name = "frmReport"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub cmdSave_Click()
Dim sFileName As String
Dim sOverride As String
Call DisableElements
If (Dir$(App.Path & "\reports", 16) <> "") Then
cdgReportSaveAs.InitDir = App.Path & "\reports"
Else
cdgReportSaveAs.InitDir = App.Path
End If
If (optHTML.Value = True) Then
cdgReportSaveAs.FileName = StringToFileName(scan_targethost & ":" & scan_targetport) & ".html"
cdgReportSaveAs.FilterIndex = 1
ElseIf (optXML.Value = True) Then
cdgReportSaveAs.FileName = StringToFileName(scan_targethost & ":" & scan_targetport) & ".xml"
cdgReportSaveAs.FilterIndex = 2
ElseIf (optTXT.Value = True) Then
cdgReportSaveAs.FileName = StringToFileName(scan_targethost & ":" & scan_targetport) & ".txt"
cdgReportSaveAs.FilterIndex = 3
Else
cdgReportSaveAs.FileName = StringToFileName(scan_targethost & ":" & scan_targetport) & ".csv"
cdgReportSaveAs.FilterIndex = 4
End If
On Error GoTo Cancel
cdgReportSaveAs.ShowSave
sFileName = cdgReportSaveAs.FileName
If (LenB(sFileName)) Then
If (Dir$(sFileName, 16) <> "") Then
sOverride = MsgBox(sFileName & " already exists." & vbCrLf & "Do you want to replace it?", _
vbExclamation + vbYesNo, "Report Save As")
Else
sOverride = 6
End If
If (sOverride = 6) Then
Open sFileName For Output As #1
If (Me.optHTML.Value = True) Then
Print #1, GenerateHtmlReport(chkPreamble.Value, chkContents.Value, chkSummary.Value, _
chkMatches.Value, chkResponses.Value, chkDetails.Value, txtHitlistSize.Text)
ElseIf (optTXT.Value = True) Then
Print #1, GenerateTxtReport(chkPreamble.Value, chkContents.Value, chkSummary.Value, _
chkMatches.Value, chkResponses.Value, chkDetails.Value, txtHitlistSize.Text)
ElseIf (optXML.Value = True) Then
Print #1, GenerateXmlReport(chkMatches.Value, chkResponses.Value, txtHitlistSize.Text)
Else
Print #1, GenerateCsvReport(txtHitlistSize.Text)
End If
Close
End If
Call ShellExecute(frmMain.hwnd, "Open", sFileName, "", App.Path, 1)
Unload Me
End If
Cancel:
Call EnableElements
End Sub
Private Sub optCsv_GotFocus()
Call ActivateDetails
End Sub
Private Sub optCsv_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
Call ActivateDetails
End Sub
Private Sub optHTML_GotFocus()
Call ActivateDetails
End Sub
Private Sub optHTML_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
Call ActivateDetails
End Sub
Private Sub optTXT_GotFocus()
Call ActivateDetails
End Sub
Private Sub optTXT_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
Call ActivateDetails
End Sub
Private Sub optXML_GotFocus()
Call ActivateDetails
End Sub
Private Sub optXML_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
Call ActivateDetails
End Sub
Private Sub txtHitlistSize_KeyPress(KeyAscii As Integer)
Select Case KeyAscii
Case vbKey0 To vbKey9, vbKeyBack
Case Else
KeyAscii = 0
End Select
End Sub
Private Sub txtHitlistSize_LostFocus()
txtHitlistSize.Text = AllowIntegersOnly(CInt(Val(txtHitlistSize.Text)), 1, 999, 20)
End Sub
Private Sub ActivateDetails()
If optCsv.Value = True Then
chkPreamble.Enabled = False
chkContents.Enabled = False
chkSummary.Enabled = False
chkMatches.Enabled = False
chkResponses.Enabled = False
chkDetails.Enabled = False
ElseIf optXML.Value = True Then
chkPreamble.Enabled = False
chkContents.Enabled = False
chkSummary.Enabled = False
chkMatches.Enabled = True
chkResponses.Enabled = True
chkDetails.Enabled = False
Else
chkPreamble.Enabled = True
chkContents.Enabled = True
chkSummary.Enabled = True
chkMatches.Enabled = True
chkResponses.Enabled = True
chkDetails.Enabled = True
End If
End Sub
Private Sub DisableElements()
chkPreamble.Enabled = False
chkContents.Enabled = False
chkSummary.Enabled = False
chkMatches.Enabled = False
chkResponses.Enabled = False
chkContents.Enabled = False
txtHitlistSize.Enabled = False
optHTML.Enabled = False
optXML.Enabled = False
optTXT.Enabled = False
optCsv.Enabled = False
cmdSave.Enabled = False
cmdCancel.Enabled = False
Screen.MousePointer = vbHourglass
End Sub
Private Sub EnableElements()
chkPreamble.Enabled = True
chkContents.Enabled = True
chkSummary.Enabled = True
chkMatches.Enabled = True
chkResponses.Enabled = True
chkContents.Enabled = True
txtHitlistSize.Enabled = True
optHTML.Enabled = True
optXML.Enabled = True
optTXT.Enabled = True
optCsv.Enabled = True
cmdSave.Enabled = True
cmdCancel.Enabled = True
Screen.MousePointer = vbNormal
End Sub