📄 fstat.c
字号:
/** This file is part of Firestorm NIDS* Copyright (c) 2002 Gianni Tedesco* This program is released under the terms of the GNU GPL version 2*/#include <config.h>#include <stdio.h>#include <stdarg.h>#include <firestorm.h>#include <plugin.h>#ifdef HAVE_DLFCN_H#include <dlfcn.h>#endifvoid mesg(unsigned char code, char *fmt, ...){ va_list va; va_start(va, fmt); vprintf(fmt, va); printf("\n"); va_end(va);}void *plugin_callback(const char *item){ if ( !strcmp(item, "mesg")) return mesg; return NULL;}void firestat(char *an, char *fn){ struct plugin_out pout; struct plugin_in pin; void *lib; proc_plugin_init init; proc_plugin_unload unload; if ( !(lib=dlopen(fn, RTLD_NOW)) ) { fprintf(stderr, "%s: %s\n", an, dlerror()); return; } if ( !(init=dlsym(lib, plugin_init)) ) { fprintf(stderr, "%s: %s: Couldn't resolve " plugin_init "\n", an, fn); dlclose(lib); return; } if ( !(unload=dlsym(lib, plugin_unload)) ) { fprintf(stderr, "%s: %s: Couldn't resolve " plugin_unload "\n", an, fn); dlclose(lib); return; } pout.size=(sizeof(struct plugin_out)); pin.size=(sizeof(struct plugin_in)); pin.import=plugin_callback; switch ( init(&pin, &pout) ) { case PLUGIN_ERR_PARAM: case PLUGIN_ERR_SIZE: fprintf(stderr, "%s: failed to init, internal error\n", fn); dlclose(lib); return; } mesg(M_INFO,"Filename: %s", fn); mesg(M_INFO,"Summary: %s", pout.desc); mesg(M_INFO,"Name: %s", pout.name); mesg(M_INFO,"Version: %i.%i", pout.ver_major, pout.ver_minor); mesg(M_INFO,"Author: %s <%s>", pout.author_name, pout.author_email); mesg(M_INFO,"License: %s", pout.license); unload(0); dlclose(lib); /* If unload() prints messages group them with the * right plugin... */ printf("\n");}int main(int argc, char **argv){ int i; for(i=1; i<argc; i++) { firestat(argv[0], argv[i]); } return 0;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -