This happened a few months back, but there's no harm in telling it now.
A client came to me saying they wanted to move to a different server. Changing servers is either a small job or a big one depending on what you find — and in this case, their software developer was dead set against it.
After poking around, I understood why. The site was written in C#, and most of it was straightforward: pack up the files, move them over, database included. The snag was the config file, which was partially encrypted.
Not encrypted as a whole — only the database connection string. And not even the whole connection string: just part of it.
I could more or less guess how that string was put together, so I tried writing that portion out in plain text. No luck. The program decrypts that section unconditionally, so my plain text got "decrypted" right along with everything else.
That left one route: actually decrypt it and see what was inside.
Following the error thrown by the failed decryption, I tracked down the relevant .dll. A tool called dnSpy can reverse-engineer compiled C# assemblies, and sure enough, I found the key.
Which raised a new problem. I don't really know C#. PHP is what I've always been most comfortable with. So even holding the key, I still couldn't open the lock.
Time to bring in the AI assistants. I asked both Qwen and Doubao; Qwen got there first with working code:
from Crypto.Cipher import DES3
from Crypto.Util.Padding import unpad
import hashlib
import base64
# 1. Prepare the data
ciphertext_base64 = "[encrypted database connection string]"
password = "[key found in the .dll]"
# 2. Core logic: reproduce how C# generates the Key
# First MD5 the password (16 bytes)
md5_hash = hashlib.md5(password.encode('utf-8')).digest()
# To reach 24 bytes, concatenate the MD5 result with itself (16 bytes + first 8 bytes = 24 bytes)
# This is the most common way C# pads a 3DES Key
key = md5_hash + md5_hash[:8]
# 3. Decrypt
# Initialize the cipher, ECB mode, PKCS7 padding (PKCS7 in pycrypto)
cipher = DES3.new(key, DES3.MODE_ECB)
ciphertext = base64.b64decode(ciphertext_base64)
# Decrypt and strip padding
try:
decrypted_padded = cipher.decrypt(ciphertext)
# Try removing padding with PKCS7
decrypted = unpad(decrypted_padded, DES3.block_size, style='pkcs7')
print("Decryption succeeded (PKCS7):")
print(decrypted.decode('utf-8'))
except ValueError:
# If PKCS7 fails, try NoPadding (some old programs don't pad)
print("PKCS7 failed, showing raw data:")
print(decrypted_padded)
Clearly that's Python, and I'm not much good at Python either. Then I remembered online Python runners exist. Paste the code, hit run, and out came the connection string.
Here's the funny part: the original connection string was completely unremarkable — no special handling at all, exactly what I would have written myself.
So I swapped in a new database address, username, password, and database name, and hit the next wall. I asked Qwen and Doubao to encrypt it back using the key, and every attempt failed.
Reading the error output told me why: the encryption routine lives on the F: drive of the development company's computer. There was no way on earth I was getting at that.
Which meant it was time for something AI can't replace a human for.
I dropped the database and the user, then rebuilt both — with exactly the same names as before. Then I opened the server's hosts file and forced the original database address to resolve to 127.0.0.1. Now, any request to the old database address would land on the local one instead.
I committed a small act of fraud inside the server. From a security standpoint, you'd call it DNS hijacking.
The site tested fine. The client's original server was powered off, and it still tested fine. Migration complete.
Data migration isn't really difficult — it's arguably what I'm best at. Editing hosts is routine too; plenty of testing scenarios call for it. What made this one interesting was the combination: an unfamiliar C# codebase, encryption in the way, and a developer who wouldn't cooperate. Two ordinary tricks stacked together, and the result was more than the sum of its parts.
For years I avoided writing about technical work on my own site, for two reasons.
First, I never thought my skills were anything special. The occasional flash of insight was usually just two common operations combined in a way that looked clever from the outside.
Second, I saw the site as a record of my life, not my job.
But the situation has shifted. In earlier years I was handling something like 500+ server issues a year. At that volume, documentation didn't matter — repetition made everything routine, and there was nothing I couldn't handle. These days, the jobs that reach me tend to be slightly more complicated, and each one is a one-off. Which means if I don't write it down, I'll probably forget it entirely.
On top of that, the line between work and life has blurred. When I worked for someone else, the boundary was clear. Now the company is mine, and the two bleed into each other. I used to never work from my desktop at home — that machine existed purely for games. These days I'm often working from home, and that boundary is long gone.
So I retired the reading-notes category and added a technical-notes one instead. I run into hard problems far more often than I finish books, mostly because I don't read books anymore.