-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsession.manager.php
More file actions
514 lines (492 loc) · 28.8 KB
/
Copy pathsession.manager.php
File metadata and controls
514 lines (492 loc) · 28.8 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
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
<?php
require '_cred.php';
// path of the log file where errors need to be logged
$log_file = "./error.txt";
ini_set('display_errors', 0);
// setting error logging to be active
ini_set("log_errors", TRUE);
// setting the logging file in php.ini
ini_set('error_log', $log_file);
if(isset($_SESSION['malware-repository-state'])){
switch($_SESSION['malware-repository-state']){
case 'loggedin':loggedIn($conn); break;
case 'notloggedin': signin($conn);break;
case 'signup': signup($conn);break;
case 'forgot':forgotPassword();break;
case 'home':nonePage();break;
case 'category':clearContent($conn);break;
case 'malware-test':startTest();break;
default: signin();
}
}
else{
$_SESSION['malware-repository-state'] = 'home';
echo("<script>location.href = './';</script>");
}
if(isset($_GET['page'])) {
switch ($_GET['page']){
case 'signup':
$_SESSION['malware-repository-state'] = 'signup';break;
case 'signin':
$_SESSION['malware-repository-state'] = 'notloggedin'; break;
case 'forgot':
$_SESSION['malware-repository-state'] = 'forgot';break;
case 'home':
$_SESSION['malware-repository-state'] = 'home'; break;
case 'malware-test':
$_SESSION['malware-repository-state'] = 'malware-test'; break;
case 'logout': logout(); break;
case 'loggedin':
if( isset($_SESSION['username'])) {
$_SESSION['malware-repository-state'] = 'loggedin';
}break;
break;
}
echo("<script>location.href = './';</script>");
}
if(isset($_GET['category'])){
$_SESSION['malware-repository-state'] = 'category';
$_SESSION['category'] = $_GET['category'];
echo("<script>location.href = './';</script>");
}
function loggedIn($conn){
if (isset($_POST['category-submit']) && isset($_POST['malware-name']) && isset($_SESSION['username'])) {
$categoryname = $conn->real_escape_string($_POST['malware-name']);
if(isset($_POST["platforms-affected"]))
{
$platforms = "";
foreach ( $_POST['platforms-affected'] as $plat) {
$platforms .= $plat." , ";
}
$platforms = rtrim($platforms, ', \t\n');
}
$definition = $conn->real_escape_string($_POST['malware-definition']);
$categoryeffects = $conn->real_escape_string($_POST['malware-effects']);
$categorysigns= $conn->real_escape_string($_POST['malware-signs']);
$url = str_replace(' ', '-', $categoryname);
$added_by = $_SESSION['username'];
$stmt = $conn->prepare("INSERT INTO malware_categories( name_of_category, malware_date_created, malware_date_updated, url_friendly, added_by,effects,signs_and_symptoms,definition,platforms_affected) VALUES (?, NOW(),NOW(), ?,?,?,?,?,?)");
$stmt->bind_param("sssssss", $categoryname, $url, $added_by,$categoryeffects,$categorysigns,$definition,$platforms);
if ($stmt->execute()) {
echo "<div class='alert alert-success alert-dismissible' style='margin: 20px 0'> <button type='button' class='close' data-dismiss='alert'>×</button>The category has been added successfully</div>";
} else {
echo "<div class='alert alert-danger alert-dismissible' style='margin: 20px 0'> <button type='button' class='close' data-dismiss='alert'>×</button>The category could not be added because an error has occurred. The error has been logged and will be logged at. Please try again later.</div>";
}
}
if (isset($_POST['engine-submit']) && isset($_POST['name_of_engine']) && isset($_SESSION['username'])) {
$enginename = $conn->real_escape_string($_POST['name_of_engine']);
$enginetype = $conn->real_escape_string($_POST['malware_engines_type']);
$engineurl = $conn->real_escape_string($_POST['engine_url']);
$architecture = $conn->real_escape_string($_POST['architecture']);
if(isset($_POST["method_of_operation"]))
{
$method_of_operation = "";
foreach ( $_POST['method_of_operation'] as $plat) {
$method_of_operation .= $plat." , ";
}
$method_of_operation = rtrim($method_of_operation, ', \t\n');
}
$added_by = $_SESSION['username'];
$stmt = $conn->prepare("INSERT INTO malware_engines(malware_engine_name, malware_engines_type, engine_url, date_created, date_updated, architecture, method_of_operation,added_by) VALUES (?, ?,?,NOW(),NOW(),?,?,?)");
$stmt->bind_param("ssssss", $enginename, $enginetype, $engineurl, $architecture, $method_of_operation,$added_by);
if ($stmt->execute()) {
echo "<div class='alert alert-success alert-dismissible' style='margin: 20px 0'> <button type='button' class='close' data-dismiss='alert'>×</button><b>Success!</b> The Engine has been added successfully</div>";
} else {
echo "<div class='alert alert-danger alert-dismissible' style='margin: 20px 0'> <button type='button' class='close' data-dismiss='alert'>×</button><b>Failed!</b> The Engine could not be added because an error has occurred. The error has been logged and will be logged at. Please try again later.</div>";
}
}
if (isset($_POST['platform-submit']) && isset($_SESSION['username'])) {
$platformname = $conn->real_escape_string($_POST['platform-name']);
$platformdeveloper = $conn->real_escape_string($_POST['platform-developer']);
$platformarchitecture = $conn->real_escape_string($_POST['platform-architecture']);
$added_by = $_SESSION['username'];
$stmt = $conn->prepare("INSERT INTO platforms_available(platforms_name, platforms_developer, platforms_available_architecture, added_by,date_created, date_updated) VALUES (?,?,?,?,NOW(),NOW())");
$stmt->bind_param("ssss", $platformname, $platformdeveloper, $platformarchitecture,$added_by);
if ($stmt->execute()) {
echo "<div class='alert alert-success alert-dismissible' style='margin: 20px 0'> <button type='button' class='close' data-dismiss='alert'>×</button><b>Success!</b>The Engine has been added successfully</div>";
} else {
echo "<div class='alert alert-danger alert-dismissible' style='margin: 20px 0'> <button type='button' class='close' data-dismiss='alert'>×</button><b>Failed!</b>The Engine could not be added because an error has occurred. The error has been logged and will be logged at. Please try again later.</div>";
}
}
echo "<div class='card' style='margin:20px 0' ><ul class=\"nav nav-pills\">
<li class=\"nav-item\">
<a class=\"nav-link disabled\" href=\"./?page=loggedin\"><b>Dashboard</b></a>
</li>
<li class=\"nav-item\" >
<a class=\"nav-link disabled\" href=\"javascript:void(0)\"><b>|</b></a>
</li>
<li class=\"nav-item\">
<a class=\"nav-link\" href=\"./all-samples.php\"><b>All Samples</b></a>
</li>
<li class=\"nav-item\" >
<a class=\"nav-link disabled\" href=\"javascript:void(0)\"><b>|</b></a>
</li>
<li class=\"nav-item float-right\" >
<a class=\"nav-link\" href=\"./upload-sample.php\"><b>Upload Sample</b></a>
</li>
<li class=\"nav-item\" >
<a class=\"nav-link disabled\" href=\"javascript:void(0)\"><b>|</b></a>
</li>
<li class=\"nav-item float-right\" >
<a class=\"nav-link\" href=\"./malware-test.php\"><b>Malware Troubleshoot</b></a>
</li>
</ul></div>";
echo '<h3 class="text-light" style="margin: 20px 0">Quick Stats <a class="btn btn-primary btn-sm float-right" role="button" href="javascript:void(0)" data-toggle="modal" data-target="#generateReport" data-backdrop="static"><i class="fas fa-download fa-sm text-white-50"></i> Generate Reports</a></h3>
';
require './statistics.php';
echo'<a class="btn btn-primary btn-sm float-right" role="button" href="javascript:void(0)" data-toggle="modal" data-target="#addCategory" data-backdrop="static"><i class="fas fa-plus fa-sm text-white-50"></i> Add Malware Category</a><h3 class="text-light">Malware Categories</h3>
<div class="row" style="margin: 20px 0">
';
require './malware-categories.php';
echo'</div>
<a class="btn btn-primary btn-sm float-right" role="button" href="javascript:void(0)" data-toggle="modal" data-target="#addEngine" data-backdrop="static"><i class="fas fa-plus fa-sm text-white-50"></i> Add Malware Engine</a>
<h3 class="text-light">Malware Engines </h3>
<div class="row" style="margin: 20px 0">
';
require './malware-engines.php';
echo '</div>
<a class="btn btn-primary btn-sm float-right" role="button" href="javascript:void(0)" data-toggle="modal" data-target="#addPlatform" data-backdrop="static"><i class="fas fa-plus fa-sm text-white-50"></i> Add New Platform</a>
<h3 class="text-light">Platforms / Operating Systems Available </h3>
<div class="row" style="margin: 20px 0">
';
require './platform-architecture.php';
echo '</div>
<h3 class="text-light">Live Attack Maps </h3>
<embed width="95%" height="701" src="https://cybermap.kaspersky.com/en/widget/dynamic/dark" frameborder="0">
';
}
function signup($conn){
if(isset($_POST['register_submit'])){
// prepare and bind
$firstname =$_POST["first_name"];
$lastname =$_POST["last_name"];
$username =$_POST["user_name"];
if(isset($_POST["porfolio_link"])){
$portfolio =$_POST["porfolio_link"];
}
else{
$portfolio=null;
}
if(isset($_POST["github_username"])){
$github_username =$_POST["github_username"];
}
else{
$github_username=null;
}
$email =$_POST["email"];
$password =md5(md5($_POST["password_repeat"]));
$account_status = null;
$auth_token = bin2hex(openssl_random_pseudo_bytes(128));
$fullname = $firstname." ".$lastname;
$stmt = $conn->prepare("INSERT INTO users(users_name, users_password, users_level, users_username, users_email, users_github, users_portfolio_link, users_account_status, users_auth_token, users_date_joined, user_groups_user_groups_id) VALUES (?, ?, 1,?,?,?,?,?,?,NOW(),1)");
$stmt->bind_param("ssssssss", $fullname, $password,$username,$email,$github_username,$portfolio,$account_status,$auth_token);
if($stmt->execute()){
echo "<div class='alert alert-success' style='margin:20px 0'><b>Success!</b> You have been succesfully signed up! <a href='./?page=signin'>Click me</a> to take you to sign in</div>";
}
else{
echo "<div class='alert alert-danger' style='margin:20px 0' >An error has occured and had been logged.</div>";
// logging error message to given log file
error_log($stmt->error);
}
$stmt->close();
}
echo '<div class="card shadow-lg o-hidden border-0 my-5">
<div class="card-body p-0">
<div class="row">
<div class="col-lg-5 d-none d-lg-flex">
<div class="flex-grow-1 bg-register-image" style="background-image: url("assets/img/dogs/image2.jpeg");"></div>
</div>
<div class="col-lg-7">
<div class="p-5">
<div class="text-center">
<h4 class="text-dark mb-4">Create an Account!</h4>
</div>
<form class="user" method="post" action="" onsubmit="return validateSignup()">
<div class="form-group row">
<div class="col-sm-6 mb-3 mb-sm-0"><input class="form-control form-control-user" type="text" id="FirstName" placeholder="First Name" name="first_name" required></div>
<div class="col-sm-6"><input class="form-control form-control-user" type="text" id="LastName" placeholder="Last Name" name="last_name" required></div>
</div>
<div class="form-group row">
<div class="col-sm-6 mb-3 mb-sm-0"><input class="form-control form-control-user" type="text" autocomplete="preferred-username" id="preferredUsername" placeholder="Preferred Username" name="user_name" required></div>
<div class="col-sm-6"><input class="form-control form-control-user" type="text" id="githubusername" placeholder="Github Username (Optional)" name="github_username"></div>
</div>
<div class="form-group"><input class="form-control form-control-user" type="url" id="portfolioLink" aria-describedby="emailHelp" placeholder="Preferred Username(Optional)" name="porfolio_link"></div>
<div class="form-group"><input class="form-control form-control-user" type="email" id="exampleInputEmail" aria-describedby="emailHelp" placeholder="Email Address" autocomplete="username" name="email" required></div>
<div class="form-group row">
<div class="col-sm-6 mb-3 mb-sm-0"><input class="form-control form-control-user" type="password" id="examplePasswordInput" placeholder="Password" autocomplete="new-password" name="password" required></div>
<div class="col-sm-6"><input class="form-control form-control-user" type="password" id="exampleRepeatPasswordInput" placeholder="Repeat Password" autocomplete="repeat-new-password" name="password_repeat" required></div>
</div>
<span id="password_error_message" class="text-danger" style="margin-bottom: 10px"></span>
<button class="btn btn-primary btn-block text-white btn-user" type="submit" name="register_submit"> Register Account</button>
<hr>
</form>
<div class="text-center"><a class="small" href="./?page=forgot">Forgot Password?</a></div>
<div class="text-center"><a class="small" href="./?page=signin">Already have an account? Login!</a></div>
</div>
</div>
</div>
</div>
</div>';
}
function signin($conn){
if(isset($_POST['signin_submit'])){
// prepare and bind
$username =$_POST["email_sign"];
$password =md5(md5($_POST["password_sign"]));
$sql = "SELECT * FROM users WHERE (users_username='$username' OR users_email = '$username') AND users_password ='$password';";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
echo "<div class='alert alert-success' style='margin:20px 0'><b>Success!</b> You are being signed in momentarily!</div>";
$_SESSION['username'] =$username;
$_SESSION['userimage'] ='avatar1.jpeg';
echo("<script>location.href = './?page=loggedin';</script>");
while($row = $result->fetch_assoc()){
$_SESSION["id"] =$row['id_users'];
}
} else {
echo "<div class='alert alert-danger' style='margin:20px 0'>Unable to sign you in. Have you checked if the credentials are correct?</div>";
}
}
echo '<div class="row justify-content-center"><div class="col-md-9 col-lg-12 col-xl-10">
<div class="card shadow-lg o-hidden border-0 my-5">
<div class="card-body p-0">
<div class="row">
<div class="col-lg-6 d-none d-lg-flex">
<div class="flex-grow-1 bg-login-image" style="background-image: url("assets/img/dogs/image3.jpeg");"></div>
</div>
<div class="col-lg-6">
<div class="p-5">
<div class="text-center">
<h4 class="text-dark mb-4">Welcome Back!</h4>
</div>
<form class="user" method="post" action="">
<div class="form-group"><input class="form-control form-control-user" type="text" autocomplete="username" required id="exampleInputEmail" aria-describedby="emailHelp" placeholder="Email Address or username" name="email_sign"></div>
<div class="form-group"><input class="form-control form-control-user" type="password" autocomplete="current-password" required id="exampleInputPassword" placeholder="Password" name="password_sign"></div>
<div class="form-group">
<div class="custom-control custom-checkbox small">
<div class="form-check"><input class="form-check-input custom-control-input" type="checkbox" id="formCheck-1"><label class="form-check-label custom-control-label" for="formCheck-1">Remember Me</label></div>
</div>
</div><button class="btn btn-primary btn-block text-white btn-user" type="submit" name="signin_submit">Login</button>
<hr>
</form>
<div class="text-center"><a class="small" href="./?page=forgot">Forgot Password?</a></div>
<div class="text-center"><a class="small" href="./?page=signup">Create an Account!</a></div>
</div>
</div>
</div>
</div>
</div>
</div></div>';
}
function forgotPassword(){
echo '<div class="row justify-content-center">
<div class="col-md-9 col-lg-12 col-xl-10">
<div class="card shadow-lg o-hidden border-0 my-5">
<div class="card-body p-0">
<div class="row">
<div class="col-lg-6 d-none d-lg-flex">
<div class="flex-grow-1 bg-password-image" style="background-image: url("assets/img/dogs/image1.jpeg");"></div>
</div>
<div class="col-lg-6">
<div class="p-5">
<div class="text-center">
<h4 class="text-dark mb-2">Forgot Your Password?</h4>
<p class="mb-4">We get it, stuff happens. Just enter your email address below and we\'ll send you a link to reset your password!</p>
</div>
<form class="user">
<div class="form-group"><input class="form-control form-control-user" type="email" id="exampleInputEmail" aria-describedby="emailHelp" placeholder="Enter Email Address..." name="email"></div><button class="btn btn-primary btn-block text-white btn-user"
type="submit">Reset Password</button></form>
<div class="text-center">
<hr><a class="small" href="./?page=signup">Create an Account!</a></div>
<div class="text-center"><a class="small" href="./?page=signin">Already have an account? Login!</a></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>';
}
function nonePage(){
echo '<div class="row">
<div class="row justify-content-center">
<div class="col-md-12 col-lg-12 col-xl-12" style="margin: 20px">
<div class="alert alert-danger"><strong>Danger ahead!</strong> All samples are live! If you don\'t know
how to handle the files you are about to download, kindly don\'t download. You might infect your devices
or network which can lead to catastrophic results</div>
<div class="card card-3" style="position: relative;">
<img src="./assets/img/background.jpg" class="img-fluid"/>
<div style="position: absolute; top: 8px; right: 16px; font-size: 18px; ">Malware hides in plain sight</div>
</div>
</div>
</div>
<div class="col-md-6 col-lg-6 col-xl-6" style="margin: 20px 0" >
<div class="card card-3">
<div class="card-body">
<h4 class="card-title">Are you infested with malware?</h4>
<h6 class="text-muted card-subtitle mb-2">Easy step by step discovery.</h6>
<p class="card-text">Our Application allows you to discover if your computer is infested with Malware or a Hardware issue. Sometimes it is hard to distinguish between hardware
failures or hardware bottlenecks that can result to your system acting up and slowing down.</p>
<a class="card-link" href="./malware-test.php">Start Now</a><a href ="#demo" class="card-link" data-toggle="collapse" data-target="#demo">Learn More</a></div>
<p class="collapse" id="demo" style="padding: 10px; margin-left: 10px" >With out stop at any time questionarre, we will calculate the probailtiy of
an issue affecting you being malware or a hardware issue. It is recommended that you do as many questions as possinle
to increase the accuracy and increase the probability of getting the cause.</p>
</div></div>
<div class="col-md-6 col-lg-6 col-xl-6" style="margin: 20px 0">
<div class="card card-3">
<div class="card-body">
<h4 class="card-title">Download Malware Samples</h4>
<h6 class="text-muted card-subtitle mb-2">Easy to download and set up</h6>
<p class="card-text">Once you log in, you can easily download and extract Malware Samples.</p>
<p class="text-danger card-text"><strong>Samples are purely for research and academic purposes only.</strong></p>
<a class="card-link" href="./all-samples.php">Download Now</a><a href ="#download-desc" class="card-link" data-toggle="collapse" data-target="#download-desc">Learn More</a></div>
<p class="collapse" id="download-desc" style="padding: 10px; margin-left: 10px" >The purpose of the Malware Repository is to allow for the study of
malware and enable people who are interested in malware analysis (or maybe even as a part of their job) to have
access to live malware, analyse the ways they operate, and maybe even enable advanced and savvy people to block
specific malware within their own environment. <br>
It is recommended to run the samples in a Virtual Machine which has no internet connection (or an internal virtual network if you must)
and without guest additions or any equivalents. Some of them are worms and will automatically try to spread out.
Running them unconstrained means that you will infect yourself or others with vicious and dangerous malware. Take
extreme caution when handling these samples.
</p>
</div></div>
</div>
<div class="row">
<div class="col-md-6 col-lg-6 col-xl-6" style="margin: 20px 0">
<div class="card card-3">
<div class="card-body">
<h4 class="card-title">Upload Malware Samples</h4>
<h6 class="text-muted card-subtitle mb-2">Sharing is caring.</h6>
<p class="card-text">
Uploading malware samples assists the community to research on the Malware and come up with better engines to
curb malware, detect them and come up with smarter ways of detecting and handling Malware.
</p><a class="card-link" href="./upload-sample.php">Upload Now</a><a href ="#upload-desc" class="card-link" data-toggle="collapse" data-target="#upload-desc">Learn More</a></div>
<p class="collapse" id="upload-desc" style="padding: 10px; margin-left: 10px" >Feel free to create a malware sample and share
with the community to allow the community research on Malware so as to enhance the security of applications and platforms. An sample sourced
and uploaded will be appreciated to help the community grow. Follow the procedure to upload the samples in a safe and recommended method. All samples are
uploaded as ZIP files and are locked with a password and encrypted to safely store and share them for sampling.
</p>
</div></div>
<div class="col-md-6 col-lg-6 col-xl-6" style="margin: 20px 0">
<div class="card card-3">
<div class="card-body">
<h4 class="card-title">Collaborate and Share information.</h4>
<h6 class="text-muted card-subtitle mb-2">Share important information with the community</h6>
<p class="card-text">
The vastness of knowledge and information is unmatched. Any information shared helps the community grow and helps
better understand Malware for all users in the community.
</p><a class="card-link" href="#">Learn More</a></div>
</div></div>
</div>
<div class="row">
<div class="col-md-6 col-lg-6 col-xl-6" style="margin: 20px 0">
<div class="card card-3">
<div class="card-body">
<h4 class="card-title">Download the Android app</h4>
<h6 class="text-muted card-subtitle mb-2">Easier and fast to access.</h6>
<p class="card-text">
Get the android app that will allow you to access the repository much easier and faster than typing urls to access the repository.
</p><a class="card-link" href="./app/app.apk" download>Download Now</a>
</div></div>
</div>';
}
function logout(){
session_destroy();
}
function clearContent($conn){
$category = $_SESSION["category"];
$sql = "SELECT * FROM malware_categories WHERE url_friendly='$category'";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
$categ_id = $row["id_malware_categories"];
echo "<div class='card' style='margin:20px 0' ><ul class=\"nav nav-pills\">
<li class=\"nav-item\">
<a class=\"nav-link\" href=\"./?page=loggedin\">Dashboard</a>
</li>
<li class=\"nav-item\" style='margin-left: -20px'>
<a class=\"nav-link disabled\" href=\"#\">|</a>
</li>
<li class=\"nav-item\" style='margin-left: -20px'>
<a class=\"nav-link disabled\" href=\"#\"><b>" . $row["name_of_category"]. "</b></a>
</li>
</ul></div>
<div style='margin:20px 0' class='card'><div class='card-body'>
<h3>" . $row["name_of_category"]. "</h3>
<hr>
<div class=\"row \" style='margin:40px 0'>
<div class='border-left-warning' id='definition'>
<blockquote class='blockquote' style='padding-left:10px;'>
" . $row["definition"]. "
</blockquote>
</div>
</div>
<h4>Effects on Devices</h4>
<div class=\"row \" style='margin:20px 0'>
<div id='effects'>
" . $row["effects"]. "
</div>
</div>
<h4>Signs and Symptoms of infection</h4>
<div class=\"row \" style='margin:20px 0'>
<div id='samples'>
" . $row["signs_and_symptoms"]. "
</div>
</div>
<h4>Malware Engines</h4>
<div class=\"row \" style='margin:20px 0'>
<div id='samples'>
This is the malware engine that are mainly in that category
</div>
</div>
<h4>Platforms Affected</h4>
<div class=\"row \" style='margin:20px 0'>
<div id='samples'>
".$row['platforms_affected']."
</div>
</div>
<h4>Samples</h4>
<div class=\"row \" style='margin:20px 0'>
<div class='card-deck' id='samples' style='padding-left:10px;'>";
$sqlsample = "SELECT * FROM malware_samples WHERE category_malware='$categ_id'";
$result_sample= $conn->query($sqlsample);
if ($result_sample->num_rows > 0) {
// output data of each row
while($row_sample = $result_sample->fetch_assoc()) {
echo '<div class="card shadow border-left-danger py-2">
<div class="card-body">
<div class="row align-items-center no-gutters">
<div class="col mr-2">
<div class="text-uppercase text-danger font-weight-bold text-xs mb-1"><span>'.$row["name_of_category"].'</span></div>
<div class="text-dark font-weight-bold h5 mb-0"><span>'.$row_sample['malware_name'].'</span></div><br>
<a href="'.$row_sample['url_file'].'" download><i class="fas fa-download"></i> Download</a>
<a href="javascript:void(0)"><i class="fas fa-arrow-right"></i> Details</a>
</div>
<div class="col-auto"><i class="fas fa-bug fa-2x text-gray-300"></i></div>
</div>
</div>
</div>';
}
} else {
echo "<span class='text-danger'>No sample has been uploaded yet</span>";
}
echo "</div>
</div>
</div></div>";
}
} else {
echo "<div style='margin:20px 0' class='card'><div class='card-body'>
<h3 class='text-danger'>❌ Category doesn't exist</h3>
<hr>
<div class=\"row \" style='margin:40px 0'>
Unfortunately we could not find the requested Category. Please refresh or click <a href='./?page=home'>here</a> to go back home.
</div>
</div>
";
}
$conn->close();
}
function startTest(){
echo 'Test Code';
}