Skip to content

Instantly share code, notes, and snippets.

@r15ch13
Last active January 22, 2025 01:01
Show Gist options
  • Save r15ch13/0f82e368003a1e0150f97dc585fa2527 to your computer and use it in GitHub Desktop.
Save r15ch13/0f82e368003a1e0150f97dc585fa2527 to your computer and use it in GitHub Desktop.
Convert Flipper SubGhz RAW Files to CSV
# Converts Flipper SubGhz RAW Files to PSCustomObject[]
function ConvertFrom-SubGhzRAW {
param(
[Parameter(Mandatory = $true, Position = 0, ValueFromPipeline = $true)]
[String] $Path
)
process {
$data = Get-Content $Path
if(!$data.Contains("Filetype: Flipper SubGhz RAW File")) {
throw "$Path is not a Flipper SubGhz RAW File"
}
$data | Select-Object -Skip 5
| ForEach-Object { $_.Replace("RAW_Data: ", "") }
| Join-String -Separator " "
| Select-String -Pattern '(\d+)\s(-\d+)' -AllMatches
| ForEach-Object { $_.Matches }
| ForEach-Object { [PSCustomObject]@{ Tone = $_.Groups[1]; Silence = $_.Groups[2] } }
}
}
@r15ch13
Copy link
Author

r15ch13 commented May 21, 2023

Copy and paste to console hit <Enter>, then run:

# convert one file
ConvertFrom-SubGhzRAW mysubfile.sub | ConvertTo-Csv | Out-File mycsvfile.csv
# convert every *.sub file in a directory
Get-ChildItem *.sub | ForEach-Object { ConvertFrom-Sub -Path $_ | ConvertTo-Csv | Out-File "$($_.BaseName).csv" }

@jamisonderek
Copy link

Nice! This week I'm working on the wiki, so once I have a Sub-GHz page, I'll reference this script!

@jamisonderek
Copy link

For now, I've updated the comments in the video to point to this page.

@knoxoxen
Copy link

this is epic , thank you. its saved a lot of work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment