DISARM THE B.O.M.B.!
bash, vim and dc (343)
I'm sitting at a bash prompt which has been configured by the Evil Genius, and of course he has VISUAL=vim
in the default environment. Using the default bash binding for edit-and-execute-command
(C-x C-e
) bash invokes $VISUAL
and will execute its buffer contents on exit (ZZ
). I type in the following sequence (Note: kbd-mode are commands issued in normal mode and control sequences):
C-xC-e
acat<<<45C-c4C-aaa
Now the vim buffer contains
cat<<<49a
. Continuing ...45C-c3C-aaa
54C-c41C-aaa
55C-c13C-aaa
Now the vim buffer contains
cat<<<49a48a95a68a
. Continuing ...51C-c31C-aaa
55C-c24C-aaa
44C-c43C-aaa
42C-c41C-aaa
42C-c41C-aaa
54C-c11C-aaa
55C-c25C-aaa>s
Now the vim buffer contains
cat<<<49a48a95a68a82a79a87a83a83a65a80a>s
Get out of insert mode, save and exit
C-cZZ
The
s
file now contains adc
script that generates the desired string on the stack, now we need to add print commands.C-xC-eadc<<<55C-c25C-aaa>>sC-cZZ
Repeat the above command 9 times.
C-xC-eadc<<<55C-c25C-aaa>>sC-cZZ
C-xC-eadc<<<55C-c25C-aaa>>sC-cZZ
C-xC-eadc<<<55C-c25C-aaa>>sC-cZZ
C-xC-eadc<<<55C-c25C-aaa>>sC-cZZ
C-xC-eadc<<<55C-c25C-aaa>>sC-cZZ
C-xC-eadc<<<55C-c25C-aaa>>sC-cZZ
C-xC-eadc<<<55C-c25C-aaa>>sC-cZZ
C-xC-eadc<<<55C-c25C-aaa>>sC-cZZ
C-xC-eadc<<<55C-c25C-aaa>>sC-cZZ
C-xC-eacat<<< f >>s
Execute the dc script:
C-xC-eadc sC-cZZ
Output:
PASSWORD_01
Contents of the s
file:
49a48a95a68a82a79a87a83a83a65a80a
P
P
P
P
P
P
P
P
P
P
f
Ruby, 57 + 10 (*
) = 67
$*<<4*4*5<<214%135<<44%25*5<<1%1
$><<"%cASSW%cRD%c%d1"%$*
This answer uses *
and %
to build the ASCII values of the missing characters (and 0 as Fixnum) and pushes them into $*
(ARGV
). This array is then used in combination with a format string to generate the correct password, which is printed with $><<
($>
is stdout).
Ruby, 62 + 10 (.
) = 72, no linebreak
$>.<< "%cASSW%cRD%c%d1".% %w%%<<311%231<<214%135<<321%113<<1%1
Roughly the same principle as the above version, except that here the array is built from an empty array literal (%w%%
). Some fiddling with .
is needed to get the desired operator precedence.
CJam - 24 + 10 (() = 34
"Q"c("ASSW"1$("aRD"(((T1
No additional key - 39
211 131%c"ASSW"211 132%c"RD"321 113%cT1
Try it at http://cjam.aditsu.net/