mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-06 09:12:45 +01:00
Use importer's new --json flag.
Using the new --json flag is not only more reliable than using a regex, the way the import script was written even re-imports will provide a url. This means that in more cases we can provide the results to the users (even if nothing changed).
This commit is contained in:
@@ -227,11 +227,11 @@ function import_file() {
|
|||||||
log "importing..."
|
log "importing..."
|
||||||
case $importer in
|
case $importer in
|
||||||
pcap)
|
pcap)
|
||||||
response=$($CMD_PREFIX "salt '$node' cmd.run 'so-import-pcap $file'")
|
response=$($CMD_PREFIX "salt '$node' cmd.run 'so-import-pcap $file --json'")
|
||||||
exit_code=$?
|
exit_code=$?
|
||||||
;;
|
;;
|
||||||
evtx)
|
evtx)
|
||||||
response=$($CMD_PREFIX "salt '$node' cmd.run 'so-import-evtx $file'")
|
response=$($CMD_PREFIX "salt '$node' cmd.run 'so-import-evtx $file --json'")
|
||||||
exit_code=$?
|
exit_code=$?
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
@@ -246,7 +246,8 @@ function import_file() {
|
|||||||
log "Exit Code: $exit_code"
|
log "Exit Code: $exit_code"
|
||||||
|
|
||||||
if [[ exit_code -eq 0 ]]; then
|
if [[ exit_code -eq 0 ]]; then
|
||||||
url=$(echo "$response" | sed ':a;N;$!ba;s/\n//g' | grep -E -o "https://\S*")
|
# trim off the node header ("manager_standalone:\n") and parse out the URL
|
||||||
|
url=$(echo "$response" | tail -n +2 | jq -r .url)
|
||||||
$(echo "$url" > "${SOC_PIPE}")
|
$(echo "$url" > "${SOC_PIPE}")
|
||||||
else
|
else
|
||||||
log "false"
|
log "false"
|
||||||
|
|||||||
Reference in New Issue
Block a user