// Path: java/vulns-servlet/src/main/java/com/baidu/rasp/task/DNSTask.java
// public class DNSTask implements Callable {
// 
//     public String host;
// 
//     public DNSTask(String host) {
//         this.host = host;
//     }
// 
//     @Override
//     public Object call() {
//         return getHostNames(host);
//     }
// 
//     public static String getHostNames(String host) {
//         InetAddress[] addresses = new InetAddress[0];
//         try {
//             addresses = InetAddress.getAllByName(host);
//         } catch (UnknownHostException e) {
//             e.printStackTrace();
//             return "UnknownHost";
//         }
//         List<String> list = new ArrayList<String>();
//         for (int i = 0; i < addresses.length; i++) {
//             String hostname = addresses[i].getHostName();
//             list.add(hostname);
//         }
//         return list.toString();
//     }
// }


import com.baidu.rasp.task.DNSTask;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
package com.baidu.rasp;




public class DNS extends HttpServlet {

    public ExecutorService executor = Executors.newFixedThreadPool(5);

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doPost(req, resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        resp.setHeader("Content-type", "text/html;charset=UTF-8");//告知浏览器编码方式;
        resp.setCharacterEncoding("UTF-8");
        String option = req.getParameter("option");
        String host = req.getParameter("host");
        if ("DNS".equals(option)){
// Path: java/vulns-servlet/src/main/java/com/baidu/rasp/task/DNSTask.java
// public class DNSTask implements Callable {
// 
//     public String host;
// 
//     public DNSTask(String host) {
//         this.host = host;
//     }
// 
//     @Override
//     public Object call() {
//         return getHostNames(host);
//     }
// 
//     public static String getHostNames(String host) {
//         InetAddress[] addresses = new InetAddress[0];
//         try {
//             addresses = InetAddress.getAllByName(host);
//         } catch (UnknownHostException e) {
//             e.printStackTrace();
//             return "UnknownHost";
//         }
//         List<String> list = new ArrayList<String>();
//         for (int i = 0; i < addresses.length; i++) {
//             String hostname = addresses[i].getHostName();
//             list.add(hostname);
//         }
//         return list.toString();
//     }
// }


// Path: java/vulns-servlet/src/main/java/com/baidu/rasp/DNS.java
import com.baidu.rasp.task.DNSTask;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;

package com.baidu.rasp;




public class DNS extends HttpServlet {

    public ExecutorService executor = Executors.newFixedThreadPool(5);

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doPost(req, resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        resp.setHeader("Content-type", "text/html;charset=UTF-8");//告知浏览器编码方式;
        resp.setCharacterEncoding("UTF-8");
        String option = req.getParameter("option");
        String host = req.getParameter("host");
        if ("DNS".equals(option)){
            String result = DNSTask.getHostNames(host);