-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtest.sh
28 lines (19 loc) · 845 Bytes
/
test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash
AUTH=`echo ${SPLUNK_USER}:${SPLUNK_PASSWORD} | base64.exe -w 0`
echo "[*] Getting an authentication token..."
TOKEN=$(curl -s \
-X GET \
-H "Authorization: Basic {$AUTH}" \
-H "Cache-Control: no-cache" "https://api.splunk.com/2.0/rest/login/splunk" \
| jq -r .data.token)
PKG=`find -name '*.spl'`
echo "[*] Submitting ${PKG} for validation..."
DATA=$(curl -s \
-X POST \
-H "Authorization: bearer ${TOKEN}" \
-H "Cache-Control: no-cache" \
-H "Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW" \
-F "app_package=@${PKG}" "https://appinspect.splunk.com/v1/app/validate")
RID=$(echo $DATA | jq -r .request_id)
REPORT_CMD="curl -s -H \"Authorization: bearer ${TOKEN}\" https://appinspect.splunk.com/v1/app/report/${RID}"
echo "[*] Download the report with ${REPORT_CMD}"