temp save
This commit is contained in:
parent
97c7b64fdb
commit
376886d08b
5 changed files with 87 additions and 23 deletions
|
@ -2,14 +2,14 @@ AUTOMAKE_OPTIONS = foreign
|
|||
ACLOCAL_AMFLAGS = -I autotools
|
||||
AM_MAKEFLAGS = -s
|
||||
|
||||
pkglib_LTLIBRARIES = libfeedserv.la
|
||||
libfeedserv_la_SOURCES = feed.c feed_help.c
|
||||
pkglib_LTLIBRARIES = feedserv.la
|
||||
feedserv_la_SOURCES = feed.c feed_help.c
|
||||
noinst_HEADERS = feed.h
|
||||
|
||||
libfeedserv_la_LDFLAGS = -module -avoid-version
|
||||
feedserv_la_LDFLAGS = -module -avoid-version
|
||||
|
||||
|
||||
EXTRA_DIST = autotools/ccdv.c autotools/shtool RELNOTES
|
||||
dist_doc_DATA = README.feed README.feed.html
|
||||
dist_doc_DATA = README.feedserv README.feedserv.html
|
||||
|
||||
include $(top_srcdir)/autotools/rules.mk
|
||||
|
|
22
Makefile.in
22
Makefile.in
|
@ -65,9 +65,9 @@ am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
|
|||
am__installdirs = "$(DESTDIR)$(pkglibdir)" "$(DESTDIR)$(docdir)"
|
||||
pkglibLTLIBRARIES_INSTALL = $(INSTALL)
|
||||
LTLIBRARIES = $(pkglib_LTLIBRARIES)
|
||||
libfeedserv_la_LIBADD =
|
||||
am_libfeedserv_la_OBJECTS = feed.lo feed_help.lo
|
||||
libfeedserv_la_OBJECTS = $(am_libfeedserv_la_OBJECTS)
|
||||
feedserv_la_LIBADD =
|
||||
am_feedserv_la_OBJECTS = feed.lo feed_help.lo
|
||||
feedserv_la_OBJECTS = $(am_feedserv_la_OBJECTS)
|
||||
DEFAULT_INCLUDES = -I. -I$(srcdir) -I.
|
||||
depcomp = $(SHELL) $(top_srcdir)/autotools/depcomp
|
||||
am__depfiles_maybe = depfiles
|
||||
|
@ -77,8 +77,8 @@ LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
|
|||
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
|
||||
$(AM_CFLAGS) $(CFLAGS)
|
||||
CCLD = $(CC)
|
||||
SOURCES = $(libfeedserv_la_SOURCES)
|
||||
DIST_SOURCES = $(libfeedserv_la_SOURCES)
|
||||
SOURCES = $(feedserv_la_SOURCES)
|
||||
DIST_SOURCES = $(feedserv_la_SOURCES)
|
||||
dist_docDATA_INSTALL = $(INSTALL_DATA)
|
||||
DATA = $(dist_doc_DATA)
|
||||
HEADERS = $(noinst_HEADERS)
|
||||
|
@ -202,12 +202,12 @@ wi_PWD = @wi_PWD@
|
|||
AUTOMAKE_OPTIONS = foreign
|
||||
ACLOCAL_AMFLAGS = -I autotools
|
||||
AM_MAKEFLAGS = -s
|
||||
pkglib_LTLIBRARIES = libfeedserv.la
|
||||
libfeedserv_la_SOURCES = feed.c feed_help.c
|
||||
pkglib_LTLIBRARIES = feedserv.la
|
||||
feedserv_la_SOURCES = feed.c feed_help.c
|
||||
noinst_HEADERS = feed.h
|
||||
libfeedserv_la_LDFLAGS = -module -avoid-version
|
||||
feedserv_la_LDFLAGS = -module -avoid-version
|
||||
EXTRA_DIST = autotools/ccdv.c autotools/shtool RELNOTES
|
||||
dist_doc_DATA = README.feed README.feed.html
|
||||
dist_doc_DATA = README.feedserv README.feedserv.html
|
||||
LINK = $(LIBTOOL) --tag=CXX --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||
$(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
|
||||
|
@ -284,8 +284,8 @@ clean-pkglibLTLIBRARIES:
|
|||
echo "rm -f \"$${dir}/so_locations\""; \
|
||||
rm -f "$${dir}/so_locations"; \
|
||||
done
|
||||
libfeedserv.la: $(libfeedserv_la_OBJECTS) $(libfeedserv_la_DEPENDENCIES)
|
||||
$(LINK) -rpath $(pkglibdir) $(libfeedserv_la_LDFLAGS) $(libfeedserv_la_OBJECTS) $(libfeedserv_la_LIBADD) $(LIBS)
|
||||
feedserv.la: $(feedserv_la_OBJECTS) $(feedserv_la_DEPENDENCIES)
|
||||
$(LINK) -rpath $(pkglibdir) $(feedserv_la_LDFLAGS) $(feedserv_la_OBJECTS) $(feedserv_la_LIBADD) $(LIBS)
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT)
|
||||
|
|
55
feed.c
55
feed.c
|
@ -23,13 +23,18 @@
|
|||
|
||||
#include "neostats.h"
|
||||
#include "feed.h"
|
||||
#include "mrss.h"
|
||||
|
||||
static int feed_cmd_list( const CmdParams *cmdparams );
|
||||
static int feed_cmd_add( const CmdParams *cmdparams );
|
||||
static int feed_cmd_del( const CmdParams *cmdparams );
|
||||
static int feed_set_exclusions_cb( const CmdParams *cmdparams, SET_REASON reason );
|
||||
|
||||
static void FeedDownLoadHandler(void *ptr, int status, char *data, int datasize);
|
||||
Bot *feed_bot;
|
||||
typedef struct feeddata {
|
||||
mrss_t *mrss;
|
||||
} feeddata;
|
||||
|
||||
|
||||
/** Copyright info */
|
||||
static const char *feed_copyright[] = {
|
||||
|
@ -66,7 +71,7 @@ static bot_cmd feed_commands[]=
|
|||
|
||||
static bot_setting feed_settings[]=
|
||||
{
|
||||
{"VERBOSE", &feed.verbose, SET_TYPE_BOOLEAN, 0, 0, NS_ULEVEL_ADMIN, NULL, feed_help_set_verbose, feed_set_cb, (void*)1 },
|
||||
{"VERBOSE", &feed.verbose, SET_TYPE_BOOLEAN, 0, 0, NS_ULEVEL_ADMIN, NULL, feed_help_set_verbose, NULL, (void*)1 },
|
||||
{"EXCLUSIONS", &feed.exclusions, SET_TYPE_BOOLEAN, 0, 0, NS_ULEVEL_ADMIN, NULL, feed_help_set_exclusions, feed_set_exclusions_cb, (void *)0 },
|
||||
NS_SETTING_END()
|
||||
};
|
||||
|
@ -160,6 +165,51 @@ static int feed_set_exclusions_cb( const CmdParams *cmdparams, SET_REASON reason
|
|||
return NS_SUCCESS;
|
||||
}
|
||||
|
||||
static void ScheduleFeeds() {
|
||||
feeddata *ptr;
|
||||
SET_SEGV_LOCATION();
|
||||
ptr = ns_malloc(sizeof(feeddata));
|
||||
ptr->mrss = NULL;
|
||||
mrss_new(&ptr->mrss);
|
||||
if (new_transfer("http://slashdot.org/index.rss", NULL, NS_MEMORY, "", ptr, FeedDownLoadHandler) != NS_SUCCESS ) {
|
||||
nlog(LOG_WARNING, "Download Feed Failed");
|
||||
irc_chanalert(feed_bot, "Download Feed Failed");
|
||||
mrss_free(ptr->mrss);
|
||||
ns_free(ptr);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/** @brief CheckFeed
|
||||
*/
|
||||
static void CheckFeed(feeddata *ptr) {
|
||||
|
||||
}
|
||||
|
||||
/** @brief FeedDownLoadHandler
|
||||
*/
|
||||
static void FeedDownLoadHandler(void *usrptr, int status, char *data, int datasize) {
|
||||
mrss_error_t ret;
|
||||
feeddata *ptr = (feeddata *)usrptr;
|
||||
SET_SEGV_LOCATION();
|
||||
if (status != NS_SUCCESS) {
|
||||
dlog(DEBUG1, "RSS Scrape Download failed: %s", data);
|
||||
irc_chanalert(feed_bot, "RSS Scrape Failed: %s", data);
|
||||
mrss_free((feeddata *)ptr->mrss);
|
||||
ns_free(ptr);
|
||||
return;
|
||||
}
|
||||
/* ok, here is our data */
|
||||
ret = mrss_parse_buffer(data, datasize, &ptr->mrss);
|
||||
if (ret != MRSS_OK) {
|
||||
dlog(DEBUG1, "RSS Parse Failed: %s", mrss_strerror(ret));
|
||||
mrss_free((feeddata *)ptr->mrss);
|
||||
ns_free(ptr);
|
||||
return;
|
||||
}
|
||||
CheckFeed((feeddata *)ptr);
|
||||
return;
|
||||
}
|
||||
|
||||
/** @brief ModInit
|
||||
*
|
||||
|
@ -191,6 +241,7 @@ int ModSynch (void)
|
|||
{
|
||||
SET_SEGV_LOCATION();
|
||||
feed_bot = AddBot (&feed_botinfo);
|
||||
ScheduleFeeds();
|
||||
return NS_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
7
feed.h
7
feed.h
|
@ -28,6 +28,12 @@
|
|||
|
||||
extern Bot *feed_bot;
|
||||
|
||||
typedef struct feedcfg {
|
||||
int verbose;
|
||||
int exclusions;
|
||||
} feedcfg;
|
||||
|
||||
extern feedcfg feed;
|
||||
|
||||
/* help text */
|
||||
extern const char *feed_about[];
|
||||
|
@ -36,4 +42,5 @@ extern const char *feed_help_del[];
|
|||
extern const char *feed_help_list[];
|
||||
|
||||
extern const char *feed_help_set_exclusions[];
|
||||
extern const char *feed_help_set_verbose[];
|
||||
#endif /* FEED_H */
|
||||
|
|
18
feed_help.c
18
feed_help.c
|
@ -18,12 +18,12 @@
|
|||
** USA
|
||||
**
|
||||
** NeoStats CVS Identification
|
||||
** $Id: opsb_help.c 210 2006-01-26 15:35:09Z Fish $
|
||||
** $Id: feed_help.c 210 2006-01-26 15:35:09Z Fish $
|
||||
*/
|
||||
|
||||
#include "neostats.h"
|
||||
|
||||
const char *opsb_about[] = {
|
||||
const char *feed_about[] = {
|
||||
"\2Open Proxy Scanning Bot Information\2",
|
||||
"",
|
||||
"This service scans clients connecting to this network for",
|
||||
|
@ -37,7 +37,7 @@ const char *opsb_about[] = {
|
|||
NULL
|
||||
};
|
||||
|
||||
const char *opsb_help_add[] = {
|
||||
const char *feed_help_add[] = {
|
||||
"Add a port to scanning",
|
||||
"Syntax: \2ADD <type> <port>\2",
|
||||
"",
|
||||
|
@ -49,7 +49,7 @@ const char *opsb_help_add[] = {
|
|||
NULL
|
||||
};
|
||||
|
||||
const char *opsb_help_del[] = {
|
||||
const char *feed_help_del[] = {
|
||||
"Delete a port from scanning",
|
||||
"Syntax: \2DEL <index>\2",
|
||||
"",
|
||||
|
@ -58,7 +58,7 @@ const char *opsb_help_del[] = {
|
|||
NULL
|
||||
};
|
||||
|
||||
const char *opsb_help_list[] = {
|
||||
const char *feed_help_list[] = {
|
||||
"List protocols and ports scanned",
|
||||
"Syntax: \2LIST\2",
|
||||
"",
|
||||
|
@ -67,8 +67,14 @@ const char *opsb_help_list[] = {
|
|||
NULL
|
||||
};
|
||||
|
||||
const char *opsb_help_set_exclusions[] = {
|
||||
const char *feed_help_set_exclusions[] = {
|
||||
"\2EXCLUSIONS <ON|OFF>\2",
|
||||
"Use global exclusion list in addition to local exclusion list",
|
||||
NULL
|
||||
};
|
||||
|
||||
const char *feed_help_set_verbose [] = {
|
||||
"\2VERBOSE <ON|OFF>\2",
|
||||
"Whether OPSB is verbose in operation or not",
|
||||
NULL
|
||||
};
|
||||
|
|
Reference in a new issue