From 3dbf451d753906393fbaea2b54043ebb6424c637 Mon Sep 17 00:00:00 2001 From: milisman Date: Sat, 8 Oct 2016 22:27:35 +0300 Subject: [PATCH] miliskur.py --- bin/miliskur-test.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) mode change 100755 => 100644 bin/miliskur-test.py diff --git a/bin/miliskur-test.py b/bin/miliskur-test.py old mode 100755 new mode 100644 index af2b116da..fdff08fb6 --- a/bin/miliskur-test.py +++ b/bin/miliskur-test.py @@ -8,6 +8,7 @@ from dialog import Dialog import os,sys,re,subprocess,time +import crypt d = Dialog(dialog="dialog") f = open("/tmp/log.txt","w") @@ -40,13 +41,19 @@ def checkUsername(): if status == "ok": checkUsername() + +def createUser(name,username,password): + encPass = crypt.crypt(password,"22") + return os.system("useradd -p "+encPass+ " -s "+ "/bin/bash "+ "-d "+ "/home/" + username+ " -m "+ " -c \""+ name+"\" " + username) + + def checkUserPassword(username): #insecure=True parolanın yıldız şeklinde gözükmesini sağlar, #root şifresi sorarken belki bunu silebiliriz normal sudo şifresi #girer gibi gözükmez. status,password = d.passwordbox(text="Lütfen {} kullanıcısı için şifrenizi giriniz".format(username),insecure=True) if len(password) > 0: - #buraya kullanıcı ekleme kodu eklenecek. Şuan kendi sistemimde yazıyorum sıkıntı çıkmasın diye implemente etmedim. + createUser(username,username,password) f.write("[+] Kullanıcı eklendi") if d.yesno(text="Yeni kullanıcı eklemek istiyor musunuz ?") == "ok": checkUsername()