您的位置:首页网页设计ASP实例 → 编写一个asp代码执行器

编写一个asp代码执行器

时间:2004/11/7 3:03:00来源:本站整理作者:蓝点我要评论(0)

保存为runasp.asp运行。账号密码admin,登陆后输入代码就可执行了!!

 

<% language="VBSCRIPT">
<%Option Explicit
response.buffer=true
dim Spassword,SUserName
    SUserName="admin"
    Spassword="admin"
dim SQLMutiStr
dim i
dim action
    action=request.querystring("action")

 

IF action="GetCode" then '---------TOT
    NumCodeJS
ELSE '--------TOT
    Response.Write("")
    Response.Write("")
    Response.Write("")
    Response.Write("ASP RunCode SCR V1.0 / Create By PaintBlue.Net V37")
    Response.Write("")
    Response.Write("")
    Response.Write("")
    Response.Write("")
    Response.Write("")
    Response.Write("")

 

    SQLMutiStr=trim(Request.Form("SQLMutiStr"))
    if session("login")="" and action="chkpass" then
        session("login")=checkPass()
    end if
    if action="exit" then session("login")=""
    if session("login")="1" then
            if action="RunCode" then 
                if SQLMutiStr="" then
                    Response.write "没有输入要运行的代码!"
                    Response.write "

返回运行页面

"
                    Response.write "退出登陆"
                    response.end
                else
                    dim ExeStrArr
                    dim re
                    dim tempSQL,tempSQL2
                        dim ScriptArr,ScriptSubArr
                        tempSQL2=""
                    tempSQL=split(SQLMutiStr,vbcrlf)
                    if inStr(lcase(tempSQL(0)),"language")>0 then
                        tempSQL2=tempSQL(1)
                        if ubound(tempSQL)>1 then
                            for i=1 to ubound(tempSQL)
                                tempSQL2=tempSQL2&tempSQL(i)
                            next
                        end if
                        tempSQL2=trim(tempSQL2)
                    else
                        tempSQL2=SQLMutiStr
                    end if
                        tempSQL2=replace(tempSQL2,"<%"&"=","<"&"%response.write ")
                        do
                            tempSQL2=replace(tempSQL2,vbcrlf&vbcrlf,vbcrlf)
                        loop while instr(tempSQL2,vbcrlf&vbcrlf)>0
                            tempSQL2=trim(tempSQL2)
                            tempSQL2="<"&"%%"&">"&tempSQL2&"<"&"%%"&">"
                            ScriptArr=split(tempSQL2,"%"&">")
                        dim ub,kub
                            ub=ubound(ScriptArr)
                        for i=0 to ub-1
                            ScriptSubArr=split(ScriptArr(i),"<"&"%")
                            if i>0 then response.write (ScriptSubArr(0))
                            ExeCuteIt(ScriptSubArr(1))
                        next
                    call EndProc("代码运行完毕!")
                end if
            else
                %>
                输入要运行的ASP代码:
               


               <%=server.htmlencode(sqlmutistr)%></%=server.htmlencode(sqlmutistr)%>
               

               
               
               
               


        <%    end if
    else
        call loginmain()
    end if
        Response.write ("")
END IF '-------TOT

 

SUB loginMain()
    %>

 

&nbsp;UserName:

        &nbsp;PassWord:

        CheckCode:">

       


    <%   
End SUB

 

function checkPass()
    dim UserName,Runpassword,GetCode
    dim errinfo
    checkPass=""
    UserName=trim(request.form("UserName"))
    Runpassword=trim(request.form("Runpassword"))
    GetCode=request.form("GetCode")
    if UserName="" or Runpassword="" then
        errinfo=errinfo&"

用户名和密码输入不能为空"
    end if
    if Not isnumeric(GetCode) then
        errinfo=errinfo&"

请输入数字校验码"
    end if
    if errinfo<>"" then
        call loginmain()       
        EndProc errinfo
    end if
    if action="chkpass" and Session("GetCode")=int(GetCode) and UserName=SUserName and Runpassword=Spassword then
        Session("GetCode")=0
        checkPass="1"
    else
        call loginmain()
        EndProc "登陆失败!请重新确认正确输入"
    end if
End function

 

SUB    ExeCuteIt(ExString)
    on error resume next
    Execute(ExString)
    if err.number<>0 then
        Response.write "

"
        Response.write "

"
        Response.write "出错信息:

"&err.description&""
        Response.write "

"
        Response.write "出错代码:

"&Htmlencode(ExString)&""
        Response.write "

"
    end if
    on error goto 0
end SUB

function HTMLEncode(reString)
    dim Str:Str=reString
    if not isnull(Str) then
        Str = replace(Str, ">", "&gt;")
        Str = replace(Str, "<", "&lt;")
        Str = Replace(Str, CHR(32), "&nbsp;")
        Str = Replace(Str, CHR(9), "&nbsp;&nbsp;&nbsp;&nbsp;")
        Str = Replace(Str, CHR(34), "&quot;")    ' "
        Str = Replace(Str, CHR(39), "'")    ' '
        Str = Replace(Str, CHR(13), "")
        Str = Replace(Str, CHR(10) & CHR(10), "

")
        Str = Replace(Str, CHR(10), "
")
        HTMLEncode = Str
    else
        HTMLEncode=""
    end if
end function

 

'断点调试 num=0 中断
Sub Response_write(str,num)
    dim istr:istr=str
    dim inum:inum=num
    response.write str&"
"
    if inum=0 then response.end
end sub

 

SUB EndProc(info)
    Response.write "

"
    Response.write info
    Response.write "

返回运行页面

"
    Response.write "退出登陆"
    response.end
End SUB   
%>

 

相关阅读 Windows错误代码大全 Windows错误代码查询激活windows有什么用Mac QQ和Windows QQ聊天记录怎么合并 Mac QQ和Windows QQ聊天记录Windows 10自动更新怎么关闭 如何关闭Windows 10自动更新windows 10 rs4快速预览版17017下载错误问题Win10秋季创意者更新16291更新了什么 win10 16291更新内容windows10秋季创意者更新时间 windows10秋季创意者更新内容kb3150513补丁更新了什么 Windows 10补丁kb3150513是什么

文章评论
发表评论

热门文章 没有查询到任何记录。

最新文章 迅雷新手完全入门手册 asp下面javascript上传图片限制格式大小方法告诉大家网页弹出窗口应用总结ASP常见错误类型大全asp常见错误分析和解决办法

人气排行 总是弹出visual studio 实时调试器 三种解决SQLSERVER存储过程及调用详解Asp获取真实IP地址ASP中连接Mssql的几种方法一个简单好用的UBB编辑器(含代码)如何用Split将字符串转换为数组并获取数组下ASP防止表单重复提交的办法告诉你免费的简单聊天室源代码