Skip to content

Commit

Permalink
Progress tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
rubnogueira committed May 24, 2020
1 parent 21e4897 commit 00987ac
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 33 deletions.
2 changes: 1 addition & 1 deletion modules/report/tiktok.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ def get_videos(self):

video = {}
video["key"] = os.path.basename(entry)
video["last_modified"] = ""
video["last_modified"] = 0
videos.append(video)

logging.info("{} video(s) found".format(len(videos)))
Expand Down
8 changes: 3 additions & 5 deletions psy/extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ def dump_apps(self):
if self.dsprocessor:
self.progress.setProgressText(' Extracting application data ({}).\n Please wait.'.format(app_id))
else:
self.progress.progress('Extracting application data ({})'.format(app_id))
self.progress.next_job('Extracting application data ({})'.format(app_id))

for serial, folder in self.extract.dump_from_adb(app_id, devices = self.devices).items():
# If the device not in the list
if not folders.get(serial):
Expand All @@ -31,8 +31,6 @@ def dump_apps(self):
if not folder in folders[serial]:
folders[serial].append(folder)

#self.progressJob.next_job("Extracting {}".format(app_id))


for serial, folderslist in folders.items():
extracted_list = []
Expand All @@ -56,7 +54,7 @@ def extract_dumps(self, serial, folder):
if self.dsprocessor:
self.progress.setProgressText(' Handling extracted data from {}.\n Please wait.'.format(serial))
else:
self.progress.progress('Handling extracted data from {}'.format(serial))
self.progress.change_text('Handling extracted data from {}'.format(serial))

for filename in files:
if '_internal.tar.gz' in filename:
Expand Down
19 changes: 7 additions & 12 deletions psy/ingest.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,21 @@ def process(self, dataSource, progressBar):
#Initialize list of possible data sources
data_sources = []

max_apps = len(Utils.get_all_packages().values())

#Extract method for adb selected #THIS IS ONLY USED IN <= AUTOPSY 4.15
if self.method == "method_adb":
#Get list of selected apps to extract
self.apps = json.loads(self.settings.getSetting('apps'))

jobs = len(self.apps)*3 #extract, analyser, index
jobs = max_apps * 3 #extract, analyser, index
self.progressJob = ProgressJob(progressBar, jobs)

self.progressJob.next_job("Extracting from ADB")
logging.info("Starting ADB")

#Variable used to store all folders for each device
folders = Extractor(self.apps, DeviceCommunication.list_devices(), progressBar, dsprocessor = False).dump_apps()
folders = Extractor(self.apps, DeviceCommunication.list_devices(), self.progressJob, dsprocessor = False).dump_apps()

# Add one datasource for each device, with the list of the possible folders
for serial, folders_list in folders.items():
Expand All @@ -85,14 +87,7 @@ def process(self, dataSource, progressBar):
logging.info("Using Selected Datasource")
data_sources.append(dataSource)

# if self.method == "method_importfile":
# self.progressJob = ProgressJob(progressBar, len(data_sources)) #indexing ( x1)
# else:
jobs = 0
for source in data_sources:
jobs = jobs + len(self.fileManager.findFiles(source, "%_internal.tar.gz"))

self.progressJob = ProgressJob(progressBar, 2 * jobs) #indexing and analying
self.progressJob = ProgressJob(progressBar, max_apps * 2) #indexing and analying


# For each data source, we will process it each one
Expand Down Expand Up @@ -194,7 +189,7 @@ def process_by_datasource(self, dataSource):
report_folder_path = os.path.join(temp_directory, app_id, str(report_number)) #report path
Utils.check_and_generate_folder(report_folder_path)

self.progressJob.change_text("Analyzing Information for {} ({})".format(dataSource.getName(), app_id))
self.progressJob.next_job("Analyzing Information for {} ({})".format(dataSource.getName(), app_id))

# Folder to analyze
analyzer = Analyzer(app_id, base_path, report_folder_path)
Expand Down Expand Up @@ -222,7 +217,7 @@ def process_by_datasource(self, dataSource):
except:
continue

self.progressJob.next_job("Processing report {} ".format(app_id))
self.progressJob.change_text("Processing report {} ".format(app_id))
# Since we can have multiple json files for multiple apps, we have to track how many reports exists for each app
if not reports_by_app.get(app_id):
reports_by_app[app_id] = []
Expand Down
2 changes: 1 addition & 1 deletion psy/processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def initComponents(self):

self.p_method = SettingsUtils.createPanel(ptop = 15)

self.sp2 = SettingsUtils.createSeparators(1)
self.sp2 = SettingsUtils.createSeparators(0)
self.p_info.add(self.sp2, BorderLayout.SOUTH)

self.p_method.add(JLabel("Extract user data from:"))
Expand Down
18 changes: 4 additions & 14 deletions template/assets/js/report.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,14 +236,16 @@ function renderMedia() {
content += `</div>`;

$("#page-builder").html(content);
$(".button-copy").on("click", copyText);

renderMediaList("all")

$('#media-filter').on('change', function() {
renderMediaList(this.value)
});


$(".button-copy").on("click", copyText);

}

function renderMediaList(filter){
Expand Down Expand Up @@ -271,7 +273,7 @@ function renderMediaList(filter){
return
}

mediaListing += `<button type="button" class="btn btn-primary btn-sm button-copy" data-toggle="tooltip" data-placement="bottom" onclick='copyToClipboard("${item["path"]}")' title="${item["path"]}">Copy Path</button>`;
mediaListing += `<button type="button" class="btn btn-primary btn-sm button-copy" data-toggle="tooltip" data-placement="bottom" title="${item["path"]}">Copy Path</button>`;

if ((item["type"] === "video" && (filter === "all" || filter === "video")) || (item["type"] === "audio" && (filter === "all" || filter === "video"))){
mediaListing += `<a class="btn btn-primary btn-sm ml-2" href="${item["path"]}" download target="_blank">Download for External Player</a>`
Expand All @@ -291,18 +293,6 @@ function renderMediaList(filter){
return mediaListing
}


function copyToClipboard(str) {
const el = document.createElement('input');
el.value = str;
document.body.appendChild(el);
el.select();
document.execCommand('copy');
document.body.removeChild(el);
};



function pageBuilder(titlenumber) {
//if (!(title in reportData)) {
// return;
Expand Down

0 comments on commit 00987ac

Please sign in to comment.