Server IP : 149.255.58.128 / Your IP : 216.73.216.88
System : Linux cloud516.thundercloud.uk 5.14.0-427.26.1.el9_4.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jul 17 15:51:13 EDT 2024 x86_64
PHP Version : 8.2.28
Disable Function : allow_url_include, apache_child_terminate, apache_setenv, exec, passthru, pcntl_exec, posix_kill, posix_mkfifo, posix_getpwuid, posix_setpgid, posix_setsid, posix_setuid, posix_setgid, posix_seteuid, posix_setegid, posix_uname, proc_close, proc_get_status, proc_open, proc_terminate, shell_exec, show_source, system
cURL : ON | WGET : ON | Sudo : OFF | Pkexec : OFF
Upload Files :
Command :
Current File : /usr/lib/python3.9/site-packages/sepolgen//classperms.py
# Authors: Karl MacMillan <kmacmillan@mentalrootkit.com>
#
# Copyright (C) 2006 Red Hat
# see file 'COPYING' for use and warranty information
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; version 2 only
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
import sys
tokens = ('DEFINE',
'NAME',
'TICK',
'SQUOTE',
'OBRACE',
'CBRACE',
'SEMI',
'OPAREN',
'CPAREN',
'COMMA')
reserved = {
'define' : 'DEFINE' }
t_TICK = r'\`'
t_SQUOTE = r'\''
t_OBRACE = r'\{'
t_CBRACE = r'\}'
t_SEMI = r'\;'
t_OPAREN = r'\('
t_CPAREN = r'\)'
t_COMMA = r'\,'
t_ignore = " \t\n"
def t_NAME(t):
r'[a-zA-Z_][a-zA-Z0-9_]*'
t.type = reserved.get(t.value,'NAME')
return t
def t_error(t):
print("Illegal character '%s'" % t.value[0])
t.skip(1)
from . import lex
lex.lex()
def p_statements(p):
'''statements : define_stmt
| define_stmt statements
'''
if len(p) == 2:
p[0] = [p[1]]
else:
p[0] = [p[1]] + [p[2]]
def p_define_stmt(p):
# This sucks - corresponds to 'define(`foo',`{ read write }')
'''define_stmt : DEFINE OPAREN TICK NAME SQUOTE COMMA TICK list SQUOTE CPAREN
'''
p[0] = [p[4], p[8]]
def p_list(p):
'''list : NAME
| OBRACE names CBRACE
'''
if p[1] == "{":
p[0] = p[2]
else:
p[0] = [p[1]]
def p_names(p):
'''names : NAME
| NAME names
'''
if len(p) == 2:
p[0] = [p[1]]
else:
p[0] = [p[1]] + p[2]
def p_error(p):
print("Syntax error on line %d %s [type=%s]" % (p.lineno, p.value, p.type))
from . import yacc
yacc.yacc()
f = open("all_perms.spt")
txt = f.read()
f.close()
#lex.input(txt)
#while 1:
# tok = lex.token()
# if not tok:
# break
# print tok
test = "define(`foo',`{ read write append }')"
test2 = """define(`all_filesystem_perms',`{ mount remount unmount getattr relabelfrom relabelto transition associate quotamod quotaget }')
define(`all_security_perms',`{ compute_av compute_create compute_member check_context load_policy compute_relabel compute_user setenforce setbool setsecparam setcheckreqprot }')
"""
result = yacc.parse(txt)
print(result)
Name |
Size |
Last Modified |
Owner / Group |
Permissions |
Options |
.. | -- | March 19 2025 22:42:16 | 0 / root | 0755 | |
__pycache__ | -- | May 30 2024 07:43:41 | 0 / root | 0755 | |
| | | | | |
__init__.py | 0 KB | April 03 2024 15:47:25 | 0 / root | 0644 | |
access.py | 11.697 KB | April 03 2024 15:47:25 | 0 / root | 0644 | |
audit.py | 21.465 KB | April 03 2024 15:47:25 | 0 / root | 0644 | |
classperms.py | 2.752 KB | April 03 2024 15:47:25 | 0 / root | 0644 | |
defaults.py | 2.833 KB | April 03 2024 15:47:25 | 0 / root | 0644 | |
interfaces.py | 16.078 KB | April 03 2024 15:47:25 | 0 / root | 0644 | |
lex.py | 41.899 KB | April 03 2024 15:47:25 | 0 / root | 0644 | |
matching.py | 8.454 KB | April 03 2024 15:47:25 | 0 / root | 0644 | |
module.py | 7.115 KB | April 03 2024 15:47:25 | 0 / root | 0644 | |
objectmodel.py | 6.366 KB | April 03 2024 15:47:25 | 0 / root | 0644 | |
output.py | 5.043 KB | April 03 2024 15:47:25 | 0 / root | 0644 | |
policygen.py | 14.991 KB | April 03 2024 15:47:25 | 0 / root | 0644 | |
refparser.py | 30.599 KB | April 03 2024 15:47:25 | 0 / root | 0644 | |
refpolicy.py | 31.415 KB | April 03 2024 15:47:25 | 0 / root | 0644 | |
sepolgeni18n.py | 0.989 KB | April 03 2024 15:47:25 | 0 / root | 0644 | |
util.py | 5.354 KB | April 03 2024 15:47:25 | 0 / root | 0644 | |
yacc.py | 134.098 KB | April 03 2024 15:47:25 | 0 / root | 0644 | |