diff options
Diffstat (limited to 'usr/bin/wlan_prov.pl')
-rwxr-xr-x | usr/bin/wlan_prov.pl | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/usr/bin/wlan_prov.pl b/usr/bin/wlan_prov.pl new file mode 100755 index 0000000..f1cbf5a --- /dev/null +++ b/usr/bin/wlan_prov.pl @@ -0,0 +1,31 @@ +#!/usr/bin/perl +use strict; +use warnings; + +my $mac = "00:90:4c:c5:12:38"; +my $bcmdhd_file = "lib/firmware/bcmdhd.cal"; +my $tmp_file = $bcmdhd_file."tmp"; +my $modify = 0; + +open IN, $bcmdhd_file or die "Can't open file: $!"; +open OUT, ">", $tmp_file or die "Can't open file: $!"; +while(<IN>) { + if ($_ =~/$mac/) { + my $postfix = sprintf("%02x:%02x:%02x", int(rand(256)), + int(rand(256)), + int(rand(256))); + $_ =~ s/c5:12:38/$postfix/i; + $modify = 1; + } + + print OUT $_; +} + +close(IN); +close(OUT); + +if ($modify) { + rename($tmp_file, $bcmdhd_file) || die "rename failed: $!"; +} + +unlink $tmp_file |