From e24003df9744e85388724da3f9b66835f7aa01f9 Mon Sep 17 00:00:00 2001 From: ibuler Date: Thu, 17 Dec 2015 17:12:26 +0800 Subject: [PATCH] Update connect.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复 remote ip抓取问题 --- connect.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/connect.py b/connect.py index 11f3cefe1..ca5f76566 100644 --- a/connect.py +++ b/connect.py @@ -90,8 +90,7 @@ def log_record(username, host): log_file_path = os.path.join(today_connect_log_dir, log_filename) dept_name = User.objects.get(username=username).dept.name pid = os.getpid() - pts = os.popen("ps axu | awk '$2==%s{ print $7 }'" % pid).read().strip() - ip_list = os.popen("who | awk '$2==\"%s\"{ print $5 }'" % pts).read().strip('()\n') + ip_list = os.popen("who -m | awk '{ print $5 }'").read().strip('()\n') if not os.path.isdir(today_connect_log_dir): try: