~ubuntu-branches/ubuntu/raring/apparmor/raring

« back to all changes in this revision

Viewing changes to utils/severity.pl

  • Committer: Bazaar Package Importer
  • Author(s): Kees Cook
  • Date: 2007-03-23 16:42:01 UTC
  • Revision ID: james.westby@ubuntu.com-20070323164201-jkax6f0oku087b7l
Tags: upstream-2.0.1+510.dfsg
ImportĀ upstreamĀ versionĀ 2.0.1+510.dfsg

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");