예제 #1
0
파일: javaos.py 프로젝트: choudarykvsp/kali
def popen(*args, **kwargs):
    """popen(command [, mode='r' [, bufsize]]) -> pipe

    Open a pipe to/from a command returning a file object.
    """
    # allow lazy import of popen2 and javashell
    import popen2
    return popen2.popen(*args, **kwargs)
예제 #2
0
def popen( *args, **kwargs ):
    """popen(command [, mode='r' [, bufsize]]) -> pipe

    Open a pipe to/from a command returning a file object.
    """
    # allow lazy import of popen2 and javashell
    import popen2
    return popen2.popen( *args, **kwargs )
예제 #3
0
파일: check-mem.py 프로젝트: jb55/jgblue
def send_email(mem, total_mem, percent):
    import smtplib

    to = "*****@*****.**"
    frm = "*****@*****.**"
    subject = "Garfist memory low"
    msg = """Subject: Garfist memory low

    Status --
    %d / %d (%f%%)
    """ % (
        mem,
        total_mem,
        percent,
    )

    server = smtplib.SMTP("localhost")
    server.sendmail(frm, to, msg)
    server.quit


total_mem = int(popen("free | grep Mem: | awk '{ print $2 }'")[0].read().strip())
mem = int(popen("free | grep buffers/cache | awk '{ print $4; }'")[0].read().strip())

percent = (float(mem) / float(total_mem)) * 100

print mem, "/", total_mem, percent

if percent <= PERCENT_LIMIT:
    send_email(mem, total_mem, percent)
예제 #4
0
def popen( *args, **kwargs ):
    # allow lazy import of popen2 and javashell
    import popen2
    return popen2.popen( *args, **kwargs )