egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

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

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
sapo
Voice


Joined: 15 Jun 2012
Posts: 5

PostPosted: Fri Jun 15, 2012 9:45 am    Post subject: TCL get IP from webchat, converts from HEX to the real ip Reply with quote

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:

# 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"
Back to top
View user's profile Send private message
sapo
Voice


Joined: 15 Jun 2012
Posts: 5

PostPosted: Sat Jun 16, 2012 9:38 pm    Post subject: help Reply with quote

can anyone help please?
Back to top
View user's profile Send private message
sapo
Voice


Joined: 15 Jun 2012
Posts: 5

PostPosted: Tue Jul 10, 2012 7:16 am    Post subject: Reply with quote

anyone please?
Back to top
View user's profile Send private message
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Tue Jul 10, 2012 9:04 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
speechles
Revered One


Joined: 26 Aug 2006
Posts: 1398
Location: emerald triangle, california (coastal redwoods)

PostPosted: Tue Jul 10, 2012 3:25 pm    Post subject: Reply with quote

Code:
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.
_________________
speechles' eggdrop tcl archive
Back to top
View user's profile Send private message
sapo
Voice


Joined: 15 Jun 2012
Posts: 5

PostPosted: Tue Jul 10, 2012 3:58 pm    Post subject: Reply with quote

thanks it really works I just edit the line putserv "privmsg #my_chan .." to only send the data to that specific channel, thanks
Back to top
View user's profile Send private message
kingkong
Voice


Joined: 08 Apr 2012
Posts: 10

PostPosted: Sat Jan 12, 2013 2:37 am    Post subject: Reply with quote

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?
Back to top
View user's profile Send private message
SmasHinG
Voice


Joined: 29 Aug 2011
Posts: 29

PostPosted: Sat Jan 12, 2013 5:15 am    Post subject: Reply with quote

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®
Back to top
View user's profile Send private message
Get_A_Fix
Master


Joined: 07 May 2005
Posts: 206
Location: New Zealand

PostPosted: Sun Jan 13, 2013 2:33 am    Post subject: Reply with quote

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:

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


with....

Code:

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.
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
SmasHinG
Voice


Joined: 29 Aug 2011
Posts: 29

PostPosted: Sun Jan 13, 2013 6:17 am    Post subject: Reply with quote

Can you give me script for this who i want ?
_________________
SmasHinG®
Back to top
View user's profile Send private message
bunnybump
Voice


Joined: 17 Aug 2012
Posts: 9

PostPosted: Sun Jan 13, 2013 1:13 pm    Post subject: Reply with quote

Quote:
<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 Smile
_________________
In the Beginning... Was the Command Line
Back to top
View user's profile Send private message Visit poster's website
kingkong
Voice


Joined: 08 Apr 2012
Posts: 10

PostPosted: Sun Jan 13, 2013 9:59 pm    Post subject: Reply with quote

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:
Quote:

<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.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber