From debe4a565ebd51b740855e3e83b331a6d5fd7e33 Mon Sep 17 00:00:00 2001 From: sixdub Date: Thu, 12 May 2016 10:58:27 -0400 Subject: Added Get-MicrophoneAudio.ps1 and associated Pester tests --- Tests/Exfiltration.tests.ps1 | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'Tests/Exfiltration.tests.ps1') diff --git a/Tests/Exfiltration.tests.ps1 b/Tests/Exfiltration.tests.ps1 index e4f60d5..ed98f45 100644 --- a/Tests/Exfiltration.tests.ps1 +++ b/Tests/Exfiltration.tests.ps1 @@ -52,3 +52,34 @@ Describe 'Get-Keystrokes' { Remove-Item -Force "$($env:TEMP)\key.log" } + +Describe "Get-MicrophoneAudio" { + + $RecordPath = "$env:TEMP\test_record.wav" + $RecordLen = 2 + Context 'Successful Recording' { + BeforeEach { + #Ensure the recording as been removed prior to testing + Remove-Item -Path $RecordPath -ErrorAction SilentlyContinue + } + + AfterEach { + #Remove the recording after testing + Remove-Item -Path $RecordPath -ErrorAction SilentlyContinue + } + + It 'should record audio from the microphone and save it to a specified path' { + $result = Get-MicrophoneAudio -Path $RecordPath -Length $RecordLen + $result | Should Not BeNullOrEmpty + $result.Length | Should BeGreaterThan 0 + } + + } + + Context 'Invalid Arguments' { + It 'should not allow invalid paths to be used' { + { Get-MicrophoneAudio -Path "c:\FAKEPATH\yay.wav" -Length RecordLen} | Should Throw + } + } + +} -- cgit v1.2.3