// Path: java/vulns-servlet/src/main/java/com/baidu/rasp/service/IHello.java
// public interface IHello extends java.rmi.Remote{
//     String sayHello(String name) throws RemoteException;
// }


import com.baidu.rasp.service.IHello;
import java.rmi.NotBoundException;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.util.concurrent.Callable;
package com.baidu.rasp.task;



public class JNDITask implements Callable {

    private String host;
    private int port;
    private String serviceName;

    public JNDITask(String host, int port, String serviceName) {
        this.host = host;
        this.port = port;
        this.serviceName = serviceName;
    }

    @Override
    public Object call() {
        return CallService(this.host, this.port, this.serviceName);
    }

    public static String CallService(String host, int port, String serviceName) {
        try {
            Registry registry = LocateRegistry.getRegistry(host, port);
// Path: java/vulns-servlet/src/main/java/com/baidu/rasp/service/IHello.java
// public interface IHello extends java.rmi.Remote{
//     String sayHello(String name) throws RemoteException;
// }


// Path: java/vulns-servlet/src/main/java/com/baidu/rasp/task/JNDITask.java
import com.baidu.rasp.service.IHello;
import java.rmi.NotBoundException;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.util.concurrent.Callable;

package com.baidu.rasp.task;



public class JNDITask implements Callable {

    private String host;
    private int port;
    private String serviceName;

    public JNDITask(String host, int port, String serviceName) {
        this.host = host;
        this.port = port;
        this.serviceName = serviceName;
    }

    @Override
    public Object call() {
        return CallService(this.host, this.port, this.serviceName);
    }

    public static String CallService(String host, int port, String serviceName) {
        try {
            Registry registry = LocateRegistry.getRegistry(host, port);
            IHello service = (IHello) registry.lookup(serviceName);