#!/usr/bin/python

import os
import time

unumber = os.getuid()
pnumber = os.getpid()
where = os.getcwd()
what = os.uname()
used = os.times()
now = time.time()
means = time.ctime(now)

print "User number",unumber
print "Process ID",pnumber
print "Current Directory",where
print "System information",what
print "System information",used

print "\nTime is now",now
print "Which interprets as",means

'PYTHON > CODE' 카테고리의 다른 글

[CODE] Port Scanner 예제  (0) 2012.09.26
[CODE] TKINTER 메뉴 만들기  (0) 2012.09.24
[CODE] ID/PASSWD 복잡성 체크  (0) 2012.09.24
[CODE] 디스크 사용량 체크  (0) 2012.09.24
[CODE] 특정 파일을 검색해 권한 출력하기  (0) 2012.09.24

import pwd

#initialize counters
erroruser = []
errorpass = []

#get password database
passwd_db = pwd.getpwall()

try:
    #check each user and password for validity
    for entry in passwd_db:
        username = entry[0]
        password = entry [1]
        if len(username) < 6:
            erroruser.append(username)
        if len(password) < 8:
            errorpass.append(username)

    #print results to screen
    print "The following users have an invalid userid (less than six characters):"
    for item in erroruser:
        print item
    print "\nThe following users have invalid password(less than eight characters):"
    for item in errorpass:
        print item
except:
    print "There was a problem running the script."

'PYTHON > CODE' 카테고리의 다른 글

[CODE] Port Scanner 예제  (0) 2012.09.26
[CODE] TKINTER 메뉴 만들기  (0) 2012.09.24
[CODE] 시스템 정보 가져오기  (0) 2012.09.24
[CODE] 디스크 사용량 체크  (0) 2012.09.24
[CODE] 특정 파일을 검색해 권한 출력하기  (0) 2012.09.24

#!/usr/bin/python

import commands

result=commands.getoutput('df -k').split('\n')

for line in result[1:]:
        temp=line.split()
        usage=temp[4][:-1]
        usage=int(usage)
        if usage > 60:
                print line
        else:
                pass

'PYTHON > CODE' 카테고리의 다른 글

[CODE] Port Scanner 예제  (0) 2012.09.26
[CODE] TKINTER 메뉴 만들기  (0) 2012.09.24
[CODE] 시스템 정보 가져오기  (0) 2012.09.24
[CODE] ID/PASSWD 복잡성 체크  (0) 2012.09.24
[CODE] 특정 파일을 검색해 권한 출력하기  (0) 2012.09.24

+ Recent posts