我们可以使用owasp-ESAPI来记录android应用程序,因为我试图在google上搜索然后根据我的理解我发现OWASP-ESAPI可以用于JAVA-EE。 有人可以帮我在Android应用程序上将安全记录器与OWASP-ESAPI集成吗?
为了更好地理解我的问题,请访问:
“ esapi-2.1.0.jar ”允许我们写信 以下是我正在尝试的代码:
private final Logger logger = ESAPI.getLogger(MyActivity.class.getName());
logger.error(Logger.SECURITY_FAILURE, "session has expired, log out user");
当我运行我的项目时,会在logcat上给出以下内容:
05-01 13:02:52.455: D/ResourcesManager(9936): creating new AssetManager and set to /data/app/com.example.loggerlatestjar-1/base.apk
05-01 13:02:52.555: I/System.out(9936): Attempting to load ESAPI.properties via file I/O.
05-01 13:02:52.555: I/System.out(9936): Attempting to load ESAPI.properties as resource file via file I/O.
05-01 13:02:52.555: I/System.out(9936): Not found in 'org.owasp.esapi.resources' directory or file not readable: /ESAPI.properties
05-01 13:02:52.565: I/System.out(9936): Not found in SystemResource Directory/resourceDirectory: .esapi/ESAPI.properties
05-01 13:02:52.565: I/System.out(9936): Not found in 'user.home' () directory: /esapi/ESAPI.properties
05-01 13:02:52.565: I/System.out(9936): Loading ESAPI.properties via file I/O failed. Exception was: java.io.FileNotFoundException
05-01 13:02:52.565: I/System.out(9936): Attempting to load ESAPI.properties via the classpath.
05-01 13:02:52.615: I/System.out(9936): ESAPI.properties could not be loaded by any means. Fail. Exception was: java.lang.IllegalArgumentException: Failed to load ESAPI.properties as a classloader resource.
05-01 13:02:52.615: D/AndroidRuntime(9936): Shutting down VM
05-01 13:02:52.620: E/AndroidRuntime(9936): FATAL EXCEPTION: main
05-01 13:02:52.620: E/AndroidRuntime(9936): Process: com.example.loggerlatestjar, PID: 9936
05-01 13:02:52.620: E/AndroidRuntime(9936): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.loggerlatestjar/com.example.loggerlatestjar.MainActivity}: org.owasp.esapi.errors.ConfigurationException: java.lang.reflect.InvocationTargetException SecurityConfiguration class (org.owasp.esapi.reference.DefaultSecurityConfiguration) CTOR threw exception.
05-01 13:02:52.620: E/AndroidRuntime(9936): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2702)
05-01 13:02:52.620: E/AndroidRuntime(9936): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2767)
05-01 13:02:52.620: E/AndroidRuntime(9936): at android.app.ActivityThread.access$900(ActivityThread.java:177)
05-01 13:02:52.620: E/AndroidRuntime(9936): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1449)
05-01 13:02:52.620: E/AndroidRuntime(9936): at android.os.Handler.dispatchMessage(Handler.java:102)
05-01 13:02:52.620: E/AndroidRuntime(9936): at android.os.Looper.loop(Looper.java:145)
05-01 13:02:52.620: E/AndroidRuntime(9936): at android.app.ActivityThread.main(ActivityThread.java:5951)
05-01 13:02:52.620: E/AndroidRuntime(9936): at java.lang.reflect.Method.invoke(Native Method)
05-01 13:02:52.620: E/AndroidRuntime(9936): at java.lang.reflect.Method.invoke(Method.java:372)
05-01 13:02:52.620: E/AndroidRuntime(9936): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1388)
05-01 13:02:52.620: E/AndroidRuntime(9936): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1183)
05-01 13:02:52.620: E/AndroidRuntime(9936): Caused by: org.owasp.esapi.errors.ConfigurationException: java.lang.reflect.InvocationTargetException SecurityConfiguration class (org.owasp.esapi.reference.DefaultSecurityConfiguration) CTOR threw exception.
05-01 13:02:52.620: E/AndroidRuntime(9936): at org.owasp.esapi.util.ObjFactory.make(ObjFactory.java:129)
05-01 13:02:52.620: E/AndroidRuntime(9936): at org.owasp.esapi.ESAPI.securityConfiguration(ESAPI.java:184)
05-01 13:02:52.620: E/AndroidRuntime(9936): at org.owasp.esapi.ESAPI.logFactory(ESAPI.java:137)
05-01 13:02:52.620: E/AndroidRuntime(9936): at org.owasp.esapi.ESAPI.getLogger(ESAPI.java:154)
05-01 13:02:52.620: E/AndroidRuntime(9936): at com.example.loggerlatestjar.MainActivity.onCreate(MainActivity.java:23)
05-01 13:02:52.620: E/AndroidRuntime(9936): at android.app.Activity.performCreate(Activity.java:6289)
05-01 13:02:52.620: E/AndroidRuntime(9936): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
05-01 13:02:52.620: E/AndroidRuntime(9936): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2655)
05-01 13:02:52.620: E/AndroidRuntime(9936): ... 10 more
05-01 13:02:52.620: E/AndroidRuntime(9936): Caused by: java.lang.reflect.InvocationTargetException
05-01 13:02:52.620: E/AndroidRuntime(9936): at java.lang.reflect.Method.invoke(Native Method)
05-01 13:02:52.620: E/AndroidRuntime(9936): at java.lang.reflect.Method.invoke(Method.java:372)
05-01 13:02:52.620: E/AndroidRuntime(9936): at org.owasp.esapi.util.ObjFactory.make(ObjFactory.java:86)
05-01 13:02:52.620: E/AndroidRuntime(9936): ... 17 more
05-01 13:02:52.620: E/AndroidRuntime(9936): Caused by: org.owasp.esapi.errors.ConfigurationException: ESAPI.properties could not be loaded by any means. Fail.
05-01 13:02:52.620: E/AndroidRuntime(9936): at org.owasp.esapi.reference.DefaultSecurityConfiguration.loadConfiguration(DefaultSecurityConfiguration.java:439)
05-01 13:02:52.620: E/AndroidRuntime(9936): at org.owasp.esapi.reference.DefaultSecurityConfiguration.<init>(DefaultSecurityConfiguration.java:227)
05-01 13:02:52.620: E/AndroidRuntime(9936): at org.owasp.esapi.reference.DefaultSecurityConfiguration.getInstance(DefaultSecurityConfiguration.java:75)
05-01 13:02:52.620: E/AndroidRuntime(9936): ... 20 more
05-01 13:02:52.620: E/AndroidRuntime(9936): Caused by: java.lang.IllegalArgumentException: Failed to load ESAPI.properties as a classloader resource.
05-01 13:02:52.620: E/AndroidRuntime(9936): at org.owasp.esapi.reference.DefaultSecurityConfiguration.loadConfigurationFromClasspath(DefaultSecurityConfiguration.java:667)
05-01 13:02:52.620: E/AndroidRuntime(9936): at org.owasp.esapi.reference.DefaultSecurityConfiguration.loadConfiguration(DefaultSecurityConfiguration.java:436)
05-01 13:02:52.620: E/AndroidRuntime(9936): ... 22 more
注意:我没有使用ESAPI.property文件。因为我不知道如何在Android应用程序中使用它。