Linux Fu: Pimp Your Pipes

One of the best things about working at the Linux (or similar OS) command line is the use of pipes. In simple terms, a pipe takes the output of one command and sends it to the input of another command. You can do a lot with a pipe, but sometimes it is hard to work out the right order for a set of pipes. A common trick is to attack it incrementally. That is, do one command and get it working with the right options and inputs. Then add another command until that works. Keep adding commands and tweaking until you get the final results.

That’s fine, but [akavel] wanted better and used Go to create “up” — an interactive viewer for pipelines.

Pipe Philosophy

Pipes can do a lot. They match in with the original Unix philosophy of making each tool do one thing really well. Pipe is really good at allowing Linux commands to talk to each other. If you want to learn all about pipes, have a look at the Linux Info project’s guide. They even talk about why MSDOS pipes were not really pipes at all. (One thing that write up doesn’t touch on is the named pipe. Do a “man fifo” if you want to learn more for now and perhaps that will be the subject of a future Linux Fu.)

This program — called up — continuously runs and reruns your pipeline as you make changes to the pipe. This way, every change you make is instantly reflected in the output. Here’s the video, here’s a quick video which shows off the interactive nature of up.

Installing

The GitHub page assumes you know how to install a go program. I tried doing a build but I didn’t have a few dependencies. Turns out the easy way to do it was to run this line:

go get -u github.com/akavel/up

This put the executable in ~/go/bin — which isn’t on my path. You can, of course, copy or link it to some directory that’s on your path or add that directory to your path. You could also set an alias, for example. Or, like I did in the video, just specify it every time.

Perfect?

This seems like a neat simple tool. What could be better? Well, I was a little sad that you can’t use emacs or vi edit keys on the pipeline, at least not as far as I could tell. This is exactly the kind of thing where you want to back up into the middle and change something. You can use the arrow keys, though, so that’s something. I also wished the scrollable window had a search feature like less.

Otherwise, though, there’s not much to dislike about the little tool. If writing a pipeline is like using a C compiler, up makes it more like writing an interactive Basic program.

Better 3D Printing Through Magnets

Just like Goldilocks found some porridge too hot and some too cold, 3D printers often have beds that don’t stick well enough or stick too well. A few weeks ago I switched two of my three printers to use magnetic beds and thought I’d share with you how that worked out. Spoiler alert: like most things it has its plusses and minuses.

It isn’t a secret that 3D printing is not a plug-and-play operation, especially at the price most of us are willing to pay for printers. There are lots of variables to get right: temperature, speeds, bed leveling, and a bunch of other things. However, one of the things that vexes many people is the relationship between getting that first layer to stick and being able to get the print off the bed when you are done. It is hard to find a happy medium. If the first layer won’t stick, you print is doomed. If the first layer sticks too well, you are likely to damage the part or your fingers getting it removed. I switched to BuildTak surfaces long ago, and many people like PEI. But it is sometimes hard to get a big part removed. A few weeks ago, I took the plunge and bought some magnetic build surfaces for two of my printers. These were “no name” inexpensive affairs from Ali Express.

The idea is simple. There are two sheets that look like a rubberized plastic and have magnetic properties. One piece has some 3M adhesive on the back. The other has one surface that resembles BuildTak. Once you glue down the one sheet you leave it alone. Then you put the other sheet on top and print on it. When you are done, you can pull the sheet out and flex it to pop the print off. That’s the theory, anyway. Continue reading “Better 3D Printing Through Magnets”

Video Quick Bit: The Best DIY Musical Instruments

The Hackaday Prize is almost over, and soon we’ll know the winners of the greatest hardware competition on the planet. A few weeks ago, we wrapped up the last challenge in the Hackaday Prize, the Musical Instrument Challenge. This is our challenge to build something that goes beyond traditional music instrumentation. Majenta’s back again looking at the coolest projects in the Musical Instrument Challenge in the Hackaday Prize.

We’re old-school hardware hackers here, and when you think about building your own drum machine, there’s really nothing more impressive than building one out of an Atari 2600. That’s what [John Sutley] did with his Syndrum project. It’s a custom cartridge for an Atari with a fancy ZIF socket. Of course, you need some way to trigger those drum sounds, so [John] is using an Arduino connected to the controller port as a sort-of MIDI-to-Joystick bridge.

If you want more retro consoles turned into musical instruments, look no further than [Aristides]’ DMG-01 Ukulele. It’s a ukulele with a 3D printed neck, bolted onto the original ‘brick’ Game Boy. Yes, it works as a ukulele, but that’s not the cool part. There are electronics inside that sense each individual string and turn it into a distorted chiptune assault on the ears. Just awesome.

How about a unique, new musical instrument? That’s what [Tim] is doing with Stylish!, a wearable music synthesizer. It’s based heavily on a stylophone, but with a few interesting twists. It’s built around an STM32, so there are a lot of options for what this instrument sounds like, and it’s all wrapped up in a beautiful enclosure. It’s some of the best work we’ve seen in this year’s Musical Instrument Challenge.

The Hackaday Prize is almost over, and on Saturday we’ll be announcing the winners at this year’s Hackaday Superconference. Tune in to the live stream to see which project will walk away with the grand prize of $50,000!

Apple Kernel Code Vulnerability Affected All Devices

Another day, another vulnerability. Discovered by [Kevin Backhouse], CVE-2018-4407 is a particularly serious problem because it is present all throughout Apple’s product line, from the Macbook to the Apple Watch. The flaw is in the XNU kernel shared by all of these products.

This is a buffer overflow issue in the error handling for network packets. The kernel is expecting a fixed length of those packets but doesn’t check to prevent writing past the end of the buffer. The fact Apple’s XNU kernel powers all their products is remarkable, but issues like this are a reminder of the potential downside to that approach. Thanks to responsible disclosure, a patch was pushed out in September.

Anatomy of a Buffer Overflow

Buffer overflows aren’t new, but a reminder on what exactly is going on might be in order. In low level languages like C, the software designer is responsible for managing computer memory manually. They allocate memory, tagging a certain number of bytes for a given use. A buffer overflow is when the program writes more bytes into the memory location than are allocated, writing past the intended limit into parts of memory that are likely being used for a different purpose. In short, this overflow is written into memory that can contain other data or even executable code.

With a buffer overflow vulnerability, an attacker can write whatever code they wish to that out-of-bounds memory space, then manipulate the program to jump into that newly written code. This is referred to as arbitrary code execution. [Computerphile] has a great walk-through on buffer overflows and how they lead to code execution.

This Overflow Vulnerabilty Strikes Apple’s XNU Kernel

[Kevin] took the time to explain the issue he found in further depth. The vulnerability stems from the kernel code making an assumption about incoming packets. ICMP error messages are sent automatically in response to various network events. We’re probably most familiar with the “connection refused’ message, indicating a port closed by the firewall. These ICMP packets include the IP header of the packet that triggered the error. The XNU implementation of this process makes the assumption that the incoming packet will always have a header of the correct length, and copies that header into a buffer without first checking the length. A specially crafted packet can have a longer header, and this is the data that overflows the buffer.

Because of the role ICMP plays in communicating network status, a closed firewall isn’t enough to mitigate the attack. Even when sent to a closed port, the vulnerability can still trigger. Aside from updating to a patched OS release, the only mitigation is to run the macOS firewall in what it calls “stealth mode”. This mode doesn’t respond to pings, and more importantly, silently drops packets rather than sending ICMP error responses. This mitigation isn’t possible for watchOS and iOS devices.

The good news about the vulnerability is that a packet, malformed in this way, has little chance of being passed through a router at all. An attacker must be on the same physical network in order to send the malicious packet. The most likely attack vector, then, is the public WiFi at the local coffee shop.

Come back after the break for a demonstration of this attack in action.

Continue reading “Apple Kernel Code Vulnerability Affected All Devices”

This Weekend: The Greatest Hardware Conference

The Hackaday Superconference is this weekend and it’s the greatest hardware con on the planet. Tickets are completely sold out, but you can still get in on the fun by watching the livestream and joining Supercon chat.

For everyone who will be here in person, the entire Hackaday crew is busy as beavers preparing for your arrival. We’re assembling badges, rigging AV for the talks, stuffing goodie bags, calling caterers, and taping cables to the floor. This is by far the biggest Superconference yet.

Doors open at 9 am Friday at the Supplyframe HQ. This is your first chance to get your hands on the fantastic Supercon Badge that’s a freakin’ computer. The day is filled with badge hacking, workshops, badge talks, and a launch party. [Rich Hogben] and [Andrew Bakhit] will be doing live IDM sets on Friday night, as we celebrate into the wee hours of the morning.

Saturday, doors open at 9 am over at the Supplyframe Design Lab as we turn on the livestream and get the main event under way with over 50 speakers and workshops. Badge hacking continues throughout the weekend, and this year we’ve added the SMD Soldering Challenge to the fun. There will be meetups during Supercon; the Tindie meetup and the amateur radio meetup are both Saturday at 1 pm.

Subscribe to Hackaday on YouTube and follow us on Facebook to keep up with everything going on.

Ask Hackaday: What Are Your Less Extreme Brain Hacks?

Kahn — perhaps Star Trek’s best-hated villain — said: “Improve a mechanical device and you may double productivity, but improve man and you gain a thousandfold.” In fact, a lot of hacking effort goes into doing just that. Your phone has become an extension of your memory, for example. We use glasses, cameras, and hearing aids to shore up failing senses or even give us better senses than normal. But hacking your body — or someone else’s — has always been controversial. While putting an RFID chip in your finger is one thing, would you consider having a part of your brain removed? That sounds crazy, but apparently, there is a growing interest in having your amygdala removed.

To be clear: we think this is a terrible idea. The science is shaky, at best, and we certainly wouldn’t want to be among the first to try something so radical. But why is anyone even talking about it?

The amygdala is part of your brain that causes at least some of your fear and anxiety. Get rid of your amygdala, get rid of anxiety? What’s even stranger is this the procedure — an amygdalectomy — has been going on since the 1960s! Injections of oil and wax destroy the tissue and this treatment is used for some forms of epilepsy and to manage certain aggressive behavior problems in mentally ill patients. In modern times, the procedure is not very common although it appears that it does still occur in some places. But the technology to do it does exist. There have also been documented cases where people lose their amygdala from natural causes that gives us some clues of what life would be like without one.

However, it is hard to say if these people lost fear. Most of the surgical patients were already suffering from a variety of problems. There is some evidence that the naturally occurring amygdalaless patients experienced less fear in some situations, but may experience more fear in others. They also may have other problems such as difficulty understanding social cues or making eye contact. We’re not 100% sure what the amygdala does, even disregarding potential side effects.

Continue reading “Ask Hackaday: What Are Your Less Extreme Brain Hacks?”

Oliver Heaviside: Rags To Recognition, To Madness

Like any complex topic, electromagnetic theory has its own vocabulary. When speaking about dielectrics we may refer to their permittivity, and discussions on magnetic circuits might find terms like reluctance and inductance bandied about. At a more practical level, a ham radio operator might discuss the impedance of the coaxial cable used to send signals to an antenna that will then be bounced off the ionosphere for long-range communications.

It’s everyday stuff to most of us, but none of this vocabulary would exist if it hadn’t been for Oliver Heaviside, the brilliant but challenging self-taught British electrical engineer and researcher. He coined all these terms and many more in his life-long quest to understand the mysteries of the electromagnetic world, and gave us much of the theoretical basis for telecommunications.

Continue reading “Oliver Heaviside: Rags To Recognition, To Madness”