args = parser.parse_args()


    # Testing node args
    vbox_id_as_str=''
    vbox_id=0
    vbox_name=''
    if not (args.nodename or args.nodeid) or (args.nodename and args.nodeid):
        print "Error. You must provide the name (-n) OR the id (-i) of your Vbox"
        sys.exit(0)
    
    if args.nodeid:
        vbox_id_as_str = unhexlify(args.nodeid)
        vbox_id_as_str = vbox_id_as_str[3] + vbox_id_as_str[2] + vbox_id_as_str[1] + vbox_id_as_str[0]
        vbox_id = long(args.nodeid, 16)
        vbox_name = id2name(vbox_id)

    if args.nodename:
        vbox_name = args.nodename
        vbox_id = name2id(vbox_name)
        vbox_id_as_str = name2id_as_str(vbox_name)
        vbox_id_as_str = vbox_id_as_str[3] + vbox_id_as_str[2] + vbox_id_as_str[1] + vbox_id_as_str[0]


    # Testing dumpfile arg
    dumpfile = args.file
    try:
        dumpfile_size = os.path.getsize(dumpfile)
    except:
        print "ERROR while opening %s" % dumpfile
        sys.exit(0)
Example #2
0
#!/usr/bin/env python
#
# Convert Verisure node ID to node Name
# By Jerome Nokin (http://funoverip.net / @funoverip)
#


import sys, os
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'lib'))
from securitas_name_convert import id2name, name2id

if __name__ == '__main__':

    if len(sys.argv) != 2:
        print "Usage: %s <id>" % sys.argv[0]
        print "Ex:    %s 0100c3a7" % sys.argv[0]
        sys.exit(0)

    nodeid = sys.argv[1]
    nodeid = int(nodeid, 16)

    nodename = id2name(nodeid)
    print "Id  : %08x" % nodeid
    print "Name: %s" % nodename