-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainForm.cs
More file actions
119 lines (103 loc) · 3.53 KB
/
MainForm.cs
File metadata and controls
119 lines (103 loc) · 3.53 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
using Mirage_Security.Artifacts;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Mirage_Security
{
public partial class MainForm : Form
{
Artifact driver;
Artifact fs;
Artifact mutex;
Artifact process;
Artifact registry;
public MainForm()
{
InitializeComponent();
driver = new Driver();
fs = new Filesystem();
mutex = new Mutex();
process = new Process();
registry = new Registry();
}
private void minimizeButton_Click(object sender, EventArgs e)
{
this.WindowState = FormWindowState.Minimized;
}
private void closeButton_Click(object sender, EventArgs e)
{
driver.remove();
fs.remove();
mutex.remove();
process.remove();
registry.remove();
this.Close();
}
private void updateStatus(Guna.UI2.WinForms.Guna2Button button, Guna.UI2.WinForms.Guna2CirclePictureBox statusMarker, int status)
{
switch (status)
{
case 1:
statusMarker.BeginInvoke(new Action(() => statusMarker.FillColor = Color.Green));
button.BeginInvoke(new Action(() => { button.Text = "Disable"; button.Enabled = true; }));
break;
case 2:
statusMarker.BeginInvoke(new Action(() => statusMarker.FillColor = Color.Yellow));
button.BeginInvoke(new Action(() => { button.Text = "Loading"; button.Enabled = false; }));
break;
case 3:
statusMarker.BeginInvoke(new Action(() => statusMarker.FillColor = Color.Red));
button.BeginInvoke(new Action(() => { button.Text = "Enable"; button.Enabled = true; }));
break;
default:
break;
}
}
private void doButtonWork(Guna.UI2.WinForms.Guna2Button button, Guna.UI2.WinForms.Guna2CirclePictureBox statusMarker, Artifact a)
{
updateStatus(button, statusMarker, 2);
if (button.Checked)
{
Task.Factory.StartNew(() =>
{
a.create();
updateStatus(button, statusMarker, 1);
});
}
else
{
Task.Factory.StartNew(() =>
{
a.remove();
updateStatus(button, statusMarker, 3);
});
}
}
private void fileButton_Click(object sender, EventArgs e)
{
doButtonWork(fileButton, fileStatus, fs);
}
private void processButton_Click(object sender, EventArgs e)
{
doButtonWork(processButton, processStatus, process);
}
private void registryButton_Click(object sender, EventArgs e)
{
doButtonWork(registryButton, registryStatus, registry);
}
private void driverButton_Click(object sender, EventArgs e)
{
doButtonWork(driverButton, driverStatus, driver);
}
private void mutexButton_Click(object sender, EventArgs e)
{
doButtonWork(mutexButton, mutexStatus, mutex);
}
}
}