Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
ElfQrin authored Jan 27, 2017
1 parent 3d94ad4 commit 054e3dc
Show file tree
Hide file tree
Showing 2 changed files with 123 additions and 0 deletions.
64 changes: 64 additions & 0 deletions _bash_profile
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# /root/.bash_profile

# BASH Shell Start-up
# r2017-01-23 fr2016-10-18
# by Valerio Capello - http://labs.geody.com/ - License: GPL v3.0

# Get Terminal Window Size
COLUMNS="$(tput cols)"; LINES="$(tput lines)";

# Prompt
export PS1="\[\e[1;32m\][\$(date +%Y-%m-%d\ %H:%M:%S\ %a)] \u@\h:\w\\\$\[\e[0m\] "

# History Date Format
export HISTTIMEFORMAT="%F %T "

# Aliases
alias l="ls -laF --color=auto"
alias d="ls -aF --color=auto"

# Message
echo; clear
date "+%a %d %b %Y %H:%M:%S %Z (UTC%:z)"
echo -n "Hello "; echo -ne "\033[0;33m"; echo -n "$(whoami)"; echo -ne "\033[0m";
echo -n " ("; echo -ne "\033[0;33m"; echo -n "`echo $SSH_CLIENT | awk '{print $1}'`"; echo -ne "\033[0m)";
echo -n ", ";
echo -n "welcome to "; echo -ne "\033[0;33m"; echo -n "$(hostname)"; echo -ne "\033[0m";
echo -n " ("; echo -ne "\033[0;33m"; echo -n "$(hostname -i)"; echo -ne "\033[0m)";
echo -n ". ";
echo -n "Machine ID: "; echo -n "$(cat /etc/machine-id)";
if [ $EUID -eq 0 ]; then
echo; echo -ne "\033[0;31m"; echo -n "You have ROOT superpowers!"; echo -e "\033[0m";
else
echo
fi
echo "Your Terminal Window Size: $COLUMNS x $LINES"
echo

# Software version
uname -a
echo "Bash version: $BASH_VERSION"
# Webserver version
echo -n "$(/usr/sbin/apache2 -v|head --lines=1) "; echo "$(/usr/sbin/apache2 -v|tail --lines=1)";
php -v|head --lines=1
mysql -V
echo

# System status
echo -n "CPU: "; grep "model name" /proc/cpuinfo
grep MemTotal /proc/meminfo
df -P -h | nawk '0+$5 >= 90 {print "FS: "$1" ("$6") Size: "$2" Used: "$3" (\033[1;31m"$5"\033[0m) Free: "$4" (\033[1;31m"(100-$5)"%\033[0m)";}'
echo; echo -n "Uptime: "; uptime
echo

# Users
echo "Last logged users:"; last -n 5
echo; echo "Currently logged users:"; who
echo; echo -n "Current user: "; id
echo

# Security
# Shellshock vulnerability check (reports to root only)
if [[ $EUID -eq 0 ]]; then
env x='() { :;}; echo Bash vulnerable to Shellshock' bash -c 'echo -n'
fi
59 changes: 59 additions & 0 deletions systatus.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/bin/bash

# BASH Systatus
# r2017-01-23 fr2016-10-18
# by Valerio Capello - http://labs.geody.com/ - License: GPL v3.0

# Get Terminal Window Size
COLUMNS="$(tput cols)"; LINES="$(tput lines)";

# Message
echo
date "+%a %d %b %Y %H:%M:%S %Z (UTC%:z)"
echo -n "Hello "; echo -ne "\033[0;33m"; echo -n "$(whoami)"; echo -ne "\033[0m";
echo -n " ("; echo -ne "\033[0;33m"; echo -n "`echo $SSH_CLIENT | awk '{print $1}'`"; echo -ne "\033[0m)";
echo -n ", ";
echo -n "this is "; echo -ne "\033[0;33m"; echo -n "$(hostname)"; echo -ne "\033[0m";
echo -n " ("; echo -ne "\033[0;33m"; echo -n "$(hostname -i)"; echo -ne "\033[0m)";
echo -n ". ";
echo -n "Machine ID: "; echo -n "$(cat /etc/machine-id)";
if [ $EUID -eq 0 ]; then
echo; echo -ne "\033[0;31m"; echo -n "You have ROOT superpowers!"; echo -e "\033[0m";
else
echo
fi
echo "Your Terminal Window Size: $COLUMNS x $LINES"
echo

# Software version
uname -a
echo "Bash version: $BASH_VERSION"
# Webserver version
echo -n "$(/usr/sbin/apache2 -v|head --lines=1) "; echo "$(/usr/sbin/apache2 -v|tail --lines=1)";
php -v|head --lines=1
mysql -V
echo

# System status
echo -n "CPU: "; grep "model name" /proc/cpuinfo
echo
# grep MemTotal /proc/meminfo
# egrep 'Mem|Cache|Swap' /proc/meminfo
free -h
echo
df -h
# df -P -h | nawk '0+$5 >= 90 {print "FS: "$1" ("$6") Size: "$2" Used: "$3" (\033[1;31m"$5"\033[0m) Free: "$4" (\033[1;31m"(100-$5)"%\033[0m)";}'
echo; echo -n "Uptime: "; uptime
echo

# Users
echo "Last logged users:"; last -n 5 -F
echo; echo "Currently logged users:"; who
echo; echo -n "Current user: "; id
echo

# Security
# Shellshock vulnerability check (reports to root only)
if [ $EUID -eq 0 ]; then
env x='() { :;}; echo Bash vulnerable to Shellshock' bash -c 'echo -n'
fi

0 comments on commit 054e3dc

Please sign in to comment.