-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathfrmMain.frm
2059 lines (1776 loc) · 81.6 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
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
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "MSWINSCK.OCX"
Begin VB.Form frmMain
Caption = "Attack Tool Kit"
ClientHeight = 6900
ClientLeft = 165
ClientTop = 735
ClientWidth = 8835
Icon = "frmMain.frx":0000
LinkTopic = "Form1"
ScaleHeight = 6900
ScaleWidth = 8835
StartUpPosition = 3 'Windows Default
Begin MSComctlLib.ImageList imlToolbarIcons
Left = 8160
Top = 1560
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 32
ImageHeight = 32
MaskColor = 16777215
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 10
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmMain.frx":0CCA
Key = ""
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmMain.frx":13EC
Key = ""
EndProperty
BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmMain.frx":1AC8
Key = ""
EndProperty
BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmMain.frx":21FC
Key = ""
EndProperty
BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmMain.frx":290D
Key = ""
EndProperty
BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmMain.frx":3047
Key = ""
EndProperty
BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmMain.frx":3763
Key = ""
EndProperty
BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmMain.frx":3EB4
Key = ""
EndProperty
BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmMain.frx":45F1
Key = ""
EndProperty
BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmMain.frx":4D04
Key = ""
EndProperty
EndProperty
End
Begin MSComctlLib.Toolbar tlbMenu
Align = 1 'Align Top
Height = 870
Left = 0
TabIndex = 7
Top = 0
Width = 8835
_ExtentX = 15584
_ExtentY = 1535
ButtonWidth = 1429
ButtonHeight = 1376
Wrappable = 0 'False
Appearance = 1
ImageList = "imlToolbarIcons"
_Version = 393216
BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628}
NumButtons = 13
BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "Start"
Object.ToolTipText = "Start the attack"
ImageIndex = 1
EndProperty
BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628}
Enabled = 0 'False
Caption = "Stop"
Object.ToolTipText = "Stop the running attack"
ImageIndex = 2
EndProperty
BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "Config"
Object.ToolTipText = "Open the configuration"
ImageIndex = 3
EndProperty
BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "Edit"
Object.ToolTipText = "Edit the selected plugin"
ImageIndex = 4
EndProperty
BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "Reload"
Object.ToolTipText = "Reload the selected plugin"
ImageIndex = 5
EndProperty
BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "Delete"
Object.ToolTipText = "Delete the selected plugin"
ImageIndex = 6
EndProperty
BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
BeginProperty Button10 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "Visualize"
Object.ToolTipText = "Visualize the running attack"
ImageIndex = 7
EndProperty
BeginProperty Button11 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "Response"
Object.ToolTipText = "Analyze the attack response"
ImageIndex = 8
EndProperty
BeginProperty Button12 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "Logs"
Object.ToolTipText = "Analyze the log files"
ImageIndex = 9
EndProperty
BeginProperty Button13 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "Report"
Object.ToolTipText = "See and export the report"
ImageIndex = 10
EndProperty
EndProperty
BorderStyle = 1
End
Begin MSWinsockLib.Winsock wskTCPWinsock
Index = 0
Left = 8280
Top = 1080
_ExtentX = 741
_ExtentY = 741
_Version = 393216
End
Begin VB.Timer timTimeout
Enabled = 0 'False
Interval = 10000
Left = 7800
Top = 1080
End
Begin VB.Frame fraPluginOverview
Caption = "Plugin Overview"
Height = 4935
Left = 3840
TabIndex = 6
Top = 1560
Width = 4935
Begin VB.TextBox txtPluginContent
Appearance = 0 'Flat
BackColor = &H00E0E0E0&
Height = 4575
Left = 120
Locked = -1 'True
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 2
Top = 240
Width = 4695
End
End
Begin MSComctlLib.ProgressBar pbrProgress
Height = 120
Left = 7305
TabIndex = 5
Top = 6720
Width = 1170
_ExtentX = 2064
_ExtentY = 212
_Version = 393216
Appearance = 0
Scrolling = 1
End
Begin VB.Frame fraPlugins
Caption = "Plugins"
Height = 4935
Left = 120
TabIndex = 0
Top = 1560
Width = 3615
Begin VB.FileListBox filNASLPlugins
Height = 870
Left = 360
Pattern = "*.nasl"
TabIndex = 9
Top = 2400
Visible = 0 'False
Width = 1455
End
Begin VB.FileListBox filATKPlugins
Height = 870
Left = 360
Pattern = "*.plugin"
TabIndex = 4
Top = 1440
Visible = 0 'False
Width = 1455
End
Begin MSComctlLib.TreeView tvwPlugins
Height = 4575
Left = 120
TabIndex = 1
Top = 240
Width = 3375
_ExtentX = 5953
_ExtentY = 8070
_Version = 393217
HideSelection = 0 'False
LabelEdit = 1
LineStyle = 1
Sorted = -1 'True
Style = 6
FullRowSelect = -1 'True
Appearance = 1
End
End
Begin MSComctlLib.StatusBar StatusBar
Align = 2 'Align Bottom
Height = 315
Left = 0
TabIndex = 3
Top = 6585
Width = 8835
_ExtentX = 15584
_ExtentY = 556
_Version = 393216
BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628}
NumPanels = 3
BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628}
AutoSize = 1
Object.Width = 11078
MinWidth = 1765
Text = "Ready"
TextSave = "Ready"
Object.ToolTipText = "Status message"
EndProperty
BeginProperty Panel2 {8E3867AB-8586-11D1-B16A-00C0F0283628}
Alignment = 1
Object.Width = 1411
MinWidth = 1411
Text = "100 %"
TextSave = "100 %"
EndProperty
BeginProperty Panel3 {8E3867AB-8586-11D1-B16A-00C0F0283628}
EndProperty
EndProperty
End
Begin VB.Label lblVulnerabilityState
Alignment = 2 'Center
Appearance = 0 'Flat
BackColor = &H00E0E0E0&
BorderStyle = 1 'Fixed Single
Caption = "There was no vulnerability tested yet. Please run the selected plugin to determine the existence of the flaw."
ForeColor = &H80000008&
Height = 255
Left = 120
MouseIcon = "frmMain.frx":5080
MousePointer = 99 'Custom
TabIndex = 8
ToolTipText = "Click here to open the response analysis"
Top = 1080
Width = 8595
End
Begin VB.Menu mnuFile
Caption = "&File"
Begin VB.Menu mnuExitItem
Caption = "&Exit"
Shortcut = ^Q
End
End
Begin VB.Menu mnuScan
Caption = "&Scan"
Begin VB.Menu mnuScanStartItem
Caption = "&Start"
Shortcut = +^{F1}
End
Begin VB.Menu mnuScanStopItem
Caption = "Sto&p"
Enabled = 0 'False
Shortcut = +^{F2}
End
End
Begin VB.Menu mnuConfiguration
Caption = "&Configuration"
Begin VB.Menu mnuConfigurationPreferencesItem
Caption = "&Preferences..."
Shortcut = {F9}
End
Begin VB.Menu mnuConfigurationToolbarItem
Caption = "&Toolbar..."
Shortcut = ^{F9}
End
End
Begin VB.Menu mnuPlugins
Caption = "&Plugins"
Begin VB.Menu mnuPluginsRun
Caption = "&Run"
Begin VB.Menu mnuPluginsRunDetectionItem
Caption = "&Detection"
Enabled = 0 'False
End
Begin VB.Menu mnuPluginsRunExploitItem
Caption = "&Exploit"
Enabled = 0 'False
End
End
Begin VB.Menu mnuPluginsSeparator1
Caption = "-"
End
Begin VB.Menu mnuPluginsReloadAllItem
Caption = "Reload &all"
Shortcut = {F5}
End
Begin VB.Menu mnuPluginsSeparator2
Caption = "-"
End
Begin VB.Menu mnuPluginsEditItem
Caption = "&Edit..."
Shortcut = {F4}
End
Begin VB.Menu mnuPluginsExternalEditorItem
Caption = "Edit with e&xternal editor..."
Shortcut = ^{F4}
End
Begin VB.Menu mnuPluginsReloadItem
Caption = "Re&load"
Shortcut = ^{F5}
End
Begin VB.Menu mnuPluginsDeleteItem
Caption = "&Delete"
Shortcut = {F8}
End
Begin VB.Menu mnuPluginsSeparator3
Caption = "-"
End
Begin VB.Menu mnuPluginsSearchPluginItem
Caption = "&Search plugin..."
Shortcut = ^F
End
Begin VB.Menu mnuPluginsFindNextItem
Caption = "Find &next"
Shortcut = {F3}
End
Begin VB.Menu mnuPluginsSeparator4
Caption = "-"
End
Begin VB.Menu mnuPluginsReportConfigurationItem
Caption = "Report &configuration..."
Shortcut = +^{F4}
End
Begin VB.Menu mnuPluginsSeparator5
Caption = "-"
End
Begin VB.Menu mnuPluginsShowOnlinePluginItem
Caption = "Show online plugin in the web &browser ..."
Shortcut = +^{F3}
End
Begin VB.Menu mnuPluginsDownloadTheLatestPluginsItem
Caption = "D&ownload the latest plugins..."
Shortcut = +^{F5}
End
Begin VB.Menu mnuPluginsExportLoadedPluginListItem
Caption = "Ex&port loaded plugin list..."
Shortcut = +^{F6}
End
End
Begin VB.Menu mnuAnalysis
Caption = "&Analysis"
Begin VB.Menu mnuAnalysisAttackVisualizingItem
Caption = "Attack &visualizing..."
Shortcut = ^V
End
Begin VB.Menu mnuAnalysisAttackResponseItem
Caption = "Attack &response..."
Shortcut = ^R
End
Begin VB.Menu mnuAnalysisSeparator
Caption = "-"
End
Begin VB.Menu mnuAnalysisLogsItem
Caption = "&Logs..."
Shortcut = ^L
End
End
Begin VB.Menu mnuReporting
Caption = "&Reporting"
Begin VB.Menu mnuReportingShowReportItem
Caption = "&Show report..."
Shortcut = +{F3}
End
Begin VB.Menu mnuReportingSeparator1
Caption = "-"
End
Begin VB.Menu mnuReportingConfigurationItem
Caption = "&Configuration..."
End
End
Begin VB.Menu mnuTools
Caption = "&Tools"
Begin VB.Menu mnuNslookupItem
Caption = "&Nslookup..."
Shortcut = ^{F1}
End
Begin VB.Menu mnuICMPPingItem
Caption = "&ICMP ping..."
Shortcut = ^{F2}
End
Begin VB.Menu mnuPortscannerItem
Caption = "&Portscanner..."
Shortcut = ^{F3}
End
End
Begin VB.Menu mnuHelp
Caption = "&Help"
Begin VB.Menu mnuHelpIndexItem
Caption = "&Index"
Shortcut = {F1}
End
Begin VB.Menu mnuHelpSeperator1
Caption = "-"
End
Begin VB.Menu mnuProjectWebSiteItem
Caption = "Project &web site"
Shortcut = {F12}
End
Begin VB.Menu mnuAboutItem
Caption = "&About"
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
' ************************************************************************************
' * Developement History *
' * *
' * Version 4.1 2005-01-23 *
' * - Fixed the resizing bug with the progressbar if Windows XP design is given. *
' * Version 4.1 2005-01-16 *
' * - Replaced, whenever possible, the Default and Cancel buttons with a form key *
' * press preview function. *
' * Version 4.0 2005-01-02 *
' * - Replaced the old Nessus plugins URLs with the new ones. *
' * Version 4.0 2004-12-27 *
' * - Added the feature to load and show the latest nasl plugin if nasl plugins are *
' * available. *
' * Version 4.0 2004-12-15 *
' * - Added the Reports menu item and icon by Pascal Widmer. *
' * Version 4.0 2004-12-10 *
' * - Replaced all vbCrLf with vbNewLine - Because these are a bit faster. *
' * - Optimized some of the string functions (e.g. Mid and LCase). *
' * Version 3.1 2004-11-17 *
' * - Added a routine to show also the plugin loading progress in the splash screen. *
' * - Fixed an error with the progress bar value during loading of the plugins. *
' * Version 3.0 2004-11-13 *
' * - Changed the context menu popup to a mouseup event. *
' * Version 3.0 2004-11-12 *
' * - Added the plugin search. *
' * Version 3.0 2004-11-07 *
' * - Fixed a bug in the sending command. It was not possible to use several new *
' * lines in one single send command. Also increased the speed of the send command.*
' * Version 3.0 2004-11-06 *
' * - Corrected and enhanced the procedure type detection. *
' * - Added the possibility of opening web URLs by double clicking a http link in *
' * the plugin overview. *
' * Version 3.0 2004-11-05 *
' * - Fixed the vbModeless bug if the Attack Editor is opened via the treeview. *
' * Version 3.0 2004-11-04 *
' * - Added default cancel buttons in the whole project. Most sub-frames can be *
' * closed by clicking the esc button now. *
' * - Added a routine for the plugin autoupdate which detects new plugins. Only in *
' * this case the new available plugins are loaded. *
' * Version 3.0 2004-11-03 *
' * - Added a better freeze frame handling for more resource intensive procedures. *
' * Version 3.0 2004-11-01 *
' * - Corrected the last errors with treeview actions if no element nor node is *
' * selected. *
' * Version 3.0 2004-10-17 *
' * - Changed the reload behaviour. If a plugin is selected, just the plugin is *
' * reloaded. But if no plugins are loaded, the whole plugin repository will be *
' * reloaded. *
' * - Added a procedure to handle the check if there should the triggr not be found. *
' * Version 3.0 2004-10-16 *
' * - Changed the whole new trigger behaviour. The trigger is not generally saved in *
' * plugin_trigger anymore. Instead the triggers are the parameter of the pattern *
' * matching commands. *
' * - Optimized the form resize procedure to be a bit faster. *
' * Version 3.0 2004-10-15 *
' * - Deleted all the Nessus stuff because it was not working at the current time. *
' * Sorry, I know, this is very sad but I will try to implement the whole Nessus *
' * stuff in ATK 4.0 or 5.0 - Please be patient! *
' * Version 3.0 2004-09-30 *
' * - Added the run command to let the ATK run shell based commands. *
' * - Put the increasing of the status bar after a command has been run. This *
' * prevents the software from beeing showing 100 % has reached but the last *
' * command is running. *
' * Version 3.0 2004-09-25 *
' * - Fixed some errors if a special mouse click sequence is sent and if no treeview *
' * element is selected. The whole checking should also be faster than the old. *
' * Version 2.1 2004-09-09 *
' * - Fixed an error for the progress bar if more than 199 plugins are loaded. *
' * Version 2.1 2004-09-08 *
' * - Added a checking routine for unsaved data in the attack editor if a new plugin *
' * is loaded. *
' * - Added a better error checking routine for CVE names. *
' * Version 2.1 2004-09-05 *
' * - Changed the frame menu for configuration. Added the two points preferences and *
' * toolbar. *
' * - Also changed the click behavior of the toolbar so a customization works. *
' * - For faster config access added a context menu for the toolbar menu. *
' * Version 2.1 2004-09-04 *
' * - Added the progress bar status 100 % if scan is aborded. *
' * - Corrected the progress bar during full audit. *
' * Version 2.1 2004-09-03 *
' * - Fixed a runtime error if the user is clicking the right mouse button in the *
' * plugin TreeView but there is no node selected. *
' * Version 2.0 2004-08-24 *
' * - Modified the form resize handling to put the progress bar on the right place. *
' ************************************************************************************
Dim strPluginSearchText As String 'Used for the plugin search
Private Sub filATKPlugins_Click()
'Read the selected plugin file as fast as possible
Call ParseATKPlugin(ReadPluginFromFile(filATKPlugins.Filename, application_plugin_directory))
End Sub
Private Sub filNASLPlugins_Click()
'Read the selected plugin file
Call ParseNASLPlugin(ReadPluginFromFile(filNASLPlugins.Filename, application_plugin_directory))
End Sub
Private Sub Form_Activate()
If Me.WindowState = vbMinimized Then
Me.WindowState = vbNormal
End If
End Sub
' ********************************************************************
' * Here is all the things that happen when the main form is loaded. *
' * I want to keep this par as small as possible and call external *
' * routines if possible. Just the most important stuff is done here.*
' ********************************************************************
Private Sub Form_Load()
Me.Caption = application_name
End Sub
Private Sub ValidatePluginInput()
If LenB(plugin_port) = 0 Then
WriteLogEntry "Checking the existence of the plugin_port data ...", 6
Call errPluginDataMissing("plugin_port", plugin_filename, plugin_id)
' ElseIf LenB(session_procedure_commands) < 8 Then
' WriteLogEntry "Checking the existence and compatibelity of the plugin_request data ...", 6
' Call errPluginDataMissing("plugin_request", plugin_filename, plugin_id)
Else
'Initiate the attack if everything is okay
Call InitiateAttack
End If
End Sub
' ***************************************************
' * This routine prepares everything for the check. *
' ***************************************************
Private Sub InitiateAttack()
'Reset the progress
SetProgress 0
'Write the log entry
WriteLogEntry "Starting the attack ...", 6
'Read the actual status
Call ReadText("Starting the attack. Please wait until the attempt is finished...")
'Freeze the frame
Call FreezeWindows
'Close the last used socket - Just to be sure
Call wskTCPWinsock(0).Close
'Do ICMP mapping of wanted
If application_icmp_mapping_enable Then
Call ICMPMapping
Else
WriteLogEntry "No mapping wanted. Starting attack ...", 6
Call InitiateCheckOrAudit
End If
End Sub
Private Sub ICMPMapping()
Dim ECHO As ICMP_ECHO_REPLY
'ping an ip address, passing the
'address and the ECHO structure
Call Ping(GetIPFromHostName(Target), ECHO)
WriteLogEntry "Sending ICMP echo request ...", 6
'display the results from the ECHO structure
If GetStatusCode(ECHO.status) = 0 Then
WriteLogEntry "ICMP echo reply received in " & ECHO.RoundTripTime & " ms. Starting attack ...", 6
Call InitiateCheckOrAudit
ElseIf application_icmp_mapping_ignore_enable = True Then
WriteLogEntry "No ICMP echo reply received. Starting attack ...", 5
Call InitiateCheckOrAudit
Else
WriteLogEntry "No ICMP echo reply reveiced because " & msg & ". Ready.", 4
'Enable the form to allow further input
Call FreeWindows
End If
End Sub
' *******************************************************************
' * This routine decides if a single check or audit should be done. *
' *******************************************************************
Private Sub InitiateCheckOrAudit()
If application_attack_mode = "SingleCheck" Then
'Delete the last attack response
LastResponse = vbNullString
'Start a single check
Call AttackProcedure
Else
Dim i As Integer 'This i is used for the counters
Dim LoadedPlugins As Integer 'How many plugins are loaded
LoadedPlugins = filATKPlugins.ListCount
'Initiate a full security audit
For i = 1 To LoadedPlugins
'Check if the scan was stopped
If Me.tlbMenu.Buttons.Item(2).Enabled = True Then
'Delete the last attack response
LastResponse = vbNullString
'Everytime select the new plugin and do the check until finish
filATKPlugins.ListIndex = i - 1
SetProgress (100 / LoadedPlugins) * i
Call AttackProcedure
Else
Exit For
End If
Next i
SetProgress 100
End If
Call FreeWindows
End Sub
' *********************************************************
' * This routine starts and manages the attack procedure. *
' * It is the heart or the brain of the software. *
' *********************************************************
Private Sub AttackProcedure()
Dim i As Integer 'The counter
Dim intFreeFile As Integer 'The free file integer
Dim Command() As String 'The array with all commands of a plugin
Dim CommandCount As Integer 'The number of commands in a row
'Detect DoS and abord if needed
If InStr(1, bug_vulnerability_class, "Denial of Service") Then
If application_no_dos_enable = True Then
'Message if the vulnerability was found
WriteLogEntry "No denial of service checks activated. Abording check.", 3
Call FreeWindows
Exit Sub
End If
End If
Call FreezeWindows
'Define the selected request for the attack
If session_procedure_type = "detection" Then
session_procedure_commands = plugin_procedure_detection
ElseIf session_procedure_type = "exploit" Then
session_procedure_commands = plugin_procedure_exploit
Else
Call SetPluginSessionProcedure
End If
'Replace the ATK scripting language variants
If InStrB(1, session_procedure_commands, "$DHOST", vbBinaryCompare) Then
session_procedure_commands = Replace(session_procedure_commands, "$DHOST", Target, , , vbBinaryCompare)
End If
If InStrB(1, session_procedure_commands, "$DPORT", vbBinaryCompare) Then
session_procedure_commands = Replace(session_procedure_commands, "$DPORT", plugin_port, , , vbBinaryCompare)
End If
'Split the commands in the request apart
Command = Split(session_procedure_commands, "|")
'Count the commands of this check
CommandCount = UBound(Command)
'Start the attack timeout timer
timTimeout.Interval = application_attack_timeout
timTimeout.Enabled = False
timTimeout.Enabled = True
For i = 0 To CommandCount
'We need this if the timeout comes before a send command; I have to check this
On Error Resume Next
If Mid$(Command(i), 1, 4) = "open" Then
Dim Try As Integer
Dim OpenTarget As String
'Check the target host
If Len(Command(i)) > 4 Then
OpenTarget = Mid$(Command(i), 6, Len(Command(i)))
Else
OpenTarget = Target
End If
'Open a new connection using the target data
WriteLogEntry "Opening socket to " & OpenTarget & ":" & plugin_port, 6
wskTCPWinsock(0).Connect OpenTarget, plugin_port
If IsFormVisible("frmAttackVisualizing") = True Then
Call frmAttackVisualizing.VisualizeOpenConnection
End If
'Wait a few moments for a successful connection
Do While wskTCPWinsock(0).State <> sckConnected
If Try < application_attack_timeout * 0.5 Then
Pause 1
Try = Try + 1000
Else
Exit Do
End If
Loop
ElseIf Mid$(Command(i), 1, 5) = "close" Then
If timTimeout.Enabled = True Then
'Call to close the socket
Call wskTCPWinsock(0).Close
End If
If IsFormVisible("frmAttackVisualizing") = True Then
Call frmAttackVisualizing.VisualizeCloseConnection
End If
ElseIf Mid$(Command(i), 1, 4) = "send" Then
Dim DataToSend As String
If wskTCPWinsock(0).State = 7 Then
If Len(Command(i)) > 5 Then
DataToSend = Replace(Mid$(Command(i), 6, Len(Command(i))), "\n", vbNewLine, , , vbBinaryCompare)
'Send the request with its needed command and linefeeds
wskTCPWinsock(0).SendData DataToSend
Else
'Send a "blank" request if the param1 is empty
DataToSend = vbNewLine
wskTCPWinsock(0).SendData DataToSend
End If
WriteLogEntry "Sending data """ & Mid$(DataToSend, 1, 64) & """ ...", 6
If IsFormVisible("frmAttackVisualizing") = True Then
Call frmAttackVisualizing.VisualizeSendData(DataToSend)
End If
End If
ElseIf Mid$(Command(i), 1, 5) = "sleep" Then
If timTimeout.Enabled = True Then
Dim SleepTime As Integer 'Save the time wanted to sleep
If Len(Command(i)) > 5 Then
'Sleep as long as requested
SleepTime = (Mid$(Command(i), 7, Len(Command(i))))
Else
'Sleep default seconds if parameter is missing
SleepTime = application_sleep_time_default / 1000
End If
If IsFormVisible("frmAttackVisualizing") = True Then
Call frmAttackVisualizing.VisualizeSleep(SleepTime)
End If
WriteLogEntry "Sleeping for " & SleepTime & " seconds ...", 6
Pause (SleepTime)
End If
ElseIf Mid$(Command(i), 1, 8) = "pattern_" Then
'Dev note: We have to visualize the search for the pattern before we run the
'routines for found or not found. This is because we want to keep the order of
'the visualizing.
If Mid$(Command(i), 1, 14) = "pattern_exists" Then
If Len(Command(i)) > 15 Then
session_triggers = Mid$(Command(i), 16, Len(Command(i)))
If IsFormVisible("frmAttackVisualizing") = True Then
Call frmAttackVisualizing.VisualizePatternExists(session_triggers)
End If
Call PatternExists(session_triggers)
End If
ElseIf Mid$(Command(i), 1, 18) = "pattern_not_exists" Then
If Len(Command(i)) > 19 Then
session_triggers = Mid$(Command(i), 20, Len(Command(i)))
If IsFormVisible("frmAttackVisualizing") = True Then
Call frmAttackVisualizing.VisualizePatternExists(session_triggers)
End If
Call PatternNotExists(session_triggers)
End If
End If
ElseIf Mid$(Command(i), 1, 10) = "icmp_alive" Then
'Send ICMP ping
Dim ECHO As ICMP_ECHO_REPLY
'ping an ip address, passing the
'address and the ECHO structure
Call Ping(GetIPFromHostName(Target), ECHO)
'display the results from the ECHO structure
If GetStatusCode(ECHO.status) = 0 Then
Call VulnerabilityNotFound
Else
Call VulnerabilityFound
End If
ElseIf Mid$(Command(i), 1, 3) = "run" Then
Dim strRunCommand As String
Dim strRunCommandFileName As String
'get the selected command to run
strRunCommand = (Mid$(Command(i), 5, Len(Command(i))))
strRunCommandFileName = application_response_directory & Target & "-runcommandresponse.txt"
'run the selected command
Shell Environ("Comspec") + " /C " & strRunCommand & " > " & strRunCommandFileName, vbMinimizedNoFocus
'wait until the command is finished
Pause (application_sleep_time_default / 1000)
'put the last response of the command run in the last response variant
intFreeFile = FreeFile
Open strRunCommandFileName For Input As #intFreeFile
LastResponse = Input(LOF(intFreeFile), #intFreeFile)
Close
Call LoadLatestResponse
End If
'Add for every command the progress bar
If application_attack_mode = "SingleCheck" Then
SetProgress pbrProgress.Value + 100 / (CommandCount + 1)
End If
Next i
'Finish the progress bar
If application_attack_mode = "SingleCheck" Then
SetProgress 100
End If
End Sub
' *********************************************************************
' * This routine is the "brain" of a pattern-based check. Here is the *
' * decision made, if the pattern can be found in the server response.*
' *********************************************************************
Private Sub PatternExists(ByRef strPattern As String)
Dim i As Integer 'The integer for the OR counter
Dim Patterns() As String 'The array for multiple patterns
Dim PatternCount As Integer 'The count of the patterns
'Split the multiple OR patterns
Patterns = Split(strPattern, " OR ")
PatternCount = UBound(Patterns)
'Check for the existence of one of the patterns
For i = 0 To PatternCount
'Check if the string DOES exists in the response; also do a
'regulary expression check. One of them should recognize the flaw.
If InStr(1, LastResponse, Patterns(i)) <> 0 Or _
LastResponse Like Patterns(i) Then
'Call the VulnFound procedure if the pattern was found
Call VulnerabilityFound
'Write the new pattern. This is needed to check the pattern
'in the response window and to show the found pattern in
'the scan report.
session_trigger_match = Patterns(i)
'Exit the sub if the vulnerability was found
Exit Sub
End If
Next i
'Call the VulnNotFound procedure if the pattern was not found
Call VulnerabilityNotFound
End Sub
Private Sub PatternNotExists(ByRef strPattern As String)
Dim i As Integer 'The integer for the OR counter
Dim Patterns() As String 'The array for multiple patterns
Dim PatternCount As Integer 'The count of the patterns
'Split the multiple OR patterns
Patterns = Split(strPattern, " OR ")
PatternCount = UBound(Patterns)
'Check for the existence of one of the patterns
For i = 0 To PatternCount
'Check if the string DOES exists in the response; also do a
'regulary expression check. One of them should recognize the flaw.
If InStr(1, LastResponse, Patterns(i)) <> 0 Or _
LastResponse Like Patterns(i) Then
'Call the VulnFound procedure if the pattern was found
Call VulnerabilityNotFound
'Write the new pattern. This is needed to check the pattern
'in the response window and to show the found pattern in
'the scan report.
session_trigger_match = Patterns(i)
'Exit the sub if the vulnerability was found
Exit Sub
End If
Next i
'Call the VulnNotFound procedure if the pattern was not found
Call VulnerabilityFound
End Sub
' **********************************************************************
' * This routine calls everything that is needed, if the vulnerability *
' * could be found with the used check. *
' **********************************************************************
Private Sub VulnerabilityFound()
Dim strAlertingText As String
strAlertingText = "The vulnerability " & plugin_name & _
" was found on port " & plugin_protocol & "/" & plugin_port & _
" of the host " & Target & "."
'Message if the vulnerability was found
lblVulnerabilityState.Caption = strAlertingText
lblVulnerabilityState.BackColor = &HC0C0FF
WriteLogEntry "Vulnerability found! Ready.", 5
'Write the pluginname into the report
Call WritePluginNameToReportFile(plugin_filename & ";1;" & GetTodaysDate("/") & ";" & GetActualTime(":"))
If IsFormVisible("frmAttackVisualizing") = True Then
Call frmAttackVisualizing.VisualizeVulnerabilityFound
End If
'Show the alert message
If application_vulnerability_found_alert_enable = True Then
MsgBox strAlertingText, _
vbExclamation, "Attack Tool Kit vulnerability found"
End If
'Speak the status that the vulnerability seems to be found
Call ReadText("Check is finished. The vulnerability was found.")
End Sub
' **********************************************************************
' * This routine calls everything that is needed, if the vulnerability *
' * could not be found with the used check. *
' **********************************************************************