Skip to content

Instantly share code, notes, and snippets.

@cgwxyz
Last active June 13, 2019 06:59
Show Gist options
  • Save cgwxyz/7bcd543367a051dba7e8 to your computer and use it in GitHub Desktop.
Save cgwxyz/7bcd543367a051dba7e8 to your computer and use it in GitHub Desktop.
python设置当前进程名称(linux ps时显示)
try:
import dl
libc = dl.open('/lib/libc.so.6')
libc.call('prctl', 15, 'myproc', 0, 0, 0) #执行后ps -A,显示为myproc的进程
#参数2:15 /linux/prctl.h定义 #define PR_SET_NAME 15
except:
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment