Skip to content

Instantly share code, notes, and snippets.

@r15ch13
Last active January 22, 2025 01:01
Show Gist options
  • Select an option

  • Save r15ch13/0f82e368003a1e0150f97dc585fa2527 to your computer and use it in GitHub Desktop.

Select an option

Save r15ch13/0f82e368003a1e0150f97dc585fa2527 to your computer and use it in GitHub Desktop.

Revisions

  1. r15ch13 revised this gist May 21, 2023. 2 changed files with 20 additions and 18 deletions.
    18 changes: 0 additions & 18 deletions convert-sub-to-csv.ps1
    Original file line number Diff line number Diff line change
    @@ -1,18 +0,0 @@
    # Converts Flipper SubGhz RAW Files to CSV
    function ConvertSubTo-Csv {
    param(
    [Parameter(Mandatory = $true, Position = 0, ValueFromPipeline = $true)]
    [String] $Path
    )

    process {
    Get-Content $Path
    | Select-Object -Skip 5
    | ForEach-Object { $_.Replace("RAW_Data: ", "") }
    | Join-String -Separator " "
    | Select-String -Pattern '(\d+)\s(-\d+)' -AllMatches
    | ForEach-Object { $_.Matches }
    | ForEach-Object { @{ Tone = $_.Groups[1]; Silence = $_.Groups[2] } }
    | ConvertTo-Csv
    }
    }
    20 changes: 20 additions & 0 deletions convertfrom-subghzraw.ps1
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    # 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] } }
    }
    }
  2. r15ch13 revised this gist May 21, 2023. No changes.
  3. r15ch13 created this gist May 21, 2023.
    18 changes: 18 additions & 0 deletions convert-sub-to-csv.ps1
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    # Converts Flipper SubGhz RAW Files to CSV
    function ConvertSubTo-Csv {
    param(
    [Parameter(Mandatory = $true, Position = 0, ValueFromPipeline = $true)]
    [String] $Path
    )

    process {
    Get-Content $Path
    | Select-Object -Skip 5
    | ForEach-Object { $_.Replace("RAW_Data: ", "") }
    | Join-String -Separator " "
    | Select-String -Pattern '(\d+)\s(-\d+)' -AllMatches
    | ForEach-Object { $_.Matches }
    | ForEach-Object { @{ Tone = $_.Groups[1]; Silence = $_.Groups[2] } }
    | ConvertTo-Csv
    }
    }