Skip to content

Instantly share code, notes, and snippets.

@krisdb2009
Last active March 12, 2020 18:37
Show Gist options
  • Save krisdb2009/ee8e14270d7bcdcdd4850897691fbf31 to your computer and use it in GitHub Desktop.
Save krisdb2009/ee8e14270d7bcdcdd4850897691fbf31 to your computer and use it in GitHub Desktop.
Freedom Pay Serial Gathering Tool
$version = "1"
$tries = 10
$services =
"MsrLibHost",
"FCCClientSvc"
function Stop-Services {
foreach($service in $services) {
try {
Write-Host "Stopping service: $($service)..."
Stop-Service -Name $service -Force -ErrorAction Stop
} catch {
Write-Host -ForegroundColor Yellow "Could not find service: $service"
}
}
}
function Start-Services {
foreach($service in $services) {
try {
Write-Host "Starting service: $($service)..."
Start-Service -Name $service -ErrorAction Stop
} catch {
Write-Host -ForegroundColor Yellow "Could not find service: $service"
}
}
}
Write-Host -BackgroundColor Blue -ForegroundColor Yellow "Super Serial: v$version"
Stop-Services
Write-Host "Starting EMV job, aborting in $tries seconds..."
$job = Start-Job -ArgumentList $(Get-Location) {
Set-Location $args[0]
Write-Host "Attempting to gather EMV reader data..."
Write-Host "Importing Freeway Module..."
Import-Module -Name ".\FreewayMsrLib.dll"
Write-Host "Initializing Freeway Kernel..."
[MsrLib.MsrLibKernel]::AutoAttachNewDevices = $true
[MsrLib.MsrLibKernel]::Initialize()
Write-Host "Connecting to device..."
$lane = [MsrLib.MsrLibKernel]::GetLane(0, $true)
$lane.AutoAttachNewDevices = $true
Write-Host "Reading EMV device..."
if(-not ($lane.Device -eq $null)) {
Write-Host "Writing info to registry..."
Write-Host "Registry Key: $($(New-Item "HKLM:\SOFTWARE\SuperSerial\" -Force).Name)"
Write-Host "AppProduct: $($(New-ItemProperty "HKLM:\SOFTWARE\SuperSerial\" -Name "AppProduct" -Value $($lane.Device.Properties.AppProduct) -Force).AppProduct)"
Write-Host "AppSerialNumber: $($(New-ItemProperty "HKLM:\SOFTWARE\SuperSerial\" -Name "AppSerialNumber" -Value $($lane.Device.Properties.AppSerialNumber) -Force).AppSerialNumber)"
Write-Host "AppSerialNumber2: $($(New-ItemProperty "HKLM:\SOFTWARE\SuperSerial\" -Name "AppSerialNumber2" -Value $($lane.Device.Properties.AppSerialNumber2) -Force).AppSerialNumber2)"
Write-Host "Re-booting EMV device..."
$lane.Device.Reboot()
Write-Host -ForegroundColor Green "Success!"
} else {
Write-Host -ForegroundColor Red "Could not find EMV reader!"
}
}
while($($job.State -ne "Completed") -and -not $($tries -eq 0)) {
Write-Host $tries
Start-Sleep -Seconds 1
$tries--
}
if($tries -eq 0) {
Write-Host -ForegroundColor Red "Cancelling job..."
Stop-Job $job
} else {
Write-Host "Job Done."
}
Write-Host "`r`nJob Output: `r`n"
Receive-Job $job
Write-Host ""
Start-Services
Write-Host "Done."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment