linux - 读取系统文件
问题描述
所以,我不得不在 linux 上读取系统文件(主机名和其他)并得到有趣的结果。我尝试以普通用户身份读取文件并得到加密结果,如果我以超级用户身份读取文件,我得到正常结果。
我了解,这是安全性,但我在哪里可以找到有关 Linux 操作系统安全性的更多信息?官方资源可取。谢谢你的答案。我使用 ubuntu 18.04 x64。
另外,请附上有关 OS Linux(功能)安全性的更多信息。开发人员需要的信息。我通过 nasm 汇编编写代码。
global _start
section .data
file db "/proc/sys/kernel/hostname",0
section .bss
buf resb 1024
descriptor resb 4
len equ 1024
section .text
_start:
mov eax, 5
mov ebx, file
mov ecx, 2
int 80h
mov [descriptor], eax
read:
mov eax, 3 ;read text
mov ebx, [descriptor];
mov ecx, buf ;read to variable buf
mov edx, len ;size of bug
int 80h ;interrupt
print_text:
mov edx, eax
mov eax, 4
mov ebx, 1
mov ecx, buf
int 80h
close_file:
mov eax, 6
mov ebx, [descriptor]
int 80h
exit:
mov eax, 1
mov ebx, 0
int 80h
例如,如果我在没有管理员权限的情况下执行代码,我会得到
����
如果以超级用户身份执行,我会得到
oleg
因此,当我阅读其他文件(osrelease、版本和其他)时,我得到空结果。我想明白,为什么会这样?
解决方案
推荐阅读
- google-bigquery - 在 bigquery 中创建一个非常大的表的 id 的成对组合
- javascript - handlerInput.responseBuilder 在我可以从 observable 获取数据之前返回
- firebase - 使用 Cloud Firestore 和 React 的 Todo App 数据结构
- python - 在Python中查找一列的最大值和最小值以及其他两列的差异
- java - Micronaut MySQL 删除记录 org.hibernate.HibernateException: No Session found for current thread
- angular - 使用 Router.navigate() 后未调用 Observable.subscribe()
- javascript - 几个带有 EventListeners 的按钮,一个不工作
- php - 使用正则表达式从文本中获取 1-10 中的 10
- java - java中的“***错误*** bash:第1行:7854被杀死”
- javascript - 如何使用 jQuery 从标记中调用 onclick 函数?