📄 gre.c
字号:
#include <stdlib.h>#include <firestorm.h>#include <packet.h>#include <args.h>#include <plugin.h>#include <alert.h>#include <signature.h>#include <decode.h>#include <preproc.h>PLUGIN_STD_DEFS();proc_dispatch dispatch;/* GRE: Generic routing encapsulation */void gre_decode(struct packet *);struct proto gre_p=init_proto("gre", gre_decode, NULL);struct proto_req gre_r[]={ proto_request("ip", 47), null_request()};void gre_decode(struct packet *p){ struct proto_child *pc; struct layer *l=&p->layer[p->llen]; if ( (p->layer[p->llen+1].h.raw= l->h.raw+sizeof(struct pkt_grehdr)) > p->end ) return; p->llen++; if ( p->llen >= PKT_LAYERS ) return; for(pc=l->proto->children; pc; pc=pc->next) { if ( l->h.gre->proto == pc->id ) { p->layer[p->llen].flags=0; p->layer[p->llen].session=NULL; p->layer[p->llen].proto=pc->proto; pc->proto->decode(p); return; } } if ( p->layer[p->llen].h.raw<p->end ) p->layer[p->llen++].proto=NULL; dispatch(p);}int PLUGIN_DECODE (struct decode_api *d){ int ok=0; object_check(d); dispatch=d->dispatch; ok+=d->decode_add(&gre_p, gre_r); return (ok) ? PLUGIN_ERR_OK : PLUGIN_ERR_FAIL;}int PLUGIN_INIT (struct plugin_in *in, struct plugin_out *out){ plugin_check(in, out); PLUGIN_ID("decode.gre", "Generic Routing Encapsulation"); PLUGIN_VERSION(2, 0); PLUGIN_AUTHOR("Gianni Tedesco", "gianni@scaramanga.co.uk"); PLUGIN_LICENSE("GPL"); return PLUGIN_ERR_OK;}int PLUGIN_UNLOAD (int code) { return PLUGIN_ERR_OK;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -