Created
September 4, 2018 11:11
-
-
Save rava-dosa/12160bacae517676f1fd2a2981d64310 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import subprocess | |
import os | |
while(1): | |
r=subprocess.check_output(['who','-u']) | |
s1=r.split("\n") | |
for x in s1: | |
s2=x.split(" ") | |
if(len(s2[5])==18): | |
s3=s2[5] | |
s4=s3.split(" ") | |
s5=s4[1] | |
s6=s5.replace("(","") | |
s6=s6.replace(")","") | |
os.system("ssh user@"+s6) | |
os.system("user12") | |
r1=subprocess.check_output(['who','-u']) | |
s33=r.split("\n") | |
for y in s33: | |
s34=y.split(" ") | |
s35=s34[3] | |
if s35[len(s35)-1]=="?": | |
s36=s34[5] | |
s37=s36.replace(" ","") | |
s38=s37[0:5] | |
os.system("kill "+s38) | |
os.system("exit") | |
break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment