SHARE
TWEET

moo.mrc (NO DLL REQUIRED!)

Seb May 31st, 2015 (edited) 304 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;.oO{ moo script v3.17 by HM2K }Oo. - IRC@HM2K.ORG
  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.17   - added moo cpu architecture descriptors on request of ROBERT PICARD
  20. ;moo script v3.16   - Added /stat and /statself (thanks TBF), and fixed local echoing.
  21. ;moo script v3.15   - Fixed a few bugs + Fixed the repeat checker + Out of beta
  22. ;moo script v3.14   - Change the WMI lookup location of the rammax inline with the ramuse.
  23. ;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.
  24. ;moo script v3.12   - Minor tweaks, a few code changes, added /moo echo and a few more functions.
  25. ;moo script v3.11   - Added some new features and made it easier to style the output, added some additional notes
  26. ;moo script v3.1    - Added the long awaited flood protection, simple lookup error checking, more/better functions, quicker script
  27. ;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.
  28. ;[moo] script v2.27 - !moo trigger fix, now turned off by default to stop abuse
  29. ;[moo] script v2.26 - Lots of little changes made up till this version, including getmoo.
  30. ;[moo] script v2.23 - changed some alias' to alias -l, fixed small bugs, added new featuers
  31. ;[moo] script v2.22 - minor bug fixes, bold added etc.
  32. ;[moo] script v2.21 - added a feature to turn the !moo get and !getmoo on or off, and fixed a few bugs.
  33. ;[moo] script v2.2  - name change, completly changed the /moo and !moo system, should work better now, no mistakes.
  34. ;moo script v2.13   - still a few mistakes, changes made, mbm5 isn't functioning correctly...
  35. ;moo script v2.12   - many small changes and fixes made, mbm5 was fixed also.
  36. ;moo script v2.11   - simple bug fixes.
  37. ;moo script v2.1    - minor modifications, final public release.
  38. ;moo script v2.0    - New name, new style, new script, same idea.
  39. ;MooDll Script v1.21    - Many bug fixes, first public release
  40. ;MooDll Script v1.0 - Original private release, very simple, buggy.
  41.  
  42. ;todo:
  43. ; - Fix the network traffic readings
  44. ; - Test on Windows Vista
  45.  
  46. ;thanks to...
  47. ;Mark (from influenced.net) for the original concept and for letting me know that he was not creating a new moo.dll
  48. ;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.
  49. ;Moondawn for listening to me rant.
  50. ;and also the beta testers... square, ryguy, Petersen, OutCast3k and PRO1.
  51.  
  52.  
  53. ;--------------------------------------------------------------------------------------------------------
  54. ;SETTINGS - START
  55. ;--------------------------------------------------------------------------------------------------------
  56.  
  57. ;moo banned channels - these are channels you don't want the triggers to function in
  58. alias -l moo.banchans return #debian #linux #linux-aus #mnfh
  59.  
  60. ;moo style - use this to style the titles of the output
  61. alias -l moos return $+(,$1,:)
  62.  
  63. ;--------------------------------------------------------------------------------------------------------
  64. ;SETTINGS - END
  65. ;--------------------------------------------------------------------------------------------------------
  66.  
  67. ;NOTICE: DO NOT edit below unless you know what you're doing. If you do make any changes, please let me know! :)
  68.  
  69.  
  70. alias -l moover return moo script v3.17
  71.  
  72. ;usage: /moo <moof (see below)>
  73. alias moo {
  74.   if (!$1) { $iif($chan,msg $chan,say) $moor | return }
  75.   if ($1 == echo) {
  76.     if ($moof($2)) { var %moo.var $ifmatch | echo -a moo: %moo.var }
  77.     else { echo -a $moor }
  78.     return
  79.   }
  80.   if ($moof($1)) { var %moo.var $ifmatch | $iif($active == Status Window,echo -gta,$iif($chan,msg $chan,say)) moo: %moo.var }
  81. }
  82.  
  83. ;added because of TBF 16/10/07
  84. alias stat moo $1-
  85. alias statself moo echo $1-
  86.  
  87. ;moo return - use this to change the outputs, you can also style this for the whole output
  88. alias -l moor return moo: $iif($mooi(name),$moof(os) $moof(up) $moof(cpu) $moof(gfx) $moof(res) $moof(ram) $moof(hdd) $moof(net),lookup error)
  89.  
  90. ;this section was created so you can easily change the options for what is returned
  91.  
  92. ;moo functions - you can add or change the functions that the script can handle
  93. alias -l moof {
  94.   if ($1 == os) { return $moos($1) $mooi(ostitle) - $mooi(ossp) $brak($mooi(osver)) }
  95.   if ($1 == up) { return $moos($1) $duration($mooi(up)) }
  96.   if ($1 == cpu) { return $moos($1) $mooi(cpuname) $brak($mooi(cpuarch)) at $mooi(cpuspeed) $mooi(cpuload) }
  97.   if ($1 == gfx) { return $moos($1) $mooi(gfxmake) $mooi(gfxproc) $mooi(gfxram) }
  98.   if ($1 == res) { return $moos($1) $mooi($1) $mooi(resbit) $mooi(resrate) }
  99.   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)) }
  100.   if ($1 == hdd) { return $moos($1) $mooi(hdd) }
  101.   if ($1 == net) { return $moos($1) $iif($mooi(netname),$ifmatch $iif($mooi(netspeed), - $ifmatch, ) $mooi(netin) In $mooi(netout) Out, ) }
  102.   elseif ($mooi($1)) { return $moos($1) $ifmatch }
  103. }
  104.  
  105. ;moo info - below are the useful or interesting wmi functions to use with the script
  106. alias mooi {
  107.   if ($1 == name) { return $wmiget(Win32_ComputerSystem).Name }
  108.   if ($1 == ostitle) { return $wmiget(Win32_OperatingSystem).Caption }
  109.   if ($1 == ossp) { return $wmiget(Win32_OperatingSystem).CSDVersion }
  110.   if ($1 == osver) { return $wmiget(Win32_OperatingSystem).Version }
  111.   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) }
  112.   if ($1 == osarc) { return $wmiget(Win32_OperatingSystem).OSArchitecture }
  113.   if ($1 == up) { return $uptime(system,3) }
  114.   if ($1 == cpuname) { return $wmiget(Win32_Processor).Name }
  115.   if ($1 == cpuspeed) { return $+($wmiget(Win32_Processor).CurrentClockSpeed,MHz) }
  116.   if ($1 == cpuload) { return $iif($wmiget(Win32_Processor).LoadPercentage,$brak($+($ifmatch,% Load)),) }
  117.   if ($1 == cputotal) { return $wmiget(Win32_ComputerSystem).NumberOfProcessors }
  118.   if ($1 == cpuarch) { return $mooarch($wmiget(Win32_Processor).Architecture) }
  119.   if ($1 == gfxmake) { return $wmiget(Win32_VideoController).AdapterCompatibility }
  120.   if ($1 == gfxproc) { return $wmiget(Win32_VideoController).VideoProcessor }
  121.   if ($1 == gfxram) { return $bytes($wmiget(Win32_VideoController).AdapterRam,3).suf }
  122.   if ($1 == res) { return $+($wmiget(Win32_VideoController).currenthorizontalresolution,x,$wmiget(Win32_VideoController).currentverticalresolution) }
  123.   if ($1 == resbit) { return $wmiget(Win32_VideoController).currentbitsperpixel $+ bit }
  124.   if ($1 == resrate) { return $wmiget(Win32_VideoController).currentrefreshrate $+ Hz }
  125.   if ($1 == rammax) { return $round($calc($wmiget(Win32_OperatingSystem).TotalVisibleMemorySize / 1024),1) }
  126.   if ($1 == ramuse) { return $round($calc($wmiget(Win32_OperatingSystem).FreePhysicalMemory / 1024), 1) }
  127.   if ($1 == netname) { return $wmiget(Win32_PerfRawData_Tcpip_NetworkInterface).Name }
  128.   if ($1 == netspeed) { return $calc($wmiget(Win32_PerfRawData_Tcpip_NetworkInterface).CurrentBandwidth / 1000000) $+ MB/s }
  129.   if ($1 == netin) { return $bytes($wmiget(Win32_PerfRawData_Tcpip_NetworkInterface).BytesReceivedPersec).suf }
  130.   if ($1 == netout) { return $bytes($wmiget(Win32_PerfRawData_Tcpip_NetworkInterface).BytesSentPersec).suf }
  131.   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 }
  132.   if ($1 == sound) { return $wmiget(Win32_SoundDevice).Name }
  133.   if ($1 == mobo) { return $wmiget(Win32_BaseBoard).Manufacturer $wmiget(Win32_BaseBoard).Product }
  134. }
  135.  
  136. ;moo cpu architecture descriptors
  137. alias -l mooarch {
  138.   if ($1 == 0) { return x86 }
  139.   if ($1 == 1) { return MIPS }
  140.   if ($1 == 2) { return Alpha }
  141.   if ($1 == 3) { return PowerPC }
  142.   if ($1 == 6) { return Intel Itanium Processor Family (IPF) }
  143.   if ($1 == 9) { return x64 }
  144. }
  145.  
  146. ;moo rambar - the famous rambar from the original script with a couple of changes
  147. alias -l moorambar {
  148.   if ($len($1) < 990) {
  149.     var %moo.rb.size = 10
  150.     var %moo.rb.used = $round($calc($1 / 100 * %moo.rb.size),0)
  151.     var %moo.rb.unused = $round($calc(%moo.rb.size - %moo.rb.used),0)
  152.     var %moo.rb.usedstr = $str(|,%moo.rb.used)
  153.     var %moo.rb.unusedstr = $str(-,%moo.rb.unused)
  154.     if ((%moo.rb.usedstr) && (%moo.rb.unusedstr)) return $+([,%moo.rb.usedstr,%moo.rb.unusedstr,])
  155.   }
  156. }
  157.  
  158. ;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.
  159. alias wmiget {
  160.   var %com = cominfo, %com2 = cominfo2, %com3 = cominfo3
  161.   if ($com(%com)) { .comclose %com }
  162.   if ($com(%com2)) { .comclose %com2 }
  163.   if ($com(%com3)) { .comclose %com3 }
  164.   .comopen %com WbemScripting.SWbemLocator
  165.   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)
  166.   if ($com(%com)) { .comclose %com }
  167.   if ($com(%com2)) { .comclose %com2 }
  168.   if ($com(%com3)) { .comclose %com3 }
  169.   return %x
  170. }
  171.  
  172. ;backets - I got fed up of repeating the same thing
  173. alias -l brak return $+($chr(40),$1-,$chr(41))
  174.  
  175. ;uptime script - this is the short uptime script created to return your current update and retain your best uptime
  176. on *:connect: up x
  177. alias up { ;uptime v0.4
  178.   $iif($timer(up) == $null,.timerup 0 60 up x)
  179.   if (($uptime(system,3) >= %up) || (%up == $null)) set %up $uptime(system,3)
  180.   $iif($1 == x,halt,$iif($chan,msg $chan,$iif($active == Status Window,echo,say)) $+(Windows,$OS) Uptime: $uptime(system,1) Best: $duration(%up))
  181. }
  182.  
  183. #!uptime off
  184. on *:text:!uptime:#: if (!$istok($moo.banchans,$chan,32)) { up | $repeatcheck(!uptime) }
  185. #!uptime end
  186.  
  187. ;moo triggers - public display, sharing the script and ctcp moo
  188.  
  189. #!moo off
  190. on *:text:!moo*:#: if (!$istok($moo.banchans,$chan,32)) { moo $2 | $repeatcheck(!moo) }
  191. #!moo end
  192. #!getmoo off
  193. on *:text:!getmoo:*: {
  194.   if ($chan) { .notice $nick moo: To get $moover type: "/msg $me !getmoo" (set "/dccignore off" first) | $repeatcheck(!getmoo) | halt }
  195.   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 }
  196. }
  197. #!getmoo end
  198. #ctcpmoo off
  199. ctcp *:*:*: if (($1 == MOO) || ($1 == VERSION)) { .ctcpreply $nick $1 $moover by HM2K | $repeatcheck(ctcpmoo) }
  200. #ctcpmoo end
  201.  
  202. alias -l repeatcheck { ;v0.12 by HM2K - will disable the appropriate group if its flooded
  203.   var %rep.lim = 3
  204.   var %rep.t.lim = 25
  205.   var %rep.t.expr = 10
  206.   if (%rep.lockusr- [ $+ [ $nick ] ]) { echo $ifmatch | haltdef }
  207.   inc $+(-u,%rep.t.lim,$chr(32),%,rep-,$nick,.,$len($strip($1-)),.,$hash($strip($1-),32)) 1
  208.   if (%rep- [ $+ [ $nick ] $+ . $+ [ $len($strip($1-)) ] $+ . $+ [ $hash($strip($1-),32) ] ] == %rep.lim) {
  209.     ;ignore -u60 $address($nick,5)
  210.     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 }
  211.     .set $+(-u,%rep.t.expr,$chr(32),%,rep.lockusr-,$nick) 1
  212.   }
  213. }
  214.  
  215. ;onload and onunload checks - making sure everything is as it should be
  216. 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 } }
  217. 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 }
  218.  
  219. ;the menus - only simple at the moment, however this script is designed to utilise the /moo and !moo triggers
  220. menu channel,query {
  221.   $moover
  222.   .moo all (/moo): moo
  223.   .moo uptime (/up): up
  224.   .-
  225.   .!moo trigger ( $+ $group(#!moo) $+ ):{
  226.     if ($group(#!moo) != on) { .enable #!moo }
  227.     else { .disable #!moo }
  228.     .echo -ga moo: !moo is $group(#!moo)
  229.   }
  230.   .!uptime trigger ( $+ $group(#!uptime) $+ ):{
  231.     if ($group(#!uptime) != on) { .enable #!uptime }
  232.     else { .disable #!uptime }
  233.     .echo -ga moo: !uptime is $group(#!uptime)
  234.   }
  235.   .!getmoo trigger ( $+ $group(#!getmoo) $+ ):{
  236.     if ($group(#!getmoo) != on) { .enable #!getmoo }
  237.     else { .disable #!getmoo }
  238.     .echo -ga moo: !getmoo is $group(#!getmoo)
  239.   }
  240.   .ctcp moo trigger ( $+ $group(#ctcpmoo) $+ ):{
  241.     if ($group(#ctcpmoo) != on) { .enable #ctcpmoo }
  242.     else { .disable #ctcpmoo }
  243.     .echo -ga moo: ctcpmoo is $group(#ctcpmoo)
  244.   }
  245.   .-
  246.   .unload $remove($script,$scriptdir)
  247.   ..are you sure?
  248.   ...yes: { .unload -rs $script }
  249.   ...no: { .echo $colour(info2) -gat $remove($script,$scriptdir) was NOT unloaded. }
  250. }
  251. ;EOF
RAW Paste Data
Top