每年的misc都是最无聊坐牢的

数据安全-easy_tables
import pandas as pd
import hashlib
from datetime import datetime
users_df = pd.read_csv('users.csv')
permissions_df = pd.read_csv('permissions.csv')
tables_df = pd.read_csv('tables.csv')
actionlog_df = pd.read_csv('actionlog.csv')
#判断操作是否在允许的操作中
def is_action_allowed(allowed_actions, action):
return action in allowed_actions
#判断表是否在允许的表中
def is_table_allowed(allowed_tables, table_name):
return str(table_name) in allowed_tables
#检查时间
def is_time_in_range(time_str, time_range_str):
time = datetime.strptime(time_str, "%H:%M:%S").time()
for period in time_range_str.split(','):
start, end = period.split('~')
start_time = datetime.strptime(start, "%H:%M:%S").time()
end_time = datetime.strptime(end, "%H:%M:%S").time()
if start_time <= time <= end_time:
return True
return False
def calculate_md5(s):
return hashlib.md5

文章详细描述了一个Python脚本,用于检查用户在数据库操作中的权限,包括操作类型、表名、时间范围等,确保数据安全。脚本通过读取csv文件并定义一系列函数来验证用户操作是否合法。
最低0.47元/天 解锁文章
887

被折叠的 条评论
为什么被折叠?



