Skip to content

Commit

Permalink
Surprise
Browse files Browse the repository at this point in the history
  • Loading branch information
NewEraCracker committed Nov 29, 2018
1 parent 11ba01a commit 0ae244a
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 5 deletions.
42 changes: 42 additions & 0 deletions src/Konami.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/* LOIC - Low Orbit Ion Cannon
* Released to the public domain
* Enjoy getting v&, kids.
*/

using System;
using System.Collections.Generic;
using System.Windows.Forms;

namespace LOIC
{
public class Konami
{
private static short KonamiState = 0;
private static Keys[] KonamiKeys = {Keys.Up, Keys.Up, Keys.Down, Keys.Down, Keys.Left, Keys.Right, Keys.Left, Keys.Right, Keys.B, Keys.A, Keys.Enter};

public static bool Check(Form frm)
{
bool on = Settings.HasKonamiCode();
if(!on) {
frm.KeyUp += new KeyEventHandler(HandleKonamiKeyPress);
}
return on;
}


public static void HandleKonamiKeyPress(object sender, KeyEventArgs e)
{
if (KonamiKeys[KonamiState] == e.KeyCode) {
KonamiState++;
if (KonamiState >= KonamiKeys.Length) {
KonamiState = 0;
e.Handled = true;
Settings.SaveKonamiCode();
MessageBox.Show("Close and re-open the application to apply the changes.", "Konami Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
} else if (KonamiState != 0) {
KonamiState = 0;
}
}
}
}
1 change: 1 addition & 0 deletions src/LOIC.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
<ItemGroup>
<Compile Include="cHLDos.cs" />
<Compile Include="IFlooder.cs" />
<Compile Include="Konami.cs" />
<Compile Include="ReqState.cs" />
<Compile Include="frmEZGrab.cs">
<SubType>Form</SubType>
Expand Down
17 changes: 15 additions & 2 deletions src/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,27 @@ namespace LOIC
{
public class Settings
{
private static readonly string EulaSetting = "AcceptEULA";
private static readonly string KonamiSetting = "KonaniCode";

public static bool HasAcceptedEula()
{
return (false == String.IsNullOrEmpty(ReadSetting("AcceptEULA")));
return (false == String.IsNullOrEmpty(ReadSetting(EulaSetting)));
}

public static bool SaveAcceptedEula()
{
return UpdateSetting("AcceptEULA", "1");
return UpdateSetting(EulaSetting, "1");
}

public static bool HasKonamiCode()
{
return (false == String.IsNullOrEmpty(ReadSetting(KonamiSetting)));
}

public static bool SaveKonamiCode()
{
return UpdateSetting(KonamiSetting, "1");
}

public static string ReadSetting(string key, bool emptyUndefined = true)
Expand Down
6 changes: 3 additions & 3 deletions src/frmMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public partial class frmMain : Form
private List<IFlooder> arr = new List<IFlooder>();
private StringCollection aUpOLSites = new StringCollection();
private StringCollection aDownOLSites = new StringCollection();
private bool bIsHidden = false, bResp, intShowStats;
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;
Expand Down Expand Up @@ -69,6 +69,7 @@ public frmMain(bool hive, bool hide, string ircserver, string ircport, string ir
}
}
}
bKonami = Konami.Check(this);

// IRC
if(ircserver.Length > 0)
Expand Down Expand Up @@ -101,8 +102,7 @@ private void Attack(bool toggle, bool on, bool silent = false)
Wtf ("I don't think ports are supposed to be written like THAT.", silent);
return;
}

if (!Functions.ParseInt(txtThreads.Text, 1, 99, out iThreads)) {
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;
}
Expand Down

0 comments on commit 0ae244a

Please sign in to comment.