Ejemplo n.º 1
0
 s = None
 if options.try_local:
     try:
         s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
         s.connect('/tmp/pysoul.sock')
     except:
         pass
 if not s:
     try:
         s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
         s.settimeout(options.timeout)
         s.connect((options.server_host, int(options.server_port)))
     except Exception, e:
         print "OHNOEWS %s" % e
 if s:
     ns = netsoul.ns(s, debug=None)
     list = None
     if args:
         list = args[0]
     users = ns.list_users_iter(list)
     try:
         total = 0
         for user in users:
             if not options.group or user['login'] in groups[options.group]:
                 total += 1
                 if options.raw:
                     print user['raw']
                 else:
                     # $6: niveau e confiance de l'auth: 1 = interne, 3 = externe, 100 = interne + krb
                     if 0:
                         print user['agent']
Ejemplo n.º 2
0
    reconnect_sleep = 3

    if options.daemon:
        print "Daemon mode"
    while True:
        try:
            i = False
            l = False
#            print 3
            s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
            s.settimeout(options.timeout)
            print options.server_host + ' ' + str(options.server_port)
            s.connect((options.server_host, options.server_port))
            sf = s.makefile()
            ns = netsoul.ns(socket = s, debug = pysoul_debug)
            try:
                u = False
                location = urllib.quote(options.location) if options.location else '-'
                agent = urllib.quote(options.agent) if options.agent else '-'
                status = urllib.quote(options.status) if options.status else '-'
                ns.connect(username = options.username, password = options.password, location = location, agent = agent, status = status)
                if options.ip:
                    if options.ip != ns.hello['ip']:
                        reconnect_sleep = 0.5
                        raise "bad ip"
                    else:
                        reconnect_sleep = 3
                input = [s, sys.stdin]
                if options.unix_socket:
                    u = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
Ejemplo n.º 3
0
 s = None
 if options.try_local:
     try:
         s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
         s.connect('/tmp/pysoul.sock')
     except:
         pass
 if not s:
     try:
         s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
         s.settimeout(options.timeout)
         s.connect((options.server_host, int(options.server_port)))
     except Exception, e:
         print "OHNOEWS %s" % e
 if s:
     ns = netsoul.ns(s, debug = None)
     list = None
     if args:
         list = args[0]
     users = ns.list_users_iter(list)
     try:
         total = 0
         for user in users:
             if not options.group or user['login'] in groups[options.group]:
                 total += 1
                 if options.raw:
                     print user['raw']
                 else:
                     # $6: niveau e confiance de l'auth: 1 = interne, 3 = externe, 100 = interne + krb
                     if 0:
                         print user['agent']