added in bytenode encryption
This commit is contained in:
@@ -521,94 +521,50 @@ export class AdbClientService {
|
||||
return Promise.reject(name + 'Apk install failed - No device connected! ' + filePath);
|
||||
}
|
||||
const showTotal = number && total ? '(' + number + '/' + total + ') ' : '';
|
||||
const updateStatus = (text: string): void => {
|
||||
const newStatus = `${showTotal}${text} `;
|
||||
if (task.status !== newStatus) {
|
||||
task.status = newStatus;
|
||||
}
|
||||
};
|
||||
const checkReported: Promise<InstallDecision> = isLocal
|
||||
? this.checkIsAPKReported(updateStatus, filePath)
|
||||
: Promise.resolve('DoInstall');
|
||||
return checkReported.then(installDecision => {
|
||||
task.app_name = name;
|
||||
if (installDecision === 'DoInstall') {
|
||||
task.status = name + showTotal + 'Installing Apk... ';
|
||||
return this.adbCommand(
|
||||
'install',
|
||||
{ serial: this.deviceSerial, path: filePath, isLocal: !!isLocal },
|
||||
status => {
|
||||
task.status =
|
||||
(status.percent === 1
|
||||
? name + showTotal + 'Installing Apk... '
|
||||
: name + showTotal + 'Downloading APK... ' + Math.round(status.percent * 100) + '% ') +
|
||||
' <span style="font-style:italic">' +
|
||||
filePath +
|
||||
'</span>';
|
||||
}
|
||||
)
|
||||
.then(r => {
|
||||
task.status = name + 'APK file installed ok!! ' + filePath;
|
||||
if (deleteAfter) {
|
||||
this.appService.fs.unlink(filePath, err => {});
|
||||
}
|
||||
if (filePath.indexOf('com.weloveoculus.BMBF') > -1) {
|
||||
return this.beatonService.setBeatOnPermission(this);
|
||||
}
|
||||
if (filePath.toLowerCase().indexOf('sidequest.legends') > -1) {
|
||||
return this.setPermission('com.sidequest.legends', 'android.permission.RECORD_AUDIO');
|
||||
}
|
||||
if (filePath.toLowerCase().indexOf('pavlov') > -1) {
|
||||
return this.setPermission('com.vankrupt.pavlov', 'android.permission.RECORD_AUDIO')
|
||||
.then(() =>
|
||||
this.setPermission('com.vankrupt.pavlov', 'android.permission.READ_EXTERNAL_STORAGE')
|
||||
)
|
||||
.then(() =>
|
||||
this.setPermission('com.vankrupt.pavlov', 'android.permission.WRITE_EXTERNAL_STORAGE')
|
||||
)
|
||||
.then(() =>
|
||||
this.adbCommand('shell', {
|
||||
serial: this.deviceSerial,
|
||||
command: 'echo null > /sdcard/pavlov.name.txt',
|
||||
})
|
||||
);
|
||||
}
|
||||
})
|
||||
.catch(e => {
|
||||
if (deleteAfter) {
|
||||
this.appService.fs.unlink(filePath, err => {});
|
||||
}
|
||||
return Promise.reject(e.message ? e.message : e.code ? e.code : e.toString() + ' ' + filePath);
|
||||
});
|
||||
} else {
|
||||
task.app_name = name;
|
||||
task.status = name + showTotal + 'Installing Apk... ';
|
||||
return this.adbCommand('install', { serial: this.deviceSerial, path: filePath, isLocal: !!isLocal }, status => {
|
||||
task.status =
|
||||
(status.percent === 1
|
||||
? name + showTotal + 'Installing Apk... '
|
||||
: name + showTotal + 'Downloading APK... ' + Math.round(status.percent * 100) + '% ') +
|
||||
' <span style="font-style:italic">' +
|
||||
filePath +
|
||||
'</span>';
|
||||
})
|
||||
.then(r => {
|
||||
task.status = name + 'APK file installed ok!! ' + filePath;
|
||||
if (deleteAfter) {
|
||||
this.appService.fs.unlink(filePath, err => {});
|
||||
}
|
||||
updateStatus('Canceled Install.');
|
||||
return Promise.resolve();
|
||||
}
|
||||
});
|
||||
if (filePath.indexOf('com.weloveoculus.BMBF') > -1) {
|
||||
return this.beatonService.setBeatOnPermission(this);
|
||||
}
|
||||
if (filePath.toLowerCase().indexOf('sidequest.legends') > -1) {
|
||||
return this.setPermission('com.sidequest.legends', 'android.permission.RECORD_AUDIO');
|
||||
}
|
||||
if (filePath.toLowerCase().indexOf('pavlov') > -1) {
|
||||
return this.setPermission('com.vankrupt.pavlov', 'android.permission.RECORD_AUDIO')
|
||||
.then(() => this.setPermission('com.vankrupt.pavlov', 'android.permission.READ_EXTERNAL_STORAGE'))
|
||||
.then(() => this.setPermission('com.vankrupt.pavlov', 'android.permission.WRITE_EXTERNAL_STORAGE'))
|
||||
.then(() =>
|
||||
this.adbCommand('shell', {
|
||||
serial: this.deviceSerial,
|
||||
command: 'echo null > /sdcard/pavlov.name.txt',
|
||||
})
|
||||
);
|
||||
}
|
||||
})
|
||||
.catch(e => {
|
||||
if (deleteAfter) {
|
||||
this.appService.fs.unlink(filePath, err => {});
|
||||
}
|
||||
return Promise.reject(e.message ? e.message : e.code ? e.code : e.toString() + ' ' + filePath);
|
||||
});
|
||||
},
|
||||
name
|
||||
);
|
||||
}
|
||||
async checkIsAPKReported(updateStatus: (string) => void, filePath: string): Promise<InstallDecision> {
|
||||
let isReported: boolean;
|
||||
try {
|
||||
isReported = await this.safeSideService.checkAPK(updateStatus, filePath);
|
||||
} catch {
|
||||
isReported = false;
|
||||
}
|
||||
if (isReported) {
|
||||
updateStatus('Confirming you want to install APK...');
|
||||
this.appService.headerComponent.safeModal.openModal();
|
||||
return new Promise(resolve => {
|
||||
this.appService.headerComponent.safeResolve = resolve;
|
||||
});
|
||||
} else {
|
||||
return 'DoInstall';
|
||||
}
|
||||
}
|
||||
uninstallAPK(pkg) {
|
||||
return this.processService.addItem('apk_uninstall', task => {
|
||||
task.status = 'Uninstalling ' + pkg + '...';
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { AppService } from './app.service';
|
||||
import { environment } from './../environments/environment';
|
||||
import { ElectronService } from './electron.service';
|
||||
import { AdbClientService } from './adb-client.service';
|
||||
|
||||
interface CheckSubmissionResponse {
|
||||
found: boolean;
|
||||
@@ -13,16 +8,14 @@ interface CheckSubmissionResponse {
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class SafeSideService {
|
||||
constructor(private appService: AppService, private adbService: AdbClientService) {} // private http: HttpClient
|
||||
|
||||
async checkAPK(updateStatus: (string) => void, filePath: string): Promise<boolean> {
|
||||
return this.adbService.adbCommand('hashCheck', { path: filePath }, updateStatus);
|
||||
// const hash = await this.computeFileHash(updateStatus, filePath);
|
||||
// const url = `${environment.safeSideApiUrl}/check-app-hash/${hash}`;
|
||||
// updateStatus('Checking APK against blacklist...');
|
||||
// const response = await this.http.get<CheckSubmissionResponse>(url).toPromise();
|
||||
// return response.found;
|
||||
}
|
||||
// constructor(private appService: AppService, private adbService: AdbClientService) {} // private http: HttpClient
|
||||
// async checkAPK(updateStatus: (string) => void, filePath: string): Promise<boolean> {
|
||||
// const hash = await this.computeFileHash(updateStatus, filePath);
|
||||
// const url = `${environment.safeSideApiUrl}/check-app-hash/${hash}`;
|
||||
// updateStatus('Checking APK against blacklist...');
|
||||
// const response = await this.http.get<CheckSubmissionResponse>(url).toPromise();
|
||||
// return response.found;
|
||||
// }
|
||||
// async computeFileHash(updateStatus: (string) => void, filePath: string): Promise<string> {
|
||||
// const fileSize = await this.computeFileSize(filePath);
|
||||
// return new Promise((resolve, reject) => {
|
||||
|
||||
Reference in New Issue
Block a user