/
screeny
executable file
·202 lines (173 loc) · 6.09 KB
/
screeny
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
#!/bin/bash
#
# Windows Screenfetch (Without the Screenshot functionality)
# Hacked together by Nijikokun <nijikokun@gmail.com>
# License: AOL <aol.nexua.org>
version='0.4'
# Displayment
display=( Host Cpu OS Arch Shell Motherboard HDD Memory Uptime Resolution DE WM WMTheme Font )
# Color Loop
bld=$'\e[1m'
rst=$'\e[0m'
inv=$'\e[7m'
und=$'\e[4m'
f=3 b=4
for j in f b; do
for i in {0..7}; do
printf -v $j$i %b "\e[${!j}${i}m"
done
done
# Debugging
debug=
Debug () {
echo -e "\e[1;31m:: \e[0m$1"
}
# Flag Check
while getopts "vVh" flags; do
case $flags in
h)
echo -e "${und}Usage${rst}:"
echo -e " screeny [Optional Flags]"
echo ""
echo "WinScreeny - A CLI Bash Script to show System Information for Windows!"
echo ""
echo -e "${und}Options${rst}:"
echo -e " ${bld}-v${rst} Verbose / Debug Output"
echo -e " ${bld}-V${rst} Display script version"
echo -e " ${bld}-h${rst} Display this file"
exit;;
V)
echo -e "${und}WinScreeny${rst} - Version ${version}"
echo -e "Copyright (C) Nijiko Yonskai (nijikokun@gmail.com)"
echo ""
echo -e "This is free software, under the AOL license: http://aol.nexua.org"
echo -e "Source can be downloaded from: https://github.com/Nijikokun/WinScreeny"
exit;;
v) debug=1 continue;;
esac
done
# Prevent Unix Output
unameOutput=`uname`
if [[ "$unameOutput" == 'Linux' ]] || [[ "$unameOutput" == 'Darwin' ]] ; then
echo 'This script is for Windows, silly!'
exit 0
fi
# Begin Detection
detectHost () {
user=$(echo "$USER")
host=$(hostname)
[[ "$debug" -eq "1" ]] && Debug "Finding hostname, and user.... Found as: '$user@$host'"
}
detectCpu () {
cpu=$(awk -F':' '/model name/{ print $2 }' /proc/cpuinfo | head -n 1 | tr -s " " | sed 's/^ //')
[[ "$debug" -eq "1" ]] && Debug "Finding cpu.... Found as: '$cpu'"
}
detectOS () {
os=`wmic os get name | head -2 | tail -1`
os=`expr match "$os" '\(Microsoft Windows [A-Za-z0-9]\+\)'`
[[ "$debug" -eq "1" ]] && Debug "Finding OS.... Found as: '$os'"
}
detectArch () {
arch=`wmic os get OSArchitecture | head -2 | tail -1 | tr -d '\r '`
[[ "$debug" -eq "1" ]] && Debug "Finding Architecture.... Found as: '$arch'"
}
detectHDD () {
size=`df -H | grep -E '^[A-Z]\:\/?|File' | awk '{ print $2 }' | head -1 | tr -d '\r '`
free=`df -H | grep -E '^[A-Z]\:\/?|File' | awk '{ print $4 }' | head -1 | tr -d '\r '`
[[ "$debug" -eq "1" ]] && Debug "Finding HDD Size, and Free Space.... Found as: '$free / $size'"
}
detectResolution () {
width=`wmic desktopmonitor get screenwidth | grep -vE '[a-z]+' | tr -d '\r\n '`
height=`wmic desktopmonitor get screenheight | grep -vE '[a-z]+' | tr -d '\r\n '`
[[ "$debug" -eq "1" ]] && Debug "Finding Screen Resolution.... Found as: '$width / $height'"
}
detectUptime () {
uptime=`awk -F. '{print $1}' /proc/uptime`
secs=$((${uptime}%60))
mins=$((${uptime}/60%60))
hours=$((${uptime}/3600%24))
days=$((${uptime}/86400))
uptime="${mins}m"
if [ "${hours}" -ne "0" ]; then
uptime="${hours}h ${uptime}"
fi
if [ "${days}" -ne "0" ]; then
uptime="${days}d ${uptime}"
fi
[[ "$debug" -eq "1" ]] && Debug "Finding Uptime.... Found as: '$uptime${rst}'"
}
detectMemory () {
total_mem=$(awk '/MemTotal/ { print $2 }' /proc/meminfo)
totalmem=$((${total_mem}/1024))
free_mem=$(awk '/MemFree/ { print $2 }' /proc/meminfo)
used_mem=$((${total_mem} - ${free_mem}))
usedmem=$((${used_mem}/1024))
mem="${usedmem}MB / ${totalmem}MB"
[[ "$debug" -eq "1" ]] && Debug "Finding Memory.... Found as: '$mem${rst}'"
}
detectShell () {
myshell=$(echo $SHELL | awk -F"/" '{print $NF}')
[[ "$debug" -eq "1" ]] && Debug "Finding Shell.... Found as: '$myshell'"
}
detectMotherboard () {
board=`wmic baseboard get product | tail -2 | tr -d '\r '`
[[ "$debug" -eq "1" ]] && Debug "Finding Motherboard.... Found as: '$board'"
}
detectDE () {
winver=`wmic os get version | grep -o '^[0-9]'`
if [ "$winver" == "7" ]; then
de='Aero'
elif [ "$winver" == "6" ]; then
de='Aero'
else
de='Luna'
fi
[[ "$debug" -eq "1" ]] && Debug "Finding Desktop Environment.... Found as: '$de'"
}
detectWM () {
bugn=`tasklist | grep -o 'bugn' | tr -d '\r \n'`
wind=`tasklist | grep -o 'Windawesome' | tr -d '\r \n'`
if [ "$bugn" = "bugn" ]; then
wm="bug.n"
elif [ "$wind" = "Windawesome" ]; then
wm="Windawesome"
else
wm="DWM"
fi
[[ "$debug" -eq "1" ]] && Debug "Finding Window Manager.... Found as: '$wm'"
}
detectWMTheme () {
themeFile="$(reg query 'HKCU\Software\Microsoft\Windows\CurrentVersion\Themes' /v 'CurrentTheme' | grep -o '[A-Z]:\\.*')"
theme=$(echo $themeFile | awk -F"\\" '{print $NF}' | grep -o '[0-9A-z. ]*$' | grep -o '^[0-9A-z ]*')
[[ "$debug" -eq "1" ]] && Debug "Finding Window Theme.... Found as: '$theme'"
}
detectFont () {
font=$(cat $HOME/.minttyrc | grep '^Font=.*' | grep -o '[0-9A-Za-z ]*$')
[[ "$debug" -eq "1" ]] && Debug "Finding Font.... Found as: '$font'"
# if [ -z $font ]; then
# font="Lucida Console"
# fi
}
# Loops :>
for i in "${display[@]}"; do
[[ "${display[*]}" =~ "$i" ]] && detect${i}
done
# Output
cat << EOF
$f1 ,.=:^!^!t3Z3z.,
$f1 :tt:::tt333EE3 ${f1}${user}${f7}@${f3}${host}
$f1 Et:::ztt33EEE $f2@Ee., ..,
$f1 ;tt:::tt333EE7 $f2;EEEEEEttttt33# ${f1}OS: ${f7}${os} ${arch}
$f1 :Et:::zt333EEQ.$f2 SEEEEEttttt33QL ${f1}CPU: ${f7}${cpu}
$f1 it::::tt333EEF $f2@EEEEEEttttt33F ${f1}HDD: ${f7}$free / $size
$f1 ;3=*^\`\`\`'*4EEV $f2:EEEEEEttttt33@. ${f1}Memory: ${f7}${mem}
$f4 ,.=::::it=., $f1\` $f2@EEEEEEtttz33QF ${f1}Uptime: ${f7}$uptime
$f4 ;::::::::zt33) $f2'4EEEtttji3P* ${f1}Resolution: ${f7}$width x $height
$f4 :t::::::::tt33.$f3:Z3z.. $f2\`\` $f3,..g. ${f1}Motherboard: ${f7}$board
$f4 i::::::::zt33F$f3 AEEEtttt::::ztF ${f1}Shell: ${f7}$myshell
$f4 ;:::::::::t33V $f3;EEEttttt::::t3 ${f1}DE: ${f7}$de
$f4 E::::::::zt33L $f3@EEEtttt::::z3F ${f1}WM: ${f7}$wm
$f4 {3=*^\`\`\`'*4E3) $f3;EEEtttt:::::tZ\` ${f1}WM Theme: ${f7}$theme
$f4 \` $f3:EEEEtttt::::z7 ${f1}Font: ${f7}$font
$f3 $f3'VEzjt:;;z>*\` $rst
EOF