### ### vim:ts=2 ai si sw=2 sta sm: ### ### A simple httpd module ### ^assign httpd.version $Id: httpd,v 1.20 2004/09/23 16:26:49 sec Exp sec $ alias close { dcc close raw_listen $0 ^on dcc_raw -"% % N $0" } alias httpd { ^assign listen.pnum $listen($0) ^on ^dcc_raw "% % N $0" httpd.win $$0- echo *** Listening on port $listen.pnum ... Finish with /close $0 } alias httpd.win { # echo fd $0 | connect from host $1 to port $3. ^assign httpd.$0.host $1 #state = connected assign http.$0 connect # Incoming Text ^on ^dcc_raw "$0 $1 D *" { ^assign -httpd.line if ([$right(1 $3-)] == [ ]){ ^assign httpd.line $left($rindex( $3-) $3-) }{ ^assign httpd.line $3- } # echo fd $0 < $httpd.line incoming.$http[$0] $0 $httpd.line } # Connection closed by other side. ^on ^dcc_raw "$0 $1 C" httpd.off $$0- # To send something there. ^alias httpd.$0 dcc raw $0 $1 $$0- #\;echo fd $0 > $$0- #close the connection ^alias httpd.off.$0 ^dcc close raw $0\;httpd.off $0 $1\;^alias -httpd.off.$0 } alias httpd.off { echo fd $0 | close. ^alias -httpd.$0 ^on dcc_raw -"$0 $1 C" ^on dcc_raw -"$0 $1 D *" ^assign -http.$0 } alias incoming.connect { ^assign httpd.$0.proto $toupper($1) ^assign -httpd.$0.url ^assign -httpd.$0.auth ^assign -httpd.$0.authraw ^assign httpd.$0.url $left($index(? $2) $2) ^assign -httpd.$0.cgi ^assign httpd.$0.cgi $mid($index(? /$2) 99 $2) if ([$left(2 $httpd[$0.cgi])]==[q=]){ ^assign httpd.$0.cgi $httpdecode($mid(2 99 $httpd[$0.cgi])) } ^assign -httpd.$0.ver ^assign httpd.$0.ver $toupper($3) echo fd $0 | \[$httpd[$0.host]\] $httpd[$0.proto] $httpd[$0.url] $httpd[$0.ver] \(cgi: $httpd[$0.cgi]\) ^assign http.$0 get if ([$httpd[$0.proto]]==[CONNECT]){ ^assign http.$0 connect timer 0 httpd.off.$0 } } alias incoming.get { if ([$1-] == []){ # echo fd $0 | send: $httpd.url ^assign http.$0 send if ([$httpd[$0.host]]==[62.190.92.245]) { echo fd $0 | denied access. httpd.deny $0 }{ if ([$httpd.get[$encode($httpd[$0.url])]]==[1]) { if ([$httpd.open[$encode($httpd[$0.url])]]==[auth]) { if ( rmatch($httpd[$0.auth] $httpd.auth[$encode($httpd[$0.url])])) { echo fd $0 | Authenticated. httpd.head.ok $0 ^assign auth 1 httpd.get.$httpd[$0.url] $0 $httpd[$0.cgi] }{ echo fd $0 | Auth failed. httpd.$0 HTTP/1.0 401 Auth required httpd.$0 WWW-Authenticate: Basic realm="CountEr" httpd.head.rest $0 httpd.$0 Bob says: your password is invalid, enter another. httpd.$0 $httpd.err[$encode($httpd[$0.url])] } }{ ^assign auth 0 if ([$httpd.open[$encode($httpd[$0.url])]]!=[noopen]) { httpd.head.ok $0 } # if ([$httpd[$0.proto]]==[HEAD]){ # timer 0 httpd.off.$0 # }{ httpd.get.$httpd[$0.url] $0 $httpd[$0.cgi] # } } if ([$httpd.close[$encode($httpd[$0.url])]]==[noclose]) { ; }{ if ([$httpd.close[$encode($httpd[$0.url])]]==[form]) { on ^exec_exit "$httpd[$0.url] *" httpd.formoff $0 $httpd[$0.url] }{ timer 0 httpd.off.$0 }} }{ httpd.404 $0 } } }{ # echo someone said(get) $1- on fd $0 if ([$1] == [Referer:]){ echo fd $0 | $1- } if ([$1] == [Authorization:]){ if ([$2] == [Basic]){ if ([$httpd.user.a[$encode($3)]]) { ^assign httpd.$0.auth $httpd.user.a[$encode($3)] ^assign httpd.$0.authraw $3 echo fd $0 | PreAuth as $httpd[$0.auth] }{ ^echo fd $0 | PreAuth failed for $3- } }{ echo fd $0 | PreAuth "Huh??" $1- } } } } alias incoming.send { echo fd $0 | inappropriate Text received $1- } alias httpd.head.common { httpd.$0 HTTP/1.0 $1- httpd.head.rest $0 } alias httpd.head.rest { httpd.$0 Date: $httptime($time()) httpd.$0 Server: ircII/$V, httpd/$word(2 $httpd.version) httpd.$0 Connection: close if ([$httpd.ctype[$encode($httpd[$0.url])]]) { httpd.$0 Content-Type: $httpd.ctype[$encode($httpd[$0.url])] }{ httpd.$0 Content-Type: text/html\; charset=iso-8859-1 } if ([$httpd.lm[$encode($httpd[$0.url])]]) { httpd.$0 Last-Modified: $httptime($httpd.lm[$encode($httpd[$0.url])]) } httpd.$0 } alias httptime { @ function_return = strftime($0 %a, %d %b %Y %H:%M:%S %Z) } alias httpd.head.ok { httpd.head.common $0 200 OK # echo fd $0 | head sent. } alias httpd.404 { httpd.head.common $0 404 NACK httpd.$0 The Page you requested \($httpd[$0.url]\) is not there. httpd.end $0 timer 0 httpd.off.$0 } alias httpd.deny { httpd.head.common $0 404 DENY httpd.$0 Hi $httpd[$0.host],
httpd.$0 You are using some sort of automatism which I don't like.
httpd.$0 I am a reasonable guy. We can surely work out an easier way
httpd.$0 for both of us to get you the data you want.
httpd.$0 In any case, mail me to regain access.
httpd.$0 -- Sec timer 0 httpd.off.$0 } alias httpd.title { httpd.$0 httpd.$0
httpd.$0 Here you can choose between:
httpd.$0
httpd.$0 Information about $line.chan,
and about the local IRC network:
|
httpd.$0 Some local databases:
|
httpd.$0 Please remember that this is still an IRC bot, so all this information can also be accessed via the ctcp interface.
httpd.$0 The ctcp-interface also contains gateways to the following data sources:
Nb. This query is case-sensitive.
}
}{
httpd.$0 Please enter the Nickname to look up
translates to
$morse($httpmorse($1-))
}{
httpd.$0 Please enter the Plaintext, or morse characters to convert
^assign _.postDo another Search: ^exec -name /avon -msg /httpd.$0 /home/sec/.irc/bin/avon '$strip(<>;`'" $1)' } } eval assign httpd.close.$encode(/avon) form eval assign httpd.get.$encode(/oui) 1 alias httpd.get./oui { httpd.title4l $0 "Ethernet OUIs" if ([$1]==[]) { httpd.$0 The OUI (Ethernet MAC / Ethercode) Database
^assign _.postDo another Search: ^exec -name /oui -msg /httpd.$0 /home/sec/.irc/bin/oui -html '$strip(<>;`'" $1)' } } eval assign httpd.close.$encode(/oui) form eval assign httpd.get.$encode(/blz) 1 alias httpd.get./blz { httpd.title $0 "Bankleitzahlen, Deutschland" if ([$1]==[]) { ^assign _.post Search for Name or 8-digit code:
^assign _.postDo another Search: ^exec -name /blz -msg /httpd.$0 /home/sec/.irc/bin/blz -http '$strip(<>;`'" $1-)' } } eval assign httpd.close.$encode(/blz) form eval assign httpd.get.$encode(/spell) 1 alias httpd.get./spell { httpd.title $0 Spell a word if ([$1]) { httpd.$0 $1-
while ( [$_.motd] != [$line.vers] ){ ^assign _.motd $ver[$encode($_.motd)][next] httpd.$0 $fix(HTML $ver[$encode($_.motd)][txt]) } httpd.$0httpd.end $0 } eval assign httpd.get.$encode(/hrstat) 1 alias httpd.get./hrstat { httpd.title $0 Hourly overview httpd.$0 Lines said per Hour on $line.chan:
Time | Lines | |||
---|---|---|---|---|
$ii:00 - $ii:59 | $hrlines[$ii] |
@ _.col = [#00ff00]
@ _.val = hrlines[$ii] * 2
if (hrlines[$ii] > 15){@ _.col = [#ffff00]}
if (hrlines[$ii] > 55){@ _.col = [#ff0000]}
if (hrlines[$ii] > 0){
httpd.$0
|
 \; |
exec -name bs -msg /httpd.$0 /home/sec/.irc/bin/bullshit 10 alias bs.off { httpd.$0httpd.end $0 timer 0 httpd.off.$0 on exec_exit -"bs *" } on ^exec_exit "bs *" bs.off $0 } eval assign httpd.close.$encode(/bs) noclose # oder auch /BNet-Map eval assign httpd.get.$encode(/map) 1 alias httpd.get./map { httpd.title $0 BNet-Map httpd.$0
lusers quote map } eval assign httpd.close.$encode(/map) noclose eval assign httpd.get.$encode(/list) 1 alias httpd.get./list { httpd.title $0 Channel-List if ([$1]) { # httpd.$0Channel #$1
# httpd.$0
$5 | $6 | $2 | @ | $3 | $8- |
$$1 | $$2 | $$3- |
---|---|---|
$chan | $2 | $fix(HTML $3-) |
httpd.$0 I think of you as $httpd[$0.auth].
httpd.$0 To log out, you may use this link.
httpd.$0 /url-a should now recognice you. httpd.end $0 } eval assign httpd.get.$encode(/no) 1 eval assign httpd.open.$encode(/no) auth eval assign -httpd.auth.$encode(/no) alias httpd.get./no { httpd.title $0 Checking... httpd.$0 If you can read this, you found a bug.
httpd.$0 I think of you as $httpd[$0.auth]. httpd.end $0 } alias httpd.clearuser { foreach httpd.user.u jj { ^assign -httpd.user.u.$jj } foreach httpd.user.a jj { ^assign -httpd.user.a.$jj } } alias httpd.useradd { if ([httpd.user.u[$encode($0)]]) { # echo $0 was already assigned, deleted him... ^assign -httpd.user.a.$encode($httpd.user.u[$encode($0)]) } ^assign httpd.user.u.$encode($0) $1 ^assign httpd.user.a.$encode($1) $0 } #httpd.clearuser #httpd.useradd Sec c2VjOnNlYw== eval assign httpd.get.$encode(/connect) 1 alias httpd.get./connect { httpd.title $0 Reconnect httpd.$0