Jump to content

Recommended Posts

Posted

hi all..made myself a little prog that connects to an irc channel. It logs on to the channel uccessfully, but simply won't "talk" to me with the TCPSend function.

here is the source. Thanks in advance.

;Tim Koschützki


;;break(0);disllow close from the tasktray
;; Comment this out to prevent hotkey exit
Opt("TrayIconHide", 1)  
$server = "irc.quakenet.org"
$port = 6667
$name = "Keylogger_very_mean"
$ident = "rtgyrgtdyd"
$realname = "asdhlkj aklbalkbdls"
$chan = "#jkbub"
Global $user32 = DllOpen ( "user32" )
$debug =0

Opt("TCPTimeout", 100)
Opt("WinTitleMatchMode", 3)

$irc = -1
If TCPStartup() == 0 Then
  MsgBox(0, "TCPStartup Error", "Failed to initialize TCP, make sure you have the TCP/UDP driver installed.  Error code: " & @error)
  Exit
EndIf

$irc = TCPConnect(TCPNameToIP($server), $port)
If $irc == -1 Then
  MsgBox(0, "TCPConnect Error", "Failed to connect to server.  Error code: " & @error)
  Exit
EndIf
 
Func OnAutoItExit()
  If $irc <> -1 Then
    xTCPSend($irc, "QUIT : Shutting down..." & @CRLF)
    TCPCloseSocket($irc)
    TCPShutdown()
  EndIf
EndFunc

Func HandlePing($irc, $buff)
  $x = $buff
  While not StringInStr($x, @CR)
    Sleep(100)
    $x = $x & xTCPRecv($irc, 512)

    If ($x == "") Then
      Return 0
    EndIf
  WEnd
  $type = HandleMessage($irc, StringLeft($x, StringInStr($x, @CR) - 1))
  if $type == "PING" or $type == "376" Then
    Return 1
  EndIf
  
  Return HandlePing($irc, StringRight($x, StringLen($x) - StringInStr($x, @CR) - 1))
EndFunc

Func HandleMessage($irc, $text)
  $text = StringSplit($text, " ")
  If $text[1] == "PING" Then
    xTCPSend($irc, "PONG " & $text[2] & @CRLF)
    Return "PING"
  ElseIf StringLeft($text[1], 1) == ":" Then
    Return $text[2]
  EndIf
EndFunc

Func xTCPSend($irc, $text)
  If $debug == 1 Then
    MsgBox(0, "TCPSend", $text)
  EndIf
  Return TCPSend($irc, $text)
EndFunc

Func xTCPRecv($irc, $lim)
  $x = TCPRecv($irc, $lim)
  If $x <> "" and $debug == 1 Then
    MsgBox(0, "TCPRecv", $x)
  EndIf
  Return $x
EndFunc


xTCPSend($irc, "USER " & $ident & " 0 * :" & $realname & @CRLF)
xTCPSend($irc, "NICK " & $name & @CRLF)

While (HandlePing($irc, "") == 0)
  Sleep(100)
WEnd

xTCPSend($irc, "JOIN " & $chan & @CRLF)

xTCPSend($irc, "Hi am here"); **

It will never send "Hi am here", although I am staying in the same channel with mIRC.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...