Beispiel #1
0
def timing(f):
    log = getAppLogger()

    @wraps(f)
    def wrap(*args, **kw):
        ts = time()
        result = f(*args, **kw)
        te = time()
        tr = te - ts
        log.debug('Function:%r args:[%r, %r] took: %2.4f sec' % (f.__name__, args, kw, tr))
        return result

    return wrap
Beispiel #2
0
    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
    warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
    details.

    You should have received a copy of the GNU General Public License along with this program.
    If not, see <http://www.gnu.org/licenses/>.

"""
import sys

import xml

from app.logging.legionLog import getAppLogger
from parsers.Host import Host

log = getAppLogger()

if __name__ == '__main__':

    dom = xml.dom.minidom.parse('/tmp/test_pwn01.xml')
    hostNodes = dom.getElementsByTagName('host')

    if len(hostNodes) == 0:
        sys.exit( )

    hostNode = dom.getElementsByTagName('host')[0]

    h = Host( hostNode )
    log.info('host status: ' + h.status)
    log.info('host ip: ' + h.ip)