黑客风云——风云网络
设为首页 加入收藏 我要投稿 网站地图

您现在的位置: 黑客风云 >> 黑客文章 >> 黑客入门 >> 黑客常识 >> 正文
·没有路由密码权限时的鸽08-23·上网安全 Vista自我防范10-11
·让濒临崩溃的Windows XP10-11·有备无患,快速自制救急10-11
·要你好看!Windows看图工10-11·空间赞助网提供不同类型10-11
·讨论net.exe和net1.exe的10-10·让3389远程桌面传输更通10-10
·巧妙入侵渗透赌博站10-10·Aspx空间扫权限工具10-10
·Windows2003最新提权工具10-10·易淘乐提供100M免费全能10-10
·系统开机密码忘了不着急10-09·中意网络提供免费100M免10-09
·与众不同 Windows XP开始10-08·让桌面图标翻跟斗 在XP上10-08
·上海宽元站长资助计划-提10-08·个性化Windows XP的任务10-07
·趣盘提供3G免费网络硬盘10-07·秀山热线提供200MB免费全10-07
·一次艰辛的提权过程10-06·成功入侵IT大卖场的渗透10-06
·mysqlhack- MYSQL利用工10-06·lanker一句话PHP后门客户10-06
·WIXI提供3G免费多媒体网10-06·新人网络提供100M/ftp免10-06
·如何利用QQ带来高流量10-05·UuShare提供免费网络文件10-05
[推荐]网站入侵:cookie技术与欺骗
      ★★★★★

网站入侵:cookie技术与欺骗

文章整理发布:黑客风云 文章来源:www.05112.com 更新时间:2006-5-27 7:52:28


///
我们学习了可以用jsp Cookie类来创建cookie,当然其它语言也可以创建包括客户端脚本语言javascript,vbscript同在我们主要谈谈用javascript,和html来创建cookie
1 Creating a Cookie that Is Valid Until a Certain Date
<HTML>
<HEAD>
<TITLE>Creating a cookie that is valid until a certain date</TITLE> <META
HTTP-EQUIV="Set-Cookie" CONTENT="userId=678;expires=Wednesday, 26-Dec-01 16:00:00 GMT;
path=/">
</HEAD>
<BODY>
Unless you set your browser to not accept cookies, a cookie called userId with a value of
678 has been created for you.
</BODY>
</HTML>
/////
2 Creating Cookies with document.cookiess
document.cookiess = "cookieName=cookievalue
?[; expires=timeInGMTString]
?[; path=pathName]
?[; domain=domainName]
?[; secure]"
Listing 25.3 Creating a Cookie with document.cookiess
<HTML>
<HEAD>
<TITLE>Creating a cookie with document.cookiess</TITLE>
<SCRIPT LANGUAGE="javascript">
document.cookiess="Quantity=7";
</SCRIPT>
</HEAD>
<BODY>
This page creates a cookie on the client side.
Make sure that your browser is set to accept cookies.
</BODY>
</HTML>
Creating Cookies with the setCookie Function
For example, you'll want to create a cookie when your user chooses to buy something in your online store web application
Listing 25.4 The setCookie Function
<SCRIPT LANGUAGE="javascript">
function setCookie(name, value, expires, path, domain, secure) {
?document.cookiess = name + "=" + escape(value) +
? ?((expires) ? "; expires=" + expires.toGMTString() : "") +
? ?((path) ? "; path=" + path : "") +
? ?((domain) ? "; domain=" + domain : "") +
? ?((secure) ? "; secure" : "");
}
</SCRIPT>
Listing 25.7 An Example that Creates a Cookie with an Expiration Date
<HTML>
<HEAD>
<TITLE>Using the setCookie function</TITLE>
<SCRIPT LANGUAGE="javascript"> ?
function setCookie(name, value, expires, path, domain, secure) {
?document.cookiess = name + "=" + escape(value) +
? ?((expires) ? "; expires=" + expires.toGMTString() : "") +
? ?((path) ? "; path=" + path : "") +
? ?((domain) ? "; domain=" + domain : "") +
? ?((secure) ? "; secure" : "");
}

function fixDate(date) {
? ?var base = new Date(0);
? ?var skew = base.getTime();
? ?if (skew > 0) date.setTime(date.getTime() - skew);
}

var expiryDate = new Date();
fixDate(expiryDate);
expiryDate.setTime(expiryDate.getTime() + 365 * 24 * 60 * 60 * 1000);
setCookie("authorizationLevel", 2, expiryDate);

</SCRIPT>
</HEAD>
<BODY>
A cookie which is valid for a year has been created for this page.
</BODY>
</HTML>
Listing 25.9 Writing and Reading Cookies
<HTML>
<HEAD>
<TITLE>Writing and Reading Cookies</TITLE>
<SCRIPT LANGUAGE="javascript">

function setCookie(name, value, expires, path, domain, secure) {
?document.cookiess = name + "=" + escape(value) +
? ?((expires) ? "; expires=" + expires.toGMTString() : "") +
? ?((path) ? "; path=" + path : "") +
? ?((domain) ? "; domain=" + domain : "") +
? ?((secure) ? "; secure" : "");
}

function getCookie(name) {
?var cName = name + "=";
?var dc = document.cookiess;
?if (dc.length>0) {
? ?begin = dc.indexOf(cName);
? ?if (begin != -1) {
? ? ?begin += cName.length;
? ? ?end = dc.indexOf(";", begin);
? ? ?if (end == -1) end = dc.length;
? ? ? ?return unescape(dc.substring(begin,end));
? ?}
?}
?return null;
}

</SCRIPT>
</HEAD>
<BODY>
Type in your user id, and then click the Create Cookie button.
A cookie will be created for you.
<BR>
<FORM>
User ID: <INPUT TYPE=TEXT NAME=UserID>
<BR>
<INPUT TYPE=BUTTON value="Create Cookie"
onClick='setCookie("UserID", document.FORMs[0].UserID.value)'>
<BR>
Click the Read Cookie button to display the cookie.
<INPUT TYPE=BUTTON value="Read Cookie"
onClick='alert(getCookie("UserID"))'>
</FORM>
</BODY>
</HTML>
Listing 25.10 Deleting a Cookie
<SCRIPT LANGUAGE="javascript">
function deleteCookie (name, path, domain) {
?if (getCookie(name)) {
? ?document.cookiess = name + "=" +
? ?((path==null) ? "" : "; path=" + path) +
? ?((domain==null) ? "" : "; domain=" + domain) +
? ?"; expires=Thu, 01-Jan-70 00:00:01 GMT";
?}
}

function getCookie(name) {
?var cName = name + "=";
?var dc = document.cookiess;
?if (dc.length>0) {
? ?begin = dc.indexOf(cName);
? ?if (begin != -1) {
? ? ?begin += cName.length;
? ? ?end = dc.indexOf(";", begin);
? ? ?if (end == -1) end = dc.length;
? ? ? ?return unescape(dc.substring(begin,end));
? ?}
?}
?return null;
}
</SCRIPT>
Checking If the Browser Can Accept Cookies Using javascript
用javascript来检查用户浏览器是否支持cookie技术
Listing 25.11 Checking If the Browser Can Accept Cookies Using javascript
<HTML>
<HEAD>
<SCRIPT LANGUAGE="javascript">
document.cookiess="test=OK";

function getCookie(name) {
?var cName = name + "=";
?var dc = document.cookiess;
?if (dc.length>0) {
? ?begin = dc.indexOf(cName);
? ?if (begin != -1) {
? ? ?begin += cName.length;
? ? ?end = dc.indexOf(";", begin);
? ? ?if (end == -1) end = dc.length;
? ? ? ?return unescape(dc.substring(begin,end));
? ?}
?}
?return null;
}

if (getCookie('test')==null)
?alert("Please change your browser to accept cookies.");
else
?alert("Browser accepts cookies");

</SCRIPT>
</HEAD>

<BODY>
The page content
</BODY>
</HTML>
Checking If the Browser Accepts Cookies Without javascript
不用javascript来检查用户浏览器是否支持cookie技术!!!
Another way to check if the browser is willing to accept cookies is by creating a cookie on one page and then immediately redirecting the user to a second page. In the second page you can then try to read the cookies. The code in Listing 25.12 uses the <META> tag to create a cookie called "test" and then redirects the browser to a second page called checkCookie.jsp (in Listing 25.13).
Listing 25.12 Checking Browser Cookie Acceptance with Redirection
<HTML>
<HEAD>
<META HTTP-EQUIV="Set-Cookie" CONTENT="test=ok;">
<META HTTP-EQUIV="Refresh" CONTENT="0;URL=checkCookie.jsp">
</HEAD>
</HTML>
In the second page, implemented using ASP in this example, you try to read the same cookie using the code in Listing 25.13.
Listing 25.13 Reading the Cookies in the Browser Cookie Acceptance Test
<%
?If Request.cookiesss("test") <> "" Then
? ?Response.Write "Cookies accepted."
?Else
? ?Response.Write "Cookies not accepted."
?End If
%>
Even though the code in this example only sends a message to the user telling him or her whether or not his or her browser accepts cookies, you can modify it to suit your needs. For instance, you can transfer the user to a warning page if the cookies are not accepted.
了解一个cookie文件里面的内容的含义!!!!!!!
3.5 What are all those entries in my cookies.txt file?

The layout of Netscape's cookies.txt file is such that each line contains one name-value pair. An example cookies.txt file may have an entry that looks like this:
.netscape.com ? ? TRUE ? / ?FALSE ?946684799 ? NETSCAPE_ID ?100103
Each line represents a single piece of stored inFORMation. A tab is inserted between each of the fields.

From left-to-right, here is what each field represents:

domain - The domain that created AND that can read the variable.
flag - A TRUE/FALSE value indicating if all machines within a given domain can access the variable. This value is set automatically by the browser, depending on the value you set for domain.
path - The path within the domain that the variable is valid for.
secure - A TRUE/FALSE value indicating if a secure connection with the domain is needed to access the variable.
expiration - The UNIX time that the variable will expire on. UNIX time is defined as the number of seconds since Jan 1, 1970 00:00:00 GMT.
name - The name of the variable.
value - The value of the variable.
好现在还看看其它方面的,有趣的一面!
在window当中cookie一般存放在C:\Documents and Settings\wwwfox\Cookies
wwwfox为我登录xp的账号,当然由于ie版本不同存放的位置也有所不同,你可以到微软官方网站上去查看,当然最好的方法就是搜一下Cookie文件就可以知道具体在存放在那里了,

上一页  [1] [2] [3] 下一页

文章录入:cainiaowang    责任编辑:cainiaowang 
【字体:
Copyright @2006 黑客风云 ●业务联系:QQ 联系怪人 联系奇人 Email:给怪人发邮件 给奇人发邮件
ICP备案:冀06009886