Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /proc/thread-self/root/opt/rh/gcc-toolset-11/root/usr/share/systemtap/examples/process/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/thread-self/root/opt/rh/gcc-toolset-11/root/usr/share/systemtap/examples/process/pstree.stp
#!/opt/rh/gcc-toolset-11/root/usr/bin/stap
# Copyright (C) 2014-2018 Red Hat, Inc.
# by Josh Stone <[email protected]>
#
# pstree.stp generates a process diagram in DOT form.  For instance, it may be
# useful on a 'make' command to see all the processes that are started.
#
# Run the script with:
#   stap pstree.stp -c 'command_to_watch' -o output.dot
#
# Render the diagram with:
#   dot -Tsvg output.dot >output.svg

probe begin
{
  printf("digraph pstree {\n")
  printf("rankdir=\"LR\"\n")
}

function dot_escape(str)
{
  # In DOT double-quoted strings, the only escape is " to \"
  return str_replace(str, "\"", "\\\"")
}

global depth
global exe_name
global exe_name_ctr

probe process.begin
{
  if (!(pid() in depth)) {
    depth[pid()] = 1
    if (pid() != target())
      printf("PID%d_%d -> PID%d_1\n", ppid(), depth[ppid()], pid())
    printf("PID%d_1 [ label=\"(%d) %s\" tooltip=\"forked from %d\" ];\n",
           pid(), pid(), dot_escape(execname()), ppid())
  }
}

probe syscall.execve
{
  # Save value of filename. Note that filename is quoted, but we'll
  # strip these quotes in syscall.execve.return.
  exe_name[tid(), ++exe_name_ctr[tid()]] = filename
}

probe syscall.execve.return
{
  # We'd like to use '@entry(user_string($filename))' here, but we
  # can't. On kernels < 3.7, sys_execve was in arch-specific code and
  # had wildly varying variable names for the filename argument. So,
  # we'll mimic @entry() here.
  saved_exe_name = exe_name[tid(), exe_name_ctr[tid()]]
  delete exe_name[tid(), (exe_name_ctr[tid()])--]
  if (!(exe_name_ctr[tid()]))
    delete exe_name_ctr[tid()]
  
  if (retval == 0 && pid() in depth) {
    d = ++depth[pid()]
    printf("PID%d_%d -> PID%d_%d [ style=\"dashed\" ];\n",
           pid(), d-1, pid(), d)
    printf("PID%d_%d [ label=\"(%d) %s\" tooltip=\"%s\" ];\n",
           pid(), d, pid(),
           str_replace(saved_exe_name, "\"", ""),
           dot_escape(cmdline_str()))
  }
}

probe end
{
  printf("}\n")
}

Spamworldpro Mini