mirror of
https://github.com/Pennyw0rth/NetExec.git
synced 2026-11-07 09:26:01 -10:00
Merge pull request #1447 from Pennyw0rth/neff-fix-tasklist-kill
This commit is contained in:
2 files changed
+17
-17
No files matched your search
+11
-11
@@ -1264,7 +1264,7 @@ class smb(connection):
|
||||
self.logger.error("Could not get process list")
|
||||
return
|
||||
|
||||
pidList = [i["UniqueProcessId"] for i in res if i["ImageName"].lower() == self.args.taskkill.lower()]
|
||||
pidList = [i.getProcessInfo()["UniqueProcessId"] for i in res if i.getProcessInfo()["ImageName"].getValue().lower() == self.args.taskkill.lower()]
|
||||
if not pidList:
|
||||
self.logger.fail(f"Could not find process named {self.args.taskkill}")
|
||||
return
|
||||
@@ -1378,12 +1378,12 @@ class smb(connection):
|
||||
@requires_admin
|
||||
def tasklist(self):
|
||||
# Formats a row to be printed on screen
|
||||
def format_row(procInfo):
|
||||
def format_row(procInfo, pSid):
|
||||
return template.format(
|
||||
procInfo["ImageName"],
|
||||
procInfo["UniqueProcessId"],
|
||||
procInfo["SessionId"],
|
||||
procInfo["pSid"],
|
||||
str(procInfo["ImageName"].getValue()),
|
||||
str(procInfo["UniqueProcessId"]),
|
||||
str(procInfo["SessionId"]),
|
||||
pSid,
|
||||
f"{procInfo['WorkingSetSize'] // 1000:,} K",
|
||||
)
|
||||
|
||||
@@ -1399,8 +1399,8 @@ class smb(connection):
|
||||
if not res:
|
||||
return
|
||||
self.logger.success("Enumerated processes")
|
||||
maxImageNameLen = max(len(i["ImageName"]) for i in res)
|
||||
maxSidLen = max(len(i["pSid"]) for i in res)
|
||||
maxImageNameLen = max(len(i.getProcessInfo()["ImageName"].getValue()) for i in res)
|
||||
maxSidLen = max(len(i.getSid()) for i in res)
|
||||
template = f"{{: <{maxImageNameLen}}} {{: <8}} {{: <11}} {{: <{maxSidLen}}} {{: >12}}"
|
||||
self.logger.highlight(template.format("Image Name", "PID", "Session#", "SID", "Mem Usage"))
|
||||
self.logger.highlight(template.replace(": ", ":=").format("", "", "", "", ""))
|
||||
@@ -1411,12 +1411,12 @@ class smb(connection):
|
||||
# If args.tasklist is not True then a process name was supplied
|
||||
if self.args.tasklist is not True:
|
||||
# So we look for it and print its information if found
|
||||
if self.args.tasklist.lower() in procInfo["ImageName"].lower():
|
||||
if self.args.tasklist.lower() in procInfo.getProcessInfo()["ImageName"].getValue().lower():
|
||||
found_task = True
|
||||
self.logger.highlight(format_row(procInfo))
|
||||
self.logger.highlight(format_row(procInfo.getProcessInfo(), procInfo.getSid()))
|
||||
# Else, no process was supplied, we print the entire list of remote processes
|
||||
else:
|
||||
self.logger.highlight(format_row(procInfo))
|
||||
self.logger.highlight(format_row(procInfo.getProcessInfo(), procInfo.getSid()))
|
||||
|
||||
# If a process was suppliad to args.tasklist and it was not found, we print a fail message
|
||||
if self.args.tasklist is not True and not found_task:
|
||||
|
||||
Generated
+6
-6
@@ -1,4 +1,4 @@
|
||||
# This file is automatically @generated by Poetry 2.4.1 and should not be changed by hand.
|
||||
# This file is automatically @generated by Poetry 2.5.1 and should not be changed by hand.
|
||||
|
||||
[[package]]
|
||||
name = "aardwolf"
|
||||
@@ -439,7 +439,7 @@ files = [
|
||||
[package.dependencies]
|
||||
dnspython = "*"
|
||||
impacket = ">=0.9.17"
|
||||
ldap3 = ">2.5.0,<2.5.2 || >2.5.2,<2.6 || >2.6"
|
||||
ldap3 = ">2.5.0,!=2.5.2,!=2.6"
|
||||
pyasn1 = ">=0.4"
|
||||
pycryptodome = "*"
|
||||
|
||||
@@ -1190,7 +1190,7 @@ files = [
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
cryptography = ">=3.1,<3.4.0 || >3.4.0"
|
||||
cryptography = ">=3.1,!=3.4.0"
|
||||
|
||||
[package.extras]
|
||||
dev = ["black", "isort", "mypy", "types-freezegun"]
|
||||
@@ -1225,7 +1225,7 @@ files = [
|
||||
|
||||
[package.dependencies]
|
||||
dnspython = "*"
|
||||
ldap3 = ">2.5.0,<2.5.2 || >2.5.2,<2.6 || >2.6"
|
||||
ldap3 = ">2.5.0,!=2.5.2,!=2.6"
|
||||
|
||||
[[package]]
|
||||
name = "lsassy"
|
||||
@@ -2606,7 +2606,7 @@ files = [
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
click = ">=6.7,<7.0 || >7.0"
|
||||
click = ">=6.7,!=7.0"
|
||||
pip = ">=9.0.3"
|
||||
setuptools = "*"
|
||||
|
||||
@@ -3042,4 +3042,4 @@ test = ["pytest", "pytest-cov"]
|
||||
[metadata]
|
||||
lock-version = "2.1"
|
||||
python-versions = ">=3.10,<4.0"
|
||||
content-hash = "11d6b0b792b5f5e7ecb7ed5ba7406f4353f298e4ff154bca15d9a93a0a3fec48"
|
||||
content-hash = "3941314ffac5bab30f27b72b1b92e60864f7ffa070459d4d3e5c7744d61921b0"
|
||||
Reference in new issue
Block a user