Answer the question
In order to leave comments, you need to log in
How are logs depersonalized?
In general (in my head) the task is to depersonalize a large log from ip addresses, hosts, logins, etc.
1) IP search: since there is no specific base and a universal search is needed, I decided to use a regular expression by type:
Regex ip = new Regex(@"\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b");
Answer the question
In order to leave comments, you need to log in
I answer my own question.
Masks that I use:
1) To search for IP Regex ip = new Regex(@"\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{ 1,3}\b");
2) To search for hosts (of my kind) Regex host = new Regex(@"[a-zA-Z0-9]{3}-(w*\S+)");
3) To search for logins of 2 types @"(\w*)login(\w*\S+\s)" and @"l[0-9]{3}(\w*\S+\s)
" more than enough, since I only use ip \ hosts and logins in my logs.
You can immediately replace in a cycle
foreach (Match mat in matches)
{
line.Replace(mat.Value, "Конф.информация")
}
I would look for ready-made utilities instead of writing regex myself.
For a couple of minutes, I did not find something specific, but I'm sure there is.
https://aircloak.com/top-5-free-data-anonymization...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question