我在使用Soot检测Android应用时遇到了一些问题。具体来说,我无法加载android.util.Log类。我怀疑android jar文件没有正确加载。
我有最新的每晚构建版本的Soot并使用Java 1.7。我已经下载了所有的android.jar文件。
以下是我运行的命令:
javac -cp $sootDir/soot-trunk.jar AndroidInstrument.java
java -cp $sootDir/soot-trunk.jar:. AndroidInstrument -android-jars $sootDir/android-platforms-master -allow-phantom-refs -process-dir $sootDir/$apkFile -soot-classpath /usr/lib/jvm/java-1.7.0-openjdk-amd64/jre/lib/rt.jar:.
在AndroidInstrument.java中,我有这一行:
Scene.v().addBasicClass("android.util.Log",SootClass.SIGNATURES);
该程序运行没有错误,但给了我很多警告。这是整个输出。
Soot started on Wed Jan 27 22:40:04 EST 2016
Warning: android.util.Log is a phantom class!
Warning: java.lang.invoke.LambdaMetafactory is a phantom class!
Warning: android.animation.ValueAnimator is a phantom class!
Warning: android.annotation.SuppressLint is a phantom class!
Warning: android.app.Activity is a phantom class!
Warning: android.app.Notification is a phantom class!
Warning: android.app.NotificationManager is a phantom class!
Warning: android.app.PendingIntent is a phantom class!
Warning: android.app.Service is a phantom class!
Warning: android.content.BroadcastReceiver is a phantom class!
Warning: android.content.ComponentCallbacks is a phantom class!
Warning: android.content.ComponentName is a phantom class!
Warning: android.content.Context is a phantom class!
Warning: android.content.Intent is a phantom class!
Warning: android.content.IntentFilter is a phantom class!
Warning: android.content.SharedPreferences$Editor is a phantom class!
Warning: android.content.SharedPreferences is a phantom class!
Warning: android.content.pm.PackageInfo is a phantom class!
Warning: android.content.pm.PackageManager$NameNotFoundException is a phantom class!
Warning: android.content.pm.PackageManager is a phantom class!
Warning: android.content.res.Configuration is a phantom class!
Warning: android.content.res.Resources$NotFoundException is a phantom class!
Warning: android.content.res.Resources is a phantom class!
Warning: android.content.res.TypedArray is a phantom class!
Warning: android.database.DataSetObservable is a phantom class!
Warning: android.database.DataSetObserver is a phantom class!
Warning: android.graphics.Bitmap is a phantom class!
Warning: android.graphics.Canvas is a phantom class!
Warning: android.graphics.ColorFilter is a phantom class!
Warning: android.graphics.Paint is a phantom class!
Warning: android.graphics.PorterDuff$Mode is a phantom class!
Warning: android.graphics.PorterDuffColorFilter is a phantom class!
Warning: android.graphics.Rect is a phantom class!
Warning: android.graphics.drawable.Drawable is a phantom class!
Warning: android.net.ConnectivityManager is a phantom class!
Warning: android.net.NetworkInfo is a phantom class!
Warning: android.net.Uri is a phantom class!
Warning: android.net.wifi.WifiManager is a phantom class!
Warning: android.os.Build$VERSION is a phantom class!
Warning: android.os.Build is a phantom class!
Warning: android.os.Bundle is a phantom class!
Warning: android.os.Environment is a phantom class!
Warning: android.os.Handler is a phantom class!
Warning: android.os.IBinder is a phantom class!
Warning: android.os.Looper is a phantom class!
Warning: android.os.Message is a phantom class!
Warning: android.os.Parcel is a phantom class!
Warning: android.os.Parcelable$ClassLoaderCreator is a phantom class!
Warning: android.os.Parcelable$Creator is a phantom class!
Warning: android.os.Parcelable is a phantom class!
Warning: android.os.SystemClock is a phantom class!
Warning: android.view.View$OnCreateContextMenuListener is a phantom class!
Warning: android.view.ViewGroup is a phantom class!
Warning: android.view.View is a phantom class!
Warning: android.util.SparseArray is a phantom class!
Warning: android.view.LayoutInflater is a phantom class!
Warning: android.view.animation.Animation is a phantom class!
Warning: android.util.AttributeSet is a phantom class!
Warning: android.view.Menu is a phantom class!
Warning: android.view.MenuInflater is a phantom class!
Warning: android.view.MenuItem is a phantom class!
Warning: android.view.ContextMenu is a phantom class!
Warning: android.view.ContextMenu$ContextMenuInfo is a phantom class!
Warning: android.view.View$BaseSavedState is a phantom class!
Warning: android.widget.TabHost is a phantom class!
Warning: android.widget.TabHost$OnTabChangeListener is a phantom class!
Warning: android.widget.FrameLayout is a phantom class!
Warning: android.util.AndroidRuntimeException is a phantom class!
Warning: android.view.KeyEvent is a phantom class!
Warning: android.view.animation.Interpolator is a phantom class!
Warning: android.view.animation.Animation$AnimationListener is a phantom class!
Warning: android.view.VelocityTracker is a phantom class!
Warning: android.widget.Scroller is a phantom class!
Warning: android.view.MotionEvent is a phantom class!
Warning: android.view.ViewGroup$LayoutParams is a phantom class!
Warning: android.view.accessibility.AccessibilityEvent is a phantom class!
Warning: android.view.ViewGroup$MarginLayoutParams is a phantom class!
Warning: android.telephony.PhoneStateListener is a phantom class!
Warning: android.telephony.SmsMessage is a phantom class!
Warning: android.telephony.TelephonyManager is a phantom class!
Warning: android.text.TextUtils is a phantom class!
Warning: android.view.FocusFinder is a phantom class!
Warning: android.view.Gravity is a phantom class!
Warning: android.view.LayoutInflater$Factory is a phantom class!
Warning: android.view.SoundEffectConstants is a phantom class!
Warning: android.view.View$MeasureSpec is a phantom class!
Warning: android.view.ViewParent is a phantom class!
Warning: android.view.Window is a phantom class!
Warning: android.view.WindowManager$LayoutParams is a phantom class!
Warning: android.view.animation.AccelerateInterpolator is a phantom class!
Warning: android.view.animation.AlphaAnimation is a phantom class!
Warning: android.view.animation.AnimationSet is a phantom class!
Warning: android.view.animation.AnimationUtils is a phantom class!
Warning: android.view.animation.DecelerateInterpolator is a phantom class!
Warning: android.view.animation.ScaleAnimation is a phantom class!
Warning: android.widget.EdgeEffect is a phantom class!
Warning: android.widget.FrameLayout$LayoutParams is a phantom class!
Warning: android.widget.OverScroller is a phantom class!
Warning: android.widget.Toast is a phantom class!
Warning: org.apache.http.impl.client.DefaultHttpClient is a phantom class!
Warning: org.apache.http.protocol.HttpContext is a phantom class!
Warning: org.apache.http.conn.scheme.SchemeRegistry is a phantom class!
Warning: org.apache.http.HttpEntity is a phantom class!
Warning: org.apache.http.client.methods.HttpEntityEnclosingRequestBase is a phantom class!
Warning: org.apache.http.client.methods.HttpUriRequest is a phantom class!
Warning: org.apache.http.client.CookieStore is a phantom class!
Warning: org.apache.http.HttpRequestInterceptor is a phantom class!
Warning: org.apache.http.HttpRequest is a phantom class!
Warning: org.apache.http.HttpResponseInterceptor is a phantom class!
Warning: org.apache.http.HttpResponse is a phantom class!
Warning: org.apache.http.entity.HttpEntityWrapper is a phantom class!
Warning: org.apache.http.impl.client.AbstractHttpClient is a phantom class!
Warning: org.apache.http.Header is a phantom class!
Warning: org.apache.http.conn.ssl.SSLSocketFactory is a phantom class!
Warning: org.apache.http.cookie.Cookie is a phantom class!
Warning: org.apache.http.client.HttpRequestRetryHandler is a phantom class!
Warning: org.apache.http.impl.cookie.BasicClientCookie is a phantom class!
Warning: org.json.JSONArray is a phantom class!
Warning: org.apache.http.HeaderElement is a phantom class!
Warning: org.apache.http.HttpVersion is a phantom class!
Warning: org.apache.http.NoHttpResponseException is a phantom class!
Warning: org.apache.http.ProtocolVersion is a phantom class!
Warning: org.apache.http.StatusLine is a phantom class!
Warning: org.apache.http.client.HttpClient is a phantom class!
Warning: org.apache.http.client.HttpResponseException is a phantom class!
Warning: org.apache.http.client.entity.UrlEncodedFormEntity is a phantom class!
Warning: org.apache.http.client.methods.HttpGet is a phantom class!
Warning: org.apache.http.client.methods.HttpPost is a phantom class!
Warning: org.apache.http.client.utils.URLEncodedUtils is a phantom class!
Warning: org.apache.http.conn.ClientConnectionManager is a phantom class!
Warning: org.apache.http.conn.params.ConnManagerParams is a phantom class!
Warning: org.apache.http.conn.params.ConnPerRoute is a phantom class!
Warning: org.apache.http.conn.params.ConnPerRouteBean is a phantom class!
Warning: org.apache.http.conn.scheme.PlainSocketFactory is a phantom class!
Warning: org.apache.http.conn.scheme.Scheme is a phantom class!
Warning: org.apache.http.conn.scheme.SocketFactory is a phantom class!
Warning: org.apache.http.conn.ssl.X509HostnameVerifier is a phantom class!
Warning: org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager is a phantom class!
Warning: org.apache.http.message.BasicHeader is a phantom class!
Warning: org.apache.http.message.BasicNameValuePair is a phantom class!
Warning: org.apache.http.params.BasicHttpParams is a phantom class!
Warning: org.apache.http.params.HttpConnectionParams is a phantom class!
Warning: org.apache.http.params.HttpParams is a phantom class!
Warning: org.apache.http.params.HttpProtocolParams is a phantom class!
Warning: org.apache.http.protocol.BasicHttpContext is a phantom class!
Warning: org.apache.http.protocol.SyncBasicHttpContext is a phantom class!
Warning: org.apache.http.util.ByteArrayBuffer is a phantom class!
Warning: org.json.JSONException is a phantom class!
Warning: org.json.JSONObject is a phantom class!
Transforming android.support.v4.widget.r...
Transforming android.support.v4.widget.p...
Transforming android.support.v4.widget.s...
Transforming android.support.v4.widget.q...
Transforming android.support.v4.widget.v...
Transforming android.support.v4.widget.w...
Transforming android.support.v4.widget.t...
Transforming android.support.v4.widget.u...
Transforming android.support.v4.widget.j...
Transforming android.support.v4.widget.SlidingPaneLayout...
Transforming android.support.v4.app.FragmentManagerState...
非常感谢任何帮助!
答案 0 :(得分:0)
我想通过查看源代码我想出来了。发生的事情是,只要设置了“-soot-classpath”选项,就会忽略“-android-jars”选项。因此,只需删除“-soot-classpath”选项即可解决问题。
更新:
实际上,没有必要删除“-soot-classpath”。只需添加“-pp”或“-prepend-classpath”标志即可使用“-android-jars”路径和“-soot-classpath”路径。