Users should be able to alternatively specify a process id number instead of name only. This would allow for more specificity in the event that two processes share the same name. Cause as it stands right now, the code at:
Returns only the first match. Which is a problem if we want to attach to the second matching process. Additionally, it also attaches if a process name merely contains only the word specified. For example, if I wanted to attach to bigbinary.exe but I had another process named reallybigbinary.exe, its possible for it to select reallybigbinary.exe when I really wanted to attach to bigbinary.exe.
This code specifically is what im referring to
if name in process.szExeFile.decode(locale.getpreferredencoding()).lower():
This is too forgiving in my opinion. Should be along the lines of:
if name.strip() == process.szExeFile.decode(locale.getpreferredencoding()).lower().strip():
Alternatively, if you want to make this more forgiving option an argument that can be passed so both options could be chosen.
Users should be able to alternatively specify a process id number instead of name only. This would allow for more specificity in the event that two processes share the same name. Cause as it stands right now, the code at:
https://github.com/srounet/Pymem/blob/0ca7f667190eed6189ea141cf59de2c2225cf242/pymem/process.py#L285-L302
Returns only the first match. Which is a problem if we want to attach to the second matching process. Additionally, it also attaches if a process name merely contains only the word specified. For example, if I wanted to attach to
bigbinary.exe
but I had another process namedreallybigbinary.exe
, its possible for it to select reallybigbinary.exe when I really wanted to attach to bigbinary.exe.This code specifically is what im referring to
This is too forgiving in my opinion. Should be along the lines of:
Alternatively, if you want to make this more forgiving option an argument that can be passed so both options could be chosen.