Skip to content

Instantly share code, notes, and snippets.

@g33kyrash
Created April 22, 2016 13:10
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save g33kyrash/15e63fe5acc00b13cee5c313c5cc9054 to your computer and use it in GitHub Desktop.
Save g33kyrash/15e63fe5acc00b13cee5c313c5cc9054 to your computer and use it in GitHub Desktop.
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