Guest User

screeny cus

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