-
Notifications
You must be signed in to change notification settings - Fork 106
/
Copy pathProgram.cs
113 lines (103 loc) · 2.94 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
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
using System;
using System.Data;
using System.Collections;
using System.Collections.Generic;
using System.Threading;
using System.Security.Cryptography;
using System.Text;
using System.Diagnostics;
using System.Security.Principal;
using System.IO;
using System.Reflection;
using CS_SQLite3;
using SharpChrome;
using SharpFox;
using SharpEdge;
namespace SharpWeb
{
class Program
{
static void Usage()
{
string banner = @"
Usage:
.\SharpWeb.exe arg0 [arg1 arg2 ...]
Arguments:
all - Retrieve all Chrome, FireFox and IE/Edge credentials.
full - The same as 'all'
chrome - Fetch saved Chrome logins.
firefox - Fetch saved FireFox logins.
edge - Fetch saved Internet Explorer/Microsoft Edge logins.
";
Console.WriteLine(banner);
}
static void Main(string[] args)
{
string[] validArgs = { "all", "full", "chrome", "firefox", "-p", "edge" };
bool getChrome = false;
bool getFireFox = false;
bool getEdge = false;
string masterPassword = "";
if (args.Length == 0)
{
Usage();
return;
}
// Parse the arguments.
for (int i = 0; i < args.Length; i++)
{
// Valid arg!
string arg = args[i].ToLower();
if (Array.IndexOf(validArgs, arg) != -1)
{
if (arg == "all" || arg == "full")
{
getChrome = true;
getEdge = true;
getFireFox = true;
}
else if (arg == "chrome")
{
getChrome = true;
}
else if (arg == "firefox")
{
getFireFox = true;
}
else if (arg == "edge")
{
getEdge = true;
}
else if (arg == "-p")
{
masterPassword = args[i + 1];
}
}
}
if (!getChrome && !getEdge && !getFireFox)
{
Usage();
return;
}
if (getChrome)
{
Chrome.GetLogins();
}
if (getFireFox)
{
if (masterPassword != "")
{
FireFox.GetLogins(masterPassword);
}
else
{
FireFox.GetLogins();
}
}
if (getEdge)
{
Edge.GetLogins();
}
}
}
}