Created
April 22, 2016 13:10
-
-
Save g33kyrash/15e63fe5acc00b13cee5c313c5cc9054 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 re, sys | |
try: | |
f = open("/etc/passwd",'r') | |
except: | |
print "\nCan't open the file!\n" | |
sys.exit(0) | |
#enter your username here | |
username = "rash" | |
k=0 | |
for lines in f.readlines(): | |
match = re.search(username, lines) | |
if match: | |
k=1 | |
print match.group() + " exists." | |
break | |
if(k==0): | |
print username + " does not exist!" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment