# HG changeset patch
# User Jean-Francois Pieronne <jf.pieronne@laposte.net>
# Date 1587571424 -7200
#      Wed Apr 22 18:03:44 2020 +0200
# Node ID 2239bc839c80aefbef89409de24551f1ac775d93
# Parent  1cdce16e9f0a3d1c1179a2182733133d0d7ab161
secrules/rules03.py initial version

diff --git a/secrules/rules03.py b/secrules/rules03.py
new file mode 100644
--- /dev/null
+++ b/secrules/rules03.py
@@ -0,0 +1,33 @@
+# -*- coding: iso-8859-1 -*-
+__version__ = '1.0'
+
+from common import level_rule
+from FindFile import FindFile
+from get_security import get_security
+
+@level_rule(2)
+def rule0302(fo, fmt):
+    """ If the change was not approved by the system manager, then it 
+signifies an unauthorized change was made to the file, and represents an area 
+of vulnerability with regards to protection of critical files."""
+
+    if not fmt:
+        print>>fo
+        print>>fo, 'Rule 0302'
+        print>>fo, '========='
+
+    with FindFile('SYS$SYSROOT:[000000...]*.*') as fi:
+        for fn in fi:
+            id = get_security (fn)[0]
+            if (id != 'SYSTEM') and (id != '[1,1]'):
+                if (fn != 'MOM$SYSTEM') and (id != '[376,375]'):
+                    if fmt:
+                        print>>fo, '0302�2�', fn
+                    else:
+                        print>>fo, fn
+                        print>>fo, ' ' * 10, id
+
+if __name__ == '__main__':
+    import sys
+    fo = open(sys.argv[1], 'w') if len(sys.argv) > 1 else sys.stdout
+    rule0302(fo, len(sys.argv) > 2)