MIRC Script
   HOME

TheInfoList



OR:

The mIRC scripting language (often unofficially abbreviated to "mSL") is the
scripting language A scripting language or script language is a programming language that is used to manipulate, customize, and automate the facilities of an existing system. Scripting languages are usually interpreted at runtime rather than compiled. A scripting ...
embedded in
mIRC mIRC is an Internet Relay Chat (IRC) client for Windows, created in 1995. It is a fully functional chat utility and its integrated scripting language makes it extensible and versatile. mIRC has been described as "one of the most popular IRC cl ...
, an
IRC Internet Relay Chat (IRC) is a text-based chat system for instant messaging. IRC is designed for group communication in discussion forums, called '' channels'', but also allows one-on-one communication via private messages as well as chat an ...
client for
Windows Windows is a group of several proprietary graphical operating system families developed and marketed by Microsoft. Each family caters to a certain sector of the computing industry. For example, Windows NT for consumers, Windows Server for serv ...
.


Primary uses

*Channel and personal protection against any types of attacks (flooding, spamming, CTCP floods, etc.). *Dialog windows can be created in mIRC to better serve user-compatibility. **Popular mIRC dialog extensions include MDX (mIRC Dialog Extension) and DCX (Dialog Control Extension). There are also a few versions of mdx.dll and dcx.dll modded by IRC hackers. * Bots that provide automated IRC channel management, trivia or other games, and other desired functions for chatters. *Commands that save typing or otherwise simplify life on IRC (such as automatically identifying as the owner of a nickname).


Script storage

Scripts are stored as either plain text files, usually with a .mrc
file extension A filename extension, file name extension or file extension is a suffix to the name of a computer file (e.g., .txt, .docx, .md). The extension indicates a characteristic of the file contents or its intended use. A filename extension is typically d ...
, or as INI files. They, however, can be stored with any extension. Multiple script files can be loaded at one time, although in some cases, one script will conflict with another and cause one or both of them to no longer work properly.


Language features

mIRC scripting language uses its own nomenclature to refer to language constructs. (However, whilst this can be a little confusing to newcomers, they do not impact on the functionality of mSL.) *Built-in functions are termed commands or, if they return a value, identifiers. *Custom scripted
function Function or functionality may refer to: Computing * Function key, a type of key on computer keyboards * Function model, a structured representation of processes in a system * Function object or functor or functionoid, a concept of object-oriente ...
s are called aliases. Aliases that return a value are known as custom identifiers. Both are called from the command line or other parts of a script in the same ways as built-in commands and identifiers (and can even supersede them). *Popups are scripted
context menu A context menu (also called contextual, shortcut, and pop up or pop-up menu) is a menu in a graphical user interface (GUI) that appears upon user interaction, such as a right-click mouse operation. A context menu offers a limited set of choic ...
items. Popups are called when they are selected by the user. The term originally referred to the menus—which pop up upon a right click. It is still used this way in the manual. *Remotes are event-handling scripts. Remotes are called when the event they handle occurs. *All variables are
dynamically typed In computer programming, a type system is a logical system comprising a set of rules that assigns a property called a type to every "term" (a word, phrase, or other set of symbols). Usually the terms are various constructs of a computer progra ...
. *
Hash table In computing, a hash table, also known as hash map, is a data structure that implements an associative array or dictionary. It is an abstract data type that maps keys to values. A hash table uses a hash function to compute an ''index'', als ...
s are available for larger data storage;
array An array is a systematic arrangement of similar objects, usually in rows and columns. Things called an array include: {{TOC right Music * In twelve-tone and serial composition, the presentation of simultaneous twelve-tone sets such that the ...
s are not. *mIRC scripts make use of
sigils A sigil () is a type of symbol used in magic. The term has usually referred to a pictorial signature of a deity or spirit. In modern usage, especially in the context of chaos magic, sigil refers to a symbolic representation of the practitione ...
. Identifiers (whether custom or built-in) are preceded by $, binary variables are preceded by &, and other variables (whether local or global) are preceded by %. Commands and aliases are not preceded by any particular character (although when entered from a window's command line they must be preceded by the command prefix, usually /).


File handling

*Scripts can read from and write to files code>$read(file, code>$read(file,[args_">_/write_The_above_is_intended_for_singular_access_to_the_file._Because_each_time_you_issue_$read_or_/write_you_open_and_close_the_file_for_access. Multiple_accesses,_during_a_loop_for_instance,_is_best_handled_through_/fopen,_/fwrite_and_/fclose._Since_this_opens_the_file_only_once._In_some_cases_/filter_and_/savebuf_is_an_even_more_efficient_(non_scripted_loop)_method. *Scripts_can_also_copy_and_delete_files._[/copy_.html" ;"title="rgs_.html" ;"title="rgs.html" ;"title="code>$read(file,[args">code>$read(file,[args "> /write The above is intended for singular access to the file. Because each time you issue $read or /write you open and close the file for access. Multiple accesses, during a loop for instance, is best handled through /fopen, /fwrite and /fclose. Since this opens the file only once. In some cases /filter and /savebuf is an even more efficient (non scripted loop) method. *Scripts can also copy and delete files. [/copy "> /remove


Binary variables

*Contain unlimited (8192 bytes prior to mIRC 6.1) raw data *Globally accessible via commands and identifiers *Automatically unset when script returns control to mIRC (and not to another part of a script) *Prefixed with & (e.g. &Variable) *Cannot be accessed other than by /bread and /bwrite, so these variables cannot be passed onto other parts of the script


Hash tables

*May contain unlimited binary data or up to 4,150 (950 prior to mIRC 6.32) bytes of plain text. This limit is imposed by mIRC's scripting parser's own line length limitation (unless assigning a binary variable) *Globally accessible via commands and identifiers *Automatically unset when exiting mIRC as they are only stored in memory *Can be saved for later use *Not prefixed *Faster than accessing from a file, as hash tables are stored in memory rather than the hard disk *Size limited only by the computer's memory limits. *Allows any bucket size to be used


Global variables

*May contain up to 4,150 (950 prior to mIRC 6.32) bytes of data including its name (however due to line-length limitations in mIRC's scripting parser, a maximum of 4,146 bytes can be assigned explicitly using /set or /var — this number decreasing as the variable's name grows longer) *Cannot store NUL (ASCII 0) or trailing spaces *Globally accessible *Do not automatically unset unless a switch is used (stored automatically in a mIRC initialization file) *Prefixed with % (e.g. %Variable) *Created using the set command or var -g or %Variable = value notation


Local variables

*May contain up to 4,150 (950 prior to mIRC 6.32) bytes of data including the variable name (however due to line-length limitations in mIRC's scripting parser, a maximum of 4,146 bytes can be assigned explicitly using the /set or /var commands — this number decreasing as the variable's name grows longer) *Can store NUL (ASCII 0) or trailing spaces *Are destroyed when the triggered alias or event ends *Prefixed with % (e.g. %Variable) *Created using the var command. var is merely an internal alias for set -l but var poses the means to declare multiple local variables on a single line (e.g. var %a = 1, %b, %c = 2)


Limitations

*Scripting parser supports a maximum of 8,292 (950 prior to mIRC 6.32) characters per line (not including newlines or indentation). *Strings are not syntactically enclosed, creating ambiguities in code where characters meant as literal strings are treated as part of the language's syntax. *Each line of code is broken down into a set of space-delimited tokens. As mIRC's parser does not support null tokens and the language doesn't provide a syntax to clearly differentiate literal strings from code; Prior to mIRC version 6.2 it was impossible to pass multiple consecutive spaces to any command or alias. However, this was fixed with the introduction of the returnex command which allows the preservation of spaces.


Code examples

The code below is in the remote scripts format. If placed into an alias file, the command names should not be preceded by the word "alias". Test Comments include the common /* comment */ and ;comment. Here is an example of a
Hello World ''Hello'' is a salutation or greeting in the English language. It is first attested in writing from 1826. Early uses ''Hello'', with that spelling, was used in publications in the U.S. as early as the 18 October 1826 edition of the '' Norwich ...
alias:
;Defines the alias 'hello' in the remote script

;Note: if this is placed in an alias script,
;the 'alias' part must be removed (result: hello {)
;Usage: /hello

alias hello {

  ;Displays(/echo) 'Hello World!' into the active window(-a)
  echo -a Hello World!

}
A remote script to automatically respond to certain text
;Placed in a remote script

;When a user types Hello! in a channel,
;you answer back: Hello,  ickname

on *:TEXT:Hello!:#:{ msg $chan Hello, $nick $+ ! }

;When a user types Hello! in a private message,
;you answer back: Hello,  ickname

on *:TEXT:Hello!:?: { msg $nick Hello, $nick $+ ! }

;Here is a script which automatically gives voice to a user
;who joins a particular channel (The Bot or user should have HOP)

on *:JOIN:#?: { mode $chan +v $nick }

;A bad word script

on *:Text:die*:#: { .mode $chan +b $nick ,  kick $chan $nick Dont say that again }


See also

*
Internet Relay Chat Internet Relay Chat (IRC) is a text-based chat system for instant messaging. IRC is designed for group communication in discussion forums, called ''channels'', but also allows one-on-one communication via private messages as well as chat and ...
*
mIRC mIRC is an Internet Relay Chat (IRC) client for Windows, created in 1995. It is a fully functional chat utility and its integrated scripting language makes it extensible and versatile. mIRC has been described as "one of the most popular IRC cl ...


References

* Smith, Chris. (2004)
"Hack #20 Automate IRC with Scripting" in ''IRC Hacks: 100 Industrial-Strength Tips & Tools''
Paul Mutton, ed. O'Reilly Media, Inc. pp. 71–74. ''(In-depth example of script features and usage)'' * Jose Nazario (200
''Defense and Detection Strategies Against Internet Worms''
Artech House, 2004. p. 53, 55. ''(Discusses 1997 mIRC script attack.)'' *Ken Dunham, Jim Melnick (2008
''Malicious Bots: An Inside Look into the Cyber-Criminal Underground of the Internet''
CRC Press. p. 7-31. ''(In-depth analysis/reverse engineering of mIRC-script-based malware bot)'' *
Peter Szor Peter may refer to: People * List of people named Peter, a list of people and fictional characters with the given name * Peter (given name) ** Saint Peter (died 60s), apostle of Jesus, leader of the early Christian Church * Peter (surname), a su ...
(2005)
''The Art of Computer Virus Research and Defense''
Pearson Education. Ch. 3.7.7. * David Harley, Robert S. Vibert (2007)
''AVIEN Malware Defense Guide for the Enterprise''
Elsevier. p. 147. (usage in script attacks) *Esharenana E. Adomi (2008)
''Security and Software for Cybercafés''
Idea Group Inc (IGI). p. 173. *Markus Jakobsson, Zulfikar Ramzan. (2008)
''Crimeware: Understanding New Attacks and Defenses''
Addison-Wesley Professional. p. 194.


External links


Official mIRC website



WikiChip mIRC pages
nbsp;— A Wiki-based user-maintained help reference primarily for mIRC scripting
mIRC Scripting Help
nbsp;— Turkish/English mIRC Scripting Help unofficial {{DEFAULTSORT:Mirc Scripting Language Scripting languages sv:Mirc#MSL (mIRC Scripting Language)