Boyum.Portal.Tools/SanitizeUsers.html

74 lines
3.5 KiB
HTML

<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>