Update DB-File-Viewer.ps1
This commit is contained in:
@@ -4,7 +4,7 @@ SYNOPSIS
|
|||||||
This script uses sqlite to enumerate database files and return table information to the user.
|
This script uses sqlite to enumerate database files and return table information to the user.
|
||||||
|
|
||||||
Option 1
|
Option 1
|
||||||
Scrape browser files for database files, extract information and display results
|
Scrape this computer's browser directories for database files, extract information and display results
|
||||||
|
|
||||||
Option 2
|
Option 2
|
||||||
Specify a .db OR .sqlite file to display information
|
Specify a .db OR .sqlite file to display information
|
||||||
@@ -182,58 +182,58 @@ while ($true){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
while($true){
|
while($true){
|
||||||
cls
|
cls
|
||||||
|
|
||||||
$showfiles = Get-ChildItem -Path $selectedFolder -Filter '*.csv' -Recurse
|
|
||||||
$filesList = @()
|
|
||||||
|
|
||||||
foreach ($file in $showfiles) {
|
|
||||||
if ($file.Length -gt 0){
|
|
||||||
$filesList += [PSCustomObject]@{
|
|
||||||
'Index' = $filesList.Count + 1
|
|
||||||
'Name' = $file.Name
|
|
||||||
'Size (KB)' = [math]::Round($file.Length / 1KB, 2)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($filesList.Count -eq 0) {
|
|
||||||
Write-Host "No non-empty CSV files found in the selected folder."
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
$filesList | Format-Table -AutoSize -Wrap
|
|
||||||
|
|
||||||
Write-Host "`n0. Back To Folders"
|
|
||||||
$selectionIndex = Read-Host "Select a file "
|
|
||||||
|
|
||||||
if ($selectionIndex -eq '0'){
|
|
||||||
break
|
|
||||||
}
|
|
||||||
if ([int]::TryParse($selectionIndex, [ref]$null)) {
|
|
||||||
$selectionIndex = [int]$selectionIndex
|
|
||||||
if ($selectionIndex -ge 1 -and $selectionIndex -le $filesList.Count) {
|
|
||||||
$selectedFile = ($showfiles | Where-Object { $_.Name -eq $filesList[$selectionIndex - 1].Name }).FullName
|
|
||||||
Write-Host "You selected file: $selectedFile"
|
|
||||||
if ((Get-Item $selectedFile).length -gt 100) {
|
|
||||||
Import-Csv $selectedFile | Out-GridView -Title "Data from table $table"
|
|
||||||
sleep 1
|
|
||||||
break
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Write-Host "File is empty.."
|
|
||||||
sleep 1
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Write-Host "Invalid selection. Please enter a number between 1 and $($filesList.Count)."
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Write-Host "Invalid input. Please enter a valid number."
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
$showfiles = Get-ChildItem -Path $selectedFolder -Filter '*.csv' -Recurse
|
||||||
|
$filesList = @()
|
||||||
|
|
||||||
|
foreach ($file in $showfiles) {
|
||||||
|
if ($file.Length -gt 0){
|
||||||
|
$filesList += [PSCustomObject]@{
|
||||||
|
'Index' = $filesList.Count + 1
|
||||||
|
'Name' = $file.Name
|
||||||
|
'Size (KB)' = [math]::Round($file.Length / 1KB, 2)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($filesList.Count -eq 0) {
|
||||||
|
Write-Host "No non-empty CSV files found in the selected folder."
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
$filesList | Format-Table -AutoSize -Wrap
|
||||||
|
|
||||||
|
Write-Host "`n0. Back To Folders"
|
||||||
|
$selectionIndex = Read-Host "Select a file "
|
||||||
|
|
||||||
|
if ($selectionIndex -eq '0'){
|
||||||
|
break
|
||||||
|
}
|
||||||
|
if ([int]::TryParse($selectionIndex, [ref]$null)) {
|
||||||
|
$selectionIndex = [int]$selectionIndex
|
||||||
|
if ($selectionIndex -ge 1 -and $selectionIndex -le $filesList.Count) {
|
||||||
|
$selectedFile = ($showfiles | Where-Object { $_.Name -eq $filesList[$selectionIndex - 1].Name }).FullName
|
||||||
|
Write-Host "You selected file: $selectedFile"
|
||||||
|
if ((Get-Item $selectedFile).length -gt 100) {
|
||||||
|
Import-Csv $selectedFile | Out-GridView -Title "Data from table $table"
|
||||||
|
sleep 1
|
||||||
|
break
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Write-Host "File is empty.."
|
||||||
|
sleep 1
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Write-Host "Invalid selection. Please enter a number between 1 and $($filesList.Count)."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Write-Host "Invalid input. Please enter a valid number."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user