Archive for the ‘bash’ Category
Posted by jpluimers on 2026/07/09
[Wayback/Archive] A bit of perl trickery shows a great example why you should only code you understand.
It explains the innards of a classic trap luring people into execute some obfuscated code, in this case Perl based.
Which makes it yet another testament to not blindly download and execute stuff from the internet.
So be aware when you see obfuscated scripts and things luring you into:
Be even more alert when these require elevated access (like running under sudo).
Via: [Wayback/Archive] Leo Bicknell on Twitter: “@jpluimers @IanColdwater Executes “rm -rf /”. This is ancient Perl monks way of teaching people not to run programs they don’t understand as root. … But hey, these days people “curl -o – url | bash”. It’s surprising that isn’t exploited more.”
Which was response to me asking what the below code did that was fully misunderstood by ChatGPT (which is Large Language Model based on a large corpus of natural language, not a small corpus of evil red-team programming language code snippets) to a series of Tweets by Ian Coldwater.
Read the rest of this entry »
Posted in *nix, *nix-tools, ash/dash, bash, bash, CommandLine, Development, Perl, Power User, PowerShell, PowerShell, Python, RegEx, Scripting, sh, Software Development | Leave a Comment »
Posted by jpluimers on 2026/05/05
Back when I wanted a more universal solution [Wayback/Archive] bash script for $* loop accept command line with spaces in wildcard file names at DuckDuckGo I got into a mess of tips that either did not work at all, or were very convoluted.
As back then I only needed a one-time solution, I just listed the filenames with ls into a text file, did some sed and editing steps, then had each file execute in a separate step. Low tech, non-repeatable when new files appeared, but good enough.
In case I want to go for a more universal solution, below are some links to investigate further. Will likely take me hours, so most of the time this is not worth it. Maybe the subshell plus $IFS (Input Field Separators) is a good start, though it gives me a feeling that in the future it will break something else that was expecting a default $IFS value, as is using while read loop. Both types of solutions feel too convoluted. Same for the array solution below.
I might have just been spoiled with PowerShell piping objects instead of strings having made life so much easier.
Read the rest of this entry »
Posted in *nix, *nix-tools, ash/dash, bash, bash, Development, Power User, Scripting, Software Development | Leave a Comment »
Posted by jpluimers on 2026/03/11
I had to remove all text files including a -bar.txt from the current directory using bash, so I automatically typed rm *txt resulting in this nice error:
rm: illegal option -- b
usage: rm [-f | -i] [-dPRrvW] file ...
unlink file
When there was just a file named -foo.txt in the directory, the error became more interesting:
rm: illegal option -- o
usage: rm [-f | -i] [-dPRrvW] file ...
unlink file
Then it struck me: rm is one of those old tools where you can smack all options together. Read the rest of this entry »
Posted in *nix, *nix-tools, Apple, bash, Mac OS X / OS X / MacOS, Power User | Leave a Comment »
Posted by jpluimers on 2026/03/04
Dit is net zo nalatig als de Odildo hack waar alle klantgegevens mee op straat kwamen te liggen: [Wayback/Archive] Odido-router verzamelt analytics van je huishouden
Bevindingen in het kort
- De Odido-router haalt bij een nieuwe WAN-verbinding een bash-script op over een onversleutelde HTTP-verbinding.
- Je kan dit script manipuleren om een root shell op je router te krijgen.
- Als je TLS-verkeer mitm’t zie je analytics-data over de lijn gaan; de scripters hebben TLS-validatie uitgezet (`curl -k`) dus je kan dit ‘versleutelde’ analytics-verkeer inzien.
- Je router stuurt namen en MAC-adressen van devices in je huis door naar Lifemote. Verder deelt het ding de SSID’s en MAC-adressen van WiFi-netwerken in de buurt. En wat analytics-stats over je dataverbruik. Lifemote adverteert met “AI-Powered Home Wi-Fi Solutions for ISPs”. Het voelt wat vies dat zij AI’s gaan trainen met data uit mijn huishouden. Daar vind ik wat van.
--jeroen
Posted in *nix, *nix-tools, bash, bash, Development, ISP, Odido (ex Dutch T-Mobile), Power User, Python, Scripting, Software Development | Leave a Comment »
Posted by jpluimers on 2026/03/03
A few years back I tweeted [Wayback/Archive] Jeroen Wiert Pluimers @wiert@mastodon.social on Twitter: “@b0rk @jilles_com Acids vs bases.”

It was a kind of tongue-in-cheek reaction (with a way better picture below) to a very valuable post by b0rk (Julia Evans) on both Twitter and Mastodon [Wayback/Archive] Julia Evans on Twitter: “bases” / [Wayback/Archive] Julia Evans: “bases title: bases # we usually…” – Mastodon for two reasons:
- There are various interpretations of bases
- Octal is very important to educate as errors introduced by its support are hard to spot even if you do know about octal.
Back to Julia’s post:
Read the rest of this entry »
Posted in *nix, *nix-tools, 68k, 8086, Assembly Language, bash, bash, C, C++, Chemistry, Conference Topics, Conferences, Development, EPS/PostScript, Event, Haskell, History, Java, Java Platform, JavaScript/ECMAScript, Jon Skeet, LifeHacker, Mathematics, PDP-11, Perl, PHP, Power User, Python, science, Scripting, Software Development, x86 | Leave a Comment »
Posted by jpluimers on 2026/02/25
Often I need to generate passwords or uuids (on some systems called guids). I usually try to do that in a relatively platform agnostic way as I use MacOS, Windows and Linux in various mixes for many reasons (for instance that I have had developed quite hefty RSI in the early 1990s of the and the best keyboard/pointing-device combination for is the MacBook built in keyboard/touchpad combination so basically MacBooks are my window to all other operating systems).
Generating randomly with a good random number generator them makes sense as for most usage, it is important that both passwords and uuids are hard to guess which means having an entropy that is as high as possible.
A cool thing about OpenSSL is that:
- most of not all systems have it installed (it was no coincidence I published Installing OpenSSL on Windows a few days ago)
- it has a very good pseudo-random number generator and as of [Wayback/Archive] OpenSSL version 1.1.1 first released in 2018 has solved the problem around [Wayback/Archive] Random fork-safety – OpenSSLWiki, see [Wayback/Archive] Our Review of the OpenSSL 1.1.1 Random Number Generation Update – OSTIF.org.
- it supports various useful output formats
hex (hexadecimal) and base64 (next to the default of octet – or by today’s naming convention byte – output)
The easiest to generate are passwords. Yes I know that password managers can do this too, but there are some systems I cannot use them on or sync between them (don’t you love the corporate world) so my aim is to use a random password generator in a platform agnostic way which usage is easy to remember. Read the rest of this entry »
Posted in *nix, *nix-tools, Apple, base64, bash, bash, Batch-Files, Conference Topics, Conferences, Development, Encoding, Event, HEX encoding, Mac, Mac OS X / OS X / MacOS, MacBook, OpenSSL, Power User, Python, Scripting, Software Development, Windows | Leave a Comment »
Posted by jpluimers on 2026/01/28
Posted in *nix, *nix-tools, bash, bash, Development, DNS, Hardware Development, Internet, Power User, Raspberry Pi, Scripting, Software Development | Leave a Comment »
Posted by jpluimers on 2025/12/24
[Wayback/Archive] See a List of All Wi-Fi Networks a Mac Has Previously Connected To
n modern versions of Mac OS, like macOS Mojave, Catalina, Sierra, OS X El Capitan, and Yosemite, you can shorten the syntax considerably as so:
defaults read /Library/Preferences/SystemConfiguration/com.apple.airport.preferences |grep SSIDString
In prior versions of Mac OS X, you can opt for the same as the above command, or use the lengthier string below with heavy regex:
Read the rest of this entry »
Posted in *nix, *nix-tools, Apple, bash, bash, Development, Mac, Mac OS X / OS X / MacOS, MacBook, Power User, Scripting, Software Development | Leave a Comment »
Posted by jpluimers on 2025/12/10
A while ago I got an error 103 using both Beyond Compare. That did not whos the connection log or error reason, but WinSCP did: it mentioned unexpected output during the logon.
I got reminded that I had already solved this error before via [Wayback/Archive] SSH login works but SFTP login doesn’t – Server Fault (thanks [Wayback/Archive] qreon and [Wayback/Archive] Paulus):
Read the rest of this entry »
Posted in *nix, *nix-tools, bash, bash, Beyond Compare, Communications Development, Development, Internet protocol suite, Power User, Scripting, SFTP, Software Development, SSH, TCP, Windows, WinSCP | Leave a Comment »
Posted by jpluimers on 2025/09/25
Perl isn’t my strength, so I was glad to find the below links that inspired me to add this bash function to my profile decoding Quote-Printable email data (for instance used by sendmail and postfix to store SMTP message files):
# https://superuser.com/questions/1452249/fix-revert-wrong-encoding-of-file
function sendmail-decode-quoted-printable-from-stdin() {
perl -0777 -ne 'use MIME::QuotedPrint; print decode_qp($_)'
}
Read the rest of this entry »
Posted in *nix, *nix-tools, bash, bash, Development, Perl, Power User, Python, Scripting, sendmail, Software Development | Leave a Comment »