Compare commits
No commits in common. "master" and "v.0.2" have entirely different histories.
@ -1,15 +0,0 @@
|
|||||||
#!/usr/lib/python3
|
|
||||||
|
|
||||||
phrase = input('Phrase : ')
|
|
||||||
tabmot = phrase.split(' ')
|
|
||||||
cptmot = {}
|
|
||||||
|
|
||||||
for mot in tabmot :
|
|
||||||
if mot in cptmot :
|
|
||||||
cptmot[mot] = cptmot[mot] + 1
|
|
||||||
else :
|
|
||||||
cptmot[mot] = 1
|
|
||||||
|
|
||||||
for key in cptmot.keys() :
|
|
||||||
print (key, " ", cptmot[key])
|
|
||||||
|
|
@ -1 +0,0 @@
|
|||||||
tdalle
|
|
@ -1,22 +0,0 @@
|
|||||||
#/usr/bien/python3
|
|
||||||
|
|
||||||
import re
|
|
||||||
import sys
|
|
||||||
|
|
||||||
cptip = {}
|
|
||||||
regexp = '^(\S+) (\S+) (\S+) \[([^]]+)\] "(\w+) (\S+).*" (\d+) (\S+)'
|
|
||||||
|
|
||||||
for line in sys.stdin :
|
|
||||||
line = line.rstrip ()
|
|
||||||
match = re.match (regexp, line)
|
|
||||||
if match :
|
|
||||||
print (match.group(1)," ",match.group(8))
|
|
||||||
ip = match.group(1)
|
|
||||||
vol = int(match.group(8))
|
|
||||||
if ip in cptip :
|
|
||||||
cptip[ip] = cptip[ip] + vol
|
|
||||||
else:
|
|
||||||
cptip[ip] = vol
|
|
||||||
|
|
||||||
for key in cptip.keys():
|
|
||||||
print(key, ":", cptip[key])
|
|
@ -1,41 +0,0 @@
|
|||||||
#!/usr/lib/python3
|
|
||||||
import sys
|
|
||||||
import subprocess
|
|
||||||
import os
|
|
||||||
nbarg = len(sys.argv)
|
|
||||||
if nbarg != 2:
|
|
||||||
print ("Nombre d'argument invalide")
|
|
||||||
exit (1)
|
|
||||||
filename = sys.argv[1]
|
|
||||||
try:
|
|
||||||
fh = open(filename, "r")
|
|
||||||
except:
|
|
||||||
print ("Fichier ", filename," inconnu")
|
|
||||||
exit (2)
|
|
||||||
else:
|
|
||||||
line = fh.readline ()
|
|
||||||
while line:
|
|
||||||
nouvline = line.rstrip()
|
|
||||||
login,nomlong = nouvline.split(':')
|
|
||||||
cmd = "sudo useradd -m -d /home/"+login+" -c \'"+ nomlong+"\' -s /bin/bash "+ login
|
|
||||||
res = os.system ("getent passwd "+login)
|
|
||||||
if res != 0:
|
|
||||||
passw = ["pwgen", "4","1"]
|
|
||||||
#passw = "pwgen 4 1"
|
|
||||||
os.system (cmd)
|
|
||||||
#mdp = str(os.system (passw))
|
|
||||||
#print (mdp)
|
|
||||||
mdp = subprocess.run(passw,capture_output=True)
|
|
||||||
mdp2 = mdp.stdout.decode("utf-8")
|
|
||||||
mdp3 = mdp2.rstrip()
|
|
||||||
print (mdp3)
|
|
||||||
ch3 = "echo "+login+":"+mdp3+"|sudo chpasswd"
|
|
||||||
print (ch3)
|
|
||||||
os.system (ch3)
|
|
||||||
os.system ("sudo echo "+login+":"+mdp3+" >> "+filename+".pwd")
|
|
||||||
else:
|
|
||||||
print ("Utilisateur "+login+" déjà éxistant")
|
|
||||||
os.system ("sudo userdel -r "+login)
|
|
||||||
line = fh.readline()
|
|
||||||
|
|
||||||
fh.close()
|
|
Loading…
x
Reference in New Issue
Block a user