gray hat python Debugger issue. FIXED
I've been following the book word for word and in my debugger, i get this error:
Print "[*] We have sucessfully launched the process!"
^
SyntaxError: invalid syntax
my_debuger
Code:
from ctypes import *
from my_debugger_defines import *
kernel32 = windll.kernel32
class debugger():
def __init__(self):
pass
def load(self,path_to_exe):
creation_flags = DEBUG_PROCESS # replace with "CREAT_NEW_CONSOLE" to see GUI|
startupinfo = STARTUPINFO()
process_information = PROCESS_INFORMATION()
startupinfo.dwFlags = 0x1
startupinfo.wShowWindow = 0x0
startupinfo.cb = sizeof(startupinfo)
if kernel32.CreateProcessA(path_to_exe,
None,
None,
None,
None,
creation_flags,
None,
None,
byref(startupinfo),
byref(process_information)):
Print "[*] We have sucessfully launched the process!"
Print "[*] PID: %d" % process_information.dwProcessId
else:
Print"[*] Error: 0x%08x." % kernel32.GetLastError()
my_debugger_defines.py When i test this it shows no issues.
Code:
from ctypes import *
from ctypes.wintypes import LPSTR
WORD = c_ushort
DWORD = c_ulong
LPBYTE = POINTER(c_ubyte)
LPTSTR = POINTER(c_char)
HANDLE = c_void_p
DEBUG_PROCESS = 0x00000001
CREAT_NEW_CONSOLE = 0x00000010
class STARTUPINFO(Structure):
_fields_ = [
("cb", DWORD),
("lpReserved", LPTSTR),
("lpDesktop", LPSTR),
("lpTitle", LPTSTR),
("dwX", DWORD),
("dwY", DWORD),
("dwXSize", DWORD),
("dwYSize", DWORD),
("dwXCountChars", DWORD),
("dwYCountCHars", DWORD),
("dwFillAttribute", DWORD),
("dwFlags", DWORD),
("wShowWindow", WORD),
("cbReserved2", WORD),
("lpReserved2", LPBYTE),
("hStdInput", HANDLE),
("hStdOutput", HANDLE),
("hStdError", HANDLE),
]
class PROCESS_INFORMATION(Structure):
_fields_ = [
("hProcess", HANDLE),
("hTread", HANDLE),
("dwProcessId", DWORD),
("dwThreadId", DWORD),
]
Any ideas why im getting this error? Im using python2.7 w/Pydev
Im running Win10
Any help would be appreciated.
Im just retarded I used "P" instead of "p" ....