Skip to content

Commit

Permalink
fix the api of getting localhost for jboss6 (#49)
Browse files Browse the repository at this point in the history
* modify security policy log format

* add support for macos
add ognl.expression.minlength config to filter ognl expression

* update ognl test-case

* fix the api of getting localhost for jboss6
  • Loading branch information
tangyouyi1513 authored Oct 25, 2017
1 parent 4052a81 commit 114234f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 16 deletions.
5 changes: 1 addition & 4 deletions agent/java/src/main/java/com/fuxi/javaagent/HookHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,7 @@
import com.fuxi.javaagent.request.AbstractRequest;
import com.fuxi.javaagent.request.HttpServletRequest;
import com.fuxi.javaagent.response.HttpServletResponse;
import com.fuxi.javaagent.tool.FileUtil;
import com.fuxi.javaagent.tool.Reflection;
import com.fuxi.javaagent.tool.StackTrace;
import com.fuxi.javaagent.tool.TimeUtils;
import com.fuxi.javaagent.tool.*;
import com.fuxi.javaagent.tool.hook.CustomLockObject;
import com.fuxi.javaagent.tool.security.SqlConnectionChecker;
import com.fuxi.javaagent.tool.security.TomcatSecurityChecker;
Expand Down
20 changes: 8 additions & 12 deletions agent/java/src/main/java/com/fuxi/javaagent/tool/OSUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,31 +32,27 @@

import com.fuxi.javaagent.tool.model.NicModel;

import java.net.*;
import java.net.Inet4Address;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.LinkedList;

public class OSUtil {

private static InetAddress inetAddress;

static {
try {
inetAddress = InetAddress.getLocalHost();
} catch (UnknownHostException e) {
e.printStackTrace();
}
}

public static String getHostName() {
return inetAddress == null ? null : inetAddress.getHostName();
}

public static LinkedList<NicModel> getIpAddress() {
LinkedList<NicModel> ipList = new LinkedList<NicModel>();
Enumeration allNetInterfaces = null;
try {
if (inetAddress == null) {
inetAddress = InetAddress.getLocalHost();
}
Enumeration allNetInterfaces = null;
allNetInterfaces = NetworkInterface.getNetworkInterfaces();

if (allNetInterfaces != null) {
Expand All @@ -75,7 +71,7 @@ public static LinkedList<NicModel> getIpAddress() {
}
}
}
} catch (SocketException e) {
} catch (Exception e) {
e.printStackTrace();
}
return ipList;
Expand Down

0 comments on commit 114234f

Please sign in to comment.