Console

Platform:  mIRC
Published  Nov 28, 2010
Updated  Nov 28, 2010
Stdout /*

Usage: //echo -a $console(CMD) ; where CMD is valid input for a command console.

Example: //echo -a $console(ipconfig /all)

Notes:
1) Information returned is delimited by $crlf which allows for mIRC to return all of the information on one line as opposed to a consoles method of returning information on multiple lines.

*/

alias console {
if (!$com($flag(1))) && (!$com($flag(2))) && (!$com($flag(3))) {
.comopen $flag(1) wscript.shell
noop $com($flag(1),exec,1,string,cmd /c $1-,dispatch* $flag(2))
noop $com($flag(2),stdout,3,dispatch* $flag(3))
.timerstdout -m 0 100 stdout
pause 2
.timer 1 0 unset %consoleoutput
return %consoleoutput
}
else return * /console: COM connections already open.
}

alias -l flag return mirc $+ $gettok(console stream stdout,$1,32)

alias -l pause {
var %w = wsh $+ $ticks
.comopen %w wscript.shell
.comclose %w $com(%w,run,1,bstr*,$(%comspec%,) /c ping.exe -n $1 127.0.0.1 >nul,uint,0,bool,true)
}

alias -l stdout {
noop $com($flag(2),status,3)
if ($com($flag(2)).result) {
.timerstdout off
while (!$com($flag(3)).result) {
%consoleoutput = %consoleoutput $null($com($flag(3),readline,3)) $com($flag(3)).result $+ $crlf
noop $com($flag(3),atendofstream,3)
}
.comclose $flag(1)
.comclose $flag(2)
.comclose $flag(3)
}
}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

/*

Usage: /console CMD ; where CMD is valid input for a command console.

Example: /console ipconfig /all

Notes:
1) Information echoed is delimited by $crlf which allows for mIRC to show all of the information on one line as opposed to a consoles method of returning information on multiple lines.

*/

alias console {
.comopen $flag(1) wscript.shell
noop $com($flag(1),exec,1,string,cmd /c $1-,dispatch* $flag(2))
noop $com($flag(2),stdout,3,dispatch* $flag(3))
noop $comcall($flag(2),stream,status,3)
}

alias stream {
var %stream
while (!$com($flag(3)).result) {
%stream = %stream $null($com($flag(3),readline,3)) $com($flag(3)).result $+ $crlf
noop $com($flag(3),atendofstream,3)
}
echo -a %stream
tokenize 32 $flag(1) $flag(2) $flag(3)
.comclose $*
}

alias -l flag return mirc $+ $gettok(console stream stdout,$1,32)

Comments

Sign in to comment.
ProIcons   -  Apr 04, 2011
How is exactly working this thing.. i want to open a SSH Connection with OpenSSH, and send some data... with "run" it can't be...

how can i send them with Com Objects? :P
 Respond  
mSLChampagne   -  Dec 09, 2010
Why thank you kind sir/ma'am. A rare soul who appreciates the subtle art that is COM. :)
 Respond  
TheImrac   -  Dec 06, 2010
Ok... This is just sexy. Great work!
 Respond  
Dark|   -  Nov 29, 2010
THeres always a use for somthing -
ALWAYS xD
 Respond  
Burrito   -  Nov 28, 2010
Nice. Too bad I have no use for it :|
 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.