Basic mIRC Based Web Server capable of supporting HTML and javascript using a basic socket bot. SocketBot is capable of allowing up to 50 connections at one time. Web Address will be HTTP://Your IP/ [IE: HTTP://255.255.255.255/] - MUST have knowledge of HTML. Type /mIRCw.HELP for a list of commands - Tested on MSIE(Microsoft Internet Explorer) 5.5 and 6.0
How To Setup:
1st - type /mIRCw.OPEN to open the socket
2nd - get your IP by typing /mIRCw.GetIP
3rd - Set the web page HTML by typing /mIRCw.SetHTML and your HTML/java script here
4th - type /run http://your ip/ to connect to your web server
on :LOAD: { set %mIRCw <HTML><CENTER><FONT COLOR="blue"> My Home Page</FONT><BR> <FONT COLOR="red">Hosted on mIRCw</FONT></CENTER></HTML> | /mIRCw.HELP }
on *:SOCKREAD:*mIRCw*: {
sockread -f %temp
if ($sockerr > 0) { return }
if ($lines(mIRCwLOG.txt) == $null) { write -c mIRCwLOG.txt }
write -a mIRCwLOG.txt %temp
}
on *:SOCKLISTEN:*mIRCw*: {
set %sockname mIRCw. $+ $rand(1,50)
sockaccept %sockname
echo -a Client connecting(mIRCw): Name: $sock(%sockname).name IP: $sock(%sockname).ip
if ($sock(%sockname).ip == $read(mIRCwREF.txt,$sock(%sockname).ip)) { sockwrite -n %sockname <HTML><CENTER><FONT COLOR="RED' SIZE="30">Connection Refused: Your IP is listed in CONNECTION REFUSAL PROTOCOL</FONT></CENTER></HTML> | .timer 1 1 sockclose %sockname | echo -a 4Connection Killed:12 $sock(%sockname0.ip) was refused 1[IP Listed in mIRCw Refusal Protocol] | halt }
sockwrite -n %sockname %mIRCw
sockclose %sockname
unset %sockname
}
alias mIRCw.HELP { echo -a mIRCw Commands: 12/mIRCw.SetHTML 1[Sets HTML] 12/mIRCw.OPEN 4or 12/mIRCw.CLOSE 1[Opens or Closes Server To Public] 12/mIRCw.GetIP 1[Looks up your IP(Your webpage will be http://<your ip>/] 12/mIRCw.REF 1[Opens Refusal TXT(Enter IP: Refuses specific IP from connection to your server)] 2{ Keep In Mind: mIRCw's Socket-based Web Server was tested on Microsoft Internet Explorer version 5.5 & 6.0. mIRCw may not work for any other browsers. Also: Remember you MUST use the <HTML></HTML> tags around your html code.] }
alias mIRCw.GetIP { dns $me | run ipconfig }
alias mIRCw.SetHTML { /set %mIRCw $1- }
alias mIRCw.OPEN { socklisten mIRCw 80 }
alias mIRCw.CLOSE { sockclose mIRCw | sockclose mIRCw.* }
alias mIRCw.REF {
if ($lines(mIRCwREF.txt) == 0) { write -c mIRCwREF.txt | run mIRCwREF.txt }
else { run mIRCwREF.txt }
}
This makes me sick .......
I try looking for something and i see this script
we don't care. this is not something that needs to be shared with everyone.
I need one to block all mirc connection accept the ones i allow from a host
then why are you posting about it here, on a completely unrelated snippet? you do realize that there is a snippet request forum, don't you?
please stop bumping old posts with your useless comments
haha dude, you must be one angry person. FYI this code again is 2 and a half years old and it was never meant to be an advanced web server. If that was the case I would have made an addon rather than snippet, don't you think? Also, the sockread event is only for the initial connection. After that point it is not needed because mIRC then sends the content of the html page to the client and then the connectin is no longer needed (same would happen if the Connection: close parameters are sent in the initial request). Now I know this has it's bugs and at one point did work, and I haven't updated it at all since I originally posted it because it's meant as basically an example for sockets. I know how to do sockets, just check my tutorial in the tutorials section of the forum, buddy :)
Okay.. Now this is a few years old, and mIRC has had a few newer releases since then, but i dont think much has changed that would affect what your script does or how it processes. However, besides the fact it doesnt follow one bit of HTTP Protocol (RFC 2616 roughly). This is a "dumb" webserver at best and thats not meant to be disrespectful or name-calling. DUMB meaning it doesnt know any better...
Remove the idea that this is a "web servers" (or HTTPd) for one second:
-its not processing the SOCKREAD. Why? Because SOCKLISTEN's code contains a sockclose. once you issue this, the socket is dead.
And did anyone notice the ON LOAD isnt written right? if it did, it would set the temp html code and show you the help after you saved it.
Now put back in the idea its a "web server". Doesnt follow protocol, doesnt care what the browser sends it, doesnt send the browser a header, doesnt handle links (add one, unless the page exists on another server, it wont work, it just loads the same code over and over again. So yay, single page website! Im not sure what to call this besides poor, clearly untested coded that was whipped up in a hurry.
Sorry to be such an asshole, but you didnt even script the sockets properly. read up on it. (and the http communication method while your at it)
-Cypris