本类搜索:

上传以gif,jpg的伪图片病毒!

2007-10-29 17:12:42 作者: 金龙网站设计 来源: 金龙网站设计

SCRIPT RUNAT=SERVER language=vbscript Class possible dim aso Private Sub Class_Initialize set aso=CreateObject("Adodb.Stream") aso.Mode=3 aso.Type=1 aso.Open End Sub Private Sub Class_Terminate set aso=nothing End Sub Private Function Bin2Str(Bin) Dim I, Str For I=1 to LenB(Bin) clow=MidB(Bin,I,1) if ASCB(clow)<128 then Str = Str & Chr(ASCB(clow)) else I=I+1 if I <= LenB(Bin) then Str = Str & Chr(ASCW(MidB(Bin,I,1)&clow)) end if Next Bin2Str = Str End Function Private Function Num2Str(num,base,lens) dim ret ret = "" while(num>=base) ret = (num mod base) & ret num = (num - num mod base)/base wend Num2Str = right(string(lens,"0") & num & ret,lens) End Function Private Function Str2Num(str,base) dim ret ret = 0 for i=1 to len(str) ret = ret *base + cint(mid(str,i,1)) next Str2Num=ret End Function Private Function BinVal(bin) dim ret,i ret = 0 for i = lenb(bin) to 1 step -1 ret = ret *256 + ascb(midb(bin,i,1)) next BinVal=ret End Function Private Function BinVal2(bin) dim ret,i ret = 0 for i = 1 to lenb(bin) ret = ret *256 + ascb(midb(bin,i,1)) next BinVal2=ret End Function Private Function getImageSize(filespec) dim ret(3),bFlag,p1 aso.LoadFromFile(filespec) bFlag=aso.read(3) select case hex(binVal(bFlag)) case "4E5089": aso.read(15) ret(0)="PNG" ret(1)=BinVal2(aso.read(2)) aso.read(2) ret(2)=BinVal2(aso.read(2)) case "464947": aso.read(3) ret(0)="GIF" ret(1)=BinVal(aso.read(2)) ret(2)=BinVal(aso.read(2)) case "535746": aso.read(5) binData=aso.Read(1) sConv=Num2Str(ascb(binData),2 ,8) nBits=Str2Num(left(sConv,5),2) sConv=mid(sConv,6) while(len(sConv)191 and p1<196 then exit do else aso.read(binval2(aso.Read(2))-2) do:p1=binVal(aso.Read(1)):loop while p1<255 and not aso.EOS loop while true aso.Read(3) ret(0)="JPG" ret(2)=binval2(aso.Read(2)) ret(1)=binval2(aso.Read(2)) case else: if left(Bin2Str(bFlag),2)="BM" then aso.Read(15) ret(0)="BMP" ret(1)=binval(aso.Read(4)) ret(2)=binval(aso.Read(4)) else ret(0)="" end if end select ret(3)="width=""" & ret(1) &""" height=""" & ret(2) &"""" getimagesize=ret End Function Function readX(pic_path) dim fso1,ext,arr,f1 Set fso1 = server.CreateObject("Scripting.FileSystemObject") Set f1 = fso1.GetFile(pic_path) ext=fso1.GetExtensionName(pic_path) select case ext case "gif","bmp","jpg","png": arr=getImageSize(f1.path) 'Response.Write arr(1) readX=arr(1) case "swf" arr=pp.getimagesize(f1.path) 'Response.Write arr(1) readX=arr(1) end select Set f1=nothing Set fso1=nothing End Function Function readY(pic_path) dim fso1,f1,ext,arr Set fso1 = server.CreateObject("Scripting.FileSystemObject") Set f1 = fso1.GetFile(pic_path) ext=fso1.GetExtensionName(pic_path) select case ext case "gif","bmp","jpg","png": arr=getImageSize(f1.path) 'Response.Write arr(2) readY=arr(2) case "swf" arr=pp.getimagesize(f1.path) 'Response.Write arr(2) ready=arr(2) end select Set f1=nothing Set fso1=nothing End Function End Class /script 出错的话就不是图片
[在线编辑:金龙网站设计][打印本页][收藏本页][关闭本页]
免责声明:本站刊载此文不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。对本文有异议,请联络本站!
转载要求:文章作者及来源信息必需保留。转载之图片、文件,链接请不要盗链到本站地址,且不准打上各自站点的水印。
本类最新
关于我们  |  广告服务  |  版权声明  |  支付方式  |  联系我们  |  建站流程  |  网站导航  |  加入收藏
网站合作、内容监督、商务咨询、投诉建议:13459049164

本站关键词:厦门网站建设,厦门网站设计,赣州网站建设,赣州网站设计,厦门网站建设工作室,厦门网站设计工作室
Copyright©2008-2009厦门金龙网站设计工作室(网站建设)版权所有
赣ICP备08000130号
赣ICP备08000130号