Advertisement
Ribang

Protect Folder Via Htaccess

Feb 4th, 2018
611
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.33 KB | None | 0 0
  1. <?php
  2. /*
  3. [+] Simple & Useful :)
  4. [+] By: xSecurity
  5. [+] Home: www.sec4ever.com
  6. => www.is-sec.com
  7. => www.dev-point.com
  8. [+] Skype: xSecur1ty
  9. */
  10. echo "<form method='POST'>
  11. <title>[Protect] Folder Via Htaccess =) | By: xSecurity</title>
  12. <center>
  13. <br><br>\<font face='Tahoma' size='5'><b><font color='red'>Protect</font> Folder Via Htaccess</b></font><font face='Tahoma' size='2'>/xSecurity</font><br><br>
  14. <font face='Tahoma' size='2'>Path: <input type='text' name='path' value='/home/".@get_current_user()."/' size='50'><br>
  15. <input type='text' name='username' placeholder='Username'>
  16. <input type='text' name='password' placeholder='Password'>
  17. <input type='submit' value='Generate Protection' name='submit'></font></form></center>";
  18. # POSTS
  19. $username = $_POST['username'];
  20. $password = $_POST['password'];
  21. $path = $_POST['path'];
  22. # htaccess
  23. $htaccess = "IyBHZW5lcmF0ZWQgQnkgeFNlY3VyaXR5IAojIERlVi1Qb2luVC5Db00KCkF1dGhUeXBlIEJhc2ljCkF1dGhOYW1lICJQcm90ZWN0ZWRbeFNlY3VyaXR5XSIKQXV0aFVzZXJGaWxlICN4c2VjdXJpdHkjLy5odHBhc3N3ZApSZXF1aXJlIHZhbGlkLXVzZXI=";
  24.  
  25. $b0x = str_replace("#xsecurity#" ,$path ,base64_decode($htaccess));
  26. $crypt = crypt($password, base64_encode($password));
  27.  
  28. # Create
  29. if($_POST['submit'])
  30. {
  31. $htpasswd = fopen($path.'.htpasswd', 'w');
  32. if($htpasswd)
  33. {
  34. $s = $username.":".$crypt;
  35. $x = fwrite($htpasswd,$s);
  36. if($x)
  37. {
  38. print "<center><font face='Tahoma' size='2'>[+] <b>.htpasswd</b> Created </center></font>";
  39. }
  40. }
  41. $htx = fopen('.htaccess','w');
  42. if($htx)
  43. {
  44. $xx = fwrite($htx, $b0x);
  45. if($xx)
  46. {
  47. print "<center><font face='Tahoma' size='2'>[+] <b>.htaccess</b> Created</font>";
  48. }
  49. }
  50. }
  51. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement