Advertisement
Guest User

BlueMelon Last Login

a guest
Sep 13th, 2012
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.93 KB | None | 0 0
  1.  
  2. #Copy/Paste your staff= into this string here:
  3. server_staff = "Monkeybob,BlueMelon,Crow,Stefan"
  4.  
  5.  
  6. months = ['Jan','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']
  7. log = open("rclog.txt",'r').readlines()
  8. staff = server_staff.split(",")
  9. times = {}
  10. for s in staff:
  11.     times[s] = 'Jan 01'
  12.  
  13. for i in range(0,len(log)):
  14.     if (i+1) >= len(log):
  15.         break
  16.     line = log[i]
  17.     line2 = log[i+1]
  18.     if "is logged in from" in line2 and "Client-RC" not in line2:
  19.         acc = line2.split(" ")[0]
  20.         if acc in staff:
  21.             currentmonth = times[acc].split(" ")[0]
  22.             currentmonth_num = months.index(currentmonth)
  23.             newmonth = line.split(" ")[2]
  24.             newmonth_num = months.index(newmonth)
  25.             if newmonth_num >= currentmonth_num:
  26.                 times[acc] = line[10:len(line2)-1]
  27.  
  28.  
  29. for acc in times.keys():
  30.     print "Last Login ("+acc+"): "+str(times[acc])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement