本文整理汇总了Python中winappdbg.Process.kill方法的典型用法代码示例。如果您正苦于以下问题:Python Process.kill方法的具体用法?Python Process.kill怎么用?Python Process.kill使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类winappdbg.Process
的用法示例。
在下文中一共展示了Process.kill方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: process_kill
# 需要导入模块: from winappdbg import Process [as 别名]
# 或者: from winappdbg.Process import kill [as 别名]
def process_kill( pid ):
# Instance a Process object.
process = Process( pid )
# Kill the process.
process.kill()
示例2: kill_cryptolocker
# 需要导入模块: from winappdbg import Process [as 别名]
# 或者: from winappdbg.Process import kill [as 别名]
def kill_cryptolocker( pname, pid ):
# Instance a Process object.
process = Process( pid )
# Kill the process.
process.kill()
proc = "(" + pname + ":" + str(gpid) + ")"
if turkish:
txt = u"[*] Cryptolocker işlemcisi durduruldu! " + proc
log(txt)
print u"[*] Cryptolocker işlemcisi durduruldu! " + proc
else:
txt = "[*] Terminated Cryptolocker process! " + proc
log(txt)
print "[*] Terminated Cryptolocker process! " + proc
if root.state() != "normal":
os.system(filename)
sys.exit(1)
示例3: main
# 需要导入模块: from winappdbg import Process [as 别名]
# 或者: from winappdbg.Process import kill [as 别名]
def main(argv):
script = os.path.basename(argv[0])
params = argv[1:]
print "Process killer"
print "by Mario Vilas (mvilas at gmail.com)"
print
if len(params) == 0 or '-h' in params or '--help' in params or \
'/?' in params:
print "Usage:"
print " %s <process ID or name> [process ID or name...]"
print
print "If a process name is given instead of an ID all matching processes are killed."
exit()
# Scan for active processes.
# This is needed both to translate names to IDs, and to validate the user-supplied IDs.
s = System()
s.request_debug_privileges()
s.scan_processes()
# Parse the command line.
# Each ID is validated against the list of active processes.
# Each name is translated to an ID.
# On error, the program stops before killing any process at all.
targets = set()
for token in params:
try:
pid = HexInput.integer(token)
except ValueError:
pid = None
if pid is None:
matched = s.find_processes_by_filename(token)
if not matched:
print "Error: process not found: %s" % token
exit()
for (process, name) in matched:
targets.add(process.get_pid())
else:
if not s.has_process(pid):
print "Error: process not found: 0x%x (%d)" % (pid, pid)
exit()
targets.add(pid)
targets = list(targets)
targets.sort()
count = 0
# Try to terminate the processes using the TerminateProcess() API.
next_targets = list()
for pid in targets:
next_targets.append(pid)
try:
# Note we don't really need to call open_handle and close_handle,
# but it's good to know exactly which API call it was that failed.
process = Process(pid)
process.open_handle()
try:
process.kill(-1)
next_targets.pop()
count += 1
print "Terminated process %d" % pid
try:
process.close_handle()
except WindowsError, e:
print "Warning: call to CloseHandle() failed: %s" % str(e)
except WindowsError, e:
print "Warning: call to TerminateProcess() failed: %s" % str(e)
except WindowsError, e:
print "Warning: call to OpenProcess() failed: %s" % str(e)
示例4: find_meterpreter_trace
# 需要导入模块: from winappdbg import Process [as 别名]
# 或者: from winappdbg.Process import kill [as 别名]
mdlog.print_console(mdlog.INFO_LEVEL,"[*] Enumerating suspicious Reverse_Process")
for proc in suspicious_veil_procList:
try:
print "Suspicious %d",proc.pid
if (proc.pid not in inScopeList):
traceFlag = find_meterpreter_trace(proc.pid,VEIL_MEMORY_TRACE_LINE_LIMIT)
except Exception,e:
mdlog.print_console(mdlog.ERROR_LEVEL,("[-] Error in tracing " + str(e)))
time.sleep(3) #sleep for another access
if (traceFlag):
try:
mdlog.print_console(mdlog.INFO_LEVEL,"[*] kill suspicious reverse_https_Meterpreter " + str(proc.pid) + " " + str(proc.name) + " " + str(proc.connections()))
vprocess = Process(proc.pid)
# Kill the process.
vprocess.kill()
time.sleep(2) #sleep for smooth debugger console
except Exception,e:
mdlog.print_console(mdlog.ERROR_LEVEL,("[-] Error in suspicious reverse_http managing " + str(e)))
mdlog.print_console(mdlog.INFO_LEVEL,"[*] Enumerating CMD_Process")
est_pids = retrieve_ps_id(est_conn_procList)
for proc in cmd_procList:
pid = proc.pid
parent_pid = proc.ppid()
if (parent_pid in est_pids and (proc.pid not in inScopeList)):
print proc.pid, proc.name, proc.connections()
try:
mdlog.print_console(mdlog.INFO_LEVEL,"[*] shell " + str(proc.pid) + " " + str(proc.name) + " " + str(proc.connections()))
myhandler = md_shell.hook_handler()