def main():
    global PARAM_FILE_NAME
    global USER_NAME
    global PASSWORD
    global Tel
    try:
        if len(sys.argv) < 2:
            usage()
            sys.exit()
        opts, args = getopt.getopt(sys.argv[2:], "hO:f:",
                                   ["help", "password", "file"])
        IP = sys.argv[1]
        for o, a in opts:
            if o in ("-h", "--help"):
                usage()
                sys.exit()
            if o in ("-O", "--password"):
                USER_NAME = a.split(":")[0]
                PASSWORD = a.split(":")[1]
                print "USER NAME:", USER_NAME
                print "PASSWORD:"******"-f", "--filename"):
                print PARAM_FILE_NAME
                PARAM_FILE_NAME = a
        if os.path.exists("Trans_" + PARAM_FILE_NAME) == False:
            TranslateTheIndex(PARAM_FILE_NAME)
        Read_param_list = read_param_file("Trans_" + PARAM_FILE_NAME)
        print Read_param_list
        try:
            Tel = Telnet(USER_NAME, PASSWORD, IP, "23", "$",
                         "Wireless AP login:"******"Password:"******"Set Command:", line
                Tel.write_command(line.replace("\n", ""))
            sleep(5)
            check_param(Tel)
            Tel.close()
        except Exception as e:
            print IP, '\t\ttelnet not OK,May is not a ap', e
    except getopt.GetoptError, err:
        # print help information and exit:
        sys.stderr.write(str(err))
        usage()
        sys.exit()
 def __del__(self):
     Telnet.__del__()
 def __init__(self, host, port=23):
     Telnet.__init__(self, host, port)
     self.conf_cmd = []
     print "Sup6T_od_snake init ok"