window下调用api列出当前所有进程,windowapi列出当前,[Python]代码#!
window下调用api列出当前所有进程,windowapi列出当前,[Python]代码#!
[Python]代码
#!/usr/bin/env python#-*- coding:utf-8 -*-"通过调用API获取进程列表"import ctypes;__metaclass__ = type;class PROCESSENTRY32(ctypes.Structure): _fields_ = [ ("dwSize",ctypes.c_ulong), ("cntUsage",ctypes.c_ulong), ("th32ProcessID",ctypes.c_ulong), ("th32DefaultHeapID",ctypes.c_void_p), ("th32ModuleID",ctypes.c_ulong), ("cntThreads",ctypes.c_ulong), ("th32ParentProcessID",ctypes.c_ulong), ("pcPriClassBase",ctypes.c_long), ("dwFlags",ctypes.c_ulong), ("szExeFile",ctypes.c_char*260) ]kernel32 = ctypes.windll.LoadLibrary("kernel32.dll");pHandle = kernel32.CreateToolhelp32Snapshot(0x2,0x0);import sys;if pHandle==-1: sys.exit();proc = PROCESSENTRY32();proc.dwSize = ctypes.sizeof(proc);while kernel32.Process32Next(pHandle,ctypes.byref(proc)): print("ProcessName : %s - ProcessID : %d"%(ctypes.string_at(proc.szExeFile),proc.th32ProcessID));kernel32.CloseHandle(pHandle);
相关内容
- python arp欺骗伪造网关代码,pythonarp伪造网关,#coding:ut
- 一个简单的MySQLdb封装类(3.2),mysqldb封装类3.2,[Python]代码
- Python通过ctypes调用windows api函数ShellExecute,ctypesshellex
- 同一库中,表结构类似的两个表的数据复制,结构,同一
- secure crt 脚本,securecrt,#$language =
- e-hentai抓取图片第二版,,[Python]代码im
- 输出乘法表到excel,输出乘法表excel,[Python]代码im
- python 基础学习第二弹:类属性和实例属性,python实例
- 淘宝面试题猜数字游戏,淘宝试题猜数字,guess.py#!/u
- darkBing SQL扫描器0.1,darkbing扫描器0.1,[Python]代码#!
评论关闭