#include <stdlib.h>
#include <time.h>
#include "iostream.h"
#define N (1+(int)(10.0*rand()/(RAND_MAX+1.0)))
start()
{
int s,t;
for(s=N%3;s>0;--s)
cout<<"nop"<<endl;
cout<<"push ebp"<<endl;
for(t=N%3;t>0;--t)
cout<<"nop"<<endl;
cout<<"mov ebp esp"<<endl;
}
push(int p)
{
switch(p)
{
case 1:
{
cout<<"push ebx\n"<<"pop ebx"<<endl;
}break;
case 2:
{
cout<<"push esi\n"<<"pop esi"<<endl;
}break;
case 3:
{
cout<<"push edi\n"<<"pop edi"<<endl;
}break;
case 4:
{
cout<<"push "<<rand()<<endl;
}break;
case 5:
{
cout<<"push -"<<rand()<<endl;
}break;
}
}
mov(int m)
{
switch(m)
{
case 1:
{
cout<<"mov eax,dword ptr fs:[0]"<<endl;
}break;
case 2:
{
cout<<"mov dword ptr fs:[0],esp"<<endl;
}break;
case 3:
{
cout<<"mov dword ptr fs:[0],eax"<<endl;
}break;
}
}
body(int b)
{
int ad=N;
switch(b)
{
case 1:
{
push(1+N%5);
}break;
case 2:
{
cout<<"inc ecx\n"<<"dec ecx"<<endl;
}break;
case 3:
{
cout<<"add esp,"<<ad<<"\nadd esp,-"<<ad<<endl;
}break;
case 4:
{
cout<<"add esp,"<<ad<<"\nsub esp,"<<ad<<endl;
}break;
case 5:
{
mov(1+N%3);
}break;
case 6:
{
cout<<"test esi,esi"<<endl;
}break;
}
}
end(int e)
{
switch(e)
{
case 1:
{
cout<<"mov eax,原入口点\npush eax\nretn"<<endl;
}break;
case 2:
{
cout<<"push 原入口点\nretn"<<endl;
}break;
case 3:
{
cout<<"mov eax, 原入口点\njmp eax"<<endl;
}break;
case 4:
{
cout<<"je 原入口点\njne 原入口点"<<endl;
}break;
case 5:
{
cout<<"jmp 附近空地址\njmp 原入口点"<<endl;
}break;
case 6:
{
cout<<"jz 原入口点\njnz 原入口点"<<endl;
}break;
case 7:
{
cout<<"jb 原入口点\njge 原入口点"<<endl;
}break;
case 8:
{
cout<<"jl 原入口点\njge 原入口点"<<endl;
}break;
case 9:
{
cout<<"ja 原入口点\njle 原入口点"<<endl;
}break;
case 10:
{
cout<<"jg 原入口点\njle 原入口点"<<endl;
}break;
}
}
main()
{
int i=3+N%3;
i=3+N%5;
srand((int)time(0));
rand();
system("cls");
cout << "\t最强的花指令生成器"<<endl;
cout << "\n\t\tBY 涩郎(ShyBoy) QQ:5007463"<<endl;
cout<<"\r\n***********************************\r\n";
start();
for(;i>0;i--)
body(1+N%6);
end(N);
cout<<"\r\n***********************************\r\n";
cout<<"\n按任意键推出..."<<endl;
cin.get();
}