本文整理汇总了Python中Client.removeProc方法的典型用法代码示例。如果您正苦于以下问题:Python Client.removeProc方法的具体用法?Python Client.removeProc怎么用?Python Client.removeProc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Client
的用法示例。
在下文中一共展示了Client.removeProc方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: P4wnP1
# 需要导入模块: import Client [as 别名]
# 或者: from Client import removeProc [as 别名]
#.........这里部分代码省略.........
def sendControlMessage(self, ctrl_message_type, payload = None):
ctrl_channel = 0
# construct header
ctrl_message = struct.pack("!II", ctrl_channel, ctrl_message_type)
# append payload
if payload:
ctrl_message += payload
self.tl.write_stream(ctrl_message)
def interactWithClientProcess(self, pid):
print "Trying to interact with process ID {0} ...".format(pid)
proc = self.client.getProcess(pid)
if not proc:
print "PID {0} not found or process not managed by P4wnP1".format(pid)
return
import select
interacting = True
proc.setInteract(True) # let the process object inform the channel that stdout and stderr should be used
while interacting:
if not self.client.isConnected():
interacting = False
print "\nClient disconnected, stop interacting"
break
if proc.hasExited:
print "\nProcess exited... stopping interaction"
if proc.keepTillInteract:
self.client.removeProc(proc.id)
break
try:
#input = getpass.getpass()
# only read key if data available in stdin(avoid blocking stdout)
if select.select([sys.stdin], [], [], 0.05)[0]: # 50 ms timeout, to keep CPU load low
input = sys.stdin.readline()
print input
proc.writeStdin(input)
except KeyboardInterrupt:
interacting = False
proc.setInteract(False)
print "\nInteraction stopped by keyboard interrupt.\nTo continue interaction use 'interact'."
#def addChannel(self, payload):
#'''
#Client requested new channel, add it...
#'''
#ch_id, ch_type, ch_encoding = struct.unpack("!IBB", payload)
#P4wnP1.print_debug("Server add channel request. Channel id '{0}', type {1}, encoding {2}".format(ch_id, ch_type, ch_encoding))
def onClientConnectStateChange(self, state):
#print "Client connect state: {0}".format(state)
if state:
print "\nTarget connected through HID covert channel\n"
else:
print "\nTarget disconnected"
self.setPrompt(state)
def onClientProcessExitted(self, payload):