mIRC Home    About    Download    Register    News    Help

Print Thread
#248275 01/10/14 04:28 AM
Joined: Apr 2014
Posts: 8
O
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
O
Joined: Apr 2014
Posts: 8
Someone recently flooded my script that uses Sockopen.
The command is /sockopen -e test www.google.com 443
The socket makes a connection but in the 'sockopen' script

on *:sockopen:test:{
echo : Socket test is open
sockwrite -nt test POST %search HTTP/1.1
sockwrite -nt test Host: www.google.com
sockwrite -nt test $crlf
}

I don't get a response, but the script says

* /sockopen: 'test' socket in use (line 62, google.mrc)

I have already restarted the client and still no response.
The script is still functions properly.

Joined: Apr 2014
Posts: 8
O
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
O
Joined: Apr 2014
Posts: 8
It seems the the sockets have been disabled. Works in a different mIRC.

Joined: Jul 2006
Posts: 4,150
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,150
Well, * /sockopen: 'test' socket in use (line 62, google.mrc) looks like a good response to me, it means you already have a socket with the name in use, you must use a different name or close that socket before


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Dec 2008
Posts: 1,515
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,515
Well with this code you can read every page you want with one command.

Usage: /sockget <page>
Example: /sockget http://www.mirc.com

Help details:

/help on sockopen
/help on sockread
/help on sockread

Try use this code:

Code:
alias sockget {
  if (!$1-) { echo -a ERROR: Enter the URL Page correctly! | return }
  ; example: /sockget http://mirc.com/versions.txt

  var %s = sockget_ $+ $rand(1,100000)
  if ($sock(%s)) { sockclose %s }
  var %site = $1-
  var %get_host = $chr(47) $+ $gettok(%site,3-,47)
  var %host = $gettok(%site,2,47)
  if ($right(%site,1) == $chr(47)) && ($right(%get_host,1) !== $chr(47)) { var -s %get_host = %get_host $+ $chr(47) }
  if (*https* iswm %site) { sockopen -e %s %host 443 }
  else { sockopen %s %host 80 }
  sockmark %s %get_host
}

ON *:SOCKOPEN:sockget_*: {
  if ($sockerr) { echo -a ERROR: SOCKOPEN -> $sock($sockname).wserr -> $sock($sockname).wsmsg | return }
  sockwrite -n $sockname GET $sock($sockname).mark HTTP/1.0
  sockwrite -n $sockname Host: $sock($sockname).addr
  sockwrite -n $sockname User-Agent: */*
  sockwrite -n $sockname Connection: Close
  sockwrite -n $sockname
}

ON *:SOCKREAD:sockget_*: {
  if ($sockerr) { echo -a ERROR: SOCKREAD -> $sock($sockname).wserr -> $sock($sockname).wsmsg | return }
  var %read
  sockread %read
  if ($sockbr) { echo -ag READ: $left(%read,4096) }
}

ON *:SOCKCLOSE:sockget_*: { echo -ag SOCKET CONNECTION CLOSED! }


Need Online mIRC help or an mIRC Scripting Freelancer? -> https://irc.chathub.org <-
Wims #248282 01/10/14 06:34 PM
Joined: Apr 2014
Posts: 8
O
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
O
Joined: Apr 2014
Posts: 8
Originally Posted By: Wims
Well, * /sockopen: 'test' socket in use (line 62, google.mrc) looks like a good response to me, it means you already have a socket with the name in use, you must use a different name or close that socket before


I'm not getting the response of the command 'echo : Socket test is open'

I know the socket is opening. Just not getting the response of saying it's open.

westor #248283 01/10/14 06:40 PM
Joined: Apr 2014
Posts: 8
O
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
O
Joined: Apr 2014
Posts: 8
Originally Posted By: westor
Well with this code you can read every page you want with one command.

Usage: /sockget <page>
Example: /sockget http://www.mirc.com

Help details:

/help on sockopen
/help on sockread
/help on sockread

Try use this code:

Code:
alias sockget {
  if (!$1-) { echo -a ERROR: Enter the URL Page correctly! | return }
  ; example: /sockget http://mirc.com/versions.txt

  var %s = sockget_ $+ $rand(1,100000)
  if ($sock(%s)) { sockclose %s }
  var %site = $1-
  var %get_host = $chr(47) $+ $gettok(%site,3-,47)
  var %host = $gettok(%site,2,47)
  if ($right(%site,1) == $chr(47)) && ($right(%get_host,1) !== $chr(47)) { var -s %get_host = %get_host $+ $chr(47) }
  if (*https* iswm %site) { sockopen -e %s %host 443 }
  else { sockopen %s %host 80 }
  sockmark %s %get_host
}

ON *:SOCKOPEN:sockget_*: {
  if ($sockerr) { echo -a ERROR: SOCKOPEN -> $sock($sockname).wserr -> $sock($sockname).wsmsg | return }
  sockwrite -n $sockname GET $sock($sockname).mark HTTP/1.0
  sockwrite -n $sockname Host: $sock($sockname).addr
  sockwrite -n $sockname User-Agent: */*
  sockwrite -n $sockname Connection: Close
  sockwrite -n $sockname
}

ON *:SOCKREAD:sockget_*: {
  if ($sockerr) { echo -a ERROR: SOCKREAD -> $sock($sockname).wserr -> $sock($sockname).wsmsg | return }
  var %read
  sockread %read
  if ($sockbr) { echo -ag READ: $left(%read,4096) }
}

ON *:SOCKCLOSE:sockget_*: { echo -ag SOCKET CONNECTION CLOSED! }


I've added the line 'if ($sockerr) { echo -a ERROR: SOCKOPEN -> $sock($sockname).wserr -> $sock($sockname).wsmsg | return }' to the first line of sockopen and still no response from it.

I know how to code for sockets. The script was running perfectly until it got flooded. Now none of my sockets want to connect on my mIRC client.

Joined: Apr 2014
Posts: 8
O
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
O
Joined: Apr 2014
Posts: 8
I had to restart the computer. Fixed the issue.

Joined: Dec 2008
Posts: 1,515
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,515
LOL!!!!!

Check your internet connection, either your antivirus and firewall to.


Need Online mIRC help or an mIRC Scripting Freelancer? -> https://irc.chathub.org <-
westor #248287 01/10/14 08:07 PM
Joined: Apr 2014
Posts: 8
O
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
O
Joined: Apr 2014
Posts: 8
Well the script was using SSL, maybe there was an issue with that. Otherwise its back and functioning.
The antivirus and firewall has no affect to the script as it works with it on.


Link Copied to Clipboard