Skip to content

Commit

Permalink
[fix] hide hostname in dmesg output
Browse files Browse the repository at this point in the history
  • Loading branch information
1ennson committed Oct 26, 2018
1 parent c2703dd commit 8637056
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions hw-probe.pl
Expand Up @@ -968,6 +968,13 @@ ($$)
return $Content;
}

sub hideHostname($)
{
my $Content = $_[0];
$Content=~s/(Set hostname to) <.+>\./$1 <...>./g;
return $Content;
}

sub hideIPs($)
{
my $Content = $_[0];
Expand Down Expand Up @@ -4992,6 +4999,7 @@ ()
listProbe("logs", "dmesg");
$Dmesg = runCmd("dmesg 2>&1");
$Dmesg = hideTags($Dmesg, "SerialNumber");
$Dmesg = hideHostname($Dmesg);
$Dmesg = hideMACs($Dmesg);
writeLog($LOG_DIR."/dmesg", $Dmesg);
}
Expand Down Expand Up @@ -7271,6 +7279,7 @@ ()
my $Dmesg_Old = runCmd("journalctl -a -k -b -1 -o short-monotonic 2>/dev/null | grep -v systemd");
$Dmesg_Old=~s/\]\s+.*?\s+kernel:/]/g;
$Dmesg_Old = hideTags($Dmesg_Old, "SerialNumber");
$Dmesg_Old = hideHostname($Dmesg_Old);
$Dmesg_Old = hideMACs($Dmesg_Old);
writeLog($LOG_DIR."/dmesg.1", $Dmesg_Old);
}
Expand Down

0 comments on commit 8637056

Please sign in to comment.