Coder Social home page Coder Social logo

androidsimfilereader's Introduction

Android SIM File Reader

This is an app to demonstrate reading SIM files in Android, with several methods. They are: using the SEEK API, injecting a new service implementation into the phone process, and AT/Hayes commands.

The app uses a factory method to transparently find a working interface to do SIM I/O. The code to locate and parse the SIM files is mostly lifted from CyanogenMod (though AOSP code should be pretty much the same), with my SIM I/O classes taking the place of the RIL class that these classes were written to use.

SEEK API

This refers to Secure Element Evaluation Kit for the Android platform. You may not need the patches from this project, because it seems to have been merged into several Android distributions. This app does not use or need the official SEEK service APK, it directly invokes the backend methods in the telephony service. This is necessary to circumvent permissions checking, and is also useful for CyanogenMod 11, which does not seem to have a working OpenMobile service, but does have the SEEK patches. Implemented here.

Injected service

The code in the com.android.phone process is hot-patched using ddi to allow new service calls for invoking the SIM I/O methods the RIL class has (which is how Android reads your phone number, voicemail number, etc. from the SIM.) Should be fairly compatible, but it uses so much undocumented/private behavior that it can't really be guaranteed. I recommend killing your com.android.phone process (it will restart), to flush out my code, when you're done using it. Client side here, remote (in phone process) Java part here, native glue here.

AT Commands

Compatibility is probably quite limited right now, but this works on my own Qualcomm device. AT commands are sent to the /dev/smd7 device, and responses are read and parsed. It is a bit fragile; sometimes the superuser'd processes that read/write to the device don't terminate correctly, meaning the next time the app runs it won't be able to connect to the device correctly, and may hang or crash. SIM I/O interface here, general AT command interface here.

Other unimplemented methods

TelephonyManager.iccExchangeSimIO()

Android 5.0 appears to have introduced a public [iccExchangeSimIO()](https://developer.android.com/reference/android/telephony/TelephonyManager.html#iccExchangeSimIO\(int, int, int, int, int, java.lang.String)) API. I haven't tried it, but it looks like it can do what we need. It requires privileges, but that shouldn't be a problem.

Privacy

There are several places where potentially sensitive information (your phone number, your TMSI, your LAI) is sent to logcat. Beware, other apps or users could view this log and learn these data about your phone/SIM card.

Building

Something is wrong with the build process. To reliably build the RilExtender (injected service), you have to build twice. The first build doesn't properly package the secondary dex file in to the app.

Logs

Example logcat command to filter to output from this app (also shown on the app's screen):

adb logcat -s SIMFileReader,RilExtender,RilExtenderCommandsInterface,AtCommandInterface,CommandsInterfaceFactory,TelephonySeekServiceCommandsInterface,SIMRecords,Parcel,librilinject,CMDProcessor,lib__hijack.bin__.so,System.err,su

androidsimfilereader's People

Contributors

scintill avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.