~ubuntu-branches/ubuntu/wily/apparmor/wily

« back to all changes in this revision

Viewing changes to utils/severity.pl

  • Committer: Bazaar Package Importer
  • Author(s): Kees Cook
  • Date: 2011-04-27 10:38:07 UTC
  • mfrom: (5.1.118 natty)
  • Revision ID: james.westby@ubuntu.com-20110427103807-ym3rhwys6o84ith0
Tags: 2.6.1-2
debian/copyright: clarify for some full organization names.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/perl -w
2
 
# ----------------------------------------------------------------------
3
 
#    PROPRIETARY DATA of IMMUNIX INC.
4
 
#    Copyright (c) 2004, 2005 IMMUNIX (All rights reserved)
5
 
#
6
 
#    This document contains trade secret data which is the property
7
 
#    of IMMUNIX Inc.  This document is submitted to recipient in
8
 
#    confidence. Information contained herein may not be used, copied
9
 
#    or disclosed in whole or in part except as permitted by written
10
 
#    agreement signed by an officer of IMMUNIX, Inc.
11
 
# ----------------------------------------------------------------------
12
 
 
13
 
# This is just a quick-n-dirty tester and demo; not intended for use by
14
 
# end users.
15
 
 
16
 
use strict;
17
 
use Immunix::Severity;
18
 
 
19
 
sub ranker {
20
 
        my $ob = shift;
21
 
        my ($resource, $mode) = @_;
22
 
 
23
 
        if (defined $mode) {
24
 
                print "$mode $resource " . $ob->rank($resource, $mode);
25
 
        } else {
26
 
                print "$resource " . $ob->rank($resource);
27
 
        }
28
 
        print "\n";
29
 
}
30
 
 
31
 
my ($ob);
32
 
$ob = Immunix::Severity->new;
33
 
 
34
 
$ob->init("/tmp/severity.db");
35
 
 
36
 
ranker($ob, "CAP_SYS_ADMIN");
37
 
ranker($ob, "CAP_SETUID");
38
 
ranker($ob, "CAP_MISSPELLED");
39
 
ranker($ob, "MISSPELLED");
40
 
ranker($ob, "/etc/passwd","rw");
41
 
ranker($ob, "/etc/passwd","w");
42
 
ranker($ob, "/etc/passwd","r");
43
 
ranker($ob, "/etc/nothere","r");
44
 
 
45
 
 
46
 
print "\n";
47
 
$ob->init("/tmp/severity.db", -1111);
48
 
 
49
 
ranker($ob, "CAP_SYS_ADMIN");
50
 
ranker($ob, "CAP_SETUID");
51
 
ranker($ob, "CAP_MISSPELLED");
52
 
ranker($ob, "MISSPELLED");
53
 
ranker($ob, "/etc/passwd","rw");
54
 
ranker($ob, "/etc/passwd","w");
55
 
ranker($ob, "/etc/passwd","r");
56
 
ranker($ob, "/etc/nothere","r");