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 

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

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


Joined: 02 Nov 2022
Posts: 3

PostPosted: Wed Nov 02, 2022 10:45 pm    Post subject: OP users if their IP (from /whois) appears on a whitelist Reply with quote

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:

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
Back to top
View user's profile Send private message
simo
Owner


Joined: 22 Mar 2015
Posts: 969

PostPosted: Thu Nov 03, 2022 8:27 pm    Post subject: Reply with quote

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


Joined: 02 Nov 2022
Posts: 3

PostPosted: Thu Nov 03, 2022 8:38 pm    Post subject: Reply with quote

it's EFnet so there are no cloaks
Back to top
View user's profile Send private message
simo
Owner


Joined: 22 Mar 2015
Posts: 969

PostPosted: Sun Nov 06, 2022 11:12 am    Post subject: Reply with quote

to see IP in whois you would need IRCOP access
Back to top
View user's profile Send private message
catharsis
Voice


Joined: 02 Nov 2022
Posts: 3

PostPosted: Sun Nov 06, 2022 11:15 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
simo
Owner


Joined: 22 Mar 2015
Posts: 969

PostPosted: Sun Nov 06, 2022 11:19 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
simo
Owner


Joined: 22 Mar 2015
Posts: 969

PostPosted: Sun Nov 06, 2022 12:08 pm    Post subject: Reply with quote

this is what i have so far

Code:


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"
      }
    }
  }
}

Back to top
View user's profile Send private message
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1183

PostPosted: Sun Nov 06, 2022 4:32 pm    Post subject: Reply with quote

A couple things come to mind:

simo wrote:
this is what i have so far

Code:

...
  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.


Quote:

Code:

...
        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 !
Back to top
View user's profile Send private message
simo
Owner


Joined: 22 Mar 2015
Posts: 969

PostPosted: Sun Nov 06, 2022 8:25 pm    Post subject: Reply with quote

Quote:


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