Exemple #1
0
 def OnMouseUp(self, event):
     self.SetCursor(wx.Cursor(wx.CURSOR_ARROW))
     self.c2 = None  # ANDY
     print("mouse up")
     dbg(self.c1)
     dbg(self.c2)
     self.Refresh()
Exemple #2
0
def test_variables():
    intType = 2
    floatType = 2.1
    strType = "mystring"
    boolType = True
    NoneType = None

    out = io.StringIO()
    with redirect_stdout(out):
        dbg(intType)
        dbg(floatType)
        dbg(strType)
        dbg(boolType)
        dbg(NoneType)

    want = f"""[{cwd}/tests/test_pydbg.py:21] intType = 2
[{cwd}/tests/test_pydbg.py:22] floatType = 2.1
[{cwd}/tests/test_pydbg.py:23] strType = mystring
[{cwd}/tests/test_pydbg.py:24] boolType = True
[{cwd}/tests/test_pydbg.py:25] NoneType = None
"""

    assert out.getvalue() == want
Exemple #3
0
import utils, sys
from pydbg import *
from pydbg import dbg
'''
BOOL WINAPI WriteFile(
    _In_    HANDLE hFile,
    _In_    LPCVOID lpBuffer,
    _In_    DWORD nNumberOfBytesTowrite,
    _Out_opt_   LPDWORD lpNumberOfBytesToWritten,
    _Inout_opt_ LPOVERLAPPED lpOverlapped
);
'''
dbg = dbg()
isProcess = False

orgPattern = "love"
repPattern = "hate"
isProcessName = "notepad.exe"


def replaceString(dbg, args):
    buffer = dbg.read_process_memory(args[1], args[2])

    if orgPattern in buffer:
        print("[APIHooking] Before : %s" % buffer)
        buffer = buffer.replace(orgPattern, repPattern)
        replace = dbg.write_process_memory(args[1], buffer)
        print("[APIHooking] After : %s" %
              dbg.read_process_memory(args[1], args[2]))

    return DBG_CONTINUE
Exemple #4
0
def test_variables():
    NoneType = None
    boolType = True
    intType = 2
    floatType = 3.4
    strType = "mystring"
    strType1 = "None"
    strType2 = "True"
    strType3 = "2"
    strType4 = "3.4"

    out = io.StringIO()
    with redirect_stderr(out):
        dbg(NoneType)
        dbg(boolType)
        dbg(intType)
        dbg(floatType)
        dbg(strType)
        dbg(strType1)
        dbg(strType2)
        dbg(strType3)
        dbg(strType4)
        dbg(add(5, 6))
    assert out.getvalue() == f"""\
Exemple #5
0
def test_variables():
    NoneType = None
    boolType = True
    intType = 2
    floatType = 3.4
    strType = "mystring"
    strType1 = "None"
    strType2 = "True"
    strType3 = "2"
    strType4 = "3.4"

    out = io.StringIO()
    with redirect_stdout(out):
        dbg(NoneType)
        dbg(boolType)
        dbg(intType)
        dbg(floatType)
        dbg(strType)
        dbg(strType1)
        dbg(strType2)
        dbg(strType3)
        dbg(strType4)
        dbg(add(5, 6))

    want = f"""\
[{cwd}/tests/test_pydbg.py:22] NoneType = None
[{cwd}/tests/test_pydbg.py:23] boolType = True
[{cwd}/tests/test_pydbg.py:24] intType = 2
[{cwd}/tests/test_pydbg.py:25] floatType = 3.4
[{cwd}/tests/test_pydbg.py:26] strType = 'mystring'
[{cwd}/tests/test_pydbg.py:27] strType1 = 'None'
[{cwd}/tests/test_pydbg.py:28] strType2 = 'True'
[{cwd}/tests/test_pydbg.py:29] strType3 = '2'
[{cwd}/tests/test_pydbg.py:30] strType4 = '3.4'
[{cwd}/tests/test_pydbg.py:31] add(5, 6) = 11
"""

    assert out.getvalue() == want
Exemple #6
0
from pydbg import dbg

a = 2

b = 3

dbg(a + b)


def square(x: int) -> int:
    return x * x


dbg(square(a))