Home
About
Blog
Products
Forum
Support
Contact
Sunbelt Computer Software
PL/B Language Development and Support
Home
About
Blog
Products
Forum
Support
Contact
KernelHiddenExecute/ControlPanel/ControlPanel.cpp at master · pythonfansx/KernelHiddenExecute · GitHub
Skip to content
Navigation Menu
Sign in
Appearance settings
Platform
AI CODE CREATION
GitHub Copilot
Write better code with AI
GitHub Copilot app
Direct agents from issue to merge
MCP Registry
Integrate external tools
DEVELOPER WORKFLOWS
Actions
Automate any workflow
Codespaces
Instant dev environments
Issues
Plan and track work
Code Review
Manage code changes
Code Quality
Enforce quality at merge
APPLICATION SECURITY
GitHub Advanced Security
Find and fix vulnerabilities
Code security
Secure your code as you build
Secret protection
Stop leaks before they start
EXPLORE
Why GitHub
Documentation
Blog
Changelog
Marketplace
View all features
Solutions
BY COMPANY SIZE
Enterprises
Small and medium teams
Startups
Nonprofits
BY USE CASE
App Modernization
DevSecOps
DevOps
CI/CD
View all use cases
BY INDUSTRY
Healthcare
Financial services
Manufacturing
Government
View all industries
View all solutions
Resources
EXPLORE BY TOPIC
AI
Software Development
DevOps
Security
View all topics
EXPLORE BY TYPE
Customer stories
Events & webinars
Ebooks & reports
Business insights
GitHub Skills
SUPPORT & SERVICES
Documentation
Customer support
Community forum
Trust center
Partners
View all resources
Open Source
COMMUNITY
GitHub Sponsors
Fund open source developers
PROGRAMS
Security Lab
Maintainer Community
GitHub Stars
Archive Program
REPOSITORIES
Topics
Trending
Collections
Enterprise
ENTERPRISE SOLUTIONS
Enterprise platform
AI-powered developer platform
AVAILABLE ADD-ONS
GitHub Advanced Security
Enterprise-grade security features
Copilot for Business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
pythonfansx
/
KernelHiddenExecute
Public
forked from
zouxianyu/KernelHiddenExecute
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Files
Expand file tree
master
Breadcrumbs
KernelHiddenExecute
/
ControlPanel
/
ControlPanel.cpp
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
271 lines (225 loc) · 7.37 KB
master
Breadcrumbs
KernelHiddenExecute
/
ControlPanel
/
ControlPanel.cpp
Copy path
Top
File metadata and controls
Code
Blame
271 lines (225 loc) · 7.37 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
#
include
"
ControlPanel.h
"
ControlPanel::ControlPanel
(QWidget* parent)
: QWidget(parent),
//
initialize strings
protectedServiceName(
"
KernelHiddenExecute
"
),
protectedServiceDisplayName(
"
Kernel Hidden Execute
"
),
//
protectedDriverPath(".\\sys\\protected.sys"),
protectedDeviceName(
"
\\\\
.
\\
KernelHiddenExecute
"
),
protectedDriverControl(),
malwareServiceName(
"
KernelHiddenExecuteMalware
"
),
malwareServiceDisplayName(
"
Kernel Hidden Execute Malware
"
),
//
malwareDriverPath(".\\sys\\malware.sys"),
malwareDeviceName(
"
\\\\
.
\\
KernelHiddenExecuteMalware
"
),
malwareDriverControl(),
//
initialize bool variables
initialized(
false
)
//
isSafeProcExecuted1(false),
//
isUnsafeProcExecuted1(false),
//
isAttacked(false),
//
isSafeProcExecuted2(false),
//
isUnsafeProcExecuted2(false)
{
ui.
setupUi
(
this
);
//
initialize buttons connection
connect
(ui.
initBtn
, &QPushButton::clicked,
this
, &ControlPanel::initialize);
connect
(ui.
attackBtn
, &QPushButton::clicked,
this
, &ControlPanel::attack);
connect
(ui.
unsafeProcBtn
, &QPushButton::clicked,
this
, &ControlPanel::normalProcedure);
connect
(ui.
safeProcBtn
, &QPushButton::clicked,
this
, &ControlPanel::protectedProcedure);
//
fix relative path
QDir
protectedDriverDir
(
"
./sys/KernelHiddenExecute.sys
"
);
protectedDriverPath = protectedDriverDir.
absolutePath
().
replace
(
QString
(
"
/
"
),
QString
(
"
\\
"
));
QDir
malwareDriverDir
(
"
./sys/KernelHiddenExecuteMalware.sys
"
);
malwareDriverPath = malwareDriverDir.
absolutePath
().
replace
(
QString
(
"
/
"
),
QString
(
"
\\
"
));
//
add helper text
ui.
helperTextBrowser
->
clear
();
ui.
helperTextBrowser
->
append
(
"
请进行初始化
"
);
ui.
helperTextBrowser
->
append
(
"
下方会显示初始化的状态
"
);
}
void
ControlPanel::initialize
()
{
qDebug
() <<
"
initialize
"
;
if
(initialized)
{
return
;
}
//
initialize service control manager
ui.
outputTextBrowser
->
append
(
"
开始初始化SCM
"
);
if
(
Services::init
() ==
false
)
{
ui.
outputTextBrowser
->
append
(
"
SCM初始化失败
"
);
return
;
}
ui.
outputTextBrowser
->
append
(
"
SCM初始化成功
"
);
//
load protected driver
//
TODO:FIX ABSOLUTE PATH
ui.
outputTextBrowser
->
append
(
"
开始加载被攻击的程序
"
);
if
(!
loadDriver
(protectedDriverPath, protectedServiceName, protectedServiceDisplayName))
{
return
;
}
//
load malware driver
ui.
outputTextBrowser
->
append
(
"
开始加载恶意程序
"
);
if
(!
loadDriver
(malwareDriverPath, malwareServiceName, malwareServiceDisplayName))
{
return
;
}
//
open drivers handle
ui.
outputTextBrowser
->
append
(
"
开始连接到被攻击的程序
"
);
if
(!protectedDriverControl.
open
(protectedDeviceName))
{
ui.
outputTextBrowser
->
append
(
"
打开失败
"
);
return
;
}
ui.
outputTextBrowser
->
append
(
"
打开成功
"
);
ui.
outputTextBrowser
->
append
(
"
开始连接到恶意程序
"
);
if
(!malwareDriverControl.
open
(malwareDeviceName))
{
ui.
outputTextBrowser
->
append
(
"
打开失败
"
);
return
;
}
ui.
outputTextBrowser
->
append
(
"
打开成功
"
);
initialized =
true
;
//
scroll to next page
ui.
controlStackedWidget
->
setCurrentIndex
(
1
);
//
add helper text
ui.
helperTextBrowser
->
clear
();
ui.
helperTextBrowser
->
append
(
"
初始化成功
"
);
ui.
helperTextBrowser
->
append
(
"
建议先点击上方的两个按钮,观察程序的执行情况。然后再进行攻击。最后再次点击上方的两个按钮,再次观察程序的执行情况
"
);
}
void
ControlPanel::attack
()
{
qDebug
() <<
"
attack
"
;
if
(!malwareDriverControl.
attack
())
{
ui.
outputTextBrowser
->
append
(
"
攻击失败
"
);
return
;
}
ui.
outputTextBrowser
->
append
(
"
攻击成功
"
);
}
void
ControlPanel::normalProcedure
()
{
qDebug
() <<
"
normalProcedure
"
;
ui.
outputTextBrowser
->
append
(
"
开始演示未受保护的过程
"
);
ui.
outputTextBrowser
->
append
(
QString
(
"
读取的数据:
"
) + protectedDriverControl.
unsafeRead
());
ui.
outputTextBrowser
->
append
(
QString
(
"
执行的结果:
"
) + protectedDriverControl.
unsafeExec
());
}
void
ControlPanel::protectedProcedure
()
{
qDebug
() <<
"
protectedProcedure
"
;
ui.
outputTextBrowser
->
append
(
"
开始演示受保护的过程
"
);
ui.
outputTextBrowser
->
append
(
QString
(
"
读取的数据:
"
) + protectedDriverControl.
safeRead
());
ui.
outputTextBrowser
->
append
(
QString
(
"
执行的结果:
"
) + protectedDriverControl.
safeExec
());
}
void
ControlPanel::closeEvent
(QCloseEvent* event)
{
qDebug
() <<
"
closeEvent
"
;
if
(
QMessageBox::question
(
this
,
"
退出
"
,
"
确定要退出吗?
"
, QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes)
{
//
unload drivers
malwareDriverControl.
close
();
protectedDriverControl.
close
();
unloadDriver
(malwareServiceName);
unloadDriver
(protectedServiceName);
//
ui.outputTextBrowser->append("卸载中");
//
QThread::sleep(2);
//
uninitialize SCM
Services::uninit
();
event->
accept
();
}
else
{
event->
ignore
();
}
}
bool
ControlPanel::loadDriver
(QString driverPath, QString serviceName, QString serviceDisplayName)
{
unsigned
long
registrationResult =
Services::Register
(driverPath,
serviceName,
serviceDisplayName,
"
Demand
"
,
"
Normal
"
);
switch
(registrationResult) {
case
ERROR_SERVICE_EXISTS
:
ui.
outputTextBrowser
->
append
(
"
Service registration failed. The service already exists.
"
);
break
;
case
1
:
ui.
outputTextBrowser
->
append
(
"
Service registration failed. Empty or invalid parameters have been provided.
"
);
return
false
;
case
0
:
ui.
outputTextBrowser
->
append
(
"
Service registration succeeded.
"
);
break
;
default
:
ui.
outputTextBrowser
->
append
(
QString
(
"
Service registration failed. Error code %1.
"
).
arg
(registrationResult));
return
false
;
}
unsigned
long
startResult =
Services::Start
(serviceName);
switch
(startResult) {
case
1
:
ui.
outputTextBrowser
->
append
(
"
Starting service failed.
"
);
return
false
;
case
ERROR_SHARING_VIOLATION
:
ui.
outputTextBrowser
->
append
(
"
The process cannot access the file because it is being used by another process.
"
);
return
false
;
case
ERROR_SERVICE_DOES_NOT_EXIST
:
ui.
outputTextBrowser
->
append
(
"
The specified service does not exist as an installed service.
"
);
return
false
;
case
ERROR_SERVICE_ALREADY_RUNNING
:
ui.
outputTextBrowser
->
append
(
"
An instance of the service is already running.
"
);
break
;
case
0
:
ui.
outputTextBrowser
->
append
(
"
Service started.
"
);
break
;
default
:
ui.
outputTextBrowser
->
append
(
QString
(
"
Starting service failed. Error code %1.
"
).
arg
(startResult));
return
false
;
}
return
true
;
}
bool
ControlPanel::unloadDriver
(QString serviceName)
{
//
if (!initialized)
//
{
//
return false;
//
}
unsigned
long
stopResult =
Services::Stop
(serviceName);
switch
(stopResult) {
case
1
:
ui.
outputTextBrowser
->
append
(
"
Stopping service failed.
"
);
break
;
case
ERROR_SERVICE_NOT_ACTIVE
:
ui.
outputTextBrowser
->
append
(
"
The service has not been started.
"
);
break
;
case
ERROR_SERVICE_DOES_NOT_EXIST
:
ui.
outputTextBrowser
->
append
(
"
The specified service does not exist as an installed service.
"
);
break
;
case
0
:
ui.
outputTextBrowser
->
append
(
"
Service stopped.
"
);
break
;
default
:
ui.
outputTextBrowser
->
append
(
QString
(
"
Stopping service failed. Error code %1.
"
).
arg
(stopResult));
break
;
}
unsigned
long
unregistrationResult =
Services::Unregister
(serviceName);
bool
unregResult =
false
;
switch
(unregistrationResult) {
case
1
:
ui.
outputTextBrowser
->
append
(
"
Service unregistration failed.
"
);
unregResult =
false
;
break
;
case
ERROR_SERVICE_DOES_NOT_EXIST
:
ui.
outputTextBrowser
->
append
(
"
The specified service does not exist as an installed service.
"
);
unregResult =
false
;
break
;
case
0
:
ui.
outputTextBrowser
->
append
(
"
Service unregistration succeeded.
"
);
unregResult =
true
;
break
;
default
:
ui.
outputTextBrowser
->
append
(
QString
(
"
Service unregistration failed. Error code %1.
"
).
arg
(unregistrationResult));
unregResult =
false
;
break
;
}
//
initialized = false;
return
unregResult;
}
You can’t perform that action at this time.