From the Canyon Edge -- :-Dustin
Showing posts with label tmux. Show all posts
Showing posts with label tmux. Show all posts

Wednesday, December 17, 2014

Hollywood Technodrama -- There's an App for that!



Wargames.  Hackers.  Swordfish.  Superman 3.  Jurassic Park.  GoldenEye.  The Matrix.

You've all seen the high stakes hacking scene, packed with techno-babble and dripping in drama.  And the command and control center with dozens of over-sized monitors, overloaded with scrolling text...

I was stuck on a plane a few weeks back, traveling home from Las Vegas, and the in flight WiFi was down.  I know, I know.  Real world problems.  Suddenly, I had 2 hours on my hands, without access to email, IRC, or any other distractions.

It's at this point I turned to my folder of unfinished ideas, and cherry-picked one that would take just a couple of fun hours to hack.  And I'm pleased to introduce the fruits of that, um, labor -- the hollywood package for Ubuntu :-)  Call it an early Christmas present!  All code is on both Launchpad and Github.


If you're already running Vivid (Ubuntu 15.04) -- I salute you! -- and you can simply:

sudo apt-get install hollywood

If you're on any other version of Ubuntu, you'll need to:

sudo apt-add-repository ppa:hollywood/ppa
sudo apt-get update
sudo apt-get install hollywood

Fire up a terminal, maximize it, open byobu, and run the hollywood command.  Then sit back and soak into the trance...

I recently jumped on the vertical monitor bandwagon, for my secondary display.  It's fantastic for reading and writing code.  It's also hollywood-worthy ;-)


How does all of this work?

For starters, it's all running in a Byobu (tmux) session, which enables us to split a single shell console into a bunch of "panes" or "splits".

The hollywood package depends on a handful of utilities that I found (mostly apt-cache searching the Ubuntu archives for monitors and utilities).  You can find a handful of scripts in /usr/lib/hollywood/.  Each of these is a "driver" for a widget that might run in one of these splits.  And ccze is magical, accepting input on stdin and colorizing the text.

In fact, they're quite easy to write :-)  I'm happy to accept contributions of new driver widgets, as long as you follow a couple of simple rules.  Each widget:
  • Must run as a regular, non-root user
  • Must not eat all available CPU, Disk, or Memory
  • Must not write data
  • Must run indefinitely, until receiving a Ctrl-C
  • Must look hollywood cool!
So far, we have widgets that: generate passphrases encoded in NATO phonetic, monitor and render network bandwidth, emulate The Matrix, find and display, with syntax highlighting, source code on the system, show a bunch of error codes, hexdump a bunch of binaries, monitor some processes, render some images to ASCII art, colorize some log files, open random manpages, generate SSH keys and show their random art, stat a bunch of inodes in /proc and /sys and /dev, and show the tree output of some directories.

I also grabbed a copy of the Mission Impossible theme song, licensed under the Creative Commons.  I played it in the Totem music player in Ubuntu, with the Monoscope visual effect, and recorded a screencast with gtk-recordmydesktop.  I then mixed the output .ogv file, with the original .mp3 file, and transcoded it to mp4/h264/aac, reducing the audio bitrate to 64k and frame size to 128x96, using this command:
avconv -i missionimpossible.ogv -i MissionImpossibleTheme.mp3 -s 128x96 -b 64k -vcodec libx264 -acodec aac -f mpegts -strict experimental -y mi.mp4

Then, hollywood plays it in one of the splits with mplayer's ascii art video output on the console :-)

DISPLAY= mplayer -vo caca /usr/share/hollywood/mi.mp4

Sound totally cheesy?  Why, yes, it is :-)  That's the point :-)

Oh, and by the way...  If you ever sit down at someone else's Linux PC, and want to freak them out a little, just type:

ubuntu@x230:~⟫ PS1="root@$(hostname):~# "; clear 
root@x230:~# 

And then have fun!
That latter "hack", as well as the entire concept of hollywood is inspired in part by Kees Cook's awesome talk, in particular his "Useless Hollywood Drama Mode" in his exploit demo.
Happy hacking!
:-Dustin

Tuesday, July 19, 2011

Byobu 4.18 released, getting close to tmux profiles ;-)

Howdy!

I just released and uploaded Byobu 4.18 to the PPA for older Ubuntu releases and to Ubuntu Oneiric.  I'm very close to having profiles for tmux, as per the feedback to this post a few weeks ago.

In moving that direction, I needed to refactor Byobu's status framework, such that it could be usable by both Screen and Tmux.  So I created a byobu-statusd daemon that gathers and updates status as it expires, caching it in a run directory in tmpfs.  This has the really nice side effect that it should be much more efficient and less resource intensive, involving hundreds of fewer shell forks per minute.  Thanks to Scott Moser for some of the code and much help along the way!

That said, a lot of code has changed with byobu-4.18.  Please, please, please test it and report bugs in the usual location in Launchpad:

Thanks,
:-Dustin

Sunday, June 19, 2011

Anyone interested in Byobu profiles for Tmux?

Last week, my friend and colleague Gustavo Niemeyer introduced me to tmux, modern alternative to GNU Screen.  While I had heard of tmux before, I had never used it.  I spent a few hours this week getting familiar with a handful of how-to tutorials, testimonials of people who have switched from screen to tmux, and of course, the manpage itself.

The short of it is -- I'm really damn impressed!  It seems like a feature-filled terminal multiplexer, with an vibrant community, active developer base, and regular releases.

To get my feet wet this weekend, I started by duplicating many of Byobu's keybindings in my ~/.tmux.conf.  I had to learn a bit about tmux to accomplish that (and even write one trivial patch against tmux to get it working better with gnome-terminal).  You can find my Byobu-like ~/.tmux.conf here, which I've committed to the Byobu source tree and installing from the Byobu PPA packages in /usr/share/byobu/profiles/tmux.  While I have most of the keybindings working, I have not ported over any of the byobu-status scripts yet.  (I'm still thinking about the best way to go about doing that so that they could work with both screen and tmux.)

So I'm curious...
  1. Any Ubuntu/tmux users out there?
  2. Anyone interested in being able to use Byobu's goodness (keybindings, live status information) with tmux (in addition to screen)?

:-Dustin

Printfriendly