1

I'm currently trying to get one process id (and the id alone) from a running process, to be used later to inject a DLL into it.

I had originally tried using psutil like this:

def findProcessIdByName(processName):
listOfProcessObjects = []
#Iterate over the all the running process
for proc in psutil.process_iter():
try:
pinfo = proc.as_dict(attrs=['pid', 'name', 'create_time'])
# Check if process name contains the given name string.
if processName.lower() in pinfo['name'].lower() :
listOfProcessObjects.append(pinfo)
except (psutil.NoSuchProcess, psutil.AccessDenied , psutil.ZombieProcess) :
pass
return listOfProcessObjects;

and trying to find the pid as such:

rvglId = findProcessIdByName('rvgl')

But I realized that it returns more than just the id.

Is there any way to modify this process to just get the pid?

For context, the idea of the whole process would end up being something like:

injector = Injector()
pid = METHOD_HERE
path = "./mods/"
injector.load_from_pid(pid)
injector.inject_dll(path_dll)
anonfoxer
  • 25
  • 6

0 Answers0