This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

TCL get IP from webchat, converts from HEX to the real ip

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
s
sapo
Voice
Posts: 5
Joined: Fri Jun 15, 2012 9:38 am

TCL get IP from webchat, converts from HEX to the real ip

Post by sapo »

Hello,

I would like that: when a user from a webchat join a channe where the bot is, his real IP would be written by the bot on a private channel that I have.
The IP from a webchat is formatted as HEX.

The TCL doesn't do nothing can you help, please?

Code: Select all

# This script allows to find out true IP of an user
# connected thru webchat services.
#

# Enable IP discovery on trigger (!findip)
set findip_do 1

# Enable IP discovery on join
set findjoinedip_do 1

# Channels to show info on
set findip_channel(#palmela-bots)  1

#
# End of prefs
#

set findip_header "\[ FindIP \]"

bind pub  m|m !findip findip
bind join -|- *       findjoinedip

proc findip {nick uhost hand channel arg} {
  global findip_header findip_do findip_channel

  set channel [string tolower $channel]
  if {$findip_do != 1} {
    return;
  }

  # hint taken from http://www.peterre.com/characters.html
  set arg [lindex [split $arg] 0]

  set hexip ""
  set host [getchanhost $arg $channel]
  if {$host != ""} {
    if {[regexp -- {-?([0-9a-f]{8})@(.*\.ircnet\.(info|com)|webchat\.(xs4all\.nl|irc\.cz))} $host all hexip]} {
      set realip [long2ip [format %d "0x$hexip"]]
      putserv "PRIVMSG $channel :$findip_header Real IP of $arg is $realip"
    }
  }
}

proc findjoinedip {nick uhost hand channel} {
  global findip_header findjoinedip_do join_message findip_channel

  set channel [string tolower $channel]
  if {$findjoinedip_do != 1 || [info exists findip_channel($channel)] && $findip_channel($channel) == "0"} {
    return
  }

  set arg [lindex [split $nick] 0]
  set hexip ""
  if {$uhost != ""} {
    if {[regexp -- {-?([0-9a-f]{8})@(.*\.ircnet\.(info|com)|webchat\.xs4all\.nl|webchat\.irc\.cz)} $uhost all hexip]} {
      set realip [long2ip [format %d "0x$hexip"]]
      putserv "PRIVMSG $channel :$findip_header $arg is connected thru a webchat service, his real IP is $realip"
    }
  }
}


# proc taken from http://www.eggfaq.com/docs/faq.html
proc long2ip {long} {
  return [format "%d.%d.%d.%d" \
  [expr ($long >> 24) & 0xff] \
  [expr ($long >> 16) & 0xff] \
  [expr ($long >> 8) & 0xff] \
  [expr $long & 0xff]]
}

putlog "Loaded FindIP 0.5"
s
sapo
Voice
Posts: 5
Joined: Fri Jun 15, 2012 9:38 am

help

Post by sapo »

can anyone help please?
s
sapo
Voice
Posts: 5
Joined: Fri Jun 15, 2012 9:38 am

Post by sapo »

anyone please?
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Could you provide an example of how an hex IP looks like?
Once the game is over, the king and the pawn go back in the same box.
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

Code: Select all

bind pub - !hex hexIdent
bind join - * hexIdentJoin

setudef flag hex
setudef flag hexjoin

proc hexIdentJoin {nick uhost hand chan} {
	if {![channel get $chan hexjoin]} { return }
	hexIdent $nick $uhost $hand $chan $nick 1
}

proc hexIdent {nick uhost hand chan text {join 0}} {
	if {![channel get $chan hex]} { return }
	set wnick [lindex [split [getchanhost [lindex [split $text] 0] $chan] @] 0]
	if {[string length $wnick]} { set text $wnick } { set wnick $text }
	set a $text
	if {[string length $a] == 8} {
		while {[string length $a]} {
			set piece [string range $a 0 1]
			set a [string range $a 2 end]
			if {[regexp {^[a-fA-F0-9]+$} $piece]} {
				lappend ip [scan $piece %x]
			} else {
				set flag 1 ; break
			}
		}
		if {![info exists flag]} {
			set ip [join $ip "."]
			putserv "privmsg $chan :\002$wnick\002 > Ident:\002$text\002; IP:\002$ip\002"
		} else {
			if {$join < 1} {
				putserv "privmsg $chan :\002$wnick\002 > \"$text\" is not hex based."
			}
		}
	} else {
		if {$join < 1} {
			putserv "privmsg $chan :\002$wnick\002 isn't the amount of characters (8) required to convert to hex ip."
		}
	}
}
There are 2 ways this is usually done:

1) -----
nick!A6FD2E9F@somewebchat.net

This is the code I use to do that. It works when the nickname's "ident" is hex encoded. Where that a6 stuff is above. This is similar to the way the script you originally posted handles it, except I know mine above works. If this is what you meant.. Enjoys..

Make sure you:
to enable !hex for your users >> .chanset #yourchan +hex
to enable hex checks on join >>.chanset #yourchan +hexjoin


2) ----
nick!webchat@9785F988.22D4FF26.21659F86.IP

If instead, it looks like this. It would take a different script to reverse this type of hostmask. Neither the script I posted nor the one you originally posted will work with this type.
s
sapo
Voice
Posts: 5
Joined: Fri Jun 15, 2012 9:38 am

Post by sapo »

thanks it really works I just edit the line putserv "privmsg #my_chan .." to only send the data to that specific channel, thanks
k
kingkong
Voice
Posts: 10
Joined: Sun Apr 08, 2012 5:02 am

Post by kingkong »

hey, it doesn't work at me coz our cloaked ips different hexed.
as an example cloaked ip here: @350CE3.C1A208.7F4D68.0036C0

can someone help with it please?
S
SmasHinG
Voice
Posts: 29
Joined: Mon Aug 29, 2011 2:58 am

Post by SmasHinG »

Can you make this script to check for proxy checking ip/host and if is proxy bot tell to channel example: Warning This IP 54.67.88.35 is infected !
Thank You
SmasHinG®
User avatar
Get_A_Fix
Master
Posts: 206
Joined: Sat May 07, 2005 6:11 pm
Location: New Zealand

Post by Get_A_Fix »

kingkong wrote:hey, it doesn't work at me coz our cloaked ips different hexed.
as an example cloaked ip here: @350CE3.C1A208.7F4D68.0036C0

can someone help with it please?
you probably want to change

Code: Select all

set wnick [lindex [split [getchanhost [lindex [split $text] 0] $chan] @] 0]
with....

Code: Select all

set wnick [lindex [split [getchanhost $text $chan] @] 1]
That should work.

SmasHinG wrote:Can you make this script to check for proxy checking ip/host and if is proxy bot tell to channel example: Warning This IP 54.67.88.35 is infected !
Thank You
lol, umm, there are plenty of other script's out there that do that. This script is completely different from what you want/need, it's made for webchat IRC client's that use encrypted identd connections.
We explore.. and you call us criminals. We seek after knowledge.. and you call us criminals. We exist without skin color, without nationality, without religious bias.. and you call us criminals.
S
SmasHinG
Voice
Posts: 29
Joined: Mon Aug 29, 2011 2:58 am

Post by SmasHinG »

Can you give me script for this who i want ?
SmasHinG®
User avatar
bunnybump
Voice
Posts: 9
Joined: Fri Aug 17, 2012 2:32 am
Contact:

Post by bunnybump »

<birex> ZendOR isn't the amount of characters ( 8 ) required to convert to hex ip.
what if i want to use less than 8 character to convert it to hex ip? is it possible for that? can somebody help me how to do it pls. thanks :)
In the Beginning... Was the Command Line
k
kingkong
Voice
Posts: 10
Joined: Sun Apr 08, 2012 5:02 am

Post by kingkong »

hi, thanks for reply, for all. I tried it but couldn't make it work. always gives this output. how to run this? i give here some examples:
<kingkong>: !hex @350CE3.C1A208.7F4D68.0036C0
<bot>: @350CE3.C1A208.7F4D68.0036C0 isn't the amount of characters ( 8 ) required to convert to hex ip.
<kingkong> !hex 350CE3.C1A208.7F4D68.0036C0
<bot>: 350CE3.C1A208.7F4D68.0036C0 isn't the amount of characters ( 8 ) required to convert to hex ip.
Post Reply