Advertisement
Guest User

moo script 3.20

a guest
Jan 21st, 2019
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 14.65 KB | None | 0 0
  1. ;.oO{ moo script v3.20 (21-Jan-2019)
  2.  
  3. ;description:
  4. ;no more moo.dll! -- this script uses $com to lookup the WMI functions to return specified system information.
  5. ;moo script was originally created to display your system information via IRC, including: operating system, uptime, cpu, memory usage, graphics card, resolution, network details and hard drive details.
  6.  
  7. ;installation:
  8. ;NOTICE: please unload and remove any old moo scripts, else this script may not work.
  9. ;make sure moo.mrc is in your $mircdir then type: /load -rs moo.mrc
  10.  
  11. ;Please make sure you have the latest windows updates or the latest WMI core (http://www.microsoft.com/downloads/details.aspx?FamilyID=98a4c5ba-337b-4e92-8c18-a63847760ea5&DisplayLang=en)
  12. ;Also, please use the latest version of mIRC, ideally mIRC v6.16 and above...
  13.  
  14. ;usage:
  15. ;for moo type: /moo or !moo (if enabled)
  16. ;for uptime only type: /up or !uptime (if enabled)
  17.  
  18. ;history:
  19. ;moo script v3.20 - added registry key reading to read Windows build revision - needs testing
  20. ;script changes below made by H2MK and others
  21. ;moo script v3.17 - added moo cpu architecture descriptors on request of ROBERT PICARD
  22. ;moo script v3.16 - Added /stat and /statself (thanks TBF), and fixed local echoing.
  23. ;moo script v3.15 - Fixed a few bugs + Fixed the repeat checker + Out of beta
  24. ;moo script v3.14 - Change the WMI lookup location of the rammax inline with the ramuse.
  25. ;moo script v3.13 - Changed the ram function to use a more reliable WMI location, added OSArchitecture (osarc) for Vista, fixed CPU load to not return anything if there's no load.
  26. ;moo script v3.12 - Minor tweaks, a few code changes, added /moo echo and a few more functions.
  27. ;moo script v3.11 - Added some new features and made it easier to style the output, added some additional notes
  28. ;moo script v3.1 - Added the long awaited flood protection, simple lookup error checking, more/better functions, quicker script
  29. ;moo script v3.0 - The whole script was changed, no more moo.dll, it now uses WMI however this version MUST be run on mIRC v6.16 or above.
  30. ;[moo] script v2.27 - !moo trigger fix, now turned off by default to stop abuse
  31. ;[moo] script v2.26 - Lots of little changes made up till this version, including getmoo.
  32. ;[moo] script v2.23 - changed some alias' to alias -l, fixed small bugs, added new featuers
  33. ;[moo] script v2.22 - minor bug fixes, bold added etc.
  34. ;[moo] script v2.21 - added a feature to turn the !moo get and !getmoo on or off, and fixed a few bugs.
  35. ;[moo] script v2.2 - name change, completly changed the /moo and !moo system, should work better now, no mistakes.
  36. ;moo script v2.13 - still a few mistakes, changes made, mbm5 isn't functioning correctly...
  37. ;moo script v2.12 - many small changes and fixes made, mbm5 was fixed also.
  38. ;moo script v2.11 - simple bug fixes.
  39. ;moo script v2.1 - minor modifications, final public release.
  40. ;moo script v2.0 - New name, new style, new script, same idea.
  41. ;MooDll Script v1.21 - Many bug fixes, first public release
  42. ;MooDll Script v1.0 - Original private release, very simple, buggy.
  43.  
  44. ;todo:
  45. ; - Fix the network traffic readings
  46. ; - Test on Windows Vista
  47.  
  48. ;thanks to...
  49. ;Mark (from influenced.net) for the original concept and for letting me know that he was not creating a new moo.dll
  50. ;HndlWCare who inspired me to write this for saying: "moo.dll was written by a college student roommate of one of our ops who has admitted inserting a backdoor into it" -- none of this is true, there IS NO backdoor in moo.dll and just like there is NO backdoor in this script. HndlWCare you are an idiot.
  51. ;Moondawn for listening to me rant.
  52. ;and also the beta testers... square, ryguy, Petersen, OutCast3k and PRO1.
  53.  
  54.  
  55. ;--------------------------------------------------------------------------------------------------------
  56. ;SETTINGS - START
  57. ;--------------------------------------------------------------------------------------------------------
  58.  
  59. ;moo banned channels - these are channels you don't want the triggers to function in
  60. alias -l moo.banchans return #php #windows #eztv
  61.  
  62. ;moo style - use this to style the titles of the output
  63. alias -l moos return $+(,$1,:)
  64.  
  65. ;--------------------------------------------------------------------------------------------------------
  66. ;SETTINGS - END
  67. ;--------------------------------------------------------------------------------------------------------
  68.  
  69. ;NOTICE: DO NOT edit below unless you know what you're doing. If you do make any changes, please let me know! [:)]
  70.  
  71.  
  72. alias -l moover return moo script v3.17
  73.  
  74. ;usage: /moo <moof (see below)>
  75. alias moo {
  76.   if (!$1) { $iif($chan,msg $chan,say) $moor | return }
  77.   if ($1 == echo) {
  78.     if ($moof($2)) { var %moo.var $ifmatch | echo -a moo: %moo.var }
  79.     else { echo -a $moor }
  80.     return
  81.   }
  82.   if ($moof($1)) { var %moo.var $ifmatch | $iif($active == Status Window,echo -gta,$iif($chan,msg $chan,say)) moo: %moo.var }
  83. }
  84.  
  85. ;added because of TBF 16/10/07
  86. alias stat moo $1-
  87. alias statself moo echo $1-
  88.  
  89. ;moo return - use this to change the outputs, you can also style this for the whole output
  90. alias -l moor return moo: $iif($mooi(name),$moof(os) $moof(up) $moof(cpu) $moof(gfx) $moof(res) $moof(ram) $moof(hdd) $moof(net) $moof(sound) $moof(mobo),lookup error)
  91.  
  92. ;this section was created so you can easily change the options for what is returned
  93.  
  94. ;moo functions - you can add or change the functions that the script can handle
  95. alias -l moof {
  96.   if ($1 == os) { return $moos($1) $mooi(ostitle) - $mooi(ossp) $brak($mooi(osver)) }
  97.   if ($1 == up) { return $moos($1) $duration($mooi(up)) }
  98.   if ($1 == cpu) { return $moos($1) $mooi(cpuname) $brak($mooi(cpuarch)) at $mooi(cpuspeed) $mooi(cpuload) }
  99.   if ($1 == gfx) { return $moos($1) $mooi(gfxmake) $mooi(gfxproc) $mooi(gfxram) }
  100.   if ($1 == res) { return $moos($1) $mooi($1) $mooi(resbit) $mooi(resrate) }
  101.   if ($1 == ram) { var %moo.rammax = $mooi(rammax) | var %moo.ramuse = $mooi(ramuse) | return $moos($1) $+($round($calc(%moo.rammax - %moo.ramuse),0),/,%moo.rammax,MB) $+($chr(40),$round($calc((%moo.rammax - %moo.ramuse) / %moo.rammax * 100),2),%,$chr(41)) $moorambar($round($calc((%moo.rammax - %moo.ramuse) / %moo.rammax * 100),2)) }
  102.   if ($1 == hdd) { return $moos($1) $mooi(hdd) }
  103.   if ($1 == net) { return $moos($1) $iif($mooi(netname),$ifmatch $iif($mooi(netspeed), - $ifmatch, ) $mooi(netin) In $mooi(netout) Out, ) }
  104.   if ($1 == sound) { return $moos($1) $mooi(sound) }
  105.   if ($1 == mobo) { return $moos($1) $mooi(mobo) }
  106. }
  107.  
  108. ;moo info - below are the useful or interesting wmi functions to use with the script
  109. alias mooi {
  110.   if ($1 == name) { return $wmiget(Win32_ComputerSystem).Name }
  111.   if ($1 == ostitle) { return $wmiget(Win32_OperatingSystem).Caption }
  112.   if ($1 == ossp) { return $wmiget(Win32_OperatingSystem).CSDVersion }
  113.   if ($1 == osver) { return $wmiget(Win32_OperatingSystem).Version $+ $ubr }
  114.   if ($1 == osinstall) { var %time = $ctime($iif($wmiget(Win32_OperatingSystem).InstallDate,$+($mid($ifmatch,7,2),/,$mid($ifmatch,5,2),/,$mid($ifmatch,1,4)) $+($mid($ifmatch,9,2),:,$mid($ifmatch,11,2),:,$mid($ifmatch,13,2)))) | return $asctime(%time) $brak($duration($calc($ctime - %time)) ago) }
  115.   if ($1 == osarc) { return $wmiget(Win32_OperatingSystem).OSArchitecture }
  116.   if ($1 == up) { return $uptime(system,3) }
  117.   if ($1 == cpuname) { return $wmiget(Win32_Processor).Name }
  118.   if ($1 == cpuspeed) { return $+($wmiget(Win32_Processor).CurrentClockSpeed,MHz) }
  119.   if ($1 == cpuload) { return $iif($wmiget(Win32_Processor).LoadPercentage,$brak($+($ifmatch,% Load)),) }
  120.   if ($1 == cputotal) { return $wmiget(Win32_ComputerSystem).NumberOfProcessors }
  121.   if ($1 == cpuarch) { return $mooarch($wmiget(Win32_Processor).Architecture) }
  122.   if ($1 == gfxmake) { return $wmiget(Win32_VideoController).AdapterCompatibility }
  123.   if ($1 == gfxproc) { return                                  $wmiget(Win32_VideoController).VideoProcessor }
  124.   ;if ($1 == gfxproc) { return $wmiget(CIM_VideoController).Description }
  125.   if ($1 == gfxram) { return $bytes($wmiget(Win32_VideoController).AdapterRam,3).suf }
  126.   if ($1 == res) { return $+($wmiget(Win32_VideoController).currenthorizontalresolution,x,$wmiget(Win32_VideoController).currentverticalresolution) }
  127.   if ($1 == resbit) { return $wmiget(Win32_VideoController).currentbitsperpixel $+ bit }
  128.   if ($1 == resrate) { return $wmiget(Win32_VideoController).currentrefreshrate $+ Hz }
  129.   if ($1 == rammax) { return $round($calc($wmiget(Win32_OperatingSystem).TotalVisibleMemorySize / 1024),1) }
  130.   if ($1 == ramuse) { return $round($calc($wmiget(Win32_OperatingSystem).FreePhysicalMemory / 1024), 1) }
  131.   if ($1 == netname) { return $wmiget(Win32_PerfRawData_Tcpip_NetworkInterface).Name }
  132.   if ($1 == netspeed) { return $calc($wmiget(Win32_PerfRawData_Tcpip_NetworkInterface).CurrentBandwidth / 1000000) $+ MB/s }
  133.   if ($1 == netin) { return $bytes($wmiget(Win32_PerfRawData_Tcpip_NetworkInterface).BytesReceivedPersec).suf }
  134.   if ($1 == netout) { return $bytes($wmiget(Win32_PerfRawData_Tcpip_NetworkInterface).BytesSentPersec).suf }
  135.   if ($1 == hdd) { var %i 1 | while (%i <= $disk(0)) { if ($disk(%i).type == fixed) var %var %var $disk(%i).path $+($bytes($disk(%i).free).suf,/,$bytes($disk(%i).size).suf) | inc %i } | return %var }
  136.   if ($1 == sound) { return $wmiget(Win32_SoundDevice).Name }
  137.   if ($1 == mobo) { return $wmiget(Win32_BaseBoard).Manufacturer $wmiget(Win32_BaseBoard).Product }
  138. }
  139.  
  140. ;moo cpu architecture descriptors
  141. alias -l mooarch {
  142.   if ($1 == 0) { return x86 }
  143.   if ($1 == 1) { return MIPS }
  144.   if ($1 == 2) { return Alpha }
  145.   if ($1 == 3) { return PowerPC }
  146.   if ($1 == 6) { return Intel Itanium Processor Family (IPF) }
  147.   if ($1 == 9) { return x64 }
  148. }
  149.  
  150. ;moo rambar - the famous rambar from the original script with a couple of changes
  151. alias -l moorambar {
  152.   if ($len($1) < 990) {
  153.     var %moo.rb.size = 10
  154.     var %moo.rb.used = $round($calc($1 / 100 * %moo.rb.size),0)
  155.     var %moo.rb.unused = $round($calc(%moo.rb.size - %moo.rb.used),0)
  156.     var %moo.rb.usedstr = $str(|,%moo.rb.used)
  157.     var %moo.rb.unusedstr = $str(-,%moo.rb.unused)
  158.     if ((%moo.rb.usedstr) && (%moo.rb.unusedstr)) return $+([,%moo.rb.usedstr,%moo.rb.unusedstr,])
  159.   }
  160. }
  161.  
  162. ;Get WMI data - this is the most useful function here, this only works if mIRC has the $COM function, its very useful, but a little slow.
  163. alias wmiget {
  164.   var %com = cominfo, %com2 = cominfo2, %com3 = cominfo3
  165.   if ($com(%com)) { .comclose %com }
  166.   if ($com(%com2)) { .comclose %com2 }
  167.   if ($com(%com3)) { .comclose %com3 }
  168.   .comopen %com WbemScripting.SWbemLocator
  169.   var %x = $com(%com,ConnectServer,3,dispatch* %com2), %x = $com(%com2,ExecQuery,3,bstr*,select $prop from $1,dispatch* %com3), %x = $comval(%com3,$iif($2,$2,1),$prop)
  170.   if ($com(%com)) { .comclose %com }
  171.   if ($com(%com2)) { .comclose %com2 }
  172.   if ($com(%com3)) { .comclose %com3 }
  173.   return %x
  174. }
  175.  
  176. ;backets - I got fed up of repeating the same thing
  177. alias -l brak return $+($chr(40),$1-,$chr(41))
  178.  
  179. ;uptime script - this is the short uptime script created to return your current update and retain your best uptime
  180. on *:connect: up x
  181. alias up { ;uptime v0.4
  182.   $iif($timer(up) == $null,.timerup 0 60 up x)
  183.   if (($uptime(system,3) >= %up) || (%up == $null)) set %up $uptime(system,3)
  184.   $iif($1 == x,halt,$iif($chan,msg $chan,$iif($active == Status Window,echo,say)) $+(Windows,$OS) Uptime: $uptime(system,1) Best: $duration(%up))
  185. }
  186.  
  187. #!uptime off
  188. on *:text:!uptime:#: if (!$istok($moo.banchans,$chan,32)) { up | $repeatcheck(!uptime) }
  189. #!uptime end
  190.  
  191. ;moo triggers - public display, sharing the script and ctcp moo
  192.  
  193. #!moo off
  194. on *:text:!moo*:#: if (!$istok($moo.banchans,$chan,32)) { moo $2 | $repeatcheck(!moo) }
  195. #!moo end
  196. #!getmoo off
  197. on *:text:!getmoo:*: {
  198.   if ($chan) { .notice $nick moo: To get $moover type: "/msg $me !getmoo" (set "/dccignore off" first) | $repeatcheck(!getmoo) | halt }
  199.   else { .close -m $nick | .dcc send $nick $script | .notice $nick moo: Once you receive the script issue: "/load -rs $nopath($script) $+ ", and don't forget to do "/dccignore on" | $repeatcheck(!getmoo) | halt }
  200. }
  201. #!getmoo end
  202. #ctcpmoo off
  203. ctcp *:*:*: if (($1 == MOO) || ($1 == VERSION)) { .ctcpreply $nick $1 $moover by HM2K | $repeatcheck(ctcpmoo) }
  204. #ctcpmoo end
  205.  
  206. alias -l repeatcheck { ;v0.12 by HM2K - will disable the appropriate group if its flooded
  207.   var %rep.lim = 3
  208.   var %rep.t.lim = 25
  209.   var %rep.t.expr = 10
  210.   if (%rep.lockusr- [ $+ [ $nick ] ]) { echo $ifmatch | haltdef }
  211.   inc $+(-u,%rep.t.lim,$chr(32),%,rep-,$nick,.,$len($strip($1-)),.,$hash($strip($1-),32)) 1
  212.   if (%rep- [ $+ [ $nick ] $+ . $+ [ $len($strip($1-)) ] $+ . $+ [ $hash($strip($1-),32) ] ] == %rep.lim) {
  213.     ;ignore -u60 $address($nick,5)
  214.     if ($group($chr(35) $+ $1) == on) { .disable $chr(35) $+ $1 | .echo -gat $1 is $group($chr(35) $+ $1) due to a repeat flood from $iif($chan,$nick in $chan,$nick) $+ , to re-enable: /enable $chr(35) $+ $1 }
  215.     .set $+(-u,%rep.t.expr,$chr(32),%,rep.lockusr-,$nick) 1
  216.   }
  217. }
  218.  
  219. ;onload and onunload checks - making sure everything is as it should be
  220. on *:load: { up x | if ($version < 6.16) { echo -a moo: you need mIRC v6.16 or greater to run this script, get the latest version from www.mirc.com/get.html | unload -rs $script | halt } }
  221. on *:unload: { .timerup off | $iif($input(Do you want to remove the best uptime data,y,unset %up),unset %up,) | .echo $colour(info2) -gat $moover was unloaded, to reload type: /load -rs $script }
  222.  
  223. ;the menus - only simple at the moment, however this script is designed to utilise the /moo and !moo triggers
  224. menu channel,query {
  225.   $moover
  226.   .moo all (/moo): moo
  227.   .moo uptime (/up): up
  228.   .-
  229.   .!moo trigger ( $+ $group(#!moo) $+ ):{
  230.     if ($group(#!moo) != on) { .enable #!moo }
  231.     else { .disable #!moo }
  232.     .echo -ga moo: !moo is $group(#!moo)
  233.   }
  234.   .!uptime trigger ( $+ $group(#!uptime) $+ ):{
  235.     if ($group(#!uptime) != on) { .enable #!uptime }
  236.     else { .disable #!uptime }
  237.     .echo -ga moo: !uptime is $group(#!uptime)
  238.   }
  239.   .!getmoo trigger ( $+ $group(#!getmoo) $+ ):{
  240.     if ($group(#!getmoo) != on) { .enable #!getmoo }
  241.     else { .disable #!getmoo }
  242.     .echo -ga moo: !getmoo is $group(#!getmoo)
  243.   }
  244.   .ctcp moo trigger ( $+ $group(#ctcpmoo) $+ ):{
  245.     if ($group(#ctcpmoo) != on) { .enable #ctcpmoo }
  246.     else { .disable #ctcpmoo }
  247.     .echo -ga moo: ctcpmoo is $group(#ctcpmoo)
  248.   }
  249.   .-
  250.   .unload $remove($script,$scriptdir)
  251.   ..are you sure?
  252.   ...yes: { .unload -rs $script }
  253.   ...no: { .echo $colour(info2) -gat $remove($script,$scriptdir) was NOT unloaded. }
  254. }
  255.  
  256. alias ubr {
  257.   var %key = HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ubr
  258.   return $iif($regread(%key),. $+ $ifmatch,$+)
  259. }
  260. alias regread {
  261.   var %a = regread $+ $ticks, %c
  262.   .comopen %a WScript.Shell
  263.   if (!$comerr) {
  264.     var %b = $com(%a,RegRead,3,bstr,$1-), %c = $com(%a).result
  265.     .comclose %a
  266.   }
  267.   return %c
  268. }
  269. ;EOF
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement