Skip to content

Instantly share code, notes, and snippets.

@jakerullman
Last active January 17, 2017 19:30
Show Gist options
  • Save jakerullman/fd37f28d20904f57d648 to your computer and use it in GitHub Desktop.
Save jakerullman/fd37f28d20904f57d648 to your computer and use it in GitHub Desktop.
look like you're busy
#!/bin/bash
collect()
{
while read line;do
if [ -d "$line" ];then
(for i in "$line"/*;do echo $i;done)|sort -R|collect
echo $line
elif [[ "$line" == *".h" ]];then
echo $line
fi
done
}
sse="$(awk '/flags/{print;exit}' </proc/cpuinfo|grep -o 'sse\S*'|sed 's/^/-m/'|xargs)"
flags=""
pd="\\"
while true;do
collect <<< /usr/include|cut -d/ -f4-|
(
while read line;do
if [ "$(dirname "$line")" != "$pd" ];then
x=$((RANDOM%8-3))
if [[ "$x" != "-"* ]];then
ssef="$(sed 's/\( *\S\S*\)\{'"$x,$x"'\}$//' <<< "$sse")"
fi
pd="$(dirname "$line")"
opt="-O$((RANDOM%4))"
if [[ "$((RANDOM%2))" == 0 ]];then
pipe=-pipe
fi
case $((RANDOM%4)) in
0) arch=-m32;;
1) arch="";;
*) arch=-m64;;
esac
if [[ "$((RANDOM%3))" == 0 ]];then
gnu="-D_GNU_SOURCE=1 -D_REENTRANT -D_POSIX_C_SOURCE=200112L "
fi
flags="gcc -w $(xargs -n1 <<< "opt pipe gnu ssef arch"|sort -R|(while read line;do eval echo \$$line;done))"
fi
if [ -d "/usr/include/$line" ];then
echo $flags -shared $(for i in /usr/include/$line/*.h;do cut -d/ -f4- <<< "$i"|sed 's/h$/o/';done) -o "$line"".so"
sleep $((RANDOM%2+1))
else
line=$(sed 's/h$//' <<< "$line")
echo $flags -c $line"c" -o $line"o"
sleep 0.$((RANDOM%4))
fi
done
)
done
#!/usr/bin/python3
import random
import time
first_level_dirs = ['main', 'home', 'usr', 'root', 'html', 'assets', 'files']
title_descs = ['page', 'script', 'interface', 'popup']
id_names = ['container', 'main', 'textbox', 'popup']
tag_names = ['div', 'textarea', 'span', 'strong', 'article', 'summary', 'blockquote', 'b']
autoclosing_tags = ['br', 'input']
def random_js_line():
return random.choice([
' $("#%s").html("<b>" + $("#%s").text() + "</b>");' % (random.choice(id_names), random.choice(id_names)),
' $.get("t_%i.txt", function(resp) {\n callback(resp);\n });' % (int(random.random() * 50)),
' $("%s>%s").css({width: %i + "px", height: %i + "px"});' % (random.choice(tag_names), random.choice(tag_names), int(random.random() * 75), int(random.random() * 75)),
' for (var i = 0; i < count; i++) {\n $("<div>").appendTo("#%s");\n }' % (random.choice(id_names))
])
def random_js_lines():
lines = [random_js_line() for _ in range(int(random.random() * 14) + 1)]
return '\n'.join(lines)
def random_html_line():
tag_name = random.choice(tag_names)
return random.choice([
' <%s>id: %i</%s>' % (tag_name, int(random.random() * 1000), tag_name),
' <%s class="%s">\n <%s/>\n </%s>' % (tag_name, random.choice(first_level_dirs), random.choice(autoclosing_tags), tag_name),
' <div id="%s"></div>' % (random.choice(first_level_dirs))
])
def random_html_lines():
lines = [random_html_line() for _ in range(int(random.random() * 9) + 1)]
return '\n'.join(lines)
while True:
print('creating /%s/%i.html' % (random.choice(first_level_dirs), int(random.random() * 1000)))
time.sleep(random.random())
lines = [
'<!DOCTYPE html>',
'<html lang="en">',
' <head>',
' <title>%s #%i</title>' % (random.choice(title_descs), int(random.random() * 100)),
' <script type="text/javascript" src="/js/assets/jquery.min.js"></script>',
' <script type="text/javascript">',
random_js_lines(),
' </script>',
' </head>',
' <body>',
random_html_lines(),
' </body>',
'</html>'
]
lines = [single_line for linegroup in lines for single_line in linegroup.split('\n')]
for line in lines:
print(line)
time.sleep(random.random() / 10)
print()
time.sleep(random.random() / 2)
#/bin/bash
# prints the contents of every file identified as text in /var/log/ line by line, with random delays
if [ "$EUID" -ne 0 ]
then
echo "Please run as root to be hackerish."
exit
fi
# turn off globbing
set -f
# split on newlines only for for loops
IFS='
'
for log in $(find /var/log -type f); do
# only use the log if it's a text file; we _will_ encounter some archived logs
if [ `file $log | grep -e text | wc -l` -ne 0 ]
then
echo $log
for line in $(cat $log); do
echo $line
# sleep for a random duration between 0 and 1/4 seconds to indicate hard hackerish work
bc -l <<< $(bc <<< "$RANDOM % 10")" / 40" | xargs sleep
done
fi
done
hexdump -C /dev/urandom | pv -q -L 2k
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment