-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
212 lines (177 loc) · 7.05 KB
/
Program.cs
File metadata and controls
212 lines (177 loc) · 7.05 KB
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading;
using System.Windows.Forms;
using System.Media;
//
// Application Name: Meg Bit
// Description: Application that generates erratic mouse and keyboard movements and input and generates system sounds and fake dialogs to confuse the user
// Topic:
// 1) Threads
// 2) System.Windows.Forms namespace & assembly
// 3) Hidden application
namespace MegBit
{
class Program
{
public static Random _random = new Random();
public static int _startupDelaySeconds = 10;
public static int _totalDurationSeconds = 240;
/// <summary>
/// Entry point for prank application
/// </summary>
/// <param name="args"></param>
static void Main(string[] args)
{
Console.WriteLine("MegaBit Prank Application by: Hacker (aka. Roger");
// Check for command line arguelents and assign the new values
if (args.Length >= 2)
{
_startupDelaySeconds = Convert.ToInt32(args[0]);
_totalDurationSeconds = Convert.ToInt32(args[1]);
}
// Create all threads that manipulate all of the inputs and outputs to the system
Thread megabitMouseThread = new Thread(new ThreadStart(MegaMouseThread));
Thread megabitKeyBoardThread = new Thread(new ThreadStart(MegaBitKeyboardThread));
Thread megabitSoundThread = new Thread(new ThreadStart(MegaBitSoundThread));
Thread megabitPopupThread = new Thread(new ThreadStart(MegaBitPopupThread));
DateTime future = DateTime.Now.AddSeconds(_startupDelaySeconds);
Console.WriteLine("Waiting 10 seconds before starting threads");
while (future > DateTime.Now)
{
Thread.Sleep(1000);
}
// Start all of the threads
megabitMouseThread.Start();
megabitKeyBoardThread.Start();
megabitSoundThread.Start();
megabitPopupThread.Start();
future = DateTime.Now.AddSeconds(_totalDurationSeconds);
while (future > DateTime.Now)
{
Thread.Sleep(1000);
}
Console.WriteLine("Terminating all threads");
// Kill all threads and exit application
megabitMouseThread.Abort();
megabitKeyBoardThread.Abort();
megabitSoundThread.Abort();
megabitPopupThread.Abort();
}
#region Thread Functions
/// <summary>
/// This thread will random affect the mouse movement to screw with the end user
/// </summary>
public static void MegaMouseThread()
{
Console.WriteLine("MegaBitMouseThread Started");
int moveX = 0;
int moveY = 0;
while (true)
{
Console.WriteLine(Cursor.Position.ToString());
// Generate the random amount to move the cursor on X and Y
moveX = _random.Next(20) - 10;
moveY = _random.Next(20) - 10;
// Change mouse cursor position to new random coordinates
Cursor.Position = new System.Drawing.Point(
Cursor.Position.X + moveX,
Cursor.Position.Y + moveY);
Thread.Sleep(50);
}
}
/// <summary>
/// This will generate random keyboard output to screw with the end user
/// </summary>
public static void MegaBitKeyboardThread()
{
Console.WriteLine("MegaBitKeyboardThread Started");
while (true)
{
if (_random.Next(100) > 50)
{
// Generate a random capitol letter
char key = (char)(_random.Next(25) + 65);
// 50/50 make it lower case
if (_random.Next(2) == 0)
{
key = Char.ToLower(key);
}
SendKeys.SendWait(key.ToString());
Thread.Sleep(_random.Next(500));
}
}
}
/// <summary>
/// This will play system sounds at random to screw with the end user
/// </summary>
public static void MegaBitSoundThread()
{
Console.WriteLine("MegaBitSoundThread Started");
while (true)
{
// Determine if we're going to play a sound this time through the loop (20% odds)
if (_random.Next(100) > 90)
{
// Randomly select a system sound
switch (_random.Next(5))
{
case 0:
SystemSounds.Asterisk.Play();
break;
case 1:
SystemSounds.Beep.Play();
break;
case 2:
SystemSounds.Exclamation.Play();
break;
case 3:
SystemSounds.Hand.Play();
break;
case 4:
SystemSounds.Question.Play();
break;
}
SystemSounds.Asterisk.Play();
}
Thread.Sleep(50);
}
}
/// <summary>
/// This will play popup fake error notifications to make the user go crazy and pull their hair out
/// </summary>
public static void MegaBitPopupThread()
{
Console.WriteLine("MegaBitPopupThread Started");
while (true)
{
// Every 10 seconds roll the dice and 10% of the time show a dialog
if (_random.Next(100) > 90)
{
// Determined which message to show user
switch (_random.Next(2))
{
case 0:
MessageBox.Show
("Internet explorer has stopped working",
"Internet Explorer",
MessageBoxButtons.OK,
MessageBoxIcon.Error);
break;
case 1:
MessageBox.Show("Your system is running low on resources",
"Microsoft Windows",
MessageBoxButtons.OK,
MessageBoxIcon.Error);
break;
}
}
Thread.Sleep(10000);
}
#endregion
}
}
}