summaryrefslogtreecommitdiffstats
path: root/config/chroot_local-includes/usr/local/bin/getTorBrowserUserAgent
blob: b0218d7c583b99477f75626cef98c5f788d6eabf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/perl

use warnings;
use strict;
use 5.10.0;
use Fatal qw( open close );

sub getTorBrowserUserAgent {
    my $file = shift;

    my $ua;
    open (my $in, "<", $file);
    while (my $line = <$in>) {
        chomp $line;
        if (($ua) = ($line =~ m/^pref[(]"general[.]useragent[.]override", "(.*)"[)];$/)) {
            last;
        }
    }
    close $in;
    return $ua;
}

my $ua = getTorBrowserUserAgent('/etc/iceweasel/pref/000-tor-browser.js');
if (defined $ua && $ua) {
    say $ua;
}
else {
    die "Unparseable file."
}