scripts/update/hook_durian_update_locationd.js
/*
    When fud and DurianUpdaterService are done, they just call locationd with the according asset
    URL.
    */
When fud and DurianUpdaterService are done, they just call locationd with the according asset
URL.
When fud and DurianUpdaterService are done they just call locationd with the according asset URL .
interceptFirmwareUpdate() {
        var self = this;
        var {CLDurianService} = ObjC.classes;
        Interceptor.attach(CLDurianService['- updateFirmwareForDevice:withAssetURL:forClient:'].implementation, {
            onEnter: function(args) {
                console.log(' ! ENTERED FIRMWARE UPDATE');
                console.log(new ObjC.Object(args[3]));
            }
        });
        var {CLDurianFirmwareAssetPacketizer} = ObjC.classes;
        Interceptor.attach(CLDurianFirmwareAssetPacketizer['- initWithAssetType:assetData:maxPacketSize:'].implementation, {
            onEnter: function(args) {
                var assetType = parseInt(args[2]);
                console.log(' * Creating new asset data packet with type ' + assetType);
                var assetData = new ObjC.Object(args[3]);
                console.log(assetData);  
                if (self.replace_firmware[assetType]) {
                    this.context.x3 = self.replace_firmware[assetType];
                    console.log(' ! FOUND BLOB FOR ' + assetType + ', REPLACED FIRMWARE!');
                }
            }
        });
    }
interceptFirmwareUpdate ( ) { var self = this ; var { CLDurianService } = ObjC . classes ; Interceptor . attach ( CLDurianService [ '- updateFirmwareForDevice:withAssetURL:forClient:' ] . implementation , { onEnter : function ( args ) { console . log ( ' ! ENTERED FIRMWARE UPDATE' ) ; console . log ( new ObjC . Object ( args [ 3 ] ) ) ; } } ) ; var { CLDurianFirmwareAssetPacketizer } = ObjC . classes ; Interceptor . attach ( CLDurianFirmwareAssetPacketizer [ '- initWithAssetType:assetData:maxPacketSize:' ] . implementation , { onEnter : function ( args ) { var assetType = parseInt ( args [ 2 ] ) ; console . log ( ' * Creating new asset data packet with type ' + assetType ) ; var assetData = new ObjC . Object ( args [ 3 ] ) ; console . log ( assetData ) ; if ( self . replace_firmware [ assetType ] ) { this . context . x3 = self . replace_firmware [ assetType ] ; console . log ( ' ! FOUND BLOB FOR ' + assetType + ', REPLACED FIRMWARE!' ) ; } } } ) ; }
When fud and DurianUpdaterService are done, they just call locationd with the according asset
URL.
When fud and DurianUpdaterService are done they just call locationd with the according asset URL .
// -[CLDurianService updateFirmwareForDevice:withAssetURL:forClient:] // withAssetURL as ObjC prints: file:///private/var/MobileAsset/AssetsV2/com_apple_MobileAsset_MobileAccessoryUpdate_DurianFirmware/eba889b5f77e7aa5fb27e24adcf44b20a62c6dc1.asset/AssetData/DurianFirmware.acsw/ // all sub binaries (blap.bin etc.) are sent separately by the asset packetizer //NSData //TODO // send to Python script for further processing //var blob = assetData.bytes().readByteArray(assetData.length()); //send({msgType: "asset", assetType: assetType}, blob); // also overwrite if asset is set