本文整理汇总了Python中lib.common.results.NetlogFile.send方法的典型用法代码示例。如果您正苦于以下问题:Python NetlogFile.send方法的具体用法?Python NetlogFile.send怎么用?Python NetlogFile.send使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lib.common.results.NetlogFile
的用法示例。
在下文中一共展示了NetlogFile.send方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: dump_memory
# 需要导入模块: from lib.common.results import NetlogFile [as 别名]
# 或者: from lib.common.results.NetlogFile import send [as 别名]
def dump_memory(self):
"""Dump process memory.
@return: operation status.
"""
if not self.pid:
log.warning("No valid pid specified, memory dump aborted")
return False
if not self.is_alive():
log.warning("The process with pid %d is not alive, memory " "dump aborted", self.pid)
return False
bin_name = ""
bit_str = ""
file_path = os.path.join(PATHS["memory"], "{0}.dmp".format(self.pid))
if self.is_64bit():
orig_bin_name = LOADER64_NAME
bit_str = "64-bit"
else:
orig_bin_name = LOADER32_NAME
bit_str = "32-bit"
bin_name = os.path.join(os.getcwd(), orig_bin_name)
if os.path.exists(bin_name):
ret = subprocess.call([bin_name, "dump", str(self.pid), file_path])
if ret == 1:
log.info("Dumped %s process with pid %d", bit_str, self.pid)
else:
log.error("Unable to dump %s process with pid %d, error: %d", bit_str, self.pid, ret)
return False
else:
log.error(
"Please place the %s binary from cuckoomon into analyzer/windows/bin in order to analyze %s binaries.",
os.path.basename(bin_name),
bit_str,
)
return False
nf = NetlogFile(os.path.join("memory", "{0}.dmp".format(self.pid)))
infd = open(file_path, "rb")
buf = infd.read(1024 * 1024)
try:
while buf:
nf.send(buf, retry=True)
buf = infd.read(1024 * 1024)
except:
infd.close()
nf.close()
log.warning("Memory dump of process with pid %d failed", self.pid)
return False
infd.close()
nf.close()
log.info("Memory dump of process with pid %d completed", self.pid)
return True
示例2: finish
# 需要导入模块: from lib.common.results import NetlogFile [as 别名]
# 或者: from lib.common.results.NetlogFile import send [as 别名]
def finish(self):
log.info("starting to send data")
data = self.m.get_logs()
log.info("size of log: {}".format(len(data)))
nc = NetlogFile("files/proxyLog.log")
log.info("netlog initiated")
nc.send(data, retry=True)
log.info("netlog sent")
return True
示例3: finish
# 需要导入模块: from lib.common.results import NetlogFile [as 别名]
# 或者: from lib.common.results.NetlogFile import send [as 别名]
def finish(self):
data = self.m.get_logs()
nc = NetlogFile("files/proxyLog.log")
nc.send(data, retry=True)
return True