|
[原创]盘古越狱工具在用户空间的行为
第一个图挂了 |
|
[原创][已开源] 一步一步编写Safari插件xImage到发布
收藏了先,以备日后学习用 |
|
[求助]如何截获ios https请求
我也推荐一个软件charlesproxy 也可以提供HTTP代理功能 |
|
|
|
搞定结贴.
支持64位的 |
|
[原创]仿InternetGetCookie自己解析Cookie文件
我刚好前端时间写了一个VB.NET的代码. 也贴上来好了.献丑了.本人不是专科出身,代码也是东抄西拼的.大家伙将就下看吧 Imports System.IO Imports System.Text Imports System.Collections.Generic Imports System.Linq Imports System.Windows.Forms Imports System.Runtime.InteropServices Imports System.Reflection Public Class BinaryCookieReader1 Private mybyte() As Byte Private outCookie As String = "" Public Shared Function ReadFile(ByVal fileName As String) As Byte() Dim fs As New FileStream(fileName, FileMode.Open) Dim buffer As Byte() = New Byte(fs.Length - 1) {} Try fs.Read(buffer, 0, buffer.Length) fs.Seek(0, SeekOrigin.Begin) Return buffer Catch Return buffer Finally If fs IsNot Nothing Then fs.Close() End If End Try End Function Public Function ReadInt32(ByRef myByte As Byte(), ByVal startIndex As Integer, Optional ByVal useLeEndian As Boolean = False) As Integer Dim read4Byte(3) As Byte If useLeEndian = True Then read4Byte(0) = myByte(startIndex + 3) read4Byte(1) = myByte(startIndex + 2) read4Byte(2) = myByte(startIndex + 1) read4Byte(3) = myByte(startIndex + 0) ReadInt32 = CInt("&H" + BitConverter.ToString(read4Byte, 0, 4).Replace("-", "")) Else ReadInt32 = CInt("&H" + BitConverter.ToString(myByte, startIndex, 4).Replace("-", "")) End If End Function Public Function ReadCookies(ByRef mybyte As Byte(), ByVal startIndex As Integer) As String '除了 '1. First 4 bytes in the cookie is the size of the cookie. '2. The next 4 bytes are unknown (may be related to cookies flags). '3. The next four bytes are the cookie flags. This is an integer value (1=Secure, 4=HttpOnly, 5= Secure+HttpOnly). '4. The next 4 bytes are unknown. '5. The next 4 bytes is an integer specifying the start of the url field in bytes from the start of the cookie record. '6. The next 4 bytes is an integer specifying the start of the name field in bytes from the start of the cookie record. '7. The next 4 bytes is an integer specifying the start of the path field in bytes from the start of the cookie record. '8. The next 4 bytes is an integer specifying the start of the value field in bytes from the start of the cookie record. '9. The next 8 bytes represents the end of the cookie and it is always 0×0000000000000000. '10. The next 8 bytes are the cookie expiration date. Date is in Mac epoch format (Mac absolute time). Mac epoch format starts from Jan 2001. '11. The next 8 bytes are the cookie creation date. '12. Next to that, the cookie contains the actual cookie domain, name, path & value. The order is not specific and they can appear in any order. ReadCookies = "" Dim CookieLength As Integer = ReadInt32(mybyte, startIndex, True) Dim CookieFlag As Integer = ReadInt32(mybyte, startIndex + 8, True) Dim CookieUrlOffset As Integer = ReadInt32(mybyte, startIndex + 16, True) Dim CookieNameOffset As Integer = ReadInt32(mybyte, startIndex + 20, True) Dim CookiePathOffset As Integer = ReadInt32(mybyte, startIndex + 24, True) Dim CookieValueOffset As Integer = ReadInt32(mybyte, startIndex + 28, True) 'end of cookie + 8 0000000000000000 'Dim ExpirationDate As Long ' end of cookie+8 'dim CreationDate as long '+8 Dim CookieUrl As String = Encoding.ASCII.GetString(mybyte, startIndex + CookieUrlOffset, CookieNameOffset - CookieUrlOffset - 1) Dim CookieName As String = Encoding.ASCII.GetString(mybyte, startIndex + CookieNameOffset, CookiePathOffset - CookieNameOffset - 1) Dim CookiePath As String = Encoding.ASCII.GetString(mybyte, startIndex + CookiePathOffset, CookieValueOffset - CookiePathOffset - 1) Dim CookieValue As String = Encoding.ASCII.GetString(mybyte, startIndex + CookieValueOffset, CookieLength - CookieValueOffset - 1) outCookie = outCookie + CookieName + ChrW(9) + CookieValue + ChrW(9) + CookiePath + ChrW(9) + CookieUrl + vbCrLf ReadCookies = outCookie End Function Public Function ReadPage(ByRef mybyte As Byte(), ByVal startIndex As Integer) 'Page(Format) '1. Every page starts with a 4 byte page header: 0×00000100. '2. Next four bytes is an integer specifying the number of cookies in the page. '3. Following that, a 4 byte integer for each cookie, represents the cookie offset. Offset specifies the start of the cookie in bytes from the start of the page. '4. Next to that, the page contains the actual cookie contents. Each cookie is of variable length. Cookie format is explained below. '5. Page ends with a 4 byte value and it is always 0×00000000. Dim PageHeader As Integer = ReadInt32(mybyte, startIndex) '头固定为 0x00000100 Dim NumberOfCookies As Integer = BitConverter.ToInt32(mybyte, startIndex + 4) 'COOKIE 数量 'Dim NumberOfCookies As Integer = ReadInt32(mybyte, startIndex + 4) 'COOKIE 数量 Dim NumberOfCookiesStartIndex As Integer = startIndex + 8 Dim CookieOffset() As Integer ReDim CookieOffset(NumberOfCookies - 1) For I As Integer = 0 To NumberOfCookies - 1 CookieOffset(I) = BitConverter.ToInt32(mybyte, NumberOfCookiesStartIndex + I * 4) ReadCookies(mybyte, startIndex + CookieOffset(I)) Next End Function Private LengthPage_StartIndex As Integer = 8 Private Page_StartIndex As Integer = -1 Public Sub New(ByVal cookiefile As String) 'FileHead NoOfpages Page1-N PageHeader BE Endian 'PageFormat & Cookie Format use LE Endian mybyte = ReadFile(cookiefile) Dim FileHead As String = Encoding.ASCII.GetString(mybyte, 0, 4) ' //0-3 Dim NumberOfPages As Integer = ReadInt32(mybyte, 4) '开始位置就是第9位,索引-1 就是8 Dim LengthOfPages() As Integer ReDim LengthOfPages(NumberOfPages - 1) For I As Integer = 0 To NumberOfPages - 1 LengthOfPages(I) = ReadInt32(mybyte, LengthPage_StartIndex + 4 * I) Next outCookie = "" Dim nextStartIndex As Integer = 8 + NumberOfPages * 4 For I As Integer = 0 To NumberOfPages - 1 ReadPage(mybyte, nextStartIndex) nextStartIndex = nextStartIndex + LengthOfPages(I) Next MsgBox(outCookie) End Sub End Class |
|
好变态的小软件[原创]
回帖看KX |
|
[求助]在哪看有多少Kx
huitie kan kx |
|
|
|
[原创]爆破DNF外挂 (申请邀请码)
回帖看分数 |
|
[讨论]要多久能正成为正式会员
据说要多发有用帖 |
|
[讨论][讨论]只要工夫深,会员会成真。
我也看看我的情况 |
操作理由
RANk
{{ user_info.golds == '' ? 0 : user_info.golds }}
雪币
{{ experience }}
课程经验
{{ score }}
学习收益
{{study_duration_fmt}}
学习时长
基本信息
荣誉称号:
{{ honorary_title }}
能力排名:
No.{{ rank_num }}
等 级:
LV{{ rank_lv-100 }}
活跃值:
在线值:
浏览人数:{{ visits }}
最近活跃:{{ last_active_time }}
注册时间:{{ user_info.create_date_jsonfmt }}
勋章
兑换勋章
证书
证书查询 >
能力值