hostinfo & ldscript

This commit is contained in:
joonicks
2018-03-13 02:39:29 +01:00
parent 3a5bb7c761
commit 149ddd196c
11 changed files with 66 additions and 118 deletions

View File

@@ -43,14 +43,14 @@ CHMOD = chmod
INCS = config.h mcmd.h defines.h global.h h.h structs.h text.h
OFILES = alias.o auth.o bounce.o chanban.o channel.o core.o \
ctcp.o debug.o dns.o dynamode.o function.o greet.o help.o irc.o \
ctcp.o debug.o dns.o dynamode.o function.o greet.o help.o hostinfo.o irc.o \
kicksay.o main.o net.o net_chan.o note.o notify.o ons.o parse.o \
perl.o prot.o python.o redirect.o reset.o seen.o shit.o socket.o \
spy.o stats.o tcl.o telnet.o toybox.o trivia.o uptime.o \
user.o vars.o web.o @MD5_O@ @SHA_O@
SRCFILES = alias.c auth.c bounce.c chanban.c channel.c core.c \
ctcp.c debug.c dns.c dynamode.c function.c greet.c help.c irc.c \
ctcp.c debug.c dns.c dynamode.c function.c greet.c help.c hostinfo.c irc.c \
kicksay.c main.c net.c net_chan.c note.c notify.c ons.c parse.c \
perl.c prot.c python.c redirect.c reset.c seen.c shit.c socket.c \
spy.c stats.c tcl.c telnet.c toybox.c trivia.c uptime.c \
@@ -155,6 +155,9 @@ greet.o: greet.c $(INCS)
help.o: help.c $(INCS) usage.h
$(CROSS_COMPILE)$(CC) $(CFLAGS) -c $< $(CPROF)
hostinfo.o: hostinfo.c $(INCS)
$(CROSS_COMPILE)$(CC) $(CFLAGS) -c $< $(CPROF)
irc.o: irc.c $(INCS)
$(CROSS_COMPILE)$(CC) $(CFLAGS) -c $< $(CPROF)

View File

@@ -159,7 +159,9 @@ void afmt(char *copy_to, const char *src, const char *input)
argend++;
}
}
// debug("args #%i-#%i, characters %i-%i\n",startnum,endnum,argstart-input,argend-input);
#ifdef DEBUG
debug("(afmt) args #%i-#%i, characters %i-%i\n",startnum,endnum,argstart-input,argend-input);
#endif /* DEBUG */
while(*argstart && argstart < argend && dest <= BUFTAIL)
*(dest++) = *(argstart++);
continue;
@@ -169,7 +171,9 @@ void afmt(char *copy_to, const char *src, const char *input)
*(dest++) = *(src++);
}
*dest = 0;
// debug("start %i end %i spc %i\n",startnum,endnum,spc);
#ifdef DEBUG
debug("(afmt) start %i end %i spc %i\n",startnum,endnum,spc);
#endif /* DEBUG */
}
#ifndef ALIASTEST

View File

@@ -187,6 +187,11 @@
#undef CHANBAN
#endif /* IRCD_EXTENSIONS */
/*
* HOSTINFO: share information about the host that the bot is running on
*/
@DEF_HOSTINFO@
/*
* FASTNICK: faster nick regain if the nick is seen when released
* Enables code that is potentially dangerous if an attacker aquires

View File

@@ -1,7 +1,7 @@
/*
EnergyMech, IRC bot software
Copyright (c) 1997-2009 proton
Copyright (c) 1997-2018 proton
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -223,6 +223,11 @@ struct
/*
* Level 100
*/
#ifdef HOSTINFO
{ 0, "HOSTINFO", "do_hostinfo", 100 | CCPW | GAXS },
{ 0, "MEMINFO", "do_meminfo", 100 | CCPW | GAXS },
{ 0, "CPUINFO", "do_cpuinfo", 100 | CCPW | GAXS },
#endif /* HOSTINFO */
#ifdef RAWDNS
{ 0, "DNSSERVER", "do_dnsserver", 100 | CCPW | GAXS },
{ 0, "DNSROOT", "do_dnsroot", 100 | CCPW | GAXS | CARGS },

View File

@@ -581,6 +581,13 @@ LS void check_dynamode(Chan *) __page(CORE_SEG);
#endif /* DYNAMODE */
#ifdef HOSTINFO
LS void do_hostinfo(COMMAND_ARGS) __page(CMD1_SEG);
LS void do_meminfo(COMMAND_ARGS) __page(CMD1_SEG);
LS void do_cpuinfo(COMMAND_ARGS) __page(CMD1_SEG);
#endif /* HOSTINFO */
/*
*
*/

View File

@@ -1,105 +0,0 @@
OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
OUTPUT_ARCH(i386)
ENTRY(_start)
SEARCH_DIR(/lib);
SEARCH_DIR(/usr/lib);
SEARCH_DIR(/usr/local/lib);
SECTIONS
{
. = 0x08048000 + SIZEOF_HEADERS;
.interp : { *(.interp) }
.hash : { *(.hash) }
.dynsym : { *(.dynsym) }
.dynstr : { *(.dynstr) }
.gnu.version_d : { *(.gnu.version_d) }
.gnu.version_r : { *(.gnu.version_r) }
.rel.text : { *(.rel.text) *(.rel.gnu.linkonce.t*) }
.rela.text : { *(.rela.text) *(.rela.gnu.linkonce.t*) }
.rel.data : { *(.rel.data) *(.rel.gnu.linkonce.d*) }
.rela.data : { *(.rela.data) *(.rela.gnu.linkonce.d*) }
.rel.rodata : { *(.rel.rodata) *(.rel.gnu.linkonce.r*) }
.rela.rodata : { *(.rela.rodata) *(.rela.gnu.linkonce.r*) }
.rel.got : { *(.rel.got) }
.rela.got : { *(.rela.got) }
.rel.ctors : { *(.rel.ctors) }
.rela.ctors : { *(.rela.ctors) }
.rel.dtors : { *(.rel.dtors) }
.rela.dtors : { *(.rela.dtors) }
.rel.init : { *(.rel.init) }
.rela.init : { *(.rela.init) }
.rel.fini : { *(.rel.fini) }
.rela.fini : { *(.rela.fini) }
.rel.bss : { *(.rel.bss) }
.rela.bss : { *(.rela.bss) }
.rel.plt : { *(.rel.plt) }
.rela.plt : { *(.rela.plt) }
.init : { *(.init) } =0x9090
.plt : { *(.plt) }
.text :
{
*(.text)
*(.text.d) /* INIT */
*(.text.e) /* RARE */
*(.text.c) /* CMD1 */
*(.text.a) /* CORE */
*(.text.f) /* DBUG */
*(.text.b) /* CFG1 */
*(.stub)
*(.gnu.warning)
*(.gnu.linkonce.t*)
} =0x9090
_etext = .;
PROVIDE (etext = .);
.fini : { *(.fini) } =0x9090
.rodata : { *(.rodata) *(.gnu.linkonce.r*) }
.rodata1 : { *(.rodata1) }
. = ALIGN(0x1000) + (. & (0x1000 - 1));
.data :
{
*(.data)
*(.gnu.linkonce.d*)
CONSTRUCTORS
}
.data1 : { *(.data1) }
.ctors : { *(.ctors) }
.dtors : { *(.dtors) }
.got : { *(.got.plt) *(.got) }
.dynamic : { *(.dynamic) }
.sdata : { *(.sdata) }
_edata = .;
PROVIDE (edata = .);
__bss_start = .;
.sbss : { *(.sbss) *(.scommon) }
.bss :
{
*(.dynbss)
*(.bss)
*(COMMON)
}
. = ALIGN(32 / 8);
_end = . ;
PROVIDE (end = .);
.stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }
.stab.excl 0 : { *(.stab.excl) }
.stab.exclstr 0 : { *(.stab.exclstr) }
.stab.index 0 : { *(.stab.index) }
.stab.indexstr 0 : { *(.stab.indexstr) }
.debug 0 : { *(.debug) }
.line 0 : { *(.line) }
.debug_srcinfo 0 : { *(.debug_srcinfo) }
.debug_sfnames 0 : { *(.debug_sfnames) }
.debug_aranges 0 : { *(.debug_aranges) }
.debug_pubnames 0 : { *(.debug_pubnames) }
.debug_info 0 : { *(.debug_info) }
.debug_abbrev 0 : { *(.debug_abbrev) }
.debug_line 0 : { *(.debug_line) }
.debug_frame 0 : { *(.debug_frame) }
.debug_str 0 : { *(.debug_str) }
.debug_loc 0 : { *(.debug_loc) }
.debug_macinfo 0 : { *(.debug_macinfo) }
.debug_weaknames 0 : { *(.debug_weaknames) }
.debug_funcnames 0 : { *(.debug_funcnames) }
.debug_typenames 0 : { *(.debug_typenames) }
.debug_varnames 0 : { *(.debug_varnames) }
}

View File

@@ -24,6 +24,7 @@
#include "function.c"
#include "greet.c"
#include "help.c"
#include "hostinfo.c"
#include "irc.c"
#include "kicksay.c"
#include "main.c"

View File

@@ -449,9 +449,10 @@ recheck_alias:
{
if (!Strcasecmp(alias->alias,command))
{
afmt(amem,alias->format,msg);
unchop(command,msg);
afmt(amem,alias->format,command);
#ifdef DEBUG
debug("(on_msg) [ALIAS] %s %s --> %s\n",command,msg,amem);
debug("(on_msg) [ALIAS] %s --> %s\n",command,amem);
#endif /* DEBUG */
msg = amem;
pt = chop(&msg);