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+shell provider+status

Old posts that have not been replied to for several years.
Locked
C
CaLy
Voice
Posts: 3
Joined: Fri Mar 26, 2004 10:22 am
Location: Argentina

TCL+shell provider+status

Post by CaLy »

I wanna know if exists a tcl what can change topic of the shell channel , for example, when its working it changes the topic to "Shell UP, visit us at blablabla" and when something happens and its go down it will change the topic.
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

this depends if the bot is running on the shell thats going down or not :D. you might want to check its avaiblity using socket either checking timed based or just hoping your system will close the tcp sock, if the shell goes down :D. you can always change the topic like:
putserv "TOPIC $chan :Shell is \002down\002 - $defaulttopictext"

for further infos about socket and events connected to such, you should read "The Manual". Its quite an intressting story :D.
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
User avatar
^DooM^
Owner
Posts: 772
Joined: Tue Aug 26, 2003 5:40 pm
Location: IronForge
Contact:

Post by ^DooM^ »

De Kus wrote:you should read "The Manual". Its quite an intressting story :D.
The ending made me cry.. :cry:
The lifecycle of a noob is complex. Fledgling noobs gestate inside biometric pods. Once a budding noob has matured thru gestation they climb out of their pod, sit down at a PC, ask a bunch of questions that are clearly in the FAQ, The Noob is born
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

There is no actual way to detect that. Because when the box is down nothing on it can run not even an eggdrop. So we are unable to detect it.

However if the box is offline then maybe if we try to resolve some dns's on the vhosts or the hosts they may not resolve which can be a possible YES the box is down.

So heres my suggestion:

Load 2 eggdrops. Eggdrop #1 on the machine where you want to find the status, if it is UP or DOWN and Eggdrop #2 on some other machine. Both eggdrops should be on the same channel.

When Eggdrop #1 quits from the channel, hopefully ping out or say doesnt get klined, banned or whatsoever make Eggdrop #2 set the topic as STATUS: DOWN as your box went down generally the message is "Client closed connection" if the process wasn't killed and the box was restarted or went down. When Eggdrop #1 comes back up joins the channel make Eggdrop #2 set the topic STATUS: UP.

Now detecting them in channels wouldn't be my kind of idea. You can maybe try to add both to the watch/notify list.
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
g
greenbear
Owner
Posts: 733
Joined: Mon Sep 24, 2001 8:00 pm
Location: Norway

Post by greenbear »

why not just ping the box
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

seem I have point out my suggestion. If the bot doing the topic change is on another box, then the box itself. I would just recommend to do open a socket on a port which is always open (like 113 for identd, or 80 for http or 23 for ssh, just as 3 suggestions. maybe you check all 3 of them). if the connection fails the box is down, simply idea, what? thats at least the way you usually check avaiblity of servers. no matter if shell, game server or whatever :).
If you set a timed event every minute (make sure timeout is below 60sec, otherwise better make 5min interval or so) you can check very accurate. In case of 1min you could even say you will ignore first failure and declare offline only on the second in a row.
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
O
Ofloo
Owner
Posts: 953
Joined: Tue May 13, 2003 1:37 am
Location: Belguim
Contact:

Post by Ofloo »

yeah but its not certain that the bot is on the same box but anyway you could make sur and when the bot splits check sshd with async socket, no point doing this timed .. i have never know a ssh to be down or an ftp.. so.. no use

but if a eggdrop splits from a botnet that can be lots of reasons so when the bot splits you could check a socket and see if it's still online..
XplaiN but think of me as stupid
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

I like De Kus's method better. :lol:
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
O
Ofloo
Owner
Posts: 953
Joined: Tue May 13, 2003 1:37 am
Location: Belguim
Contact:

Post by Ofloo »

its not tested it should work there is probably a beter way sorry for the crappy code ..

Code: Select all

set hostname "127.0.0.1"
set servlist {
  ssh 22
  www 80
}

set channels "#channel,#channel_"

proc timed_socket_event {min hour day month year} {
  global servlist hostname service
  foreach {srv prt} $servicelist {
    if {[catch {socket $hostname $prt} s]} {
      set service($srv) "offline"
    } else {
      fileevent $s writable [list call_timed_socket_event  $s $srv $prt]
    }
  }
}

proc call_timed_socket_event {s srv prt} {
  global service
  if {[string equal {} [fconfigure $s -error]]} {
    set service($srv) "online"
  } else {
  	set service($srv) "offline"
  }
  close $s
  if {![regexp -all {sock[0-9]{1,5}} [file channels]]} {
    foreach {x} [array names service] {
      lappend s "\($x:$service($x)\)"
    }
    foreach {chan} [split $channels \x2c] {
      if {[regexp {(.*}ServiceStatus:} [topic $chan] -> t]} {
        putserv "TOPIC $chan :$t ServiceStatus: $s"
      } else {
        putserv "TOPIC $chan :[topic $chan] ServiceStatus: $s"
      }
    }
  }
}



bind time - "?O * * * *" timed_socket_event
XplaiN but think of me as stupid
Locked