Jul 25, 2008

Sockets Help (mirc)

Free Web Hosting, No Ads > CONTRIBUTE > Computers > Programming Languages > Others

free web hosting

Sockets Help (mirc)

AlternativeNick
hello, i was wondering if someone would be able to help me out a bit.
Im looking to get some info from my forums using sockets and mIRC, however the info i want requires that you be logged in.

I know that it would require sockwrite POST something, but im not really sure how to use that :S
anyways, here is the source to the login section (HTML)
HTML
<form action="http://www.altscripts.trap17.com/forum/index.php?action=login2" method="post" style="margin: 3px 1ex 1px 0pt; text-align: right;">

<input name="user" size="10" type="text"> <input name="passwrd" size="10" type="password">
<select name="cookielength">
<option value="60">1 Hour</option>
<option value="1440">1 Day</option>
<option value="10080">1 Week</option>
<option value="302400">1 Month</option>

<option value="-1" selected="selected">Forever</option>
</select>
<input value="Login" type="submit"><br>
Login with username, password and session length
</form>

 

 

 


Reply

imacul8
Sorta gotta error test this to get it all to work properly but this would be the basic layout of it

CODE
alias getforum {
sockclose forum
sockopen forum 64.69.46.210 80
}

on *:sockopen:forum: {
  if ($sockerr) {
    echo -a Connection failed
    sockclose forum
    return
  }
sockwrite -n $sockname POST  /forum/index.php?action=login2&user=<user>&passwrd=<pass>&cookielength=-1 HTTP/1.1
sockwrite -n $sockname Host: 64.69.46.210
sockwrite -n $sockname User-Agent: explorer
sockwrite -n $sockname Accept: *.*, */*
sockwrite -n $sockname Referer: /forum/index.php?action=login2
sockwrite -n $sockname Connection: Keep-Alive
sockwrite -n $sockname Content-Type: text/html
sockwrite -n $sockname $crlf
}


Hope this helps you, if u need more info i am free to help here smile.gif

 

 

 


Reply

AlternativeNick
hey thanks, but im not really sure how to go back to the page and read the next page from that, if you could PM me with some contact info (irc server, channels, and nickname) i would really appreciate it.

otherwise, im available (most of the time) on irc.swiftirc.net in channel #scripting and #mirc
thanks smile.gif

Reply

imacul8
Well im not sure if your website needs the cookies sent each page you view but if it does it gets a bit more complicated.... if it doesnt then its pretty easy. Since in that last POST it logs in forever (how ever many days it can "max days").

So if it doesnt need cookies sent each time - Once u have done the login part you need to use the sockread event and scan the code for the correct text like "Logged in" or whateva your website says once ur logged in. Once it sees that text u then need to make it open the socket again and grab the next page....

You need to set all the events out better so u can use the same event but have it grab a different page.. i will get to that down a bit further....

something like this would do the job, you can also use it as a debug for the html received from the site to make sure it is working right.


Can use this for the debug
CODE
on *:sockread:forum: {
window -e @forum
  sockread %temp
  if (!$sockbr) { return }
  if (%temp) {
    echo @forum %temp
  }
}


And you can add your scan part

CODE
on *:sockread:forum: {
window -e @forum
  sockread %temp
  if (!$sockbr) { return }
  if (%temp) {
    echo @forum %temp
  }
if (Logged isin %temp) { echo @forum %temp }
}


you will see what that line with that returns, probably even includes a link u can grab out that line... or if u know where u wanna go next just add the commands there (this is where all your events need to be set out better
ie.

CODE
alias forumlogin {
sockclose forum
sockopen forum 64.69.46.210 80
set %forum.get POST  /forum/index.php?action=login2&user=<user>&passwrd=<pass>&cookielength=-1 HTTP/1.1
}

alias foruminfo {
sockclose forum
sockopen forum 64.69.46.210 80
set %forum.get GET /pageyouwannagethere.php HTTP/1.1
}

on *:sockopen:forum: {
  if ($sockerr) {
    echo -a Connection failed
    sockclose forum
    return
  }
sockwrite -n $sockname %forum.get
sockwrite -n $sockname Host: 64.69.46.210
sockwrite -n $sockname User-Agent: explorer
sockwrite -n $sockname Accept: *.*, */*
sockwrite -n $sockname Connection: Keep-Alive
sockwrite -n $sockname Content-Type: text/html
sockwrite -n $sockname $crlf
}

on *:sockread:forum: {
window -e @forum
  sockread %temp
  if (!$sockbr) { return }
  if (%temp) {
    echo @forum %temp
  }
if (Logged isin %temp) { <---- you might need to add/alter this part depending what ur site returns
echo @forum %temp
foruminfo
}
}


Hope this helps you, i will try catch u on that server u mentioned (there now but you arent.. )
If this doesnt work and the foruminfo echos something like "You are not logged in" to the @forums window then you will have to send cookies each time which can be difficult but will cover that if need be...

goodluck smile.gif

Reply

imacul8
Well since i havent been able to get hold of you for the past couple days and you havent replied on here i took it upon myself to get this working correctly and in my studies found you are going to have to save and send the cookies each time u view a page.
I wont cover that at this time since im not even sure if you are continuing with this project...?

But here is the up to date code that will get you logged in correctly to the account

CODE
alias forumlogin {
  sockclose altforum
  sockopen altforum www.altscripts.trap17.com 80
  set %forum.get POST  /forum/index.php?action=login2&user=<username>&passwrd=<password>&cookielength=-1 HTTP/1.1
}

alias foruminfo {
  sockclose altforum
  sockopen altforum www.altscripts.trap17.com 80
  set %forum.get POST /forum/index.php?action=profile HTTP/1.1
}

on *:sockopen:altforum: {
  if ($sockerr) {
    echo -a Connection failed
    sockclose forum
    return
  }

  sockwrite -n $sockname %forum.get
  sockwrite -n $sockname Host: www.altscripts.trap17.com
  sockwrite -n $sockname User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; FDM)
  sockwrite -n $sockname Accept: *.*, */*
  sockwrite -n $sockname Connection: Keep-Alive
  sockwrite -n $sockname Content-Type: text/html
  sockwrite -n $sockname $crlf
}

on *:sockread:altforum: {
  window -e @altforum
  sockread %temp
  if (!$sockbr) { return }
  if (%temp) {
    if (Location: isin %temp) {
      sockclose altforum
      sockopen altforum www.altscripts.trap17.com 80
      set %forum.get POST $+(/,$gettok(%temp,3-,47)) HTTP/1.1
    }
    echo @altforum %temp
  }
}


So if you need help with the next stages after this just let me know smile.gif

Reply

AlternativeNick
ok, so after some work, heres what i have xD
(the dialog is from another script, im just adding this section to it, so ignore the dialog commands)
CODE

alias forumlogin {
  sockclose altforum
  sockopen altforum www.altscripts.trap17.com 80
  set %forum.get POST $+(/forum/index.php?action=login2&user=,$user,&passwrd=,$pass,&cookielength=-1) HTTP/1.1
}

alias foruminfo {
  sockclose altforum
  sockopen altforum www.altscripts.trap17.com 80
  set %forum.get POST /forum/index.php?action=profile HTTP/1.1
}

on *:sockopen:altforum: {
  if ($sockerr) {
    echo -a Connection failed
    sockclose forum
    return
  }

  sockwrite -n $sockname %forum.get
  sockwrite -n $sockname Host: www.altscripts.trap17.com
  sockwrite -n $sockname User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; FDM)
  sockwrite -n $sockname Accept: *.*, */*
  sockwrite -n $sockname Connection: Keep-Alive
  sockwrite -n $sockname Content-Type: text/html
  sockwrite -n $sockname $crlf
}

on *:sockread:altforum: {
  window -e @altforum
  sockread %temp
  if (!$sockbr) { return }
  if (%temp) {
    if (Location: isin %temp) {
      sockclose altforum
      sockopen altforum www.altscripts.trap17.com 80
      set %forum.get POST $+(/,$gettok(%temp,3-,47)) HTTP/1.1
    }
    if (*Hey, <b>AlternativeNick</b>, you have <a* iswm %temp) {
      var %welcome = Welcome $user $+ , You have $gettok($remove($htmlfree(%temp),$chr(9)),7,32) new messages.
      var %inbox = $gettok(%temp,2,34)
      did -a altscripts 22 %welcome
    }
    elseif (*Total Time Logged In* iswm %temp) {
      var %timeonline = You have spent $gettok($remove($htmlfree(%temp),$chr(9),$chr(46)),2,58) on the forums.
      did -a altscripts 26 %timeonline
    }
    elseif (*Show Unread Posts since last visit* iswm %temp) {
      set %showunreadpostssincelastvisit $gettok(%temp,2,34)
    }
    elseif (*Show new replies to your posts.* iswm %temp) {
      set %shownewrepliestoyourposts    $gettok(%temp,2,34)
    }
  }
}


Anyways, i was also looking at posting a now topic using mirc.

The exact url of that is http://www.altscripts.trap17.com/forum/ind...=post;board=5.0 and will always be the same board. thanks for all the help xD


ps. in this line (you gave to someone in my channel) if ($eval($+(%,$me,.kick),2) == 3) { it wont work, firstly you cant trigger your own on text events, and secondly why would you want to see if youve been swearing, its someone else youre looking for xD

Reply

imacul8
QUOTE(AlternativeNick @ Sep 7 2006, 06:13 PM) *

ps. in this line (you gave to someone in my channel) if ($eval($+(%,$me,.kick),2) == 3) { it wont work, firstly you cant trigger your own on text events, and secondly why would you want to see if youve been swearing, its someone else youre looking for xD


Oops i was just testing something with $me and must have just pasted that in and not changed it to $nick, my bad. Did that user end up getting it working??

Reply

AlternativeNick
yeah, we worked it out... the only problem that was left was that it had $me instead of $nick, took me an hour to see it (at 5 am lol)

Reply

tractor
Ok thats good this was a month ago cause your suppose to be the #2 scripter #1 goes to Marius sorry. sad.gif

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Recent Queries:-
  1. sockets irc - 10.33 hr back. (1)
  2. irc sockets - 17.87 hr back. (1)
  3. mirc scripting sockets post - 21.92 hr back. (1)
  4. sockets mirc - 23.12 hr back. (1)
  5. mirc http sockets - 48.64 hr back. (1)
  6. mirc sockets forum - 55.07 hr back. (1)
  7. mirc sockets - 56.44 hr back. (1)
  8. mirc sockwrite - 93.25 hr back. (1)
  9. sockopen help - 98.04 hr back. (1)
  10. mirc socket help - 116.11 hr back. (1)
  11. using mirc ftp sockets - 121.57 hr back. (1)
Similar Topics

Keywords : sockets, mirc

  1. Need Help With Mirc
    (0)
  2. I Am Looking For Ideas For A Mirc Addon
    I want your ideas (1)
    Well im currently between 2 projects that im scripting and im bored with them haha!! Just
    looking for ideas for something else i can make... Maybe just sumthing little that u want made, i
    will make it for you and release it here. I have a fairly wide range of scripting knowledge and i
    will try to make most things... Always looking to learn more things also Ta....
  3. Mirc 3d Rendering
    (0)
    QUOTE ======================================================================5/26/2006===
    Talons Simple 3D Tutorial irc.webchat.org:6667 in
    #mIRC,#help.mIRC ==================================================================================
    As a programmer, I often find myself trying to write things that already exist. It gives some
    satisfaction to say, "I did this on my own." even if it is not as good as what is already out there.
    Nothing is more impressive than your own work, even if it is not as good. It's an accompli....
  4. Socket Status Addon For Mirc
    (2)
    This addon will display the status of your open sockets (if there is any) Displays displays the
    Name, IP, Port, Status - Bytes sent/received & last Sent/recieved Has options to refresh the status,
    close a socket and close all sockets. Copy and paste this code below into your remotes (alt + r) To
    run the dialog u can simply type /sockstats or u can add a popup to your menubar or wherever to open
    it. ie. &Socket Status:/sockstats in your status popup section (alt + p) **IF you have no active
    sockets it wont open the dialog, it will just return no open sockets in your ....
  5. How To Customize The Look Of Your Mirc Events Part 2
    (6)
    Well in part 1 of How To Customize The Look Of Your Mirc Events i covered some channel events, so
    now i will cover the events for in a private chat. Plus some extra stuff.... ** To change the look
    of the other persons text u again use a on text event CODE on ^*:TEXT:*:?: {
      echo -t $query($nick) ( $+ $nick $+ ) $1-   halt }
    ** To change the look of your own input CODE on *:INPUT:?: {   if
    ($left($1,1) != /) {     .msg $active $1-     echo....
  6. How To Customize The Look Of Your Mirc Events
    (4)
    Well im sure that a lot of you just use mIRC for chatting and do not realise that you can actually
    use it to code cool stuff. You can also change the way your events look and i am going to explain
    how here. Starting with the on join event - which triggers when you and other users join a channel.
    Instead of having just the plain * Now talking in #channel and * nick has joined #channel you can
    make it look fancy ie. (Join/nick) (nick@address) and its not hard to do. CODE on
    ^*:JOIN:#: {   echo -t $chan (Join/ $+ $nick $+ ) (....
  7. Control Parts Of Msn Through Mirc
    (7)
    Control your MSN, or return various information such as nickname, status, etc.. Usage:
    $msn(valuetype) Valuetypes : returnvalue online : $true or $false indicating
    wheter your signed in or not (actually $true indicates status but was added to have an
    independent online checker) status : returns the status of MSN (Busy,Online,Invisible etc)
    nickname : your nickname email : your email ie. //echo -a $msn(nickname) will return ur msn
    nickname. user : $true when succesful $false when not Methods: Blocked CanPage
    Frie....
  8. Few Mirc Snippets I Have Scripted
    (19)
    Just a few things that may come in handy /smile.gif" style="vertical-align:middle" emoid=":)"
    border="0" alt="smile.gif" /> Backwards text snippet : will revers the text u input CODE bck {
      var %x = 1,%bck   while (%x <= $len($1-)) { %bck =
    $mid($1-,%x,1) $+ %bck | inc %x }   return %bck } Usage: $bck(text)
    ie. //echo -a $bck(hello everyone) Returns: enoyreve olleh Random letter/number generator :
    creates a random letter/number combo for the length specified. CODE rx {   if ($1 == &....
  9. Mirc Snippets
    Some snippets for IRC Chatters :) (10)
    You can find them on: www.hawkee.com www.mircscripts.org www.mircscripts.com www.mirc.net ... Here
    are somones...: CODE ; Repeat flood protection ; Change #channel with the name of your channel
    :) ; It will ban+kick after 3 repeats i 8 secs. on *:text:*:#klinci: {  if
    ($nick == $me) || ($nick isop $chan) || ($nick ishop
    $chan) { halt }  else {    var %text =
    $hash($strip($1-),32)    var %stari.text = %rp. [ $+ [
    $chan ] $+ . &#....

    1. Looking for sockets, mirc

Searching Video's for sockets, mirc
advertisement



Sockets Help (mirc)



 

 

 

 

ADD REPLY / Got an Opinion! Remove these ADs! RAPID SEARCH! Free Web Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE