how to load .jar dynamically to apk using frida - dynamic

I'm going to load .jar dynamically to apk and call a certain method of a class in that jar. Using frida, I've tried to load jar file but failed.
Java.perform(function(){
var pathclassloader= Java.use('dalvik.system.PathClassLoader');
var myClassLoader = pathclassloader.$new("/Sdcard/testjar.jar", classloader.getSystemClassLoader());
const Class=Java.use('java.lang.Class');
var forName = Class.forName.overload('java.lang.String', 'boolean', 'java.lang.ClassLoader');
forName.call('client', true, myClassLoader);
})
it failed with error :
{'type': 'error', 'description': "ReferenceError: identifier 'classloader' undefined", 'stack': "ReferenceError: identifier 'classloader' undefined\n at [anon] (../../../frida-gum/bindings/gumjs/duktape.c:81019)\n at /script1.js:6\n at frida/node_modules/frida-java-bridge/lib/vm.js:11\n at E (frida/node_modules/frida-java-bridge/index.js:346)\n at frida/node_modules/frida-java-bridge/index.js:298\n at frida/node_modules/frida-java-bridge/lib/vm.js:11\n at frida/node_modules/frida-java-bridge/index.js:278\n at /script1.js:15", 'fileName': '/script1.js', 'lineNumber': 6, 'columnNumber': 1}
Any help for me. Thanks.

Related

Mapbox - Failed to resolve tileset descriptors: Loading request canceled

I have the following code for download map regions. This function is called on multiple regions asynchronously. In debug/development mode I rarely get this error. But in production release app I get this issue sometimes and the whole offline user experience is ruined. Notice that for users and fields same function is being used to download regions but it fails mostly for fields and not for users.
const downloadPack = async (packName, bounds) => {
console.log("bounds", packName, bounds);
// Delete old pack
await MapboxGL.offlineManager.deletePack(packName);
const progressListener = (offlineRegion, status) => {
if (status.state === "complete") {
console.log(
`Pack: ${packName}`,
formatBytes(status.completedResourceSize),
status.percentage,
status.state,
);
}
};
const errorListener = (offlineRegion, err) => {
console.log("pack error", offlineRegion, err);
};
const packConfig = {
name: packName,
styleURL: styleURL,
minZoom: MAP_CONFIG.MIN_ZOOM_ALLOWED,
maxZoom: MAP_CONFIG.MAX_ZOOM_ALLOWED,
bounds,
};
await MapboxGL.offlineManager.createPack(
packConfig,
progressListener,
errorListener,
);
// console.log("packConfig", packConfig);
};
I am getting the following errors for following regions:
Regions:
LOG bounds field-region-74 [[67.05473691050432, 24.859774187835313], [67.05879400202377, 24.864996599470516]]
LOG bounds field-region-73 [[67.05603555964123, 24.863974062407152], [67.06011966003771, 24.86902696726922]]
LOG bounds field-region-72 [[67.05860259878298, 24.868365914318616], [67.06177770104551, 24.871585472853567]]
LOG bounds field-region-71 [[67.0527601437771, 24.865385527088804], [67.06248793623786, 24.878936670953124]]
LOG bounds field-region-70 [[67.0575708775574, 24.859917106865936], [67.06827409941002, 24.868984873055723]]
Errors:
LOG pack error {"pack":{"metadata":"{\n \"name\" : \"field-region-74\"\n}","bounds":"{\"type\":\"FeatureCollection\",\"features\":[{\"type\":\"Feature\",\"properties\":{},\"geometry\":{\"type\":\"Point\",\"coordinates\":[67.05473691050432,24.859774187835313]}},{\"type\":\"Feature\",\"properties\":{},\"geometry\":{\"type\":\"Point\",\"coordinates\":[67.05879400202377,24.864996599470516]}}]}"},"_metadata":null} {"message":"Failed to resolve tileset descriptors: Loading request canceled","name":"field-region-74"}
LOG pack error {"pack":{"metadata":"{\n \"name\" : \"field-region-73\"\n}","bounds":"{\"type\":\"FeatureCollection\",\"features\":[{\"type\":\"Feature\",\"properties\":{},\"geometry\":{\"type\":\"Point\",\"coordinates\":[67.05603555964123,24.863974062407152]}},{\"type\":\"Feature\",\"properties\":{},\"geometry\":{\"type\":\"Point\",\"coordinates\":[67.06011966003771,24.86902696726922]}}]}"},"_metadata":null} {"name":"field-region-73","message":"Failed to resolve tileset descriptors: Loading request canceled"}
LOG pack error {"pack":{"metadata":"{\n \"name\" : \"field-region-72\"\n}","bounds":"{\"type\":\"FeatureCollection\",\"features\":[{\"type\":\"Feature\",\"properties\":{},\"geometry\":{\"type\":\"Point\",\"coordinates\":[67.05860259878298,24.868365914318616]}},{\"type\":\"Feature\",\"properties\":{},\"geometry\":{\"type\":\"Point\",\"coordinates\":[67.06177770104551,24.871585472853567]}}]}"},"_metadata":null} {"name":"field-region-72","message":"Failed to resolve tileset descriptors: Loading request canceled"}
LOG pack error {"pack":{"metadata":"{\n \"name\" : \"field-region-71\"\n}","bounds":"{\"type\":\"FeatureCollection\",\"features\":[{\"type\":\"Feature\",\"properties\":{},\"geometry\":{\"type\":\"Point\",\"coordinates\":[67.0527601437771,24.865385527088804]}},{\"type\":\"Feature\",\"properties\":{},\"geometry\":{\"type\":\"Point\",\"coordinates\":[67.06248793623786,24.878936670953124]}}]}"},"_metadata":null} {"name":"field-region-71","message":"Failed to resolve tileset descriptors: Loading request canceled"}
LOG Pack: field-region-70 2.18 MB 100 complete
Notice that last pack is downloaded successfully. I even tried to await the function to make them synchronous but still I get the error.

s3Zip getting error - cannot read property of null

I have an expressjs back end and I'm trying to download/stream pdfs from s3 to a zip file. This is the error in the Heroku log:
TypeError: Cannot read property 'on' of null
at Object.s3Zip.archiveStream (/app/node_modules/s3-zip/s3-zip.js:49:6)
at Object.s3Zip.archive (/app/node_modules/s3-zip/s3-zip.js:33:24)
It was working on a localhost with "s3-zip": "^2.0.4" however I never deployed that version to heroku. Now I'm using "s3-zip": "^3.1.2"
also note, in my IDE the .archive statement is crossed out with a hint comment that a: Depreciated symbol used
public getZipFiles(req, res) {
const get_file = req.headers['pdfs'].split(',');
console.log("get file: ", get_file);
// first param is the zip file name
const zip_file_name = get_file.shift() + '.zip';
const user_downloads = downloadsFolder();
console.log(downloadsFolder()); // value is /tmp/
const output = fs.createWriteStream(join(user_downloads, zip_file_name));
// note: get_file is an array - ['file1.pdf', 'file2.pdf']
s3Zip
.archive({ region: aws_region, bucket: aws_bucket, debug: true }, '', get_file)
.pipe(output)
};
I expected to see the downloaded zip file, but got the error instead

attach a pdf to an email in meteor

This Meteor server code tries to attach a pdf file but giving errors on server startup. I want avoid saving the file locally first.
it is using pascoual:pdfkit.
The error I am getting is:
Error: Message failed: 421 Timeout waiting for data from client.
Meteor doc point to mailcomposer documentation, but the issue is how to integrate the pdf doc in the attachments. Any ideas? Thanks
Meteor.startup(() => {
Invoice.email();
};
// invoice.js
use strict";
let PDFDocument = require ('pdfkit');
let metaData = {
'Title': 'Invoice',
'Author': 'myName',
};
export const Invoice = {
'make': function () {
let doc = new PDFDocument(metaData);
doc.text('my company').text('company number');
return doc;
},
'email': function () {
let inv = Invoice.make();
Email.send({
to: 'myemail#comp.com',
from: 'personal#company.com',
subject: 'Invoice',
text: ' Please see the attached invoice',
attachments: {
filename: 'invoice.pdf',
content: inv // <=== this is the issue
});
}
};
As per Documentation, the content definition is
content - String, Buffer or a Stream contents for the attachment
Link to mailcomposer documentation.
If I am not wrong the Invoice.make() is not returning expecting format of blob. Kindly check the Stream and type so that you know you get what you are creating.
Link to more Supporting details

sails-rabbitmq adapter integration with mongodb issue

I have setup a sailsjs project and trying to access rabbitmq using sails-rabbitmq adapter. I have followed https://www.npmjs.com/package/sails-rabbitmq .
I want to use mongodb with rabbitmq. problem is when i 'sails lift' i get this error.
error: A hook (orm) failed to load!
error: Error: One of your models (message) refers to multiple datastores.
Please set its configured datastore to a string instead of an array in its model definition (.connection) or the app-wide default (sails.config.models.connection)
(this is conventionally set in your config/models.js file, or as part of your app's environment-specific config).
at constructError (C:\Users\demoapp\AppData\Roaming\npm\node_modules\sails\node_modules\sails-hook-orm\lib\construct-error.js:57:13)
at validateModelDef (C:\Users\demoapp\AppData\Roaming\npm\node_modules\sails\node_modules\sails-hook-orm\lib\validate-model-def.js:97:11)
at C:\Users\demoapp\AppData\Roaming\npm\node_modules\sails\node_modules\sails-hook-orm\lib\initialize.js:218:36
at arrayEach (C:\Users\demoapp\AppData\Roaming\npm\node_modules\sails\node_modules\lodash\index.js:1289:13)
at Function.<anonymous> (C:\Users\demoapp\AppData\Roaming\npm\node_modules\sails\node_modules\lodash\index.js:3345:13)
at Array.async.auto._normalizeModelDefs (C:\Users\demoapp\AppData\Roaming\npm\node_modules\sails\node_modules\sails-hook-orm\lib\initialize.js:216:11)
at listener (C:\Users\demoapp\AppData\Roaming\npm\node_modules\sails\node_modules\sails-hook-orm\node_modules\async\lib\async.js:605:42)
at C:\Users\demoapp\AppData\Roaming\npm\node_modules\sails\node_modules\sails-hook-orm\node_modules\async\lib\async.js:544:17
at _arrayEach (C:\Users\demoapp\AppData\Roaming\npm\node_modules\sails\node_modules\sails-hook-orm\node_modules\async\lib\async.js:85:13)
at Immediate.taskComplete (C:\Users\demoapp\AppData\Roaming\npm\node_modules\sails\node_modules\sails-hook-orm\node_modules\async\lib\async.js:543:13)
at processImmediate [as _immediateCallback] (timers.js:383:17)
I have > connection: [ 'rabbitCluster', 'regularMongo' ]
in my Message model. regularMongo is mongodb connection. Please let me know what other configuration i am missing.
With following config I do not see any error. In sails.config.models set
module.exports.models = {
connection: 'someMongodbServer',
migrate: 'safe'
};
in Message.js set
module.exports = {
connection: [ 'rabbitCluster', 'someMongodbServer' ],
routingKey: [ 'parentMessage' ],
attributes: {
title: 'string',
body: 'string',
parentMessage: {
model: 'message'
}
}
};

Meteor.call() on server side got Error: Method not found [404]

I am new to meteor. I'm getting an error trying to call a server method on the server side in the folder server/. I can't figure what I'm missing. If someone can help that would be great. Thanks
Error :
lib/node_modules/fibers/future.js:173
throw(ex);
^
Error: Method not found [404]
at _.extend.apply (packages/livedata/livedata_server.js:1251)
at _.extend.call (packages/livedata/livedata_server.js:1221)
at app/server/config.js:2:9
at app/server/config.js:4:3
Method:
var s3_options = {
key: "***",
secret: "***",
bucket: "**",
directory: "/"
}
Meteor.call("S3_config", s3_options);
Try to this :
Meteor.call('Methodname'); //here 'Methodname' is your method name
and also provide method body like to shown below where you need:
Meteor.methods
({
Methodname: function ()
{
//here write your Body
}
});
You need to provide the name of the method you'd like to call, i.e. Meteor.call("myMethod").