예제 #1
0
def print_c(a,m):
  mi,m0,m1,m2 = m
  for i,x in a:
    sc("C"); pc("%%%dd. "%mi%(i+1))
    x = x.split("\t")
    sc("Y"); pc("%%-%ds"%(m0+1)%x[0])
    sc("W"); pc("%%-%ds"%(m1+1)%x[1])
    if len(x)>2: sc("M"); pc("%%-%ds"%(m2+1)%x[2])
    sc("w")
    if len(x)>3: pc(" ".join(x[3:]))
    pc()
예제 #2
0
def help():
  sc("W")
  print("PW - PassWord keeper - Version "+VERS+" (Sep.2012) - with zlib,md5,aes/rijndael\n")
  print("pw.py xxx -- search (empty string \"\" to list all)")
  print("pw.py -s xxx -- search for starting with xxx")
  print("pw.py what name [pwd email-www-etc..] -- add record (use %20 for SPC)")
  print("pw.py -d index [index...] -- delete entries")
  print("pw.py -a file -- add records (TAB-separated) from file")
  print("pw.py -o file -- output to text file (TAB-separated records)")
  print("pw.py -i -- interactive (search,add(w/%20),delete)\n")
  print("the very first two arguments can be -f pwsfile\n")
  print("enter '?' as password to show password enternig")
  sc("w")
예제 #3
0
def colorize(line):
  done = False
  for c in long_colors:
    if line.startswith(c):
      if long_colors[c]=="-":
        return
      else:
        sc(long_colors[c]); done = True; break
  if not done:
    for c in short_colors:
      if line.startswith(c):
        sc(short_colors[c]); break
  p(line); sc(); p()
예제 #4
0
  p = enter_pwd()
  t = read_pw_file( PWFILE, p )
  delrecs = sorted( [int(n) for n in ARGS[1:]] )
  fmt = "%%%dd."%len(str(delrecs[0]))
  for n in delrecs:
    print(fmt%n,"\t".join(t[n-1].split("\t")[:2]))
  for n in delrecs[::-1]: # in desc. order! it's important for 'del'
    del t[n-1]
  print(len(delrecs),"records deleted,",len(t),"records left")
  write_pw_file( PWFILE, p, t )

elif len(ARGS)==1 and ARGS[0]=="-i": # interactive
  p = enter_pwd()
  t = read_pw_file( PWFILE, p )
  z = len(t)==0
  sc("C")
  print("xxx... -- search\na xxx... -- add (separate with SPC, use %20 for SPC)")
  print("d # #... -- delete\nq -- exit")
  sc("w")
  try:
    o = input("> ")
    while o!='q':
      if o.find(" ") < 0: # one word, search for it
        print_search(t,o.upper().replace("%20"," "))
      elif o.startswith("a "):
        r = '\t'.join(o[2:].split()).replace("%20"," ")
        if r in t:
          print( "duplicated record" )
        else:
          t.append( r )
          print( "1 record added" )