def success(self, url, plugin='unknown', **kw): report = {"url": url, "plugin": plugin} report.update(kw) self.lock.acquire() self.collect.append(report) self.log("[{}] ".format(report["plugin"])) del report["plugin"] raw = None if "raw" in report: if isinstance(report['raw'], str): raw = [report['raw']] elif isinstance(report['raw'], list): raw = report['raw'] del report['raw'] for k, v in report.items(): msg = "{0}{1}{2}".format(k, " " * (15 - len(k)), str(v).strip()) self.log(msg) self.log(' ') if raw: index = 0 for i in raw: self.log("#{0} 请求包".format(index)) self.log(i) self.log(" ") index += 1 self.lock.release() printProgress()
def log(self, msg): # Share.dataToStdout(value + '\n') width = KB["console_width"][0] while len(msg) > width: _ = msg[:width] Share.dataToStdout('\r' + _ + '\n\r') msg = msg[width:] Share.dataToStdout('\r' + msg + '\n\r') printProgress()
def log(self, msg): # Share.dataToStdout(value + '\n') Share.dataToStdout('\r' + msg + '\n\r') printProgress()
def test_console_output(self): self.output.log("test") for i in range(100): time.sleep(0.2) printProgress()