Skip to content

Instantly share code, notes, and snippets.

@Marcin648
Created September 16, 2021 17:12
Show Gist options
  • Save Marcin648/0074f322b3af8df76a2bf8e444999187 to your computer and use it in GitHub Desktop.
Save Marcin648/0074f322b3af8df76a2bf8e444999187 to your computer and use it in GitHub Desktop.
Simple script that prints all process arguments
#
# Simple script that prints all process arguments
# usage: python3 check_args.py <PID>
# by Marcin648
# September 2021
#
import sys
if(len(sys.argv) < 2):
print("usage: check_args.py <PID>")
exit(1)
pid = sys.argv[1]
cmdline = open("/proc/%s/cmdline" % pid, "r").read()
args = cmdline.split("\0")
for i, arg in enumerate(args):
print("argv[%d] = %s" % (i, arg))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment