From bbfe5deaca69c94f7e0c9d77b1075d671335c87b Mon Sep 17 00:00:00 2001 From: Alextibtab <14alexcockburn@gmail.com> Date: Fri, 26 Jan 2024 14:06:10 +0000 Subject: [PATCH 1/2] Issue #490 Add process info tome Added eldritch code and metadata --- tavern/tomes/process_info/main.eldritch | 17 +++++++++++++++++ tavern/tomes/process_info/metadata.yml | 10 ++++++++++ 2 files changed, 27 insertions(+) create mode 100644 tavern/tomes/process_info/main.eldritch create mode 100644 tavern/tomes/process_info/metadata.yml diff --git a/tavern/tomes/process_info/main.eldritch b/tavern/tomes/process_info/main.eldritch new file mode 100644 index 000000000..9457fdc0c --- /dev/null +++ b/tavern/tomes/process_info/main.eldritch @@ -0,0 +1,17 @@ +def process_info(pid): + info = process.info(sys.get_pid() if pid == -1 else pid) + for key, value in info.items(): + if key == "cmd": + print("cmd_args:\n") + for nested_value in value.split(" "): + print("\t- {}\n".format(nested_value)) + elif key == "environ": + print("env_variables:\n") + for nested_value in value.split(","): + print("\t- {}\n".format(nested_value)) + else: + print("{}={}\n".format(key, value)) + +process_info(int(input_params['pid'])) +print("\n") +print("\n") diff --git a/tavern/tomes/process_info/metadata.yml b/tavern/tomes/process_info/metadata.yml new file mode 100644 index 000000000..3f6bedeec --- /dev/null +++ b/tavern/tomes/process_info/metadata.yml @@ -0,0 +1,10 @@ +name: Process info +description: Get information about process with specified PID or -1 for current process +author: Alextibtab +support_model: FIRST_PARTY +tactic: DISCOVERY +paramdefs: +- name: pid + label: Process ID + type: int + placeholder: process id eg. 245 From 8375718cd23365554fce35e5f99048b15a31ca42 Mon Sep 17 00:00:00 2001 From: Alextibtab <14alexcockburn@gmail.com> Date: Sat, 27 Jan 2024 17:45:51 +0000 Subject: [PATCH 2/2] Updated prints to use = instead of : --- tavern/tomes/process_info/main.eldritch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tavern/tomes/process_info/main.eldritch b/tavern/tomes/process_info/main.eldritch index 9457fdc0c..94e90ed2c 100644 --- a/tavern/tomes/process_info/main.eldritch +++ b/tavern/tomes/process_info/main.eldritch @@ -2,11 +2,11 @@ def process_info(pid): info = process.info(sys.get_pid() if pid == -1 else pid) for key, value in info.items(): if key == "cmd": - print("cmd_args:\n") + print("cmd_args=\n") for nested_value in value.split(" "): print("\t- {}\n".format(nested_value)) elif key == "environ": - print("env_variables:\n") + print("env_variables=\n") for nested_value in value.split(","): print("\t- {}\n".format(nested_value)) else: