try: import dl libc = dl.open('/lib/libc.so.6') libc.call('prctl', 15, 'ubuntu-tweak', 0, 0, 0) except:pass
from ctypes import * libc = CDLL('libc.so.6') class uts_struct(Structure): _fields_ = [ ('sysname', c_char_p), ('nodename', c_char_p), ('release', c_char_p), ('version', c_char_p), ('machine', c_char_p) ] utsname = uts_struct() utsname_pointer = pointer(utsname) libc.uname(utsname_pointer) print utsname.sysname
from ctypes import * libc = CDLL('libc.so.6') getenv = libc.getenv getenv.restype = c_char_p print getenv('HOME')
在python 解释器中学习linux系统函数调用
最新推荐文章于 2022-04-29 20:08:00 发布