Advertisement
Guest User

Untitled

a guest
Jan 17th, 2014
593
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import Meddler;
  2. import System;
  3. import System.Net.Sockets;
  4. import System.Windows.Forms;
  5.  
  6. class Handlers
  7. {
  8.     static function OnConnection(oSession: Session)
  9.     {
  10.         if (oSession.ReadRequest()){       
  11.             var oHeaders: ResponseHeaders = new ResponseHeaders();
  12.             oHeaders.Status = "200 OK";
  13.             oHeaders["Connection"] = "close";
  14.            
  15.  
  16.             if (oSession.urlContains("filedownload")){
  17.                 oHeaders["Content-Type"] = "application/pdf";
  18.                 oHeaders["Set-Cookie"] = "filedownload=" + oSession.id.ToString();
  19.                 oHeaders["Content-Disposition"] = "attachment; filename=download#"+ oSession.id.ToString() +".dat";
  20.                 oSession.WriteString(oHeaders);
  21.                 for (var x=0;x<200; x++)
  22.                 {
  23.                     oSession.WriteBytes(Fuzz.NewByteArray(1024));
  24.                     System.Threading.Thread.Sleep(100);
  25.                 }
  26.             }
  27.             else
  28.             {
  29.                 oHeaders["Content-Type"] = "text/html";
  30.                 oSession.WriteString(oHeaders);
  31.                 oSession.WriteString("<HTML><head><script>");
  32.                 oSession.WriteString("window.setInterval(function() {document.getElementById('divCookie').textContent = document.cookie;}, 200);");
  33.                 oSession.WriteString("</script></head><BODY><div id='divCookie'></div>");
  34.                
  35.                 //for (var x = 0; x<15; x++){
  36.                
  37.                     oSession.WriteString("<iframe src='filedownload'></iframe>");
  38.                 //}
  39.                 oSession.WriteString("</body></html>");
  40.                
  41.             }  
  42.         }
  43.            
  44.         oSession.CloseSocket();
  45.     }
  46.  
  47.     static function Main()
  48.     {
  49.         var today: Date = new Date();
  50.         MeddlerObject.StatusText = " Rules.js was loaded at: " + today;
  51.     }
  52.    
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement