This file is indexed.

/usr/bin/nxt_server is in python-nxt 2.2.2-1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/python
#
# nxt_server program -- Serve an interface to the NXT brick
# Copyright (C) 2011  zonedabone, Marcus Wanner
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

import nxt
import socket, sys, traceback
from nxt.utils import parse_command_line_arguments

def serve(brick, channel, details):
    'handles serving the client'
    print "Connection started (" + details[0] + ')'
    run = True
    try:
        while run:
            data = channel.recv(1024)
            if not data:
                break
            code =  data[0]
            if code == '\x00' or code == '\x01' or code == '\x02':
                brick.sock.send(data)
                reply = brick.sock.recv()
                channel.send(reply)
            elif code == '\x80' or code == '\x81':
                brick.sock.send(data)
            elif code == '\x98':
                channel.send(brick.sock.type)
            elif code == '\x99':
                run = False
    except:
        traceback.print_exc()
    finally:
        channel.close()
        print "Connection Finished"

if __name__ == "__main__":
    arguments, keyword_arguments = parse_command_line_arguments(sys.argv)
    if '--help' in arguments:
        print(
"""nxt_server -- command server for NXT brick
Usage: nxt_server.py [--host <macaddress>][--name <name>]
[--iphost <server ip>][--ipport <server port>]""")
        exit(0)
    print "Connecting to NXT..."
    brick = nxt.find_one_brick(keyword_arguments.get('host',None),keyword_arguments.get('name',None))
    print "Brick found."

    print "Starting server..."
    server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    server.bind((keyword_arguments.get('iphost',''), int(keyword_arguments.get('ipport','2727'))))
    server.listen(1)
    # Have the server serve "forever":
    while True:
        channel, details = server.accept()
        #TODO: sasl authentication here?
        serve(brick, channel, details)