Deleting Files from the Linux Kernel

The NSA has been directed by an executive order from the President to remove internal and external content with the following 27 words.

  • Anti-Racism
  • Racism
  • Allyship
  • Bias
  • DEI
  • Diversity
  • Diverse
  • Confirmation Bias
  • Equity
  • Equitableness
  • Feminism
  • Gender
  • Gender Identity
  • Inclusion
  • Inclusive
  • All-Inclusive
  • Inclusivity
  • Injustice
  • Intersectionality
  • Prejudice
  • Privilege
  • Racial Identity
  • Sexuality
  • Stereotypes
  • Pronouns
  • Transgender
  • Equality

This could pose an issue for content that may contain words or phrases relating to cyber-security, technology, etc.

I imagine this is how it is going down:

grep -rlFf wordlist.txt . | xargs rm -f

Could just get a list of unique files that contain one of the banned words and do something with it too.

grep -rFof wordlist.txt . >files_to_remove.txt

What about the Linux Kernel?

So, let’s see what the Linux Kernel would need to delete.

grep -rFi -of wordlist.txt linux-6.13.2/ >files_to_remove.txt
awk -F: '{print tolower($2)}' files_to_remove.txt | awk '{count[$1]++} END {for (word in count) print word, count[word]}' | sort -k2 -nr > word_frequencies.txt

Get unique files:


cut -d':' -f1 files_to_remove.txt | sort | uniq > uniq_files.txt

Count unique files to delete:

cut -d':' -f1 files_to_remove.txt | sort | uniq | wc -l

Results

Unique files to delete: 5923 of 87174 total files.

Top 10 Filetypes to be Deleted

ExtensionCountPercentage of Unique Files
.c276446.7%
.h147224.9%
.dts4237.1%
.dtsi3355.7%
.rst3015.1%
.yaml2404.0%
.S751.3%
.txt621.0%
.sh550.9%
.json360.6%
Other1602.7%
  • C-related files (.c, .h) dominate, making up about 71.6% of the unique files.
  • Device Tree Source (.dts, .dtsi) files make up 12.8%, suggesting embedded systems or Linux kernel development.
  • Configuration & documentation files (.rst, .yaml, .txt, .json) total ~11.6%, showing structured data and documentation usage.
  • Shell scripts (.sh) and Assembly (.S) make up a smaller portion (2.2%), likely for build or automation scripts.

Categorized Files

  • Code Files (.c, .h, .S, .sh): 4,366 files (73.7%)
  • Configuration (.yaml, .json, .dts, .dtsi): 1,034 files (17.5%)
  • Documentation (.rst, .txt): 363 files (6.1%)
  • Other/Miscellaneous: 160 files (2.7%)

Word frequencies across all files:

bias 33121
dei 9472
privilege 3899
diversity 837
inclusive 724
inclusion 232
equality 88
diverse 50
gender 31
prejudice 17
pronouns 2

InvoiceNinja – Mailer problem

I maintain an InvoiceNinja instance and an error was reported when sending mail.

Check the logs in storage/logs/laravel.log I see there is an error:

Mailer Problem: scheme is not supported; supported schemes for mailer "smtp" are: "smtp", "smtps"

First, I checked my .env and saw MAIL_MAILER=smtps, so I dug into config/mail.php to have a look.

There was no scheme in the mailers.smtp, so I added 'scheme' => 'smtps', to it:

    'mailers' => [
        'smtp' => [
            'scheme' => 'smtps',
            'transport' => 'smtps',

I cleared the config cache using php artisan clear:config.

Now invoices are sending.

ManageEngine: Inline images dropped

In ManageEngine ServiceDeskPlus MSP it is notifying receipients and senders when an inline image is dropped/not processed. To disable this notification, perform the following steps to update the database.

Run the query on the database. If using Postgres bundled with ME SDP MSP, this is the query.

update GlobalConfig set paramvalue='false' where category like 'EMAIL_PROCESSING' and parameter like 'sendAttachmentStrippedNotification';

To use Postgres, navigate to your ME SDP MSP installation location in a command prompt, for example C:\ManageEngine\ServiceDeskPlus-MSP and into sub-folder pgsql\bin.

pgsql -h 127.0.0.1 -U sdpadmin -p 65432 -d servicedesk

It will prompt for the database password. If you do not know this password, you can decrypt it using ME tool found in your ME SDP MSP bin folder, for example, C:\ManageEngine\ServiceDeskPlus-MSP\bin\decryptPostgresPassword.bat. Make sure to record the password in a safe location.

Photoshop Mix

Photoshop Mix was sunset by Adobe in June 2024. This was one of the simplest mobile apps for iOS and Android that had been out since around 2016 and I heavily used it to make memes and quick edits for people in Photoshop Facebook groups. The simplicity of the layers, cutouts with shapes, and its interface was ahead of its time and to date I have not found a mobile app that can replace it, free or paid.

After June, many people took to Reddit to voice complaints that the app no longer works and thereby they cannot access all their projects anymore. I discovered that you can actually still access your projects, just not in an editable way — you can only download the “compositions”. You can download the compositions by visiting https://assets.adobe.com/mobilecreations.

Because this app is one of my favorites, I have had some thoughts on trying to get it to work, or figure out how to bypass the login screen that now errors indicating the product is no longer supported. My work so far in testing / troubleshooting has lead me to a token that seems to be the culprit. It might be possible that I can forge this token through some proxy or something to rewrite it, but that would mean I need to be on a network I can handle proxying and this wouldn’t work on a mobile network.

The error when launching Photoshop Mix now:

We couldn’t sign you in. Either the product you are trying to use is no longer supported or the client ID is not valid.

I’ll update this post with more details as I get them organized, but here’s what I have so far.

The client_id of OrionPS1 seems to be what is triggering the invalid application. In testing on my phone with Adobe Photoshop Express, I see that application uses the client_id of PSXIOS3.

This will generate the error above.

curl 'https://ims-na1.adobelogin.com/ims/authorize/v1?redirect_uri=signin%3A%2F%2Fcomplete&client_id=OrionPS1' \
-H 'Host: ims-na1.adobelogin.com' \
-H 'Sec-Fetch-Site: none' \
-H 'Connection: keep-alive' \
-H 'Sec-Fetch-Mode: navigate' \
-H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,\*/\*;q=0.8' \
-H 'User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 18_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' \
-H 'Accept-Language: en-US,en;q=0.9' \
-H 'Sec-Fetch-Dest: document'

Now, looking at the Adobe Photoshop Express app HTTP requests, this is what things look like.

GET /ims/authorize/v3?client_id=PSXIOS3&scope=creative_sdk,AdobeID,openid,sao.cce_private,additional_info.projectedProductContext,sao.spark,tk_platform,tk_platform_sync,af_byof,af_ltd_psx,tk_platform_grant_free_subscription,firefly_api&force_marketing_permission=true&locale=en-US&idp_flow=login&response_type=device&device_name=iPhone&hashed_device_id=[redacted]&state=%7B%22ac%22:%22psxios%22%7D&redirect_uri=com.adobe.psmobile://login.complete HTTP/1.1  
Host: ims-na1.adobelogin.com  
Sec-Fetch-Dest: document  
User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 18_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.0 Mobile/15E148 Safari/604.1  
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8  
Sec-Fetch-Site: none  
Sec-Fetch-Mode: navigate  
Accept-Language: en-US,en;q=0.9  
Priority: u=0, i  
Accept-Encoding: gzip, deflate, br  
Connection: keep-alive

What I note is that the URI path is changed from /ims/authorize/v1 to /ims/authorize/v3. So if I change my cUrl command to the following, I get a new error.

curl 'https://ims-na1.adobelogin.com/ims/authorize/v3?redirect_uri=signin%3A%2F%2Fcomplete&client_id=PSXIOS3&scope=creative_sdk,AdobeID,sao.cce_private&idp_flow=login&force_marketing_permission=true&response_type=device&device_id=[redacted]&device_name=iPhone&locale=en-US&state=%7B%22ac%22:%22PSMix_app%22%7D&grant_type=device&hashed_device_id=[redacted]' \
-H 'Host: ims-na1.adobelogin.com' \
-H 'Sec-Fetch-Site: none' \
-H 'Connection: keep-alive' \
-H 'Sec-Fetch-Mode: navigate' \
-H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,\*/\*;q=0.8' \
-H 'User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 18_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' \
-H 'Accept-Language: en-US,en;q=0.9' \
-H 'Sec-Fetch-Dest: document'

bad_request

missing hashed_device_id parameter

So adding that in based on what my hashed_device_id paramater is, I do not get a response back. This is as far as I’ve gotten with the 15 minutes I’ve had to work on it. I’ll explore it more later.

Deleting duplicate contacts in MDaemon address book

Somehow the contacts for an email account amassed almost 7k entries. Upon manual review, it seemed there were at least 3 entries for each contact. Here’s a powershell script to create a new MDaemon AddrBook.mrk file with removed duplicates. The script as written compares if the first name, last name, and full name are concatenated together into a single key. This means it requires all three fields to match to consider a contact as a duplicate. It isn’t 100% but it helped significantly reduce the duplicates to a manageable number for reviewing manually.

Here’s an abbreviated format of the AddrBook.mrk file:

<?xml version="1.0" encoding="UTF-8"?>  
<addressBook version="9.5.5" encoding="utf-8" lastModified="2024-07-08T18:05:22.885Z" fid="{1d30e328-d4f6-4e98-bd22-c99fd9523ab3}" NextID="1">  
  <contact>  
    <guid><![CDATA[73e3293156c74f8195dac9d1625645e2]]></guid>  
    <modified>2022-06-13 13:59:33</modified>  
    <firstName><![CDATA[John]]></firstName>  
    <lastName><![CDATA[Doe]]></lastName>  
    <fullName><![CDATA[John Doe]]></fullName>  
    <busCompany><![CDATA[Acme Widgets]]></busCompany>  
    <homeMobile><![CDATA[+1 (555) 555-5555]]></homeMobile>  
    <comment><![CDATA[  
]]></comment>  
  </contact>  
  <contact>  
    <guid><![CDATA[b17e84fa82562e63eef1623ed8475063]]></guid>  
    <modified>2022-06-13 13:59:33</modified>  
    <firstName><![CDATA[Jane]]></firstName>  
    <lastName><![CDATA[Doe]]></lastName>  
    <fullName><![CDATA[Jane Doe]]></fullName>  
    <homeMobile><![CDATA[(555) 555-5555]]></homeMobile>  
    <comment><![CDATA[  
]]></comment>  
  </contact>  
</addressBook>

Here’s the powershell code to extract non duplicate entries into a new file:

# Load the XML file from MDaemon (\users\domain.tld\username\Contacts.IMAP\AddrBook.mrk)  
[xml]$xml = Get-Content -Path "addrbook.mrk"  
  
# Create a hash table to store unique contacts  
$uniqueContacts = @{}  
  
# Function to generate a unique key for each contact  
function Get-ContactKey {  
    param (  
        $firstName,  
        $lastName,  
        $fullName  
    )  
    return "$firstName|$lastName|$fullName"  
}  
  
# Access the contact nodes directly  
$contacts = $xml.addressBook.contact  
  
# Get the total number of contacts before removing duplicates  
$totalContactsBefore = $contacts.Count  
  
# Create a list to store the contacts to remove  
$contactsToRemove = @()  
  
# Iterate through each contact and identify duplicates  
foreach ($contact in $contacts) {  
    $firstName = $contact.firstName.'#cdata-section'  
    $lastName = $contact.lastName.'#cdata-section'  
    $fullName = $contact.fullName.'#cdata-section'  
  
    $key = Get-ContactKey -firstName $firstName -lastName $lastName -fullName $fullName  
  
    if (-not $uniqueContacts.ContainsKey($key)) {  
        # Add contact to unique contacts  
        $uniqueContacts[$key] = $contact  
    } else {  
        # Duplicate found, add to list to remove later  
        $contactsToRemove += $contact  
    }  
}  
  
# Remove duplicate contacts  
foreach ($contact in $contactsToRemove) {  
    $contact.ParentNode.RemoveChild($contact) > $null  
}  
  
# Get the total number of contacts after removing duplicates  
$totalContactsAfter = $xml.addressBook.contact.Count  
  
# Save the updated XML file  
$xml.Save("updated_contacts.xml")  
  
# Write the total numbers to the console  
Write-Output "Total contacts before removing duplicates: $totalContactsBefore"  
Write-Output "Total contacts after removing duplicates: $totalContactsAfter"  

Total contacts before removing duplicates: 6871
Total contacts after removing duplicates: 2053