Skip to content

Commit f67d4c7

Browse files
committed
Initial commit including some code
But this won't work because there will be some compiler errors. I was just too lazy to code a type which can handle those pairs. (String arrays are not efficient) But with the next commit this should work.
0 parents  commit f67d4c7

10 files changed

+416
-0
lines changed

.gitattributes

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Auto detect text files and perform LF normalization
2+
* text=auto
3+
4+
# Custom for Visual Studio
5+
*.cs diff=csharp
6+
*.sln merge=union
7+
*.csproj merge=union
8+
*.vbproj merge=union
9+
*.fsproj merge=union
10+
*.dbproj merge=union
11+
12+
# Standard to msysgit
13+
*.doc diff=astextplain
14+
*.DOC diff=astextplain
15+
*.docx diff=astextplain
16+
*.DOCX diff=astextplain
17+
*.dot diff=astextplain
18+
*.DOT diff=astextplain
19+
*.pdf diff=astextplain
20+
*.PDF diff=astextplain
21+
*.rtf diff=astextplain
22+
*.RTF diff=astextplain

.gitignore

+108
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
# Build Folders (you can keep bin if you'd like, to store dlls and pdbs)
2+
[Bb]in/
3+
[Oo]bj/
4+
5+
# mstest test results
6+
TestResults
7+
8+
## Ignore Visual Studio temporary files, build results, and
9+
## files generated by popular Visual Studio add-ons.
10+
11+
# User-specific files
12+
*.suo
13+
*.user
14+
*.sln.docstates
15+
16+
# Build results
17+
[Dd]ebug/
18+
[Rr]elease/
19+
x64/
20+
*_i.c
21+
*_p.c
22+
*.ilk
23+
*.meta
24+
*.obj
25+
*.pch
26+
*.pdb
27+
*.pgc
28+
*.pgd
29+
*.rsp
30+
*.sbr
31+
*.tlb
32+
*.tli
33+
*.tlh
34+
*.tmp
35+
*.log
36+
*.vspscc
37+
*.vssscc
38+
.builds
39+
40+
# Visual C++ cache files
41+
ipch/
42+
*.aps
43+
*.ncb
44+
*.opensdf
45+
*.sdf
46+
47+
# Visual Studio profiler
48+
*.psess
49+
*.vsp
50+
*.vspx
51+
52+
# Guidance Automation Toolkit
53+
*.gpState
54+
55+
# ReSharper is a .NET coding add-in
56+
_ReSharper*
57+
58+
# NCrunch
59+
*.ncrunch*
60+
.*crunch*.local.xml
61+
62+
# Installshield output folder
63+
[Ee]xpress
64+
65+
# DocProject is a documentation generator add-in
66+
DocProject/buildhelp/
67+
DocProject/Help/*.HxT
68+
DocProject/Help/*.HxC
69+
DocProject/Help/*.hhc
70+
DocProject/Help/*.hhk
71+
DocProject/Help/*.hhp
72+
DocProject/Help/Html2
73+
DocProject/Help/html
74+
75+
# Click-Once directory
76+
publish
77+
78+
# Publish Web Output
79+
*.Publish.xml
80+
81+
# NuGet Packages Directory
82+
packages
83+
84+
# Windows Azure Build Output
85+
csx
86+
*.build.csdef
87+
88+
# Windows Store app package directory
89+
AppPackages/
90+
91+
# Others
92+
[Bb]in
93+
[Oo]bj
94+
sql
95+
TestResults
96+
[Tt]est[Rr]esult*
97+
*.Cache
98+
ClientBin
99+
[Ss]tyle[Cc]op.*
100+
~$*
101+
*.dbmdl
102+
Generated_Code #added for RIA/Silverlight projects
103+
104+
# Backup & report files from converting an old project file to a newer
105+
# Visual Studio version. Backup files are not needed, because we have git ;-)
106+
_UpgradeReport_Files/
107+
Backup*/
108+
UpgradeLog*.XML

ChromePassDecrypter.csproj

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
3+
<PropertyGroup>
4+
<ProjectGuid>{0CEE00DB-7B30-49BD-8DB5-C8D8144EFE8C}</ProjectGuid>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<OutputType>Library</OutputType>
8+
<RootNamespace>ChromePassDecrypter</RootNamespace>
9+
<AssemblyName>ChromePassDecrypter</AssemblyName>
10+
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
11+
<TargetFrameworkProfile>
12+
</TargetFrameworkProfile>
13+
<AppDesignerFolder>Properties</AppDesignerFolder>
14+
</PropertyGroup>
15+
<PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' ">
16+
<PlatformTarget>AnyCPU</PlatformTarget>
17+
</PropertyGroup>
18+
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
19+
<OutputPath>bin\Debug\</OutputPath>
20+
<DebugSymbols>True</DebugSymbols>
21+
<DebugType>Full</DebugType>
22+
<Optimize>False</Optimize>
23+
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
24+
<DefineConstants>DEBUG;TRACE</DefineConstants>
25+
</PropertyGroup>
26+
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
27+
<OutputPath>bin\Release\</OutputPath>
28+
<DebugSymbols>False</DebugSymbols>
29+
<DebugType>None</DebugType>
30+
<Optimize>True</Optimize>
31+
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
32+
<DefineConstants>TRACE</DefineConstants>
33+
</PropertyGroup>
34+
<ItemGroup>
35+
<Reference Include="System" />
36+
<Reference Include="System.Data.SQLite">
37+
<HintPath>System.Data.SQLite.dll</HintPath>
38+
<Private>False</Private>
39+
</Reference>
40+
<Reference Include="System.Security" />
41+
</ItemGroup>
42+
<ItemGroup>
43+
<Compile Include="ChromePasswords.cs" />
44+
<Compile Include="Properties\AssemblyInfo.cs" />
45+
</ItemGroup>
46+
<ItemGroup>
47+
<None Include="SQLite.Interop.dll">
48+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
49+
</None>
50+
<None Include="System.Data.SQLite.dll">
51+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
52+
</None>
53+
</ItemGroup>
54+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
55+
</Project>

ChromePassDecrypter.sln

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 11.00
3+
# Visual Studio 2010
4+
# SharpDevelop 4.3
5+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ChromePassDecrypter", "ChromePassDecrypter.csproj", "{0CEE00DB-7B30-49BD-8DB5-C8D8144EFE8C}"
6+
EndProject
7+
Global
8+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
9+
Debug|Any CPU = Debug|Any CPU
10+
Release|Any CPU = Release|Any CPU
11+
EndGlobalSection
12+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
13+
{0CEE00DB-7B30-49BD-8DB5-C8D8144EFE8C}.Debug|Any CPU.Build.0 = Debug|Any CPU
14+
{0CEE00DB-7B30-49BD-8DB5-C8D8144EFE8C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{0CEE00DB-7B30-49BD-8DB5-C8D8144EFE8C}.Release|Any CPU.Build.0 = Release|Any CPU
16+
{0CEE00DB-7B30-49BD-8DB5-C8D8144EFE8C}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
EndGlobalSection
18+
EndGlobal

ChromePasswords.cs

+126
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
/*
2+
* This is free and unencumbered software released into the public domain.
3+
*
4+
* Anyone is free to copy, modify, publish, use, compile, sell, or
5+
* distribute this software, either in source code form or as a compiled
6+
* binary, for any purpose, commercial or non-commercial, and by any
7+
* means.
8+
*
9+
* In jurisdictions that recognize copyright laws, the author or authors
10+
* of this software dedicate any and all copyright interest in the
11+
* software to the public domain. We make this dedication for the benefit
12+
* of the public at large and to the detriment of our heirs and
13+
* successors. We intend this dedication to be an overt act of
14+
* relinquishment in perpetuity of all present and future rights to this
15+
* software under copyright law.
16+
*
17+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20+
* IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
21+
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22+
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23+
* OTHER DEALINGS IN THE SOFTWARE.
24+
*
25+
* For more information, please refer to <http://unlicense.org>
26+
*/
27+
using System;
28+
using System.Data.SQLite;
29+
using System.IO;
30+
using System.Runtime.InteropServices;
31+
using System.Security.Cryptography;
32+
using System.Text;
33+
34+
namespace ChromePassDecrypter
35+
{
36+
/// <summary>
37+
/// Provides static functions for decrypting passwords stored by Google Chrome
38+
/// </summary>
39+
public static class ChromePasswords
40+
{
41+
private static string pathToProfiles = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\Google\Chrome\User Data";
42+
43+
// TODO: Think about the return type
44+
public static object GetPasswords()
45+
{
46+
// TODO: placeholder...
47+
object result = new Object();
48+
DirectoryInfo dirInfo = new DirectoryInfo(pathToProfiles);
49+
DirectoryInfo[] subDirInfo = dirInfo.GetDirectories();
50+
51+
for (int i = 0; i < subDirInfo.Length; i++)
52+
{
53+
// These directories are not important for us
54+
if (subDirInfo[i].Name == "PepperFlash" ||
55+
subDirInfos[i].Name == "Performance Monitor Databases" ||
56+
subDirInfos[i].Name == "pnacl" ||
57+
subDirInfos[i].Name == "SwiftShader" ||
58+
subDirInfos[i].Name == "Temp" ||
59+
subDirInfos[i].Name == "WidevineCDM")
60+
{
61+
continue;
62+
}
63+
64+
// TODO: placeholder...
65+
result += GetPasswords(subDirInfo[i].FullName + @"\Login Data");
66+
}
67+
68+
return result;
69+
}
70+
71+
// TODO: same here...
72+
private static object GetPasswords(string pathToPasswordsFile)
73+
{
74+
if (!File.Exists(pathToPasswordsFile))
75+
{
76+
return null;
77+
}
78+
79+
// We need to copy the file because it may be locked
80+
string tempFile = Path.GetTempFileName();
81+
File.Copy(pathToPasswordsFile, tempFile);
82+
83+
// TODO: some return type init here
84+
85+
using (SQLiteConnection conn = new SQLiteConnection("Data Source=" + tempFile + ";Version=3;New=True;Compress=True;"))
86+
{
87+
conn.Open();
88+
89+
using (SQLiteCommand comm = conn.CreateCommand())
90+
{
91+
comm.CommandText = "SELECT origin_url, username_value, password_value FROM logins";
92+
93+
using (SQLiteDataReader reader = comm.ExecuteReader())
94+
{
95+
while (reader.Read())
96+
{
97+
string originUrl = (string)reader["origin_url"];
98+
string username = (string)reader["username_value"];
99+
string password;
100+
try
101+
{
102+
password = Encoding.UTF8.GetString(ProtectedData.Unprotect((byte[])reader["password_value"], null, DataProtectionScope.CurrentUser));
103+
}
104+
catch (Exception ex)
105+
{
106+
password = "Password could not be retrieved: " + ex.Message;
107+
}
108+
}
109+
}
110+
}
111+
}
112+
113+
try
114+
{
115+
File.Delete(tempFile);
116+
}
117+
catch
118+
{
119+
// Well.. don't know what happened here and I don't care..
120+
// Some tweaking tools will clean this folder at some point..
121+
}
122+
123+
return ; // TODO: you know what to do...
124+
}
125+
}
126+
}

LICENSE.md

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
This is free and unencumbered software released into the public domain.
2+
3+
Anyone is free to copy, modify, publish, use, compile, sell, or
4+
distribute this software, either in source code form or as a compiled
5+
binary, for any purpose, commercial or non-commercial, and by any
6+
means.
7+
8+
In jurisdictions that recognize copyright laws, the author or authors
9+
of this software dedicate any and all copyright interest in the
10+
software to the public domain. We make this dedication for the benefit
11+
of the public at large and to the detriment of our heirs and
12+
successors. We intend this dedication to be an overt act of
13+
relinquishment in perpetuity of all present and future rights to this
14+
software under copyright law.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19+
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20+
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22+
OTHER DEALINGS IN THE SOFTWARE.
23+
24+
For more information, please refer to <http://unlicense.org>

0 commit comments

Comments
 (0)