Compare commits
2 Commits
51fce6e509
...
master
Author | SHA1 | Date | |
---|---|---|---|
8b623f6025 | |||
b703abbfb9 |
74
SanitizeUsers.html
Normal file
74
SanitizeUsers.html
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<style>
|
||||||
|
#input,#output {width:100%;height: 40%;}
|
||||||
|
</style>
|
||||||
|
<script>
|
||||||
|
document.addEventListener('DOMContentLoaded', (e) => {
|
||||||
|
init();
|
||||||
|
});
|
||||||
|
|
||||||
|
function init() {
|
||||||
|
document.getElementById('input').addEventListener('change', (e) => {
|
||||||
|
document.getElementById('output').value = digestLog(e.target.value);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function _digestLog(txt, msg1, msg2) {
|
||||||
|
let dateTime = txt.match(/Sanitize Users started: (\d{2}\/\d{2}\/\d{4} \d{2}:\d{2}:\d{2})/)[1];
|
||||||
|
|
||||||
|
const regexp1 = new RegExp(`${msg1} ([0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12})`,'ig');
|
||||||
|
// const regexp2 = /Clearing password for user: (([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))/ig
|
||||||
|
// const regexp2 = new RegExp(`${msg2} (([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\.)+[a-zA-Z]{2,}))`,'ig');
|
||||||
|
const regexp2 = new RegExp(`${msg2} (([^<>()\\[\\]\\\\.,;:\\s@"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@"]+)*)|(".+"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))`,'ig');
|
||||||
|
|
||||||
|
let result = '';
|
||||||
|
let userIds = txt.match(regexp1);
|
||||||
|
if(userIds) {
|
||||||
|
let userEmails = txt.match(regexp2);
|
||||||
|
|
||||||
|
for(let i=0;i<userIds.length;i++) {
|
||||||
|
result += `| ${dateTime} | ${userIds[i].substr(msg1.length)} | ${userEmails[i].substr(msg2.length)} |\n`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function digestLog(txt) {
|
||||||
|
let result = '';
|
||||||
|
result += `Deleted\n--------------------------------------------------------------\n`;
|
||||||
|
result += _digestLog(txt, 'Deleting User Id', 'Deleting user:');
|
||||||
|
result += `\n\n`;
|
||||||
|
result += `Lockout\n--------------------------------------------------------------\n`;
|
||||||
|
result += _digestLog(txt, 'Processing Inactive User Id', 'Clearing password for user:');
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Sanitize User</h1>
|
||||||
|
<p>This tool parse the <b>Log.csv</b> report, extracting the users deleted/locked</p>
|
||||||
|
<textarea id="input">State;Message
|
||||||
|
Information;"Sanitize Users started: 07/15/2022 04:30:09"
|
||||||
|
Information;" Deleting inactive users"
|
||||||
|
Information;" 0 Deleting Inactive Users to process"
|
||||||
|
Information;" Processing inactive users"
|
||||||
|
Information;" 3 Locking out Inactive Users to process"
|
||||||
|
Information;" Starting transaction"
|
||||||
|
Information;" Processing Inactive User Id 36fdba01-e241-4ae1-8d5f-f89a94429a16."
|
||||||
|
Information;" Clearing password for user: m.nater@asecom.nl"
|
||||||
|
Information;" Transaction succeeded"
|
||||||
|
Information;" Starting transaction"
|
||||||
|
Information;" Processing Inactive User Id 4891fb41-44f1-416a-8a1a-1f0c3c3b97ea."
|
||||||
|
Information;" Clearing password for user: sw@2j-antennas.com"
|
||||||
|
Information;" Transaction succeeded"
|
||||||
|
Information;" Starting transaction"
|
||||||
|
Information;" Processing Inactive User Id da8dafc7-d3d3-497e-b036-94455fc30748."
|
||||||
|
Information;" Clearing password for user: anna.polyanskih@itctg.ru"
|
||||||
|
Information;" Transaction succeeded"
|
||||||
|
Information;"Sanitize Users completed: 07/15/2022 04:30:10 (less than 1 second)" </textarea>
|
||||||
|
<textarea id="output"></textarea>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -9,6 +9,15 @@
|
|||||||
}
|
}
|
||||||
function processTestResults(e) {
|
function processTestResults(e) {
|
||||||
const txt = e.target.value;
|
const txt = e.target.value;
|
||||||
|
const output = getTestTimes(txt);
|
||||||
|
|
||||||
|
let html = '';
|
||||||
|
html+= getHtmlStats(output);
|
||||||
|
html+= getHtmlTestTimes(output);
|
||||||
|
document.getElementById("output").innerHTML = html;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getTestTimes(txt) {
|
||||||
const regex1 = /Passed (?<testName>(.)+) \[(?<testTime>(\d)+) (?<testTimeUnit>(m?s))\]/g;
|
const regex1 = /Passed (?<testName>(.)+) \[(?<testTime>(\d)+) (?<testTimeUnit>(m?s))\]/g;
|
||||||
txt.match(regex1);
|
txt.match(regex1);
|
||||||
|
|
||||||
@ -18,13 +27,23 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
output.sort( (a,b)=>(b[1]*(b[2]=='s'?1000:1)-a[1]*(a[2]=='s'?1000:1)) );
|
output.sort( (a,b)=>(b[1]*(b[2]=='s'?1000:1)-a[1]*(a[2]=='s'?1000:1)) );
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getHtmlStats(tests) {
|
||||||
|
let stats = '<table><tbody>';
|
||||||
|
stats += `<tr><td>Total Tests</td><td>${tests.length}</td></tr>`;
|
||||||
|
stats += '</table>';
|
||||||
|
return stats;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getHtmlTestTimes(tests) {
|
||||||
let trs = '';
|
let trs = '';
|
||||||
for(let i=0;i<output.length;i++)
|
for(let i=0;i<tests.length;i++)
|
||||||
{
|
{
|
||||||
trs += `<tr><td>${output[i][0]}</td><td>${output[i][1]} ${output[i][2]}</td>`;
|
trs += `<tr><td>${tests[i][0]}</td><td>${tests[i][1]} ${tests[i][2]}</td></tr>`;
|
||||||
}
|
}
|
||||||
document.getElementById("output").innerHTML = '<table><thead><tr><th>Test Name</th><th>Time</th><tbody>'+trs+'</table>';
|
return '<table><thead><tr><th>Test Name</th><th>Time</th><tbody>'+trs+'</table>';
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user