SHARE
TWEET

Untitled

a guest Jul 21st, 2017 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/env python
  2.  
  3. from getpass import getpass
  4. from crypt import crypt
  5. import re
  6. import os
  7.  
  8. salt = "CN"
  9. word = getpass()
  10.  
  11. def login(word,salt):
  12.     DES_pass = crypt(word, salt)
  13.     return DES_pass
  14.  
  15. user = raw_input("Ingrese un usuario: ")
  16. try:
  17.     f = open("/etc/passwd","r+")
  18.  
  19.     for contenido in f.readlines():
  20.         aux=contenido.split(":")
  21.         user_aux = str(aux[0]) #user
  22.         #
  23.         if re.search(user_aux,user):
  24.             print "\n\tCoinciden!! (ya existe)\n"
  25.             break
  26.         else:
  27.             f.write("\n"+user+":"+login(word,salt)+":1003:1000:geco:/home/"+user+"/:/bin/bash")
  28.             os.mkdir("/home/"+user+"/")
  29.             break
  30. except: IOError
  31.  
  32. fin = raw_input( "Presione una tecla para terminar..")
  33.  
  34. "Um brasileiro por aqui?"
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top