how to make this "action-packed, random data" being echoed in a terminal?
OK, this isn't really a question to achieve anything practical, but still it is a serious question and I hope it will be taken seriously and mods won't punish me for this :)
I'm sure majority of you have seen some good action movie, where CIA or FBI or hackers or any other "pc nerds" are "retrieving some information" and when they actually show their screens/monitors/desktops, there is a lot of random data being displayed and it's just so thrilling :D
So, we're shooting a movie and I need to reconstruct such a scene. My OS is ubuntu 10.10.
I think i've read somewhere on the internet once that shell can actually be recorded and then played back, but I'm not sure how it worked.
Basically, any script/program/code/solution which does the trick is very well welcome.
If there's anyone who could come up with a solution, it would be so cool!
Let's make this fun, shall we?
BOUNTY EDIT: Still need some more ideas, so I'm offering a bounty for 开发者_StackOverflow社区the best new upcoming idea.
There's a utility call script
(ironically) that does what you're talking about. It can even record timing data so the playback is done at the same rate the original actions were performed.
To start recording and capture timing data:
$ script -t script.out 2>timing.out
When you're finished, enter exit
.
To replay the recorded session including the original timing:
$ scriptreplay timing.out script.out
Edit:
You can simulate typing or slow dialup data transmission using the pv
utility. The command below will output the file at 37 characters per second (roughly approximating a 300 baud modem).
pv -q -L 37 somefile
Here's another idea:
hexdump -C /dev/urandom | pv -q -L 1200
This gives Matrix-like output on the screen:
#!/bin/bash
printf "\e[32m\n"
while :
do
for i in {1..16}
do
((r = $RANDOM % 2))
if (($RANDOM % 5 == 1))
then
if (($RANDOM % 4 == 1))
then
v+="\e[1m $r "
else
v+="\e[2m $r "
fi
else
v+=" "
fi
done
printf "$v\n"
v=""
done
for a lot of people dmesg
output will look like rocket science. For those who know, it will be much fun.
update: a small script to slow things down. update 2: simplified the code and made it more economical:
#!/bin/bash
while read line
do
echo "$line"
sleep 0.1
done < /var/log/dmesg
I think it really depends on /what/ you are trying to portray. Showing a computer programmer (code) is different then showing a hacker which is different than the matrix which is different then showing an FBI database lookup.
That said, two possible ideas:
One, try downloading and compiling some huge project, like gcc or firefox. Generally, you just install "build-essentials", download the source code tar.gz file from the site and run "./configure && make" in the source directory you extraced from the tar.
Another possible way is "tracepath www.google.com"
Or just print some random numbers periodically:
for k in {1..100} ; do echo -e $RANDOM"\t": $RANDOM$RANDOM; sleep 0.2; done
Set 100 to 10 or 1000 to get less or more results, set sleep to smaller numbers to speed things up.
Here is an enhanced version, which intermixes Strings from a dictionary.
First you have to search for a dictionary like that:
ls -lh $(locate dict) | grep M
This will search for the word 'dict' in path/filename, and print a lot of unwanted stuff. We try to filter just files which are in MB-Range, but some smaller files in HTML-dirs will be displayed too. I picked a german dict, because it was the only bigger one, for testing. You pick yours.
We look how long the dict is, to pick lines by random:
DICT=/usr/share/dict/ngerman
lines=$(wc -l $DICT | awk '{print $1}')
for k in {1..100}
do
row=$((RANDOM%lines));
word=$(sed -n ${row}p $DICT)
echo -e $RANDOM"\t": $RANDOM$RANDOM":\t:"$word
sleep 0.2
done
modify lines and sleep-time (seconds) to your needs.
If you put all that in a script, you don't need to record/replay it, but can restart it as you need.
You could emulate a real session, there is nothing I hate more then watching a movie where the commands entered are completely bogus.
One movie that impressed me is the shell history that is shown in "Tron: Legacy", it actually makes sense, the only issue I could pick other then a few minor syntax issues was that the PC was supposed to be 20+ years old, but had xorg clearly running in the top list.
Decide what your actor is trying to portray, eg, is he hacking a server? then emulate the basics of that, eg.
- Types "nmap -vA secure.fbi.top.secret.com"
- Waits for portscan to complete
- Notice that its running an vulnrable version of proftpd
- Pretend to start a netcat client running in another terminal window
- Execute a seemingly malicious command "echo -e "\x2d\x64\xf7...more random hex" | telnet secure.fbi.top.secret.com"
- Second terminal now magically shows a root prompt "[root@secure.fbi.top.secret.com]#"
- Actor now closes the first terminal and uses the new terminal to do stuff, say query a mysql table of fake credit card information, so real commands, just on bogus data.
As long as you dont stoop to the level of that horrid movie "Firewall" with Harrison Ford, you should be right.... i mean, c'mon, an ipod + scanner on the screen, seriously.
Hey man, I know I come after the blow, but anyway: I don't know if you already heard of it, but I guess you could take a look a http://hackertyper.net/ .
It's basically a website where you choose a source code (from the linux kernel or anything you upload to it), and the script on this site will write 5 or 6 characters of the source code on screen each time you hit the keyboard.
It's actually pretty fun to try :)
How to make this “action-packed, random data” being echoed in a terminal?
Though the movie input is probably passed, those that are still looking for something along these lines can check out the hollywood package, or here on github. It is a very detailed busy screen for the terminal available on Linux. Should be filed with some serious inspiration for OS X fans as well.
Sometimes we see a wordwise output, which looks very technically - if you think of 'technical' as 'artificial'.
#!/bin/bash
while read line
do
for c in $(echo "$line")
do
echo $c" "
sleep 0.1
done
echo
done < ./somefile
It is slow enough to make it possible to read the text - so the content should not be too obviously some random logfile. :)
Of course you can play with the delay time, increase, decrease it, or let a random function choose the value:
sleep 0.1$((RANDOM % 100))
Honestly, go with the easy options. The good thing about any of these ideas is that they can be repeated for each actual take, and you can even have the actor type and execute the command on-camera. Remember, if you want any command to stop part-way through (i.e if you want an explicit cue for the actor to 'discover' something in the data on-screen) then have them press Ctrl+C
.
Command:
find /
Output: A listing of every file on the system. Ridiculously fast.
Command:
cat /dev/urandom
Output: Pure pseudorandom data. Lots of question mark symbols though, because generally your terminal's character set won't support a randomly generated code point. You might have more luck if you have full Unicode/wide-character support in your terminal (including font) though.
EDIT: Just read in a comment that you want it to be a lot slower. Maybe this will work:
cat /dev/random
You get a small number of random bits every so often. No plaintext though.
cat /proc/<something>
There can be some stuff here which is totally legit-looking, formatted data, and you can scroll through it and go a-HA! as if you found something.
ls -R <directory>
Recursive directory listings are fun. Alternatively, something else I could do with this was wrap the call in backticks, like so:
`ls -R /`
And then I would every so often see a message from ls saying it was skipping already-listed directories (it does that when it runs into symlinks and things, for example), rather than the full millions-of-lines listing. So it wasn't predictable flying-at-the-speed-of-light text, but it wasn't predictable text-every-half-a-second either.
Also, if you want to record your desktop in Ubuntu, sudo apt-get install xvidcap
. Xvidcap is a neat little open-source utility for recording screencasts. Info and video tutorials are available on the project's website here.
精彩评论