mIRC Homepage
Posted By: tecsatan socket connections to a BNC - 18/07/06 11:14 AM
I am trying to set up a socket connection bot (that thats the idea in the long run) my BNC. Going through the BNC seems to remove some of the user error's when dealing with connecting to the server and the socket output's (in theory).

Here is the code:-

alias open.socket {
sockopen conn1 66.90.82.236 50127
echo 4 Socket connection test started
}
on *:SOCKOPEN:conn1: {
if ($sockerr > 0) return
sockwrite -tn $sockname user $rand(a,z) $+ $rand(1,99) $qt(asdf) $qt(asdf) : $+ tecsatan
sockwrite -tn $sockname nick $rand(a,z) $+ $rand(1,9999)
sockwrite -tn $sockname quote PASS <my password>
}
on *:sockread:conn1:{
if ($sockerr > 0) return
:nextread
sockread %temp
if ($sockbr == 0) return
if (%temp == $null) %temp = -
echo 4 %temp
goto nextread
}
alias close.socket {
sockclose conn1
echo 4 Socket connection test finished
}


Here is what I am gettign as a reply:-

Socket connection test started
NOTICE AUTH :You need to say /quote PASS <password>


Now the problem is, how do you send /quote commands over a socket connection? I could be rong but I don't think notice or privmsg will work because your not sending it to a person or room, your sending to the server.


Any ideas?
Posted By: SCNDRL Re: socket connections to a BNC - 18/07/06 12:22 PM
delete this from sockopen event sockwrite -tn $sockname quote PASS <my password>
add this to sokcread event " if (/quote pass isin %temp) { sockwrite -tn $sockname quote PASS <my password> } "
Posted By: tecsatan Re: socket connections to a BNC - 18/07/06 12:53 PM
That does not do anything different.

It simple make's sure it waits to be asked before answering. However I don't think sockwrite can just a command QUOTE and have in understood.

I tryed that code in botht he sockwrite and sockread sections. It would make more sens haveing it in the sockread if its an event to be triggered.

So code now reads:-

alias open.socket {
sockopen conn1 66.90.82.236 50127
echo 4 Socket connection test started
}
on *:SOCKOPEN:conn1: {
if ($sockerr > 0) return
sockwrite -tn $sockname user $rand(a,z) $+ $rand(1,99) $qt(asdf) $qt(asdf) : $+ tecsatan
sockwrite -tn $sockname nick $rand(a,z) $+ $rand(1,9999)
}
on *:sockread:conn1:{
if ($sockerr > 0) return
:nextread
sockread %temp
if ($sockbr == 0) return
if (%temp == $null) %temp = -
echo 4 %temp
if (*/quote PASS* isin %temp) { sockwrite -tn $sockname quote PASS <my password>
goto nextread
else
goto nextread
}
}
alias close.socket {
sockclose conn1
echo 4 Socket connection test finished
}



However thats still not doing anything
Posted By: SCNDRL Re: socket connections to a BNC - 18/07/06 03:03 PM
My Post
if (/quote pass isin %temp) { sockwrite -tn $sockname quote PASS <my password> }

your code

if (*/quote pass* isin %temp) { sockwrite -tn $sockname quote PASS <my password>

they are same ?
Posted By: SCNDRL Re: socket connections to a BNC - 18/07/06 03:14 PM
Umz. I Found The Real ProbLem

Code:
alias open.socket {
  sockopen conn1 66.90.82.236 50127
  echo 4 Socket connection test started
}
on *:SOCKOPEN:conn1: {
  if ($sockerr &gt; 0) return
  sockwrite -tn $sockname user $rand(a,z) $+ $rand(1,99) $qt(asdf) $qt(asdf) : $+ tecsatan
  sockwrite -tn $sockname nick $rand(a,z) $+ $rand(1,9999)
}
on *:sockread:conn1:{
  sockread %temp
  if ($sockerr) { return }
  echo 4 %temp
  if (/quote PASS isin %temp) { sockwrite -n $sockname PASS &lt;pass&gt; }
}
alias close.socket {
  sockclose conn1
  echo 4 Socket connection test finished
}

Dont Use quote
Posted By: tecsatan Re: socket connections to a BNC - 18/07/06 03:55 PM
That does not seem to work ever.

I don't know why but the BNC server does not seem to see the write commands. Or if it does, it makes no reply that it has.

But everything looks as if it should work.

If you have a BNC yourself then please try it and have a go. I would like to hear from anyone that cna get it to connect.

Current code:-

alias open.socket {
sockopen conn1 <your BNC server> <your BNC port>
echo 4 Socket connection test started
}
on *:SOCKOPEN:conn1: {
if ($sockerr > 0) return
sockwrite -tn $sockname user $rand(a,z) $+ $rand(1,99) $qt(asdf) $qt(asdf) : $+ tecsatan
sockwrite -tn $sockname nick $rand(a,z) $+ $rand(1,9999)
}
on *:sockread:conn1:{
sockread %temp
if ($sockerr) { return }
echo 4 %temp
if (/quote PASS isin %temp) {
sockwrite -n $sockname PASS <your pass>
sockwrite -tn $sockname conn <server u want to connect to> <port you want toc onnect on>
sockwrite -tn $sockname join <room you wish to join>
}
}
alias close.socket {
sockclose conn1
echo 4 Socket connection test finished
}
Posted By: SCNDRL Re: socket connections to a BNC - 18/07/06 04:36 PM
The Code which is i gave works. but i havent got a BNC so i cant try. but you can try with /server command before /debug @try then /server bncserver port you can see datas which are you send.. you can send this datas with sockwrite command..
© mIRC Discussion Forums