Search in sources :

Example 1 with SendCmdsToAgentAndRunResponse

use of comm_with_client.response.SendCmdsToAgentAndRunResponse in project MSEC by Tencent.

the class SendCmdsToAgentAndRun method exec.

public SendCmdsToAgentAndRunResponse exec(SendCmdsToAgentAndRunRequest request) {
    Logger logger = Logger.getLogger("remote_shell");
    logger.setLevel(Level.ALL);
    logger.info(String.format("I will send cmd to agent, [%s][%s]", request.getLocalFileFullName(), request.getRemoteServerIP()));
    StringBuffer sb = new StringBuffer();
    String result = doSendCmdsToAgentAndRun(request, sb);
    if (result.equals("success")) {
        logger.info(String.format("output file name: %s", sb.toString()));
        SendCmdsToAgentAndRunResponse response = new SendCmdsToAgentAndRunResponse();
        response.setMessage("success");
        response.setOutputFileName(sb.toString());
        response.setStatus(0);
        return response;
    } else {
        SendCmdsToAgentAndRunResponse response = new SendCmdsToAgentAndRunResponse();
        response.setMessage(result);
        response.setStatus(100);
        return response;
    }
}
Also used : SendCmdsToAgentAndRunResponse(comm_with_client.response.SendCmdsToAgentAndRunResponse) Logger(java.util.logging.Logger)

Aggregations

SendCmdsToAgentAndRunResponse (comm_with_client.response.SendCmdsToAgentAndRunResponse)1 Logger (java.util.logging.Logger)1