If someone can link me to a download, much apreciated
Where to get VB6 RipperWrapper?
Started by Backslash, Nov 19 2009 12:51 PM
5 replies to this topic
#1
Posted 19 November 2009 - 12:51 PM
If someone can link me to a download, much apreciated
#2
Posted 20 November 2009 - 06:12 PM
Hey Backslash,
I would recommend that you try out cxWrapper instead. In built GZIP decompression and better socket libraries make it a better wrapper
I would recommend that you try out cxWrapper instead. In built GZIP decompression and better socket libraries make it a better wrapper
#3
Posted 21 November 2009 - 05:53 AM
Is it like the TCPWrapper?
Is this cxWrapper?
Is this cxWrapper?
Imports System.Collections.Generic Imports System.Text Imports System.Text.RegularExpressions Imports System.IO Imports System.IO.Compression Imports System.Net.Sockets Public Class Wrapper Private sock As TcpClient Private ns As NetworkStream Private parts As String() Private host As String Private file As String Private user_agent As String Private last_page As String = "http://www.google.com" 'Proxy Private use_proxy As Boolean = False Private proxy_server As String Private proxy_port As Integer 'Cookies Private stored_cookies As IDictionary(Of String, Dictionary(Of String, String)) = New Dictionary(Of String, Dictionary(Of String, String))() Private cookie_dict As IDictionary(Of String, String) = New Dictionary(Of String, String)() Private cookies As String 'Regex Private jpg_pat As New Regex("ÿØ[\s\S]*ÿÙ", RegexOptions.Compiled) Private cookies_pat As New Regex("set-cookie:\s*([^=]+)=([^;]+);" , RegexOptions.IgnoreCase Or RegexOptions.Compiled) Private chunk_pat As New Regex("\r\n.*\r\n", RegexOptions.Compiled) Private location_pat As New Regex("Location: (.*)\r\n", RegexOptions.Compiled) 'Const Line-Break Const rn As String = ChrW(13) + ChrW(10) Public Sub New() user_agent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.4) Gecko/20070515 Firefox/2.0.0.4" End Sub Public Sub New(ByRef ua As String) user_agent = ua End Sub Public Sub SetUA(ByRef ua As String) user_agent = ua End Sub Public Sub UseProxy(ByRef server As String, ByRef port As Integer) proxy_server = server proxy_port = port use_proxy = True End Sub Public Sub NoProxy() use_proxy = False End Sub Public Function StoreCookies(ByRef key As String, ByRef clear_current As Boolean) As Boolean If stored_cookies.ContainsKey(key) Then stored_cookies. Remove(key) stored_cookies.Add(key, cookie_dict) Else stored_cookies.Add(key, cookie_dict) End If If clear_current Then cookie_dict. Clear() cookies = String.Empty End If Return stored_cookies.ContainsKey(key) End Function Public Function LoadCookies(ByRef key As String) As Boolean If stored_cookies.ContainsKey(key) Then cookies = String.Empty For Each item As KeyValuePair(Of String, String) In stored_cookies(key) cookies += item.Value.ToString() + "; " Next If Not String.IsNullOrEmpty(cookies) Then cookies.Remove(cookies.LastIndexOf(";"), 2) Return True Else Return False End If End Function Public Sub ClearCookies() cookie_dict.Clear( ) cookies = String.Empty End Sub Public Function GetReq(ByRef url As String, ByRef referrer As String) As String Return Req("GET", url, referrer) End Function Public Function PostReq(ByRef url As String, ByRef referrer As String) As String Return Req("POST", url, referrer) End Function Public Function GetPostReq(ByRef url As String, ByRef referrer As String) As String Return Req("GETPOST", url, referrer) End Function Public Function DownloadJPG(ByRef url As String, ByRef referrer As String) As Bitmap Req("PIC", url, referrer) 'Return New Bitmap(New MemoryStream(System.Text.Encoding.[Default].GetBytes(jpg_pat.Match(parts( 1)).ToString()))) Return New Bitmap(New MemoryStream(System.Text.Encoding.GetEncoding(1252).GetBytes(jpg_pat.Match( parts(1)).ToString()))) End Function Public Function Req(ByRef method As String, ByRef url As String, ByRef referrer As String) As String Try Dim headers As Byte() = CreateHeaders(method, url, referrer) If Not use_proxy Then sock = New TcpClient(host, 80) Else sock = New TcpClient(proxy_server, proxy_port) End If ns = sock.GetStream ns. Write(headers, 0, headers.Length) 'parts = Regex.Split(New StreamReader(ns, Encoding.[Default]).ReadToEnd, rn & rn) parts = Regex.Split(New StreamReader(ns, Encoding.GetEncoding(1252)).ReadToEnd, rn & rn) ParseCookies( ) last_page = "http://" & host & file If parts(0).Contains("302 Found") AndAlso location_pat.IsMatch(parts(0)) Then Dim location As String = location_pat.Match(parts(0)).Groups(1).Value If Not location.StartsWith("http://") Then If location.StartsWith("/") Then Return Req("GET", "http://" + host + "/" + location, last_page) Else Return Req("GET", "http://" + host + location, last_page) End If Else Return Req("GET", location, last_page) End If End If If parts(0).Contains("Transfer-Encoding") Then DeChunk() End If If parts(0).Contains("Content-Encoding") Then DecompressGzip() End If Catch e As Exception MessageBox. Show(e.ToString) End Try Return String.Concat(parts(0), rn, rn, parts(1)) End Function Private Function CreateHeaders(ByRef method As String, ByRef url As String, ByRef referrer As String) As Byte() Dim pos As Integer, _ post As String, _ headers host = IIf(url.StartsWith("http://"), url.Substring(7), url) If host.Contains("/") Then pos = host.IndexOf("/") file = host.Substring(pos) host = host.Substring(0, pos) Else file = "/" End If If method.Equals("POST") AndAlso file.Contains("?") Then pos = file.IndexOf("?") post = file.Substring(pos + 1) file = file.Substring(0, pos) Else post = String.Empty End If If method.Equals("GETPOST") Then If file.Contains("~~") Then pos = file.IndexOf("~~") post = file.Substring(pos + 2) file = file.Substring(0, pos) Else post = String.Empty End If End If If referrer.Length = 0 Then referrer = last_page If method.Equals("GET") OrElse method.Equals("PIC") Then headers = String.Concat( _ "GET ", file, " HTTP/1.1", rn, _ "Host: ", host, rn, _ "User-Agent: ", user_agent, rn, _ IIf(method. Equals("GET"), "Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/ ;q=0.5", "Accept: image/png,*/*;q=0.5"), rn, _ "Accept-Language: en-us,en;q=0.5", rn, _ "Accept-Encoding: gzip,deflate", rn, _ "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7", rn, _ "Keep-Alive: 300", rn, _ "Connection: close", rn, _ "Referer: ", referrer, rn, _ IIf(Not String.IsNullOrEmpty(cookies), "Cookie: " & cookies & rn & rn, rn)) Else headers = String.Concat( _ "POST ", file, " HTTP/1.1", rn, _ "Host: ", host, rn, _ "User-Agent: ", user_agent, rn, _ "Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/ ;q=0.5", rn, _ "Accept-Language: en-us,en;q=0.5", rn, _ "Accept-Encoding: gzip,deflate", rn, _ "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7", rn, _ "Keep-Alive: 300", rn, _ "Referer: ", referrer, rn, _ IIf(Not String.IsNullOrEmpty(cookies), "Cookie: " & cookies & rn, String.Empty), _ "Content-Type: application/x-www-form-urlencoded", rn, _ "Content-Length: ", post.Length.ToString, rn, _ "Connection: close", rn, rn, _ post) End If Return System.Text.Encoding.ASCII.GetBytes(headers) End Function Private Sub DecompressGzip() 'Dim memStream As New MemoryStream(System.Text.Encoding.[Default].GetBytes(parts(1))) Dim memStream As New MemoryStream(System.Text.Encoding.GetEncoding(1252).GetBytes(parts(1) )) Dim decompressStream As New GZipStream(memStream, CompressionMode.Decompress) Dim endBytes(3) As Byte Dim offset As Integer = 0, oc As Integer = 0, position = Convert.ToInt32(memStream.Length) - 4 memStream.Position = position memStream.Read(endBytes, 0, 4) memStream.Position = 0 Dim buffer(BitConverter.ToInt32(endBytes, 0) + 99) As Byte Do offset += oc oc = decompressStream.Read(buffer, offset, 100) Loop While oc > 0 parts(1) = Encoding.ASCII.GetString(buffer) End Sub Private Sub DeChunk() chunk_pat.Replace(parts( 1), String.Empty) End Sub Private Sub ParseCookies() Dim parsed_cookies As String = Nothing, m1 As String, m2 As String Dim matches As MatchCollection If cookies_pat.IsMatch(parts(0)) Then matches = cookies_pat.Matches(parts(0)) For Each m As Match In matches m1 = m.Groups(1).ToString() m2 = m.Groups(2).ToString() If m2 = "deleted" Then cookie_dict.Remove(m1) ElseIf cookie_dict.ContainsKey(m1) Then cookie_dict.Remove(m1) cookie_dict.Add(m1, m1 + "=" + m2) Else cookie_dict.Add(m1, m1 + "=" + m2) End If Next End If For Each item As KeyValuePair(Of String, String) In cookie_dict parsed_cookies += item.Value.ToString() + "; " Next If Not String.IsNullOrEmpty(parsed_cookies) Then parsed_cookies.Remove(parsed_cookies.LastIndexOf(";"), 2) cookies = parsed_cookies End Sub End Class
#4
Posted 21 November 2009 - 12:16 PM
Yes that's it.
#5
Posted 22 November 2009 - 01:47 PM
I was talking in reference to the DLL. Are you using VB.NET or VB6? You cannot use that code in a VB6 project however you can use the DLL Also if it is VB6 you're using get rid of it and go for python or a .NET language.
#6
Posted 22 November 2009 - 02:11 PM
I frequently switch from Vb.net to VB6, and yes this one I am using in VB.net
And learning python! ITs such a nice language but for me, kinda hard to learn
And learning python! ITs such a nice language but for me, kinda hard to learn
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users