这似乎是一个奇怪的问题,但是您会用什么来创建典型的好莱坞黑客场景?
我从朋友那里得到了这个请求,我的大脑一片空白。我能想到的只有《黑客帝国》等电影中的所有 nmap 场景。
但这需要在带有默认 OSX 的 Mac 上完成,我认为这是 *nix 的某种风格,对吧?他们无法访问互联网,因此不可能使用外部工具进行准备。
我正在考虑将相当于 /var/log/messages 的内容写到屏幕上......
Chr*_*own 34
如果您询问如何一次将一个字符打印到屏幕上(好莱坞电影中常见的“黑客”风格),以下脚本就足够了(它需要来自 的输入stdin)。
在bash:
#!/bin/bash
while IFS= read -r line; do
length="${#line}"
bol=1
for (( offset = 0 ; offset < length ; offset++ )); do
char="${line:offset:1}"
printf '%s' "$char"
if (( bol )) && [[ "$char" == " " ]]; then
continue
fi
bol=0
sleep 0.05
done
if (( length == 0 )); then
sleep 0.$(( RANDOM % 3 + 2 ))
else
sleep 0.$(( RANDOM % 7 + 3 ))
fi
printf '\n'
done
Run Code Online (Sandbox Code Playgroud)
或者,一个更简单的 C 版本:
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int main(void) {
char buf[1];
int len;
while ((len = read(STDIN_FILENO, buf, sizeof(buf))) > 0) {
if (write(STDOUT_FILENO, buf, len) != len) {
perror("write");
return EXIT_FAILURE;
}
usleep(50000);
}
if (len != 0) {
perror("read");
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
Run Code Online (Sandbox Code Playgroud)
如果您想dmesg用作输入,例如:
dmesg | hollywood
Run Code Online (Sandbox Code Playgroud)
Wie*_*err 14
export GREP_COLOR='1;32'; cat /dev/urandom | hexdump -C | grep --color=auto "ca fe"
Run Code Online (Sandbox Code Playgroud)
这(以及来自http://www.commandlinefu.com/commands/view/6663/pretend-to-be-busy-in-office-to-enjoy-a-cup-of-coffee 的其他命令)也似乎非常, ,hackish'' 并让大多数在特定时刻盯着终端的人感到困惑;)
dmesg。