Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

question: how to use dexcalibur as library? #22

Closed
monperrus opened this issue Mar 24, 2020 · 7 comments
Closed

question: how to use dexcalibur as library? #22

monperrus opened this issue Mar 24, 2020 · 7 comments
Labels
question Further information is requested

Comments

@monperrus
Copy link
Contributor

Right now, I'm using Dexcalibur with a single command + browser.

To get access to more features, I need to use it as a library.

What's the equivalent of ./dexcalibur --app=com.myapp --pull in a library setting?

(I volunteer to port the answer in dexcalibu-doc afterwards)

@FrenchYeti
Copy link
Owner

FrenchYeti commented Mar 24, 2020

I started to develop Dexcalibur as NPM library. So, you can perform everything from a script or node terminal.

I assume you have already configured your config.jsfile, and it is located at <CONFIG_PATH>.
(Depending of application size, i recommand to increase nodejs heap size)

$ cd dexcalibur
$ node --max-old-space-size=4096
> const Dexcalibur = require('./src/Project');
> var Project = new Dexcalibur( 'com.myapp', <CONFIG_PATH>);
..
> Project.pull();
..
> Project.fullscan();
..

At this step, web server is not started. You can explore application and generate hook. (i will give you more information asap doc)

Search can be performed by invoking Project.find.*. For example, if you want hook a method from TelephonyManager class:

1/ First: to list all methods enclosed into a class where FQCN match the regexp .TelephonyManager.

> Project.find.method("enclosingClass.name:TelephonyManager").show()
Running deep search ...
+---------------------------------------------------------------------------------------------------------------------------+
| Index  |  Class                                  |  Modifiers                       |  Method                              |
+---------------------------------------------------------------------------------------------------------------------------+
| 0      | android.telephony.TelephonyManager      | [static,public,constructor]      | <clinit>                             | 
| 1      | android.telephony.TelephonyManager      | [public,constructor]             | <init>                               | 
| 2      | android.telephony.TelephonyManager      | [public]                         | getAllCellInfo                       | 
| 3      | android.telephony.TelephonyManager      | [public]                         | getCallState                         | 
| 4      | android.telephony.TelephonyManager      | [public]                         | getCellLocation                      | 
| 5      | android.telephony.TelephonyManager      | [public]                         | getDataActivity                      | 
| 6      | android.telephony.TelephonyManager      | [public]                         | getDataState                         | 
| 7      | android.telephony.TelephonyManager      | [public]                         | getDeviceId                          | 
| 8      | android.telephony.TelephonyManager      | [public]                         | getDeviceSoftwareVersion             | 
| 9      | android.telephony.TelephonyManager      | [public]                         | getGroupIdLevel1                     | 
| 10     | android.telephony.TelephonyManager      | [public]                         | getLine1Number                       | 
| 11     | android.telephony.TelephonyManager      | [public]                         | getMmsUAProfUrl                      | 
| 12     | android.telephony.TelephonyManager      | [public]                         | getMmsUserAgent                      | 
| 13     | android.telephony.TelephonyManager      | [public]                         | getNeighboringCellInfo               | 
| 14     | android.telephony.TelephonyManager      | [public]                         | getNetworkCountryIso                 | 
| 15     | android.telephony.TelephonyManager      | [public]                         | getNetworkOperator                   | 
| 16     | android.telephony.TelephonyManager      | [public]                         | getNetworkOperatorName               | 
| 17     | android.telephony.TelephonyManager      | [public]                         | getNetworkType                       | 
| 18     | android.telephony.TelephonyManager      | [public]                         | getPhoneType                         | 
| 19     | android.telephony.TelephonyManager      | [public]                         | getSimCountryIso                     | 
| 20     | android.telephony.TelephonyManager      | [public]                         | getSimOperator                       | 
| 21     | android.telephony.TelephonyManager      | [public]                         | getSimOperatorName                   | 
| 22     | android.telephony.TelephonyManager      | [public]                         | getSimSerialNumber                   | 
| 23     | android.telephony.TelephonyManager      | [public]                         | getSimState                          | 
| 24     | android.telephony.TelephonyManager      | [public]                         | getSubscriberId                      | 
| 25     | android.telephony.TelephonyManager      | [public]                         | getVoiceMailAlphaTag                 | 
| 26     | android.telephony.TelephonyManager      | [public]                         | getVoiceMailNumber                   | 
| 27     | android.telephony.TelephonyManager      | [public]                         | hasCarrierPrivileges                 | 
| 28     | android.telephony.TelephonyManager      | [public]                         | hasIccCard                           | 
| 29     | android.telephony.TelephonyManager      | [public]                         | iccCloseLogicalChannel               | 
| 30     | android.telephony.TelephonyManager      | [public]                         | iccExchangeSimIO                     | 
| 31     | android.telephony.TelephonyManager      | [public]                         | iccOpenLogicalChannel                | 
| 32     | android.telephony.TelephonyManager      | [public]                         | iccTransmitApduBasicChannel          | 
| 33     | android.telephony.TelephonyManager      | [public]                         | iccTransmitApduLogicalChannel        | 
| 34     | android.telephony.TelephonyManager      | [public]                         | isNetworkRoaming                     | 
| 35     | android.telephony.TelephonyManager      | [public]                         | isSmsCapable                         | 
| 36     | android.telephony.TelephonyManager      | [public]                         | isVoiceCapable                       | 
| 37     | android.telephony.TelephonyManager      | [public]                         | listen                               | 
| 38     | android.telephony.TelephonyManager      | [public]                         | sendEnvelopeWithStatus               | 
| 39     | android.telephony.TelephonyManager      | [public]                         | setLine1NumberForDisplay             | 
| 40     | android.telephony.TelephonyManager      | [public]                         | setOperatorBrandOverride             | 
| 41     | android.telephony.TelephonyManager      | [public]                         | setPreferredNetworkTypeToGlobal      | 
| 42     | android.telephony.TelephonyManager      | [public]                         | setVoiceMailNumber                   | 
+---------------------------------------------------------------------------------------------------------------------------+

Next you can select an entry by its ID (1st column from left side), and generate a hook. If you would like hook getDeviceID (entry 7), then you can execute:

> var  meth = Project.find.method("enclosingClass.name:TelephonyManager").get(7)
> var  hook = Project.hook.probe(meth);

At this point a new hook has been created. Now you can spawn/attach to appp and start "hooking".

> Project.hook.startBySpawn( null, "com.myapp")

@FrenchYeti
Copy link
Owner

Actually, the better solution is perhaps to create your own Inspector if you want give the control on what happens into Dexcalibur when a hook message is receipt by the HookManager

@FrenchYeti FrenchYeti added the question Further information is requested label Mar 24, 2020
@monperrus
Copy link
Contributor Author

monperrus commented Mar 25, 2020 via email

@monperrus
Copy link
Contributor Author

Thanks a lot for the information. Thanks to this, I confirm I can:

  1. use Dexcalibur as a library, with a Node shell
  2. Find methods
  3. Create hooks.

FYI I ported this info into https://github.com/FrenchYeti/dexcalibur-doc/blob/master/CLI-User-guide.md#dexcalibur-as-a-library

@monperrus
Copy link
Contributor Author

Hi @FrenchYeti

var Dexcalibur = require("./src/project.js") does not work anymore. What's the new command to use dexcalibur as a library? Thanks!

@FrenchYeti
Copy link
Owner

Hey @monperrus ,

sorry for this late reply.

Please accept my apologies: latest refactoring (>=0.7) breaks this feature.

However, I fully rewrote Dexcalibur engine and UI and plan to release it this winter. So, Dexcalibur API will be available again, and documented.

@monperrus
Copy link
Contributor Author

monperrus commented Oct 7, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants