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.

egghttp please help :)

Help for those learning Tcl or writing their own scripts.
Post Reply
N
NTHosts
Op
Posts: 100
Joined: Mon Oct 10, 2005 9:57 pm
Location: UK
Contact:

egghttp please help :)

Post by NTHosts »

Ok I have written this...

Code: Select all

set url "$ip:$port/admin.cgi?mode=viewxml"


set djtrigger "!dj"
set ip "lynxfm.com"
set port "9004"
set pass "whatever"
set channel "#botchan"


if {![info exists egghttp(version)]} {
  putlog "egghttp.tcl was NOT successfully loaded."
  putlog "shoutcast.tcl has not been loaded as a result."
} else {
  proc current_dj {sock} {

    global channel

    set headers [egghttp:headers $sock]
    set body [egghttp:data $sock]

    regexp { <SERVERTITLE>(.*)</SERVERTITLE> } $body - dj


    putquick "PRIVMSG $channel :\0032The current DJ is: \0034 $dj"

  }

  bind pub -|* $djtrigger top:djtrigger
  proc top:djtrigger {nick host hand chan text} {
    global url
    set sock [egghttp:geturl $url current_dj]
    return 1
  }
}
But.. I dont know how to log into the page to parse the onfo I need so not even sure if the

set url "whatitsaysupthere"

will work with the
set ip "bleah"
set port "bleahsomemore"

as you can see i have... set pass "whatever"
But how can I get egghttp use that in the http login form with also the username admin.

I have looked through the egghttp docs but dont see anything that tells you about login forms.

Any suggestions please ? :)
www.NT-Hosts.Net - More than just a host
N
NTHosts
Op
Posts: 100
Joined: Mon Oct 10, 2005 9:57 pm
Location: UK
Contact:

...

Post by NTHosts »

Ok I tried scrapping using egghttp and use sockets.. I came up with this...

Code: Select all


bind pub -|- !dj curdj
set server "lynxfm.com"
set port "9004"
set pass "demo"

proc curdj {nick host handle chan text} {
   global server port pass
 if {[catch {set sock [socket $server $port] } sockerror]} {
 putlog "error: $sockerror"
 
return 0 } else {

	puts $sock "GET /admin.cgi?pass=$pass&mode=viewxml&page=0 HTTP/1.0"
	puts $sock "User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.9)"
	puts $sock "Host: $server"
	puts $sock "Connection: close"
	puts $sock ""
	flush $sock 

while {[eof $sock] != 1} {
	
	regexp { <SERVERTITLE>(.*)</SERVERTITLE> } $body - dj
}
 putquick "PRIVMSG $channel :\0032The current DJ is: \0034 $dj"
close $sock 
}}
But it cant open the connection for some reason :(

Nick .set errorInfo

TCLTestBot [15:17] #Nick# set errorInfo
TCLTestBot Currently: couldn't open socket: host is unreachable
TCLTestBot Currently: while executing
TCLTestBot Currently: "socket $server $port"

My head hurts lol.. any help plz ? :(
www.NT-Hosts.Net - More than just a host
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

verify you can connect to that host from your shell. Maybe its firewalled.
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...
N
NTHosts
Op
Posts: 100
Joined: Mon Oct 10, 2005 9:57 pm
Location: UK
Contact:

...

Post by NTHosts »

Nope its all run from my own server, so no firewall :(
www.NT-Hosts.Net - More than just a host
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

then maybe your routing table is improper? Just beeing it your server doesnt exclude the reason of failure to be an iptables/ipchain setting... or simply refered as "firewall and routing rules". All you can do is making sure that the IP it tries to connect is valid. Try to set debug code to show you to what it actually tries to connect and verify it can connect to it outside of the bot, because only then it would be an issue with eggdrop ^.^.
Maybe socket binds to the wrong interface(s), try using the -myaddr option.
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...
Post Reply