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.

OP users if their IP (from /whois) appears on a whitelist

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
c
catharsis
Voice
Posts: 3
Joined: Wed Nov 02, 2022 10:27 pm

OP users if their IP (from /whois) appears on a whitelist

Post by catharsis »

Something like this might already exist but I looked for hours and couldn't find anything

on /whois there's a line that looks like this:

Code: Select all

actually using host [IP address here]
what I have in mind is a script that can look up users on /whois and OP them if the IP displayed there is on a list of trusted IPs

both IPV4 and IPV6 IPs need to be supported

users should be checked when they join the channel, also, when eggdrop itself becomes OP'd, it should check all users on the channel (run /whois on every user and OP any who match the trusted IP list). Also maybe also check all users every X minutes just in case something slips through the cracks?

NOTE: I'm aware of eggdrop's built-in auto-OP functionality but I don't want to use it because it's based on hostnames so anyone with the ability to create PTR records for their own IP could trivially exploit it
s
simo
Revered One
Posts: 1071
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

u could also use the cloaked IP for that as thats unique as well tied tthe real IP i use it as well to add users and grant them access in eggdrop for like aop and such

that would take a bind join only and no whois to check for it

i hope this helps, let me know if it worked
c
catharsis
Voice
Posts: 3
Joined: Wed Nov 02, 2022 10:27 pm

Post by catharsis »

it's EFnet so there are no cloaks
s
simo
Revered One
Posts: 1071
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

to see IP in whois you would need IRCOP access
c
catharsis
Voice
Posts: 3
Joined: Wed Nov 02, 2022 10:27 pm

Post by catharsis »

simo wrote:to see IP in whois you would need IRCOP access
that's not accurate, I see everybody's IP just by doing /whois
s
simo
Revered One
Posts: 1071
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

yea i just tested again and it seems everyone can see it in whois, true

let me see if i can attempt to have it check for that
s
simo
Revered One
Posts: 1071
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

this is what i have so far

Code: Select all


setudef flag whois-IP-checker

bind join - * join:check-ip

proc join:check-ip {nick uhost hand chan} {
  if {![channel get $chan whois-IP-checker]} { return 0 }
  putserv "whois $nick"
}


bind raw - 338 Whois:Check:IP

proc Whois:Check:IP {from key text} {
  set chan #channel
  set IP [lindex [split $text] 2]
  check $IP  against whitelist here
}



bind mode - "#% +o*" autocheck:whois-IP

proc autocheck:whois-IP {nick uhost hand chan mode target} {
  if {[isbotnick $target]} {  
    foreach channel [channels] {
      if {![channel get $channel whois-IP-checker]} continue
      if {![botisop $channel]} continue

      foreach member [chanlist $channel] {
        if {[isbotnick $member]} continue
        if {[isop $member $channel] || [ishalfop $member $channel] || [matchattr [nick2hand $member] fon|fon $channel]} continue
        putserv "whois $member"
      }
    }
  }
}

w
willyw
Revered One
Posts: 1196
Joined: Thu Jan 15, 2009 12:55 am

Post by willyw »

A couple things come to mind:
simo wrote:this is what i have so far

Code: Select all

...
  check $IP  against whitelist here
}
I'm thinking that you can use info found here:
http://forum.egghelp.org/viewtopic.php?t=6885
and
https://www.tcl.tk/man/tcl8.6/TclCmd/lsearch.html
to write this part.

Code: Select all

...
        putserv "whois $member"
      }
    }
  }
}
I wonder if there is a risk here.
In that, suppose there are lot of nicks in the channel, when the bot is op'd. It looks like the bot will just hammer the irc server with /whois requests.
Is there a risk that the network won't like that, and maybe kick the bot off?
Should there be built into the script some sort of delaying? ... putting some time between each /whois command?

I don't know.
Just thinking...
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
s
simo
Revered One
Posts: 1071
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »


I wonder if there is a risk here.
In that, suppose there are lot of nicks in the channel, when the bot is op'd. It looks like the bot will just hammer the irc server with /whois requests.
Is there a risk that the network won't like that, and maybe kick the bot off?
Should there be built into the script some sort of delaying? ... putting some time between each /whois command?

I don't know.
Just thinking...
You are very right willyw its exactly what i first thought of especially since efnet doesn't allow stacked nicks for whois command /whois nick,nick,nick,nick,nick,nick like some other ircds allow so yes i suspect there to be a risk as well as OP didnt provide any info regarding that but perhaps as u mentioned some sort of delay might prevent the risk of disconnect can't really tell
Post Reply