Skip to content

Instantly share code, notes, and snippets.

@neodigm
Last active May 30, 2021 18:49
Show Gist options
  • Save neodigm/1ee1eed6c48f243984e4425fa857fd5b to your computer and use it in GitHub Desktop.
Save neodigm/1ee1eed6c48f243984e4425fa857fd5b to your computer and use it in GitHub Desktop.
// This snippet will log a url for each obs, so that you can eaisly find an OBS with event data
console.clear()
var aObs = document.querySelector( 'DIV#app' ).__vue__.$store.state.obsSys.obsList
var aHref = document.location.href.split("/")
aHref = aHref.slice(0,3).join("/")
var aTD = [ ... document.querySelectorAll("#app > div main tbody tr td:nth-child(1)")]
setTimeout(function(){
console.log( aObs )
aObs.forEach((Obs)=>{
var sURI = aHref + "/obs/" + Obs.id + "/operations/incident-response/events"
aTD.map((e)=>{
if(e.innerHTML === Obs.name){
e.innerHTML += ` | <span style="color: #d00;font-size: 9px;">${Obs.id}</span>`;
// .
// .fetch("https://privilege-assurance.pscale.qomplxos.com/api/v1/admon/projections/MP-MVLWS12DC006/6064a6cc004df90007ffc3bb/metrics?", {
fetch("https://privilege-assurance.pscale.qomplxos.com/api/v1/admon/query/hostnames/" + Obs.id, {
"headers": {
"accept": "application/json, text/plain, */*",
"accept-language": "en-US,en;q=0.9",
"sec-ch-ua": "\" Not A;Brand\";v=\"99\", \"Chromium\";v=\"90\", \"Google Chrome\";v=\"90\"",
"sec-ch-ua-mobile": "?0",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-site",
"x-qos-auth-token": document.querySelector( 'DIV#app' ).__vue__.$store.state.auth.token,
"x-requested-with": "XmlHttpRequest"
},
"referrer": "https://cyber.pscale.qomplxos.com/",
"referrerPolicy": "strict-origin-when-cross-origin",
"body": null,
"method": "GET",
"mode": "cors",
"credentials": "include"
})
.then(response => response.json())
.then((data) => {
if( data.length > 0){
console.log( data );
data.forEach( (host)=>{
e.innerHTML += ` | <span style="color: #0d0;font-size: 9px;">${host}</span>`;
})
}
})
}
})
console.log( sURI )
})
},2000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment