- Log in to post comments
User bio
404 bio not found
Member since Jan 21, 2020
Posts:
Replies:
By the Power of ChatGPT it is: Triple Quotes.
Spoiler
# Test string escaping for IRIS session routine calls
param(
[string]$Instance = "healthconnect",
[string]$TestString = "Your String Here"
)
Write-Host "Testing string escaping for IRIS session routine calls" -ForegroundColor Cyan
Write-Host "Instance: $Instance" -ForegroundColor Yellow
Write-Host "Test String: '$TestString'" -ForegroundColor Yellow
Write-Host ""
# Array of different escape patterns to test
$escapeTests = @(
@{
Name = "Backtick quotes"
Pattern = 'Say^ImplUtil(`"' + $TestString + '`")'
},
@{
Name = "Single quotes around whole command"
Pattern = "Say^ImplUtil(""$TestString"")"
},
@{
Name = "Double quotes escaped with backslash"
Pattern = 'Say^ImplUtil(\"' + $TestString + '\")'
},
@{
Name = "Single quotes inside double quotes"
Pattern = "Say^ImplUtil('$TestString')"
},
@{
Name = "No quotes around string"
Pattern = "Say^ImplUtil($TestString)"
},
@{
Name = "Backtick escaped double quotes"
Pattern = "Say^ImplUtil(`"$TestString`")"
},
@{
Name = "Double backtick quotes"
Pattern = 'Say^ImplUtil(``"' + $TestString + '``")'
},
@{
Name = "Triple quotes"
Pattern = 'Say^ImplUtil("""' + $TestString + '""")'
},
@{
Name = "Percent encoding style"
Pattern = "Say^ImplUtil(%22$TestString%22)"
},
@{
Name = "Curly braces"
Pattern = "Say^ImplUtil({$TestString})"
}
)
$successfulPatterns = @()
foreach ($test in $escapeTests) {
Write-Host "Testing: $($test.Name)" -ForegroundColor White
Write-Host "Pattern: $($test.Pattern)" -ForegroundColor Gray
try {
# Test the pattern
$result = irissession $Instance -U user $test.Pattern 2>&1
# Check if it's an invalid argument error
if ($result -match "INVALID ARGUMENT" -or $result -match "ERROR" -or $result -match "SYNTAX ERROR") {
Write-Host "❌ FAILED: $result" -ForegroundColor Red
} else {
Write-Host "✅ SUCCESS: $result" -ForegroundColor Green
$successfulPatterns += $test
}
} catch {
Write-Host "❌ EXCEPTION: $_" -ForegroundColor Red
}
Write-Host ""
}
# Summary
Write-Host "=== SUMMARY ===" -ForegroundColor Cyan
if ($successfulPatterns.Count -gt 0) {
Write-Host "Successful patterns:" -ForegroundColor Green
foreach ($pattern in $successfulPatterns) {
Write-Host " ✅ $($pattern.Name): $($pattern.Pattern)" -ForegroundColor Green
}
} else {
Write-Host "No successful patterns found. Consider testing with a simpler command first." -ForegroundColor Yellow
}
Testing: Triple quotes
Pattern: Say^ImplUtil("""Your String Here""")
✅ SUCCESS: Your String Here
I'm fairly certain i tested this before though. 🤔
- Log in to post comments
thank you for confirming my approach, but unfortunately that's not how it works it seems.
PS C:\Users\Colin\Desktop> irissession healthconnect -U user 'Say^ImplUtil("Your String Here")'
<INVALID ARGUMENT>>- Log in to post comments
Certifications & Credly badges:
Colin has no Certifications & Credly badges yet.
Followers:
Colin has no followers yet.
Following:
Colin has not followed anybody yet.
thank you, I'll try this. 😊