diff --git a/applications_controller.php b/applications_controller.php index cd6f280..1989573 100755 --- a/applications_controller.php +++ b/applications_controller.php @@ -52,7 +52,7 @@ public function get_data($serial_number = '') // Remove non-serial number characters $serial_number = preg_replace("/[^A-Za-z0-9_\-]]/", '', $serial_number); - $sql = "SELECT name, path, last_modified, obtained_from, runtime_environment, version, bundle_version, info, signed_by, has64bit + $sql = "SELECT name, path, last_modified, obtained_from, runtime_environment, version, bundle_version, bundle_id, info, signed_by, has64bit FROM applications LEFT JOIN reportdata USING (serial_number) ".get_machine_group_filter()." diff --git a/applications_model.php b/applications_model.php index 37cbada..8430d72 100755 --- a/applications_model.php +++ b/applications_model.php @@ -19,6 +19,7 @@ function __construct($serial='') $this->rs['signed_by'] = ''; $this->rs['has64bit'] = 0; // True or False $this->rs['bundle_version'] = ''; + $this->rs['bundle_id'] = null; $this->serial_number = $serial; } @@ -55,7 +56,8 @@ function process($plist) 'info' => '', 'signed_by' => '', 'has64bit' => 0, // Yes or No - 'bundle_version' => '' // Yes or No + 'bundle_version' => '', + 'bundle_id' => null ); // List of paths to ignore diff --git a/locales/en.json b/locales/en.json index 775136e..bebb421 100755 --- a/locales/en.json +++ b/locales/en.json @@ -11,5 +11,6 @@ "applications": "Applications", "no_32_bit": "No 32-bit Applications", "32_bit_apps": "32-bit Applications", - "bundle_version": "Bundle Version" + "bundle_version": "Bundle Version", + "bundle_id": "Bundle ID" } diff --git a/migrations/2024_11_21_000000_applications_add_bundle_id.php b/migrations/2024_11_21_000000_applications_add_bundle_id.php new file mode 100644 index 0000000..27a5780 --- /dev/null +++ b/migrations/2024_11_21_000000_applications_add_bundle_id.php @@ -0,0 +1,27 @@ +table($this->tableName, function (Blueprint $table) { + $table->string('bundle_id')->nullable(); + + $table->index('bundle_id'); + }); + } + + public function down() + { + $capsule = new Capsule(); + $capsule::schema()->table($this->tableName, function (Blueprint $table) { + $table->dropColumn('bundle_id'); + }); + } +} diff --git a/scripts/applications.py b/scripts/applications.py old mode 100755 new mode 100644 index eb1713c..e2ed632 --- a/scripts/applications.py +++ b/scripts/applications.py @@ -13,7 +13,7 @@ def get_app_bundle_version(app_path): try: with open(app_path+"/Contents/Info.plist", 'rb') as fp: info_plist = plistlib.load(fp) - return info_plist['CFBundleVersion'] + return info_plist except Exception: return "" @@ -63,7 +63,18 @@ def flatten_applications_info(array): app['obtained_from'] = obj[item] elif item == 'path': app['path'] = obj[item] - app['bundle_version'] = get_app_bundle_version(obj[item]) + app_info = get_app_bundle_version(obj[item]) + try: + app['bundle_version'] = app_info['CFBundleShortVersionString'] + except Exception: + app['bundle_version'] = "" + try: + app['bundle_id'] = app_info['CFBundleIdentifier'] + except Exception: + try: + app['bundle_id'] = app_info['Bundle identifier'] + except Exception: + app['bundle_id'] = "" elif item == 'runtime_environment': app['runtime_environment'] = obj[item] elif item == 'version': diff --git a/views/applications_listing.php b/views/applications_listing.php index 3559ce2..2b0510f 100755 --- a/views/applications_listing.php +++ b/views/applications_listing.php @@ -12,6 +12,7 @@ + @@ -23,7 +24,7 @@ - + @@ -81,11 +82,6 @@ }); } - // IDK what this does - if(d.search.value.match(/^\d+\.\d+(\.(\d+)?)?$/)){ - var search = d.search.value.split('.').map(function(x){return ('0'+x).slice(-2)}).join(''); - d.search.value = search; - } } }, dom: mr.dt.buttonDom, @@ -101,23 +97,24 @@ $('td:eq(0)', nRow).html(link); // Localize Obtained From - var obtained_from=$('td:eq(6)', nRow).html(); + var obtained_from=$('td:eq(7)', nRow).html(); obtained_from = obtained_from == 'unknown' ? i18n.t('unknown') : obtained_from = obtained_from == 'mac_app_store' ? i18n.t('applications.mac_app_store') : obtained_from = obtained_from == 'apple' ? "Apple": + obtained_from = obtained_from == 'safari' ? "Web Clip": (obtained_from === 'identified_developer' ? i18n.t('applications.identified_developer') : obtained_from) - $('td:eq(6)', nRow).html(obtained_from) + $('td:eq(7)', nRow).html(obtained_from) // Format date - var event = parseInt($('td:eq(7)', nRow).html()); + var event = parseInt($('td:eq(8)', nRow).html()); if (event > 0){ var date = new Date(event * 1000); - $('td:eq(7)', nRow).html(''+ moment(date).format('llll')+''); + $('td:eq(8)', nRow).html(''+ moment(date).format('llll')+''); } // runtime_environment - var colbit=$('td:eq(8)', nRow).html(); - var colvar=$('td:eq(9)', nRow).html(); + var colbit=$('td:eq(9)', nRow).html(); + var colvar=$('td:eq(10)', nRow).html(); colvar = colvar == 'arch_x86' && colbit == '1' ? 'Intel 64-bit' : colvar = colvar == 'arch_x86' && colbit == '0' ? 'Intel 32-bit' : colvar = colvar == 'arch_i64' ? 'Intel 64-bit' : @@ -129,13 +126,13 @@ colvar = colvar == 'arch_arm' ? 'Apple Silicon' : colvar = colvar == 'arch_web' ? 'Web App' : (colvar == 'arch_arm' ? 'Apple Silicon' : colvar) - $('td:eq(9)', nRow).html(colvar) + $('td:eq(10)', nRow).html(colvar) // has64bit - var colvar=$('td:eq(8)', nRow).html(); + var colvar=$('td:eq(9)', nRow).html(); colvar = colvar == '1' ? i18n.t('yes') : (colvar == '0' ? i18n.t('no') : '') - $('td:eq(8)', nRow).html(colvar) + $('td:eq(9)', nRow).html(colvar) } }); }); diff --git a/views/applications_tab.php b/views/applications_tab.php index b01d2d7..8666956 100755 --- a/views/applications_tab.php +++ b/views/applications_tab.php @@ -10,6 +10,7 @@ + @@ -21,7 +22,7 @@ - + @@ -57,6 +58,7 @@ { data: 'name' }, { data: 'version' }, { data: 'bundle_version' }, + { data: 'bundle_id' }, { data: 'signed_by' }, { data: 'obtained_from' }, { data: 'last_modified' }, @@ -67,23 +69,24 @@ ], createdRow: function( nRow, aData, iDataIndex ) { // Localize Obtained From - var obtained_from=$('td:eq(4)', nRow).html(); + var obtained_from=$('td:eq(5)', nRow).html(); obtained_from = obtained_from == 'unknown' ? i18n.t('unknown') : obtained_from = obtained_from == 'mac_app_store' ? i18n.t('applications.mac_app_store') : obtained_from = obtained_from == 'apple' ? "Apple": + obtained_from = obtained_from == 'safari' ? "Web Clip": (obtained_from == 'identified_developer' ? i18n.t('applications.identified_developer') : obtained_from) - $('td:eq(4)', nRow).text(obtained_from) + $('td:eq(5)', nRow).text(obtained_from) // Format date - var event = parseInt($('td:eq(5)', nRow).html()); + var event = parseInt($('td:eq(6)', nRow).html()); if (event > 0){ var date = new Date(event * 1000); - $('td:eq(5)', nRow).html(''+moment(date).format('llll')+''); + $('td:eq(6)', nRow).html(''+moment(date).format('llll')+''); } // runtime_environment - var colbit=$('td:eq(6)', nRow).html(); - var colvar=$('td:eq(7)', nRow).html(); + var colbit=$('td:eq(7)', nRow).html(); + var colvar=$('td:eq(8)', nRow).html(); colvar = colvar == 'arch_x86' && colbit == '1' ? 'Intel 64-bit' : colvar = colvar == 'arch_x86' && colbit == '0' ? 'Intel 32-bit' : colvar = colvar == 'arch_i64' ? 'Intel 64-bit' : @@ -95,13 +98,13 @@ colvar = colvar == 'arch_web' ? 'Web App' : colvar = colvar == 'arch_other' ? 'Unknown' : (colvar == 'arch_arm' ? 'Apple Silicon' : colvar) - $('td:eq(7)', nRow).text(colvar) + $('td:eq(8)', nRow).text(colvar) // has64bit - var colvar=$('td:eq(6)', nRow).html(); + var colvar=$('td:eq(7)', nRow).html(); colvar = colvar == '1' ? i18n.t('yes') : (colvar == '0' ? i18n.t('no') : '') - $('td:eq(6)', nRow).text(colvar) + $('td:eq(7)', nRow).text(colvar) } }); }