Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions flask_webgoat/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,18 @@ def grep_processes():
)
if res.stdout is None:
return jsonify({"error": "no stdout returned"})

out = res.stdout.decode("utf-8")
lines = out.split("\n")
# Filter lines containing the name and extract the 11th field (command)

# Filter lines containing the name and extract the 11th column (command)
names = []
for line in lines:
if name and name in line:
if name in line:
parts = line.split()
if len(parts) >= 11:
names.append(parts[10]) # 0-indexed, so field 11 is index 10
names.append(parts[10]) # 0-indexed, so 11th column is index 10

return jsonify({"success": True, "names": names})


Expand Down
Loading