首页 > 编程 > .NET > 正文

.net探针

2024-07-10 12:59:04
字体:
来源:转载
供稿:网友
未经说明,本blog.csdn.net/wind7788均为本人原创代码,凡是引用或者应用请注明出处,表示对作者的尊重.

以下代码主要使用了namevaluecollection来存储信息,用htmltable来显示信息.以方便扩展.你也可以用xml来存储要刺探的项目,这样更有利于扩充.

using system;
using system.collections;
using system.collections.specialized;
using system.componentmodel;
using system.data;
using system.drawing;
using system.web;
using system.web.sessionstate;
using system.web.ui;
using system.web.ui.webcontrols;
using system.web.ui.htmlcontrols;

namespace addr.admin
{
?///
?/// bougie 的摘要说明。
?///
?public class bougie : system.web.ui.page
?{
??protected htmltable serverinfo,cominfo,clientinfo;
??protected system.web.ui.webcontrols.textbox newcom;
??protected system.web.ui.webcontrols.button ok1;
??protected system.web.ui.webcontrols.label resultcom;
??protected system.web.ui.webcontrols.label resultadd;
??protected system.web.ui.webcontrols.textbox newexec;
??protected system.web.ui.webcontrols.validationsummary val2;
??protected system.web.ui.webcontrols.button ok2;
??protected system.web.ui.webcontrols.rangevalidator val1;
??protected system.web.ui.webcontrols.requiredfieldvalidator val3;
??protected system.web.ui.htmlcontrols.htmltablecell copyright;
?
??private void page_load(object sender, system.eventargs e)
??{
???// 在此处放置用户代码以初始化页面
???response.expires = 0;
???response.cachecontrol = "no-cache";

???namevaluecollection nvcserver=new namevaluecollection();
???namevaluecollection nvccom=new namevaluecollection();
???namevaluecollection nvcclient=new namevaluecollection();

????datetime starttime=datetime.now;
????//服务器信息
????nvcserver.add("服务器名称",server.machinename);
????nvcserver.add("服务器ip地址",request.servervariables["local_addr"]);
????nvcserver.add("服务器域名",request.servervariables["server_name"]);
????nvcserver.add(".net框架版本",environment.version.tostring());
????nvcserver.add("服务器操作系统",environment.osversion.tostring());
????nvcserver.add("iis环境",request.servervariables["server_software"]);
????nvcserver.add("服务器端口",request.servervariables["server_port"]);
????nvcserver.add("脚本超时设置",server.scripttimeout.tostring());
????nvcserver.add("服务器现在时间",datetime.now.tostring());
????nvcserver.add("虚拟目录绝对路径",request.servervariables["appl_physical_path"]);
????nvcserver.add("执行文件绝对路进",request.servervariables["path_translated"]);
????nvcserver.add("https支持",request.servervariables["https"]);
????nvcserver.add("session总数",session.keys.count.tostring());
????nvcserver.add("application总数",application.keys.count.tostring());
????//组件支持情况
????if (checkobject("jmail.smtpmail"))
????{
?????nvccom.add("jmail邮件","√");
????}
????else
????{
?????nvccom.add("jmail邮件","×");
????}
?
????if (checkobject("persits.mailsender"))
????{
?????nvccom.add("persits邮件","√");
????}
????else
????{
?????nvccom.add("persits邮件","×");
????}

????if (checkobject("geocel.mailer"))
????{
?????nvccom.add("geocel邮件","√");
????}
????else
????{
?????nvccom.add("geocel邮件","×");
????}
?
????if (checkobject("smtpmail.smtpmail.1"))
????{
?????nvccom.add("smtpmail邮件","√");
????}
????else
????{
?????nvccom.add("smtpmail邮件","×");
????}
?
????if (checkobject("persits.upload.1"))
????{
?????nvccom.add("persits上传","√");
????}
????else
????{
?????nvccom.add("persits上传","×");
????}

????if (checkobject("aspcn.upload"))
????{
?????nvccom.add("paspcn上传","√");
????}
????else
????{
?????nvccom.add("paspcn上传","×");
????}

????if (checkobject("lyfupload.uploadfile"))
????{
?????nvccom.add("lyfupload上传","√");
????}
????else
????{
?????nvccom.add("lyfupload上传","×");
????}
?
????if (checkobject("softartisans.filemanager"))
????{
?????nvccom.add("softartisans文件管理","√");
????}
????else
????{
?????? nvccom.add("softartisans文件管理","×");
????}

????if (checkobject("w3.upload"))
????{
?????nvccom.add("w3上传","√");
????}
????else
????{
?????nvccom.add("w3上传","×");
????}
?
????if (checkobject("w3image.image"))
????{
?????nvccom.add("w3image图像读写","√");
????}
????else
????{
?????nvccom.add("w3image图像读写","×");
????}
????if(checkobject("adodb.connection"))
????{
?????nvccom.add("ado数据连接","√");
????}
????else
????{
?????nvccom.add("ado数据连接","×");
????}
????if(checkobject("adodb.recordset"))
????{
?????nvccom.add("ado数据集","√");
????}
????else
????{
?????nvccom.add("ado数据集","×");
????}
????if (checkobject("scripting.filesystemobject"))
????{
?????nvccom.add("fso","√");
????}
????else
????{
?????nvccom.add("fso","×");
????}
????if (checkobject("cdonts.newmail"))
????{
?????nvccom.add("cdonts邮件","√");
????}
????else
????{
?????nvccom.add("cdonts邮件","×");
????}
????//客户端信息
????nvcclient.add("客户端ip地址",request.servervariables["remote_addr"]);
????httpbrowsercapabilities hbc=request.browser;
????nvcclient.add("客户端操作系统",hbc.platform.tostring());
????nvcclient.add("浏览器",hbc.browser.tostring());
????nvcclient.add("浏览器版本",hbc.version.tostring());
????nvcclient.add("vbs",hbc.vbscript.tostring());
????nvcclient.add("js",hbc.javascript.tostring());
????nvcclient.add("activex",hbc.activexcontrols.tostring());
????nvcclient.add("javaapplets",hbc.javaapplets.tostring());
????nvcclient.add("语言",request.servervariables["http_accept_language"]);
????nvcclient.add("框架支持",hbc.frames.tostring());
????nvcclient.add("cookie支持",hbc.cookies.tostring());
????nvcclient.add("dom",hbc.msdomversion.tostring());
????//写出数据
????writeout(nvcserver,serverinfo);
????writeout(nvccom,cominfo);
????writeout(nvcclient,clientinfo);

????datetime endtime=datetime.now;
???copyright.innerhtml="本页执行时间:"+((endtime-starttime).totalseconds).tostring()+"秒 ";
???copyright.innerhtml+="copyrighy ©2004 - 2006 4renx.com .netbougie version 1.0
千山一鸟作品[[email protected]]";
??}
??private void writeout(namevaluecollection nvc,htmltable ht)
??{
???for(int i=0;i???{
????htmltablerow tr=new htmltablerow();
????for(int j=0;j<2;j++)
????{
?????htmltablecell td=new htmltablecell();
?????td.innerhtml=nvc.getkey(i).tostring();
?????td.width="20%";
?????htmltablecell td1=new htmltablecell();
?????td1.innerhtml=nvc[i].tostring();
?????td1.width="30%";
?????tr.controls.add(td);
?????tr.controls.add(td1);
?????i++;
????}
????ht.controls.add(tr);
???}
??}
??private bool checkobject(string obj)
??{
???try
???{
????object meobj = server.createobject(obj);
????return(true);
???}
???catch
???{
????return(false);
???}
??}

??#region web form designer generated code
??override protected void oninit(eventargs e)
??{
???//
???// codegen:该调用是 asp.net web 窗体设计器所必需的。
???//
???initializecomponent();
???base.oninit(e);
??}
??
??///
??/// 设计器支持所需的方法 - 不要使用代码编辑器修改
??/// 此方法的内容。
??///
??private void initializecomponent()
??{???
???this.ok1.click += new system.eventhandler(this.ok1_click);
???this.ok2.click += new system.eventhandler(this.ok2_click);
???this.load += new system.eventhandler(this.page_load);

??}
??#endregion

??private void ok1_click(object sender, system.eventargs e)
??{
???if(checkobject(newcom.text))
???{
????resultcom.text="√";
???}
???else
???{
????resultcom.text="×";
???}
??}

??private void ok2_click(object sender, system.eventargs e)
??{
???try
???{
????int sum=0;
????int newdata=convert.toint32(newexec.text.trim());
????datetime starttime=datetime.now;
????for(int i=0;i????{
?????sum+=i;
????}
????datetime endtime=datetime.now;
????resultadd.text=((endtime-starttime).totalmilliseconds).tostring()+"毫秒";
???}
???catch
???{
????resultadd.text="执行错误!可能是参数无效!";
???}
??}

?}
}





?
??
??
??
??
??http://schemas.microsoft.com/intellisense/ie5">
??
??
?
?
??
???
????
????? 服务器信息
????

???
???
???
???
????
????? 组件支持信息
????

???
???
???
???
????
????? 客户端信息
????

???
???
???
???
????
????? 组件支持查询及执行效率查询
????

????
????? 自定义组件查询
?????
??????
?????
??????
?????
??????
????

????
????? 加法循环测试
???????
???????
?????
??????10000000
?????
??????
?????
??????
????

???
???
????
?????
????

???
???
??

?



?

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表