梦想成真工作室 | mxcz.net


网管常用技术&工具

  • oracle 热备压缩打包脚本
  • 批量添加打印机脚本
  • windows 错误代码生成脚本
  • 查询 sql server 每天产生新表的存储过程
  • 绿色的MAC地址扫描器
  • EMAIL 服务器测试工具
  • Windows下的grep(强大的文本搜索工具)
  • windows下强大的wmic命令行工具
  • IIS下URLSCAN防注入配置
  • 如何通过telnet在命令行方式下验证email发送和http状态

  • oracle 热备压缩打包脚本

    backup.bat

    d:
    rem 设置创建备份脚本的位置
    set sql=E:\work\oraclebackup.sql
    rem 设置目标脚本的位置
    set targetsql=d:\mybackup.sql
    rem 设置用密码
    set usrpwd=sys/sys
    rem 设置服务名
    set sid=xiele
    set /a bHour=%time:~0,2%
    set /a bMinute = %time:~3,2%
    if %bHour% lss 10 set bHour = %bHour%
      
    rem 设置ORACLE_SID   
      
    set ORACLE_SID=%sid%   
      
    rem 设置备份目录  
    if not exist d:\db_backup md db_backup
    if not exist d:\db_backup\%sid%%date:~0,4%%date:~5,2%%date:~8,2%_%bHour%%bMinute% md d:\db_backup\%sid%%date:~0,4%%date:~5,2%%date:~8,2%_%bHour%%bMinute%
    if not exist d:\db_backup\%sid%%date:~0,4%%date:~5,2%%date:~8,2%_%bHour%%bMinute%\archive md d:\db_backup\%sid%%date:~0,4%%date:~5,2%%date:~8,2%_%bHour%%bMinute%\archive
      
    set backup_target_path=d:\db_backup\%sid%%date:~0,4%%date:~5,2%%date:~8,2%_%bHour%%bMinute%\
      
    rem 设置归档日志目录   
      
    set archive_source_path=D:\oracle\archive\
    set archive_target_path= %backup_target_path%archive\
    rem 归档目录1
      
    rem 创建备份的SQLPLUS脚本到mybackup.sql文件
      
    D:\oracle\ora92\bin\sqlplus "sys/sys as sysdba"  @%sql% %targetsql%  %usrpwd%  %sid%  %backup_target_path%  %archive_source_path%  %archive_target_path%
    rem 执行备份   
      
    D:\oracle\ora92\bin\sqlplus /nolog @%targetsql%
    "C:\Program Files\WinRAR\rar" a -r -ep1 "D:\DB_BACKUP\%sid%%date:~0,4%%date:~5,2%%date:~8,2%_%bHour%%bMinute%.rar" "D:\DB_BACKUP\%sid%%date:~0,4%%date:~5,2%%date:~8,2%_%bHour%%bMinute%\*.*"
    if %errorlevel% GEQ 1 goto exit
    if %errorlevel% EQU 0 goto y
    :y
    rd /s /q d:\db_backup\%sid%%date:~0,4%%date:~5,2%%date:~8,2%_%bHour%%bMinute%
    goto exit
    :exit
    exit


    oraclebackup.sql

    --connect sys/sys@xiele as SYSDBA   
      
      
    set pagesize 0;
    set verify off;
    set trimspool on;
    set termout off;
    --关闭屏幕输出   
      
    set term off;   
      
    --关闭输出列头信息   
      
    set heading off;   
      
    --设置行长度   
      
    set linesize 500;   
      
    --关闭输出统计行数信息   
      
    set feedback off;   
      
    --变量扫描   
      
    SET SCAN on;   
      
    --打开输出   
      
    SET SERVEROUTPUT ON SIZE 100000;   
      
    spool off;
    --将生成的脚本输出到mybackup.sql文件   
      
    spool &1
    declare  
      
       --读取数据表空间
      
       cursor cur_tbs is  
      
        select distinct b.* from v$datafile a, v$tablespace b where a.TS# = b.TS#;   
      
       --读取表空间数据文件   
      
       cursor cur_datafile(iTS integer) is  
      
        select * from v$datafile a where a.TS# = iTS;   
      
       --读取控制文件   
      
       cursor cur_controlfile is  
      
       select * from v$controlfile;   
      
       --读取重做日志文件   
      
       cursor cur_redofile is  
      
       select * from v$logfile;   
      
    begin  
      
       --输出连接数据库命令
       dbms_output.put_line('connect &2@&3 as SYSDBA;');  
      
       for rec_tbs in cur_tbs loop   
        --排除临时表
       
        IF not(instr(lower(rec_tbs.name),'tmp')>0 or instr(lower(rec_tbs.name),'temp')>0)  then
      
        --输出开始备份表空间命令   
      
        dbms_output.put_line('alter tablespace ' || rec_tbs.name ||' begin backup;');   
      
        for rec_datafile in cur_datafile(rec_tbs.ts#) loop   
      
           --输出操作系统复制数据文件命令
      
           dbms_output.put_line('host copy /Y "'||rec_datafile.name||'" "&4";');   
      
        end loop;   
      
        --输出结束备份表空间命令   
      
        dbms_output.put_line('alter tablespace ' || rec_tbs.name || ' end backup;');   
        end if;
      
       end loop;   
      
       for rec_controlfile in cur_controlfile loop   
      
        --输出操作系统复制控制文件命令   
      
        dbms_output.put_line('host copy /Y  "'||rec_controlfile.name||'" "&4";');   
      
       end loop;   
      
       --输出切换日志命令   
    -- dbms_output.put_line('alter system switch logfile;');
       dbms_output.put_line('alter system archive log current;');   
      
       --输出备份归档日志文件命令   
      
       dbms_output.put_line('host copy /Y "&5*.*" "&6";');   
      
       for rec_redofile in cur_redofile loop   
      
        --输出备份重做日志文件命令   
      
        dbms_output.put_line('host copy /Y  "'||rec_redofile.member||'" "&4";');   
      
       end loop;  
       --输出pfile
       dbms_output.put_line('create pfile=''&4'||'initpfile.ora'' from spfile;');
       --输出退出sqlplus命令   
       dbms_output.put_line('exit;');   
      
    end;   
      
    /   
      
    spool off   
      
    exit;


    exp 导出批处理

    D:
    cd \db_backup
    del oraexpcmd.txt /q
    ECHO =======Backup xxxx DB=======
    set /a bHour=%time:~0,2%
    set /a bMinute = %time:~3,2%
    if %bHour% lss 10 set bHour = %bHour%
    copy nul oraexpcmd.txt
    echo xiele@xiele>>oraexpcmd.txt
    echo tide>>oraexpcmd.txt
    echo 65536>>oraexpcmd.txt
    echo D:\DB_BACKUP\exp_DB\shopDB%date:~4,4%%date:~9,2%%date:~12,2%_%bHour%%bMinute%.dump>>oraexpcmd.txt
    echo E>>oraexpcmd.txt
    echo yes>>oraexpcmd.txt
    echo yes>>oraexpcmd.txt
    echo yes>>oraexpcmd.txt
    exp log=D:\DB_BACKUP\exp_log\shopDB%date:~4,4%%date:~9,2%%date:~12,2%_%bHour%%bMinute%.log file=D:\DB_BACKUP\exp_DB\shopDB%date:~4,4%%date:~9,2%%date:~12,2%_%bHour%%bMinute%.dump<oraexpcmd.txt
    "C:\Program Files\WinRAR\rar" a -ep "D:\DB_BACKUP\exp_DB\shopDB%date:~4,4%%date:~9,2%%date:~12,2%_%bHour%%bMinute%.rar" "D:\DB_BACKUP\exp_DB\shopDB%date:~4,4%%date:~9,2%%date:~12,2%_%bHour%%bMinute%.dump"
    if %errorlevel% GEQ 1 goto exit
    if %errorlevel% EQU 0 goto y
    :y
    del /F /S /Q "D:\DB_BACKUP\exp_DB\shopDB%date:~4,4%%date:~9,2%%date:~12,2%_%bHour%%bMinute%.dump"
    goto exit
    :exit
    exit

    打包下载


    批量添加打印机脚本

    <job id="addprint">
    <script language="javascript">
    var ie=WScript.createobject("internetexplorer.application");
    ie.menubar=0;
    ie.addressbar=0 ;
    ie.toolbar=0;
    ie.statusbar=0;
    ie.width=600;
    ie.height=500;
    ie.resizable=1;
    ie.navigate("about:blank");
    SynchronizeIE();
    ie.left=Math.floor((ie.document.parentWindow.screen.availWidth-ie.width)/2);
    ie.top=Math.floor((ie.document.parentWindow.screen.availHeight-ie.height)/2);
    ie.visible=1;
    with (ie.document)
    {
    write("<html><head><title>梦想成真 打印机安装</title></head><body bgcolor=#dddddd scroll=no>");
    write("<h2 align=center>电脑上安装的打印机</h2><br>");
    write("<p align=center><br>");
    write("</body></html>");
    }
    var strComputer =".";

     

    var objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate,(LoadDriver)}!\\\\" + strComputer + "\\root\\cimv2");
    var colItems = objWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystem");
    var colItems = new Enumerator(colItems);
    for (; !colItems.atEnd(); colItems.moveNext())
    {
    var objItem = colItems.item();
    ie.document.write("计算机名: " + objItem.DNSHostName);
    ie.document.write("<br>");
    ie.document.write("域名: " + objItem.Domain);
    ie.document.write("<br>");
    }

    var colItems = objWMIService.ExecQuery("SELECT * FROM Win32_Printer");

    ie.document.write("<br>");
    ie.document.write("--------------------------------");
    ie.document.write("<br>");
    ie.document.write("原有的打印机");
    ie.document.write("<br>");
    var colItems = new Enumerator(colItems);
    for (; !colItems.atEnd(); colItems.moveNext())
    {
    var objItem = colItems.item();
    ie.document.write("<br>");
    ie.document.write(objItem.DeviceID);
    }
    ie.document.write("<br>");
    ie.document.write("请等待.......");

    try
    {
    //先添加驱动。不支持2000一下操作系统。包括2000
    var shell = WScript.createObject("wscript.shell");
    shell.run('cmd.exe /c cscript %windir%\\system32\\prndrvr.vbs -a -m "Samsung ML-2550 Series PCL 6" -i \\\\109.254.1.8\\打印机驱动\\Samsung\\ML-2550_PCL\\WIN2000\\ml2550.INF -h \\\\109.254.1.8\\打印机驱动\\Samsung\\ML-2550_PCL\\WIN2000',0,true);
    shell.run('cmd.exe /c cscript %windir%\\system32\\prndrvr.vbs -a -m "Samsung CLP-600 Series" -i \\\\109.254.1.8\\打印机驱动\\Samsung\\clp-600\\WIN2KXP\\SUGD1.inf -h \\\\109.254.1.8\\打印机驱动\\Samsung\\clp-600\\WIN2KXP',0,true);
    shell.run('cmd.exe /c cscript %windir%\\system32\\prndrvr.vbs -a -m "HP Color LaserJet 4650 PS" -i \\\\109.254.1.8\\打印机驱动\\hp\\4650\\chi_simp\\Drivers\\Win32_2000_XP_S2003\\PS\\hpc4650d.inf -h \\\\109.254.1.8\\打印机驱动\\hp\\4650\\chi_simp\\Drivers\\Win32_2000_XP_S2003\\PS',0,true);

    //var objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate,(LoadDriver)}!\\\\" + strComputer + "\\root\\cimv2");
    //添加打印端口tcpip
    //109.254.4.254
    var objNewPort = objWMIService.Get("Win32_TCPIPPrinterPort").SpawnInstance_();
    objNewPort.Name = "IP_109.254.4.254";
    objNewPort.Protocol = 1;
    objNewPort.HostAddress = "109.254.4.254";
    objNewPort.PortNumber = "9100";
    objNewPort.SNMPEnabled = false;
    objNewPort.Put_();
    //109.254.4.253
    var objNewPort = objWMIService.Get("Win32_TCPIPPrinterPort").SpawnInstance_();
    objNewPort.Name = "IP_109.254.4.253";
    objNewPort.Protocol = 1;
    objNewPort.HostAddress = "109.254.4.253";
    objNewPort.PortNumber = "9100";
    objNewPort.SNMPEnabled = false;
    objNewPort.Put_();
    //109.254.4.252
    var objNewPort = objWMIService.Get("Win32_TCPIPPrinterPort").SpawnInstance_();
    objNewPort.Name = "IP_109.254.4.252";
    objNewPort.Protocol = 1;
    objNewPort.HostAddress = "109.254.4.252";
    objNewPort.PortNumber = "9100";
    objNewPort.SNMPEnabled = false;
    objNewPort.Put_();
    //109.254.3.254
    var objNewPort = objWMIService.Get("Win32_TCPIPPrinterPort").SpawnInstance_();
    objNewPort.Name = "IP_109.254.3.254";
    objNewPort.Protocol = 1;
    objNewPort.HostAddress = "109.254.3.254";
    objNewPort.PortNumber = "9100";
    objNewPort.SNMPEnabled = false;
    objNewPort.Put_();
    //109.254.3.253
    var objNewPort = objWMIService.Get("Win32_TCPIPPrinterPort").SpawnInstance_();
    objNewPort.Name = "IP_109.254.3.253";
    objNewPort.Protocol = 1;
    objNewPort.HostAddress = "109.254.3.253";
    objNewPort.PortNumber = "9100";
    objNewPort.SNMPEnabled = false;
    objNewPort.Put_();
    //109.254.1.254
    var objNewPort = objWMIService.Get("Win32_TCPIPPrinterPort").SpawnInstance_();
    objNewPort.Name = "IP_109.254.1.254";
    objNewPort.Protocol = 1;
    objNewPort.HostAddress = "109.254.1.254";
    objNewPort.PortNumber = "9100";
    objNewPort.SNMPEnabled = false;
    objNewPort.Put_();
    //109.254.1.253
    var objNewPort = objWMIService.Get("Win32_TCPIPPrinterPort").SpawnInstance_();
    objNewPort.Name = "IP_109.254.1.253";
    objNewPort.Protocol = 1;
    objNewPort.HostAddress = "109.254.1.253";
    objNewPort.PortNumber = "9100";
    objNewPort.SNMPEnabled = false;
    objNewPort.Put_();

    /*添加驱动程序。测试失败,改用cmd方式,在最上面
    //命令行方式添加驱动
    //rundll32 printui.dll,PrintUIEntry /Xs /n\\SERVER\PRINTERSHARENAME DriverName "Lexmark C752 PS3"

    var objDriver = objWMIService.Get("Win32_PrinterDriver")
    objDriver.Name = "Samsung ML-2550 Series PCL 6";
    objDriver.SupportedPlatform = "Windows NT x86";
    objDriver.Version = "1.28";
    objDriver.FilePath = "\\109.254.1.8\打印机驱动\Samsung\ML-2550_PCL\WIN2000";
    objDriver.InfName = "\\109.254.1.8\打印机驱动\Samsung\ML-2550_PCL\WIN2000\ml2550.INF";
    intResult = objDriver.AddPrinterDriver(objDriver);
    //WScript.Echo(intResult);
    */

    //添加打印机
    //109.254.4.254
    var objPrinter = objWMIService.Get("Win32_Printer").SpawnInstance_();
    objPrinter.DriverName = "Samsung ML-2550 Series PCL 6";
    objPrinter.PortName = "IP_109.254.4.254";
    objPrinter.DeviceID = "22F-1";
    objPrinter.Location = "梦想成真";
    objPrinter.Network = true;
    objPrinter.Put_();
    //109.254.4.253
    var objPrinter = objWMIService.Get("Win32_Printer").SpawnInstance_();
    objPrinter.DriverName = "Samsung CLP-600 Series";
    objPrinter.PortName = "IP_109.254.4.253";
    objPrinter.DeviceID = "22F-2(color)";
    objPrinter.Location = "梦想成真";
    objPrinter.Network = true;
    objPrinter.Put_();
    //109.254.4.252
    var objPrinter = objWMIService.Get("Win32_Printer").SpawnInstance_();
    objPrinter.DriverName = "Samsung ML-2550 Series PCL 6";
    objPrinter.PortName = "IP_109.254.4.252";
    objPrinter.DeviceID = "22F-3";
    objPrinter.Location = "梦想成真";
    objPrinter.Network = true;
    objPrinter.Put_();
    //109.254.3.254
    var objPrinter = objWMIService.Get("Win32_Printer").SpawnInstance_();
    objPrinter.DriverName = "Samsung ML-2550 Series PCL 6";
    objPrinter.PortName = "IP_109.254.3.254";
    objPrinter.DeviceID = "7F-1";
    objPrinter.Location = "梦想成真";
    objPrinter.Network = true;
    objPrinter.Put_();
    //109.254.3.253
    var objPrinter = objWMIService.Get("Win32_Printer").SpawnInstance_();
    objPrinter.DriverName = "HP Color LaserJet 4650 PS";
    objPrinter.PortName = "IP_109.254.3.253";
    objPrinter.DeviceID = "7F-2(color)";
    objPrinter.Location = "梦想成真";
    objPrinter.Network = true;
    objPrinter.Put_();
    //109.254.1.254
    var objPrinter = objWMIService.Get("Win32_Printer").SpawnInstance_();
    objPrinter.DriverName = "Samsung ML-2550 Series PCL 6";
    objPrinter.PortName = "IP_109.254.1.254";
    objPrinter.DeviceID = "6F-1";
    objPrinter.Location = "梦想成真";
    objPrinter.Network = true;
    objPrinter.Put_();
    //109.254.1.253
    var objPrinter = objWMIService.Get("Win32_Printer").SpawnInstance_();
    objPrinter.DriverName = "Samsung ML-2550 Series PCL 6";
    objPrinter.PortName = "IP_109.254.1.253";
    objPrinter.DeviceID = "6F-2";
    objPrinter.Location = "梦想成真";
    objPrinter.Network = true;
    objPrinter.Put_();

     

    /*
    //默认打印机
    var colInstalledPrinters = objWMIService.ExecQuery("Select * from Win32_Printer Where Name = '" + objPrinter.DriverName + "'")
    var colItems = new Enumerator(colInstalledPrinters);
    for (; !colInstalledPrinters.atEnd(); colInstalledPrinters.moveNext())
    {
    var objItem = colItems.item();
    objItem.SetDefaultPrinter();
    }

    */

    //再次显示打印机
    var colItems = objWMIService.ExecQuery("SELECT * FROM Win32_Printer");

    ie.document.write("<br>");
    ie.document.write("--------------------------------");
    ie.document.write("<br>");
    ie.document.write("现有的打印机");
    ie.document.write("<br>");
    var colItems = new Enumerator(colItems);
    for (; !colItems.atEnd(); colItems.moveNext())
    {
    var objItem = colItems.item();
    ie.document.write("<br>");
    ie.document.write(objItem.DeviceID);
    ie.document.write("<br>");
    ie.document.write("安装完成");
    }
    }
    catch(e)
    {
    ie.document.write("<br><font color='red'>" + e.message + "</font>");
    }

    //等待IE操作结束。
    function SynchronizeIE()
    {
    while(ie.Busy)
    {
    WScript.Sleep(600);
    }
    }
    </script>
    </job>

    打包下载   windows bat 版本

    windows 错误代码生成脚本

    for /l %%a in (0,1,6019) do (
    for /f %%z in ('net helpmsg %%a') do @echo %%a %%z>>c:\windowsErrorCode.txt)
    )

    写入一个bat文件,双击运行。生成的内容如下

    0 操作成功完成。
    1 函数不正确。
    2 系统找不到指定的文件。
    3 系统找不到指定的路径。
    4 系统无法打开文件。
    5 拒绝访问。
    6 句柄无效。
    7 存储控制块被损坏。
    8 存储空间不足,无法处理此命令。
    9 存储控制块地址无效。
    10 环境不正确。
    11 试图加载格式不正确的程序。
    12 访问码无效。
    13 数据无效。
    14 存储空间不足,无法完成此操作。
    15 系统找不到指定的驱动器。
    16 无法删除目录。
    17 系统无法将文件移到不同的驱动器。
    18 没有更多文件。
    19 媒体受写入保护。
    20 系统找不到指定的设备。
    21 设备未就绪。
    22 设备不识别此命令。
    23 数据错误(循环冗余检查)。
    24 程序发出命令,但命令长度不正确。
    25 驱动器找不到磁盘上特定区域或磁道。
    26 无法访问指定的磁盘或软盘。
    27 驱动器找不到请求的扇区。
    28 打印机缺纸。
    29 系统无法写入指定的设备。
    30 系统无法从指定的设备上读取。
    31 连到系统上的设备没有发挥作用。
    32 另一个程序正在使用此文件,进程无法访问。
    33 另一个程序已锁定文件的一部分,进程无法访问。
    36 用来共享的打开文件过多。
    38 已到文件结尾。
    39 磁盘已满。
    ........

    查询 sql server 每天产生新表的存储过程

    DECLARE @DatabaseName varchar(255)
    DECLARE @TableName varchar(255)
    set nocount on
    Declare Database_Cursor Cursor for select name from master.dbo.sysdatabases where dbid>4

    OPEN Database_Cursor
    FETCH NEXT FROM  Database_Cursor INTO @DatabaseName

    WHILE(@@FETCH_STATUS=0)
    BEGIN
             PRINT convert(varchar(12),getdate(),101) + '      ' + '      数据库名:' + @DatabaseName
             exec( 'SELECT ''' + '||' + ''' as id,''' +@DatabaseName+ ''' as databasename,name,crdate,refdate into #ddd FROM ' +@DatabaseName+ '..sysobjects WHERE xtype=''U'' and datediff(day,crdate,getdate())=0; select * from #ddd;drop table #ddd')
             FETCH NEXT FROM  Database_Cursor INTO @DatabaseName
    END

    CLOSE Database_Cursor
    DEALLOCATE Database_Cursor
    GO

    配合批处理就可以获得多台sql server 服务器的新表

    set aTime=%time%
    set bDate=%date:~4,20%
    set bTime=%time:~0,2%-%time:~3,2%
    osql -S192.168.0.192 -U sa -P sa -n -w 200 -i "D:\log_collect\sqlmonitor\sqlNewTableQuery.sql" -o "D:\log_collect\sqlmonitor\monitorbyday\servername%bDate%.txt"
    quit
    exit

    绿色的MAC地址扫描器

    打包下载

    EMAIL 服务器测试工具

    用于email 服务器通路检测,非常好用。结果也很清晰。



    打包下载

    Windows下的grep(强大的文本搜索工具)

    用logparser分析超过1G的日志文件基本上程序都会停止反映。而grep一般在10分钟内搞定。对大文件支持很好。

    打包下载

    windows下强大的wmic命令行工具

    windows最令网管诟病的地方就是命令行没有unix和linux强大。但这种情况正在不断改观,windows命令行也越来越强大了。其中,微软耗费大量精力打造的wmi就是一例。

    获得进程ID与进程名称
    [code]wmic process get processid,name[/code]

    远程创建进程
    [code]wmic /node:109.254.2.102 /user:"rdgad\administrator" /password:"梦想成真" process call create commandline="cmd.exe /k echo xxxxx|clip.exe"[/code]

    获取cpu名称,位数,序列号
    [code]wmic cpu get name,addresswidth,processorid[/code]

    获取物理内存数
    [code]wmic memlogical get totalphysicalmemory[/code]

    获得品牌机的序列号
    [code]wmic csproduct get IdentifyingNumber[/code]

    加入域
    [code]wmic computersystem where name="%computername%" call joindomainorworkgroup name="www.mxcz.net" username="rdgad\adddomain" password="mxcz" fjoinoptions=1 accountou=null[/code]

    获取硬盘的总容量
    [code]wmic diskdrive get deviceid,size[/code]

    启动某服务
    [code]WMIC SERVICE where caption='TELNET' CALL STARTSERVICE[/code]

    杀掉某进程
    [code]WMIC PROCESS where name='calc.exe' delete[/code]

    ....................................................

    更具体的帮助请在命令行下键入 wmic /?查询。

    IIS下URLSCAN防注入配置

    [options]

    UseAllowVerbs=1 ; If 1, use [AllowVerbs] section, else use the
    ; [DenyVerbs] section.

    UseAllowExtensions=0 ; If 1, use [AllowExtensions] section, else use
    ; the [DenyExtensions] section.

    NormalizeUrlBeforeScan=1 ; If 1, canonicalize URL before processing.

    VerifyNormalization=1 ; If 1, canonicalize URL twice and reject request
    ; if a change occurs.

    AllowHighBitCharacters=0 ; If 1, allow high bit (ie. UTF8 or MBCS)
    ; characters in URL.

    AllowDotInPath=0 ; If 1, allow dots that are not file extensions.

    RemoveServerHeader=0 ; If 1, remove the 'Server' header from response.

    EnableLogging=1 ; If 1, log UrlScan activity.

    PerProcessLogging=1 ; If 1, the UrlScan.log filename will contain a PID
    ; (ie. UrlScan.123.log).

    AllowLateScanning=0 ; If 1, then UrlScan will load as a low priority
    ; filter.

    PerDayLogging=1 ; If 1, UrlScan will produce a new log each day with
    ; activity in the form 'UrlScan.010101.log'.

    UseFastPathReject=0 ; If 1, then UrlScan will not use the
    ; RejectResponseUrl or allow IIS to log the request.

    LogLongUrls=0 ; If 1, then up to 128K per request can be logged.
    ; If 0, then only 1k is allowed.

    RuleList=SQLInjection

    ;
    ; If UseFastPathReject is 0, then UrlScan will send
    ; rejected requests to the URL specified by RejectResponseUrl.
    ; If not specified, '/<Rejected-by-UrlScan>' will be used.
    ;

    RejectResponseUrl=

    ;
    ; LoggingDirectory can be used to specify the directory where the
    ; log file will be created. This value should be the absolute path
    ; (ie. c:\some\path). If not specified, then UrlScan will create
    ; the log in the same directory where the UrlScan.dll file is located.
    ;

    LoggingDirectory=d:\web_log\urlscanlogs

    ;
    ; If RemoveServerHeader is 0, then AlternateServerName can be
    ; used to specify a replacement for IIS's built in 'Server' header
    ;

    AlternateServerName=

    [RequestLimits]

    ;
    ; The entries in this section impose limits on the length
    ; of allowed parts of requests reaching the server.
    ;
    ; It is possible to impose a limit on the length of the
    ; value of a specific request header by prepending "Max-" to the
    ; name of the header. For example, the following entry would
    ; impose a limit of 100 bytes to the value of the
    ; 'Content-Type' header:
    ;
    ; Max-Content-Type=100
    ;
    ; To list a header and not specify a maximum value, use 0
    ; (ie. 'Max-User-Agent=0'). Also, any headers not listed
    ; in this section will not be checked for length limits.
    ;
    ; There are 3 special case limits:
    ;
    ; - MaxAllowedContentLength specifies the maximum allowed
    ; numeric value of the Content-Length request header. For
    ; example, setting this to 1000 would cause any request
    ; with a content length that exceeds 1000 to be rejected.
    ; The default is 30000000.
    ;
    ; - MaxUrl specifies the maximum length of the request URL,
    ; not including the query string. The default is 260 (which
    ; is equivalent to MAX_PATH).
    ;
    ; - MaxQueryString specifies the maximum length of the query
    ; string. The default is 2048.
    ;

    MaxAllowedContentLength=30000000
    MaxUrl=260
    MaxQueryString=2048

    [AllowVerbs]

    ;
    ; The verbs (aka HTTP methods) listed here are those commonly
    ; processed by a typical IIS server.
    ;
    ; Note that these entries are effective if "UseAllowVerbs=1"
    ; is set in the [Options] section above.
    ;

    GET
    HEAD
    POST

    [DenyVerbs]

    ;
    ; The verbs (aka HTTP methods) listed here are used for publishing
    ; content to an IIS server via WebDAV.
    ;
    ; Note that these entries are effective if "UseAllowVerbs=0"
    ; is set in the [Options] section above.
    ;

    PROPFIND
    PROPPATCH
    MKCOL
    DELETE
    PUT
    COPY
    MOVE
    LOCK
    UNLOCK
    OPTIONS
    SEARCH

    [DenyHeaders]

    ;
    ; The following request headers alter processing of a
    ; request by causing the server to process the request
    ; as if it were intended to be a WebDAV request, instead
    ; of a request to retrieve a resource.
    ;

    Translate:
    If:
    Lock-Token:
    Transfer-Encoding:

    [AllowExtensions]

    ;
    ; Extensions listed here are commonly used on a typical IIS server.
    ;
    ; Note that these entries are effective if "UseAllowExtensions=1"
    ; is set in the [Options] section above.
    ;

    .
    .htm
    .html
    .txt
    .jpg
    .jpeg
    .gif
    .aspx
    .asp
    .css
    .png
    .js
    .zip
    .rar
    .xslt
    .xml
    .ashx
    .swf
    .flv
    .fla
    .asmx

    [DenyExtensions]

    ;
    ; Extensions listed here either run code directly on the server,
    ; are processed as scripts, or are static files that are
    ; generally not intended to be served out.
    ;
    ; Note that these entries are effective if "UseAllowExtensions=0"
    ; is set in the [Options] section above.
    ;
    ; Also note that ASP scripts are denied with the below
    ; settings. If you wish to enable ASP, remove the
    ; following extensions from this list:
    ; .asp
    ; .cer
    ; .cdx
    ; .asa
    ;

    ; aspx

    .asax
    .ascx
    .config
    .cs
    .csproj
    .dll
    .licx
    .pdb
    .resx
    .resources
    .vb
    .vbproj
    .vsdisco
    .webinfo
    .xsd
    .xsx
    .axd
    .rem
    .soap

    ; Deny ASP requests
    .asp
    .cer
    .cdx
    .asa

    ; Deny executables that could run on the server
    .exe
    .bat
    .cmd
    .com

    ; Deny infrequently used scripts
    .htw ; Maps to webhits.dll, part of Index Server
    .ida ; Maps to idq.dll, part of Index Server
    .idq ; Maps to idq.dll, part of Index Server
    .htr ; Maps to ism.dll, a legacy administrative tool
    .idc ; Maps to httpodbc.dll, a legacy database access tool
    .shtm ; Maps to ssinc.dll, for Server Side Includes
    .shtml ; Maps to ssinc.dll, for Server Side Includes
    .stm ; Maps to ssinc.dll, for Server Side Includes
    .printer ; Maps to msw3prt.dll, for Internet Printing Services

    ; Deny various static files
    .ini ; Configuration files
    .log ; Log files
    .pol ; Policy files
    .dat ; Configuration files

    .bak
    .dll
    .vbs
    .vbe
    .log
    .ini
    .inf
    .sql
    .bat
    .cmd
    .sec
    .old
    .back
    .laji

    [DenyUrlSequences]
    .. ; Don't allow directory traversals
    ./ ; Don't allow trailing dot on a directory name
    \ ; Don't allow backslashes in URL
    : ; Don't allow alternate stream access
    % ; Don't allow escaping after normalization
    & ; Don't allow multiple CGI processes to run on a single request

    [SQLInjection]
    AppliesTo=.asp,.aspx
    DenyDataSection=SQLInjection Strings
    ScanUrl=0
    ScanAllRaw=0
    ScanQueryString=1
    ScanHeaders=

    [SQLInjection Strings]
    --
    %3b ; a semicolon
    char ; also catches nchar and varchar
    alter
    cast
    convert
    create
    cursor
    declare
    delete
    drop
    exec ; also catches execute
    fetch
    insert
    kill
    select
    sysobjects
    syscolumns
    update
    '

    如何通过telnet在命令行方式下验证email发送和http状态

    在做服务器管理的时候有时手边没有工具来测试email发送和http状态,实际上通过telnet这个强大的工具,就可以实现。

    email 发送测试(以下命令都在命令行下操作)

    telnet www.mxcz.net 25
    ehlo mxcz
    mail from:xiezhile@yahoo.com.cn
    rcpt to:xiezhile@yahoo.com.cn
    data
    Subject:smtp test

    this is a test

    . ::此处输入英文句点

    quit
    如此就可以简单测试smtp的发送情况。需要验证的服务器需要AUTH LOGIN命令,但是用户名和密码都需要base64编码。

    http 测试(以下命令都在命令行下操作)
    telnet www.mxcz.net 80
    GET / HTTP/1.1
    HOST XIELE

    返回结果
    HTTP/1.1 200 OK
    Date: Thu, 20 Nov 2008 05:20:24 GMT
    Server: BWS/1.0
    Content-Length: 3161
    Content-Type: text/html
    Cache-Control: private
    Expires: Thu, 20 Nov 2008 05:20:24 GMT
    Set-Cookie: BAIDUID=2EF60E43BFE68A16C5502E893950639E:FG=1; expires=Thu, 20-Nov-3
    8 05:20:24 GMT; path=/; domain=.baidu.com
    P3P: CP=" OTI DSP COR IVA OUR IND COM "
    ................................................





     服务器信息监控.Net 1.0
     版权所有:梦想成真工作室-程序制作:小明
     官方网站:http://www.mxcz.net/