$IOC
で配列から項目を引き出し、各項目に対して$ API here-stringの$ IMPORTを置き換えてコンソールに結果をエコーしますその後、$IOC
配列内の各項目についてそれを行います。ここで変数置換を行うには
#put IOC's into array
$IOC= ‘c:\Users\powershell_array.txt'
#api curl script with variable to be replaced
$API = @"
curl --insecure 'https://192.168.1.1:3000/hx/api/v2/indicators/Custom/Powershell_AD/conditions/execution' -X 'POST' --data-binary "
{
\"tests\":[
{
\"token\":\"processEvent/ActiveDirectory\",
\"type\":\"text\",
\"operator\":\"contains\",
\"preservecase\":false,
\"value\":\"$IMPORT\"
}
]
}" -H 'X-FeApi-Token: IAOaiq1s2' -H 'Accept: application/json' -H 'Content-Type: application/json'"
"@
ForEach ($i in Get-Content $IOC) {$API -replace $IMPORT, $i} echo $API
私はエラーを取得しないが、それは単に、配列の内容を出力し、その後、交換せずにコースのエコーの$API
1時間。
どちらも本当に助けましたが、残念ながら私はまだポイントを与えることはできませんが、それは非常に感謝しています! –