Beispiel #1
0
def main():
    args = get_argparser().parse_args()

    remote = Client(args.server, args.port, None)

    targets, description = remote.get_rpc_id()

    if args.action != "list-targets":
        # If no target specified and remote has only one, then use this one.
        # Exit otherwise.
        if len(targets) > 1 and args.target is None:
            print("Remote server has several targets, please supply one with "
                  "-t")
            sys.exit(1)
        elif args.target is None:
            args.target = targets[0]
        remote.select_rpc_target(args.target)

    if args.action == "list-targets":
        list_targets(targets, description)
    elif args.action == "list-methods":
        list_methods(remote)
    elif args.action == "call":
        call_method(remote, args.method, args.args)
    else:
        print("Unrecognized action: {}".format(args.action))
Beispiel #2
0
def main():
    args = get_argparser().parse_args()

    remote = Client(args.server, args.port, None)

    targets, description = remote.get_rpc_id()

    if args.action != "list-targets":
        # If no target specified and remote has only one, then use this one.
        # Exit otherwise.
        if len(targets) > 1 and args.target is None:
            print("Remote server has several targets, please supply one with "
                  "-t")
            sys.exit(1)
        elif args.target is None:
            args.target = targets[0]
        remote.select_rpc_target(args.target)

    if args.action == "list-targets":
        list_targets(targets, description)
    elif args.action == "list-methods":
        list_methods(remote)
    elif args.action == "call":
        call_method(remote, args.method, args.args)
    else:
        print("Unrecognized action: {}".format(args.action))
Beispiel #3
0
def main():
    args = get_argparser().parse_args()
    remote = Client(args.server, args.port, None)
    try:
        target_names, id_parameters = remote.get_rpc_id()
    finally:
        remote.close_rpc()
    print("Target(s):   " + ", ".join(target_names))
    if id_parameters is not None:
        print("Parameters:  " + id_parameters)
Beispiel #4
0
def main():
    args = get_argparser().parse_args()

    remote = Client(args.server, args.port, None)
    targets, description = remote.get_rpc_id()
    if args.action != "list-targets":
        remote.select_rpc_target(AutoTarget)

    if args.action == "list-targets":
        list_targets(targets, description)
    elif args.action == "list-methods":
        list_methods(remote)
    elif args.action == "call":
        call_method(remote, args.method, args.args)
    else:
        print("Unrecognized action: {}".format(args.action))
Beispiel #5
0
def main():
    args = get_argparser().parse_args()

    remote = Client(args.server, args.port, None)
    targets, description = remote.get_rpc_id()
    if args.action != "list-targets":
        remote.select_rpc_target(AutoTarget)

    if args.action == "list-targets":
        list_targets(targets, description)
    elif args.action == "list-methods":
        list_methods(remote)
    elif args.action == "call":
        call_method(remote, args.method, args.args)
    else:
        print("Unrecognized action: {}".format(args.action))