Skip to content

Instantly share code, notes, and snippets.

@g33kyrash
Created April 22, 2016 13:10
Show Gist options
  • Select an option

  • Save g33kyrash/15e63fe5acc00b13cee5c313c5cc9054 to your computer and use it in GitHub Desktop.

Select an option

Save g33kyrash/15e63fe5acc00b13cee5c313c5cc9054 to your computer and use it in GitHub Desktop.

Revisions

  1. g33kyrash created this gist Apr 22, 2016.
    22 changes: 22 additions & 0 deletions username_checker.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,22 @@
    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!"