-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
81 lines (70 loc) · 2.74 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
using CommandLine;
using System;
using System.Collections.Generic;
using YourNamespace;
internal class Program
{
private static void Main(string[] args)
{
_ = Parser.Default.ParseArguments<Options>(args)
.WithParsed(options =>
{
// Create an instance of BrowserPicker with your Chromium list
List<Chromium> chromiumList = new(); // Replace with your Chromium instances
BrowserPicker browserPicker = new(chromiumList);
// Call the Execute method with parsed options
Execute(options, browserPicker);
})
.WithNotParsed(errors =>
{
// Handle parsing errors, if any
Console.WriteLine("Invalid command-line arguments. Please check your input.");
});
}
private static void Execute(Options options, BrowserPicker browserPicker)
{
List<IBrowser> browsers = browserPicker.PickBrowsers(options.Browser, options.ProfilePath);
foreach (IBrowser browser in browsers)
{
try
{
HackBrowserData.BrowsingData.Data data = browser.GetBrowsingData(options.FullExport);
data.Output(options.ResultsDir, browser.Name, options.Format);
}
catch (Exception ex)
{
Log.Error(ex.Message);
continue;
}
}
if (options.Compress)
{
try
{
FileUtil.FileUtils.CompressDir(options.ResultsDir);
Log.Notice("Compress success");
}
catch (Exception ex)
{
Log.Error(ex.Message);
}
}
}
}
internal class Options
{
[Option('v', "verbose", Default = false, HelpText = "Verbose")]
public bool Verbose { get; set; }
[Option('c', "compress", Default = false, HelpText = "Compress result to zip")]
public bool Compress { get; set; }
[Option('b', "browser", Default = "all", HelpText = "Available browsers: all|chrome|firefox|edge")]
public string Browser { get; set; }
[Option('r', "results-dir", Default = "results", HelpText = "Export directory")]
public string ResultsDir { get; set; }
[Option('o', "format", Default = "csv", HelpText = "File format: csv|json")]
public string Format { get; set; }
[Option('p', "profile-path", Default = "", HelpText = "Custom profile directory path, get with chrome://version")]
public string ProfilePath { get; set; }
[Option('x', "full-export", Default = true, HelpText = "Export full browsing data")]
public bool FullExport { get; set; }
}