Added a UserScript to automatically log in to clarity
This commit is contained in:
63
AutoLoginClarity.js
Normal file
63
AutoLoginClarity.js
Normal file
@@ -0,0 +1,63 @@
|
||||
// ==UserScript==
|
||||
// @name AutoLoginClarity
|
||||
// @namespace http://tampermonkey.net/
|
||||
// @version 0.1
|
||||
// @description Automatically pull data out of Riverbed for the previous day.
|
||||
// @author joe.tretter@kcc.com
|
||||
// @match https://clarity.kcc.com/niku/*
|
||||
// ==/UserScript==
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
// no cleartext password
|
||||
function encryptXor(text, key) {
|
||||
return Array.from(
|
||||
text,
|
||||
(c, i) => String.fromCharCode(c.charCodeAt() ^ key.charCodeAt(i % key.length))
|
||||
).join('');
|
||||
}
|
||||
|
||||
// if the login dialog pops up -> log in.
|
||||
function loginThread(credentials) {
|
||||
let myInterval;
|
||||
myInterval= window.setInterval(()=>{
|
||||
let userNameField = document.getElementById("ppm_login_username");
|
||||
let userPasswordField = document.getElementById("ppm_login_password");
|
||||
let userLoginButton = document.getElementById("ppm_login_button");
|
||||
|
||||
if (userNameField !== null) {
|
||||
// If we don't have credentials saved we ask for credentials.
|
||||
// If the login dialog comes up again in less than 10 seconds we assume the password changed and don't retry automatically to prevent account locking.
|
||||
if ((credentials === null) || ((localStorage.getItem("LastLoginDate") !== null) && ((new Date().getTime() - localStorage.getItem("LastLoginDate")) / 1000 < 10 ))) {
|
||||
clearInterval(myInterval);
|
||||
window.document.title="[AutoLoginClarity] Login unsuccessful.";
|
||||
console.log("Login unsuccessful.");
|
||||
userLoginButton.value="AutoLoginClarity: Save Credentials + Login";
|
||||
|
||||
// Credentials are stored encrypted in the Browsen's localstorage (yes, it's NOT safe, but it's a hurdle)
|
||||
userLoginButton.onclick=function(){
|
||||
credentials={username:userNameField.value,passwordCrypt:encryptXor(userPasswordField.value, '5346245634634765377')};
|
||||
localStorage.setItem("Credentials",JSON.stringify(credentials));
|
||||
alert('Credentials Saved.');
|
||||
window.location.reload();
|
||||
};
|
||||
userLoginButton.onkeydown=onclick;
|
||||
} else {
|
||||
//window.document.title="[AutoLoginClarity] Logging In";
|
||||
localStorage.setItem("LastLoginDate",new Date().getTime())
|
||||
clearInterval(myInterval);
|
||||
userNameField.value=credentials.username;
|
||||
userPasswordField.value=encryptXor(credentials.passwordCrypt, '5346245634634765377');
|
||||
|
||||
userLoginButton.click();
|
||||
}
|
||||
}
|
||||
},1000);
|
||||
}
|
||||
|
||||
// Password is encrypted with XOR to preent "accidental" revelation
|
||||
let credentials=localStorage.getItem("Credentials");
|
||||
if (credentials!==null) { credentials=JSON.parse(credentials); }
|
||||
loginThread(credentials);
|
||||
|
||||
})();
|
||||
@@ -1,7 +1,7 @@
|
||||
// ==UserScript==
|
||||
// @name AutoPerfReports
|
||||
// @namespace http://tampermonkey.net/
|
||||
// @version 0.4
|
||||
// @version 0.6
|
||||
// @description Automatically pull data out of Riverbed for the previous day.
|
||||
// @author joe.tretter@kcc.com
|
||||
// @match https://ttw.gws.kcc.com/*
|
||||
@@ -17,7 +17,7 @@
|
||||
simulateDate.setDate(today.getDate() - 1);
|
||||
|
||||
// To overwrite the simulate date uncomment the below and change the date (remember that the month starts at 0!
|
||||
//simulateDate = new Date(2018,11,1);
|
||||
//simulateDate = new Date(2019,1,17);
|
||||
|
||||
simulateDate = new Date(simulateDate.getFullYear(), simulateDate.getMonth(), simulateDate.getDate());
|
||||
|
||||
@@ -80,20 +80,22 @@
|
||||
let myInterval;
|
||||
return new Promise((resolve, reject) => {
|
||||
myInterval = window.setInterval(() => {
|
||||
if (document.getElementsByClassName("gwt-SuggestBox EKM0XQC-tb-f").length === 1) {
|
||||
if (document.getElementsByClassName("gwt-SuggestBox OT335KC-ub-f").length === 1) {
|
||||
clearInterval(myInterval);
|
||||
// even if the screen is loaded, if we are too fast it will be too fast for the javascript of the page...
|
||||
window.setTimeout(function(){
|
||||
window.document.title="[RiverRobot] Executing Query " + theQuery;
|
||||
console.log("ExecQuery ",theQuery);
|
||||
let theSearchField = document.getElementsByClassName("gwt-SuggestBox EKM0XQC-tb-f")[0];
|
||||
|
||||
let theSearchField = document.getElementsByClassName("gwt-SuggestBox OT335KC-ub-f")[0];
|
||||
theSearchField.value = theQuery;
|
||||
|
||||
let theSearchButton = document.getElementsByClassName("gwt-Button EKM0XQC-e-d")[0];
|
||||
let theNumResultsField = document.getElementsByClassName("gwt-TextBox OT335KC-vb-f")[0];
|
||||
theNumResultsField.value = 99999;
|
||||
|
||||
let theSearchButton = document.getElementsByClassName("gwt-Button OT335KC-e-e")[0];
|
||||
theSearchButton.click();
|
||||
resolve();
|
||||
},5000);
|
||||
},15000); // that's a bit lazy - I just assume it's ready in 15 sec... otherwise I had to poll the search button till it's clickable.
|
||||
} else {
|
||||
window.document.title="[RiverRobot] Waiting for Query field " + theQuery;
|
||||
console.log("Waiting for Query field",theQuery);
|
||||
@@ -152,41 +154,67 @@
|
||||
|
||||
let allQueriesAndNames = [
|
||||
{
|
||||
name: 'PrmMainBo.Save',
|
||||
query: " ! ( class.method = 'Cas.BusinessLogic.Clc.ClcCalculationEngineBo.Activate' ) and ! ( class.method = 'Cas.BusinessLogic.Prm.PrmMainBo.Copy' ) and ( class.method = 'Cas.BusinessLogic.Prm.PrmMainBo.Save' ) and ( instance = 'ACNCASWebSite#LAOProdServer' ) | calls -type class.method -class.method Cas.BusinessLogic.Prm.PrmMainBo.Save -include_call_count -visualization transactions -limit 10000 -sort_by total_duration"
|
||||
},
|
||||
{
|
||||
name: 'PayMainBo.Save',
|
||||
query: " class.method = 'Cas.BusinessLogic.Pay.PayMainBo.Save' and instance = 'ACNCASWebSite#LAOProdServer' | calls -type class.method -class.method Cas.BusinessLogic.Pay.PayMainBo.Save -include_call_count -visualization transactions -limit 10000 -sort_by total_duration"
|
||||
},
|
||||
{
|
||||
name: 'ClcCalculationBo.Calculation',
|
||||
query: "class.method = 'Cas.BusinessLogic.Clc.ClcCalculationEngineBo.Calculation' and instance = 'ACNCASWebSite#LAOProdServer' | calls -type class.method -class.method Cas.BusinessLogic.Clc.ClcCalculationEngineBo.Calculation -include_call_count -visualization transactions -limit 10000 -sort_by total_duration"
|
||||
},
|
||||
{
|
||||
name: 'ClcCalculationEngineBo.UpdateSummaryForPeriod',
|
||||
query: "class.method = 'Cas.BusinessLogic.Clc.ClcCalculationEngineBo.UpdateSummaryForPeriod' and instance = 'ACNCASWebSite#LAOProdServer' | calls -type class.method -class.method Cas.BusinessLogic.Clc.ClcCalculationEngineBo.UpdateSummaryForPeriod -include_call_count -visualization transactions -limit 10000 -sort_by total_duration"
|
||||
query: "class.method = 'Cas.BusinessLogic.Clc.ClcCalculationEngineBo.UpdateSummaryForPeriod' AND server = 'ustca089.kcc.com' | calls -type class.method -class.method Cas.BusinessLogic.Clc.ClcCalculationEngineBo.UpdateSummaryForPeriod -include_call_count -visualization transactions -limit 100000 -sort_by total_duration"
|
||||
},
|
||||
{
|
||||
name: 'PrmTacticView.GetView',
|
||||
query: "class.method = 'Cas.BusinessLogic.Prm.PrmTacticView.GetView' and instance = 'ACNCASWebSite#LAOProdServer' | calls -type class.method -class.method Cas.BusinessLogic.Prm.PrmTacticView.GetView -include_call_count -visualization transactions -limit 10000 -sort_by total_duration"
|
||||
query: "class.method = 'Cas.BusinessLogic.Prm.PrmTacticView.GetView' AND server = 'ustca089.kcc.com' | calls -type class.method -class.method Cas.BusinessLogic.Prm.PrmTacticView.GetView -include_call_count -visualization transactions -limit 100000 -sort_by total_duration"
|
||||
},
|
||||
{
|
||||
name: 'PrmTacticView.AddViewItem',
|
||||
query: "class.method = 'Cas.BusinessLogic.Prm.PrmTacticView.AddViewItem' and instance = 'ACNCASWebSite#LAOProdServer' | calls -type class.method -class.method Cas.BusinessLogic.Prm.PrmTacticView.AddViewItem -include_call_count -visualization transactions -limit 10000 -sort_by total_duration"
|
||||
query: "class.method = 'Cas.BusinessLogic.Prm.PrmTacticView.AddViewItem' AND server = 'ustca089.kcc.com' | calls -type class.method -class.method Cas.BusinessLogic.Prm.PrmTacticView.AddViewItem -include_call_count -visualization transactions -limit 100000 -sort_by total_duration"
|
||||
},
|
||||
{
|
||||
name: 'PrmProductAllView.GetView',
|
||||
query: "class.method = 'Cas.BusinessLogic.Prm.PrmProductAllView.GetView' and instance = 'ACNCASWebSite#LAOProdServer' | calls -type class.method -class.method Cas.BusinessLogic.Prm.PrmProductAllView.GetView -include_call_count -visualization transactions -limit 10000 -sort_by total_duration"
|
||||
query: "class.method = 'Cas.BusinessLogic.Prm.PrmProductAllView.GetView' AND server = 'ustca089.kcc.com' | calls -type class.method -class.method Cas.BusinessLogic.Prm.PrmProductAllView.GetView -include_call_count -visualization transactions -limit 100000 -sort_by total_duration"
|
||||
},
|
||||
{
|
||||
name: 'PrmProductAllView.AddViewItem',
|
||||
query: "class.method = 'Cas.BusinessLogic.Prm.PrmProductAllView.AddViewItem' and instance = 'ACNCASWebSite#LAOProdServer' | calls -type class.method -class.method Cas.BusinessLogic.Prm.PrmProductAllView.AddViewItem -include_call_count -visualization transactions -limit 10000 -sort_by total_duration"
|
||||
query: "class.method = 'Cas.BusinessLogic.Prm.PrmProductAllView.AddViewItem' AND server = 'ustca089.kcc.com' | calls -type class.method -class.method Cas.BusinessLogic.Prm.PrmProductAllView.AddViewItem -include_call_count -visualization transactions -limit 100000 -sort_by total_duration"
|
||||
},
|
||||
{
|
||||
name: 'BpaMyPaymentMassCreationView.GetView',
|
||||
query: "class.method = 'Cas.BusinessLogic.Bpa.BpaMyPaymentMassCreationView.GetView' and instance = 'ACNCASWebSite#LAOProdServer' | calls -type class.method -class.method Cas.BusinessLogic.Bpa.BpaMyPaymentMassCreationView.GetView -include_call_count -visualization transactions -limit 10000 -sort_by total_duration"
|
||||
query: "class.method = 'Cas.BusinessLogic.Bpa.BpaMyPaymentMassCreationView.GetView' AND server = 'ustca089.kcc.com' | calls -type class.method -class.method Cas.BusinessLogic.Bpa.BpaMyPaymentMassCreationView.GetView -include_call_count -visualization transactions -limit 100000 -sort_by total_duration"
|
||||
},
|
||||
{
|
||||
name: 'PayMainBo.Save',
|
||||
query: "class.method = 'Cas.BusinessLogic.Pay.PayMainBo.Save' AND server = 'ustca089.kcc.com' | calls -type class.method -class.method Cas.BusinessLogic.Pay.PayMainBo.Save -include_call_count -visualization transactions -limit 100000 -sort_by total_duration"
|
||||
},
|
||||
{
|
||||
name: 'PrmMainBo.Copy',
|
||||
query: "class.method = 'Cas.BusinessLogic.Prm.PrmMainBo.Copy' AND server = 'ustca089.kcc.com' | calls -type class.method -class.method Cas.BusinessLogic.Prm.PrmMainBo.Copy -include_call_count -visualization transactions -limit 100000 -sort_by total_duration"
|
||||
},
|
||||
{
|
||||
name: 'PrmTacticProductAllView.GetView',
|
||||
query: "class.method = 'Cas.BusinessLogic.Prm.PrmTacticProductAllView.GetView' AND server = 'ustca089.kcc.com' | calls -type class.method -class.method Cas.BusinessLogic.Prm.PrmTacticProductAllView.GetView -include_call_count -visualization transactions -limit 100000 -sort_by total_duration"
|
||||
},
|
||||
{
|
||||
name: 'PrmMainView.GetView',
|
||||
query: "class.method = 'Cas.BusinessLogic.Prm.PrmMainView.GetView' AND server = 'ustca089.kcc.com' | calls -type class.method -class.method Cas.BusinessLogic.Prm.PrmMainView.GetView -include_call_count -visualization transactions -limit 100000 -sort_by total_duration"
|
||||
},
|
||||
{
|
||||
name: 'PrmMyTacticHistoryView.GetView',
|
||||
query: "class.method = 'Cas.BusinessLogic.Prm.PrmMyTacticHistoryView.GetView' AND server = 'ustca089.kcc.com' | calls -type class.method -class.method Cas.BusinessLogic.Prm.PrmMyTacticHistoryView.GetView -include_call_count -visualization transactions -limit 100000 -sort_by total_duration"
|
||||
},
|
||||
{
|
||||
name: 'PrmFundingSourcesView.GetView',
|
||||
query: "class.method = 'Cas.BusinessLogic.Prm.PrmFundingSourcesView.GetView' AND server = 'ustca089.kcc.com' | calls -type class.method -class.method Cas.BusinessLogic.Prm.PrmFundingSourcesView.GetView -include_call_count -visualization transactions -limit 100000 -sort_by total_duration"
|
||||
},
|
||||
{
|
||||
name: 'PrmMainBo.AddTacticByCopy',
|
||||
query: "class.method = 'Cas.BusinessLogic.Prm.PrmMainBo.AddTacticByCopy' AND server = 'ustca089.kcc.com' | calls -type class.method -class.method Cas.BusinessLogic.Prm.PrmMainBo.AddTacticByCopy -include_call_count -visualization transactions -limit 100000 -sort_by total_duration"
|
||||
},
|
||||
{
|
||||
name: 'ClcCalculationBo.Calculation',
|
||||
query: "class.method = 'Cas.BusinessLogic.Clc.ClcCalculationEngineBo.Calculation' AND server = 'ustca089.kcc.com' AND transactiontype = 'accenture_businesslogic' | calls -type class.method -class.method Cas.BusinessLogic.Clc.ClcCalculationEngineBo.Calculation -include_call_count -visualization transactions -limit 100000 -sort_by total_duration"
|
||||
},
|
||||
{
|
||||
name: 'PrmMainBo.Save',
|
||||
query: " ! ( class.method = 'Cas.BusinessLogic.Clc.ClcCalculationEngineBo.Activate' ) and ! ( class.method = 'Cas.BusinessLogic.Prm.PrmMainBo.Copy' ) and ( class.method = 'Cas.BusinessLogic.Prm.PrmMainBo.Save' ) | calls -type class.method -class.method Cas.BusinessLogic.Prm.PrmMainBo.Save -include_call_count -visualization transactions -limit 100000 -sort_by total_duration"
|
||||
}
|
||||
|
||||
|
||||
];
|
||||
|
||||
// Password is encrypted with XOR to preent "accidental" revelation
|
||||
|
||||
Reference in New Issue
Block a user