惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

N
Netflix TechBlog - Medium
V
Vulnerabilities – Threatpost
Google Online Security Blog
Google Online Security Blog
Hugging Face - Blog
Hugging Face - Blog
L
LINUX DO - 热门话题
云风的 BLOG
云风的 BLOG
P
Proofpoint News Feed
D
Docker
C
Cyber Attacks, Cyber Crime and Cyber Security
MyScale Blog
MyScale Blog
P
Palo Alto Networks Blog
T
Tenable Blog
P
Privacy International News Feed
Google DeepMind News
Google DeepMind News
小众软件
小众软件
Cisco Talos Blog
Cisco Talos Blog
aimingoo的专栏
aimingoo的专栏
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
A
Arctic Wolf
C
Cybersecurity and Infrastructure Security Agency CISA
C
Cisco Blogs
T
Threat Research - Cisco Blogs
NISL@THU
NISL@THU
The Hacker News
The Hacker News
Project Zero
Project Zero
AWS News Blog
AWS News Blog
Simon Willison's Weblog
Simon Willison's Weblog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
T
Threatpost
V
Visual Studio Blog
The GitHub Blog
The GitHub Blog
The Cloudflare Blog
Last Week in AI
Last Week in AI
Jina AI
Jina AI
Cyberwarzone
Cyberwarzone
The Register - Security
The Register - Security
C
CXSECURITY Database RSS Feed - CXSecurity.com
Vercel News
Vercel News
D
Darknet – Hacking Tools, Hacker News & Cyber Security
MongoDB | Blog
MongoDB | Blog
U
Unit 42
Scott Helme
Scott Helme
A
About on SuperTechFans
WordPress大学
WordPress大学
F
Fortinet All Blogs
大猫的无限游戏
大猫的无限游戏
G
GRAHAM CLULEY
Latest news
Latest news
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
S
Schneier on Security

博客园 - 小小点

使用 C# 将数字转换成大写人民币 发个自己写的分页类 计划+日程表+严格执行 今天开始做事 享受过程 明天失踪一天 加班加班 JS模拟类实现 不能连接MySQL数据库的解决办法 解决安装 MSSQL 提示有挂起的安装问题 [转载] PHP读MYSQL中文乱码的解决方法 自己定义的模仿窗体标题栏的控件 意料之中 DHTML文件访问本地数据库[转] 在b/s开发中经常用到的javaScript技术 [转贴] 关机脚本(转载) 离开... 在MSSQL中利用存储过程进行分页查询 压缩MSSQL数据库日志文件大小
ASP中无组件上传文件
小小点 · 2006-05-08 · via 博客园 - 小小点

目前有很多无组件上传类,大多写的相当复杂,有的居然还只能传文本,最关键的是没有10行代码以下的。

  其实无组件上传最核心的代码就是ADODB.Stream,实际只用五行代码就可以实现了无组件上传。

  Set objStream = Server.CreateObject("ADODB.Stream")
  objStream.Type = 1
  objStream.Open
  objStream.LoadFromFile Request("upfilename")
  objStream.SaveToFile Server.MapPath("test.gif"),2

  使用方法:

  把上面的代码写成upload.asp,在浏览器里面输入http://localhost/upload.asp?upfilename=c:\test\test.gif

  localhost为你的主机地址,执行完后你会看到你的目录下面多了一个test.gif,他就是你要文件拉。

  根据原理我们可以扩展以下代码,算一个最小的ASP木马吧,有一点值得注意,上传的本地文件路径不能包含中文字符,否则会出错。

  upload.asp文件

<%
  Function GetFileName(ByVal strFile)
  If strFile <> "" Then
   GetFileName = mid(strFile,InStrRev(strFile, "\")+1)
  Else
   GetFileName = ""
  End If
  End  function
 
  strFileName = Request.Form("upfilename")
  If strFileName<>"" Then
  Set objStream = Server.CreateObject("ADODB.Stream")
  objStream.Type = 1
  objStream.Open
  objStream.LoadFromFile strFileName
  objStream.SaveToFile Server.MapPath(GetFileName(strFileName)),2
  objStream.Close
  response.write "OK!"
  Else
%>
  <form action='<%= Request.ServerVariables("URL") %>' method='post'>
  <input type='file' name='upfilename'> <input type='submit'></form>
<%
  End if
%>
转贴:http://www.williamlong.info/archives/380.html