mot de passe compte crans
This commit is contained in:
parent
076d667d34
commit
d76ed2febb
2 changed files with 28 additions and 14 deletions
40
dump.py
40
dump.py
|
@ -13,9 +13,14 @@ import json
|
|||
CODING='cp437'
|
||||
DEVICE="/dev/ttyUSB0"
|
||||
SAMPLE_MACHINE = {
|
||||
'login': 'cerveaulent',
|
||||
'login': 'nouille',
|
||||
'macAddress': '<automatique>',
|
||||
'pass': '**********',
|
||||
'secret': '**********',
|
||||
}
|
||||
|
||||
SAMPLE_ACCOUNT = {
|
||||
'login': 'passoir',
|
||||
'pass': 'omgverysecure',
|
||||
}
|
||||
|
||||
# Load data
|
||||
|
@ -30,18 +35,26 @@ def print_carac(text, value):
|
|||
printer.println(text + ('.'*pad) + value )
|
||||
|
||||
|
||||
def show_machine(machine):
|
||||
def show_entry(entry):
|
||||
printer.justify('C')
|
||||
printer.underlineOn()
|
||||
printer.println(u'Détails machine'.encode(CODING))
|
||||
if 'secret' in entry:
|
||||
title = u'Détails machine'
|
||||
if 'type' in entry:
|
||||
title += u' ' + entry['type']
|
||||
printer.println(title.encode(CODING))
|
||||
else:
|
||||
printer.println(u'Compte Crans'.encode(CODING))
|
||||
printer.underlineOff()
|
||||
printer.justify('L')
|
||||
|
||||
print_carac('Login', machine['login'])
|
||||
if machine.has_key('macAddress'):
|
||||
print_carac('Mac', machine['macAddress'])
|
||||
if machine.has_key('pass'):
|
||||
print_carac('Mot de passe', machine['pass'])
|
||||
print_carac('Login', entry['login'])
|
||||
if 'macAddress' in entry:
|
||||
print_carac('Mac', entry['macAddress'])
|
||||
if 'secret' in entry:
|
||||
print_carac('Mot de passe', entry['secret'])
|
||||
if 'pass' in entry:
|
||||
print_carac('Mot de passe', entry['pass'])
|
||||
|
||||
printer.feed(1)
|
||||
|
||||
|
@ -54,10 +67,11 @@ def print_liste(liste):
|
|||
first = True
|
||||
|
||||
for m in liste:
|
||||
if not first:
|
||||
print_carac('','')
|
||||
#if not first:
|
||||
# print_carac('','')
|
||||
first = False
|
||||
show_machine(m)
|
||||
|
||||
show_entry(m)
|
||||
|
||||
printer.println(u'Veuillez conserver ces informations en lieu sûr.'.encode(CODING))
|
||||
|
||||
|
@ -65,7 +79,7 @@ def print_liste(liste):
|
|||
|
||||
if __name__ == '__main__':
|
||||
if not sys.argv[1:]:
|
||||
liste = [SAMPLE_MACHINE]
|
||||
liste = [SAMPLE_ACCOUNT, SAMPLE_MACHINE]
|
||||
else:
|
||||
with open(sys.argv[1], 'r') as f:
|
||||
liste = json.load(f)
|
||||
|
|
|
@ -42,7 +42,7 @@ for machine in m:
|
|||
login = machine['host'][0].split('.', 1)[0]
|
||||
todo = {'login': login, 'macAddress': machine['macAddress'][0].value}
|
||||
if machine.has_key('ipsec'):
|
||||
todo['pass'] = machine['ipsec'][0].value
|
||||
todo['secret'] = machine['ipsec'][0].value
|
||||
to_print.append(todo)
|
||||
|
||||
ch.basic_publish(exchange='', routing_key='CransTicket', body=json.dumps(to_print))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue