📄 samplemodreplace.c
字号:
/* OpenWebSpider * * Author: Stefano Alimonti aka Shen139 * Mail: shen139 [at] openwebspider (dot) org * * * This file is part of OpenWebSpider * * 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 * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * *//*gcc -g -c sampleModReplace.cgcc -g -shared -W1,-soname,sampleModReplace.so.0 -o sampleModReplace.so sampleModReplace.o -lc*/#include <stdio.h>#include <stdlib.h>#include <string.h>#include "modHeader.h"#ifndef MAXPACKETSIZE #define MAXPACKETSIZE 200000#endif/* ReplaceStr * replaces all occurrences of a string(bus) with sub */int ReplaceStr(char* string,char* strOut, char* bus, char* sub){int x=0,y=0; strOut[0]=0; for(x=0;x<(signed)strlen(string);x++) { if(strnicmp(string+x,bus,strlen(bus))==0) { strcat(strOut,sub); x+=strlen(bus)-1; y+=strlen(sub); continue; } strOut[y++]=string[x]; strOut[y]=0; }return 1;}int modFilter (struct functArg* arg){char textTmp[MAXPACKETSIZE]; if(arg) { /* strlen(arg->text)<MAXPACKETSIZE */ strcpy(textTmp,arg->text); /* Replace all occurrences of "shen139" with "931nehs" */ ReplaceStr(textTmp,arg->text,"shen139","931nehs"); return 1; }return 0;}int modInitFilter (char* hostname, char* error){ return 1;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -