好友
阅读权限10
听众
最后登录1970-1-1
|
CM是什么?Crackme是什么?这是什么东西?楼主发的什么?
他们都是一些公开给别人尝试破解的小程序,制作 Crackme 的人可能是程序员,想测试一下自己的软件保护技术,也可能是一位 Cracker,想挑战一下其它 Cracker 的破解实力,也可能是一些正在学习破解的人,自己编一些小程序给自己破解,KeyGenMe是要求别人做出它的 keygen (序号产生器), ReverseMe 要求别人把它的算法做出逆向分析, UnpackMe 是要求别人把它成功脱壳,本版块禁止回复非技术无关水贴。
160个新手CM已经爆破了快一半了,只有第二题给出了一个“you get it,Keygen it now”,然后就想试下Keygen it,做完发现蛮简单的但是还是搞了一上午才搞出来- -!
下面上过程:
先查壳
VB的程序,没壳,好开心···
打开运行下
可以运行,就是密码不对,OD载入查字符串
try again?就它了
msgBox就在他下面,看来没找错,向上查代码
0040258B处 的je跳到了密码错误的msgbox
向上找00402579处的test si,si判断si是否为0改变了零标志位
[Asm] 纯文本查看 复制代码
00402569 . 83C4 0C add esp,0xC
0040256C . B9 04000280 mov ecx,0x80020004
00402571 . B8 0A000000 mov eax,0xA
00402576 . 894D 9C mov dword ptr ss:[ebp-0x64],ecx
00402579 . 66:85F6 test si,si;这里判断了判断si是否为0改变了零标志位
0040257C . 8945 94 mov dword ptr ss:[ebp-0x6C],eax
0040257F . 894D AC mov dword ptr ss:[ebp-0x54],ecx
00402582 . 8945 A4 mov dword ptr ss:[ebp-0x5C],eax
00402585 . 894D BC mov dword ptr ss:[ebp-0x44],ecx
00402588 . 8945 B4 mov dword ptr ss:[ebp-0x4C],eax
0040258B 74 58 je short Afkayas_.004025E5;这里跳到了密码错误的msgbox
0040258D . 68 801B4000 push Afkayas_.00401B80 ; You Get It
00402592 . 68 9C1B4000 push Afkayas_.00401B9C ; \r\n
00402597 . FFD7 call edi
00402599 . 8BD0 mov edx,eax
0040259B . 8D4D E8 lea ecx,dword ptr ss:[ebp-0x18]
0040259E . FFD3 call ebx
004025A0 . 50 push eax
004025A1 . 68 A81B4000 push Afkayas_.00401BA8 ; KeyGen It Now
004025A6 . FFD7 call edi
004025A8 . 8D4D 94 lea ecx,dword ptr ss:[ebp-0x6C]
004025AB . 8945 CC mov dword ptr ss:[ebp-0x34],eax
004025AE . 8D55 A4 lea edx,dword ptr ss:[ebp-0x5C]
004025B1 . 51 push ecx
004025B2 . 8D45 B4 lea eax,dword ptr ss:[ebp-0x4C]
004025B5 . 52 push edx ; ntdll.KiFastSystemCallRet
004025B6 . 50 push eax
004025B7 . 8D4D C4 lea ecx,dword ptr ss:[ebp-0x3C]
004025BA . 6A 00 push 0x0
004025BC . 51 push ecx
004025BD . C745 C4 08000>mov dword ptr ss:[ebp-0x3C],0x8
004025C4 . FF15 10414000 call dword ptr ds:[<&MSVBVM50.#rtcMsgBox>; msvbvm50.rtcMsgBox
004025CA . 8D4D E8 lea ecx,dword ptr ss:[ebp-0x18]
004025CD . FF15 80414000 call dword ptr ds:[<&MSVBVM50.__vbaFreeS>; msvbvm50.__vbaFreeStr
004025D3 . 8D55 94 lea edx,dword ptr ss:[ebp-0x6C]
004025D6 . 8D45 A4 lea eax,dword ptr ss:[ebp-0x5C]
004025D9 . 52 push edx ; ntdll.KiFastSystemCallRet
004025DA . 8D4D B4 lea ecx,dword ptr ss:[ebp-0x4C]
004025DD . 50 push eax
004025DE . 8D55 C4 lea edx,dword ptr ss:[ebp-0x3C]
004025E1 . 51 push ecx
004025E2 . 52 push edx ; ntdll.KiFastSystemCallRet
004025E3 . EB 56 jmp short Afkayas_.0040263B
004025E5 > 68 C81B4000 push Afkayas_.00401BC8 ; You Get Wrong
004025EA . 68 9C1B4000 push Afkayas_.00401B9C ; \r\n
004025EF . FFD7 call edi
004025F1 . 8BD0 mov edx,eax
004025F3 . 8D4D E8 lea ecx,dword ptr ss:[ebp-0x18]
004025F6 . FFD3 call ebx
004025F8 . 50 push eax
004025F9 . 68 E81B4000 push Afkayas_.00401BE8 ; Try Again
004025FE . FFD7 call edi
00402600 . 8945 CC mov dword ptr ss:[ebp-0x34],eax
00402603 . 8D45 94 lea eax,dword ptr ss:[ebp-0x6C]
00402606 . 8D4D A4 lea ecx,dword ptr ss:[ebp-0x5C]
00402609 . 50 push eax
0040260A . 8D55 B4 lea edx,dword ptr ss:[ebp-0x4C]
0040260D . 51 push ecx
0040260E . 52 push edx ; ntdll.KiFastSystemCallRet
0040260F . 8D45 C4 lea eax,dword ptr ss:[ebp-0x3C]
00402612 . 6A 00 push 0x0
00402614 . 50 push eax
00402615 . C745 C4 08000>mov dword ptr ss:[ebp-0x3C],0x8
0040261C . FF15 10414000 call dword ptr ds:[<&MSVBVM50.#rtcMsgBox>; msvbvm50.rtcMsgBox
00402622 . 8D4D E8 lea ecx,dword ptr ss:[ebp-0x18]
继续向上找00402533处居然调用了一个strcmp!!!
[Asm] 纯文本查看 复制代码
0040252B . 8BD0 mov edx,eax
0040252D . 8D4D E0 lea ecx,dword ptr ss:[ebp-0x20]
00402530 . FFD3 call ebx ; <&MSVBVM50.__vbaStrMove>
00402532 . 50 push eax
00402533 . FF15 28414000 call dword ptr ds:[<&MSVBVM50.__vbaStrCm>; msvbvm50.__vbaStrCmp
00402539 . 8BF0 mov esi,eax
0040253B . 8D55 E0 lea edx,dword ptr ss:[ebp-0x20]
0040253E . F7DE neg esi
在strcmp处下端点,随便试下
居然能看到密码0.0!换个name再试发现密码变了!
继续向上翻代码。
00402415处 __vbaLenBstr读取了字符串的长度保存在eax(下断验证发现是name的长度)
0040242D处 rtcAnsiValueBstr 取字符串第一个字符的ascii码保存在eax(同样是name的第一个字符)
[Asm] 纯文本查看 复制代码
00402409 > \8B95 50FFFFFF mov edx,dword ptr ss:[ebp-0xB0]
0040240F . 8B45 E4 mov eax,dword ptr ss:[ebp-0x1C]
00402412 . 50 push eax ; /String = "AKA-585235"
00402413 . 8B1A mov ebx,dword ptr ds:[edx] ; |
00402415 . FF15 E4404000 call dword ptr ds:[<&MSVBVM50.__vbaLenBs>; \__vbaLenBstr
0040241B . 8BF8 mov edi,eax
0040241D . 8B4D E8 mov ecx,dword ptr ss:[ebp-0x18]
00402420 . 69FF FB7C0100 imul edi,edi,0x17CFB ; msvbvm50.__vbaStrCat
00402426 . 51 push ecx ; /String = "D?"
00402427 . 0F80 91020000 jo Afkayas_.004026BE ; |
0040242D . FF15 F8404000 call dword ptr ds:[<&MSVBVM50.#rtcAnsiVa>; \rtcAnsiValueBstr
00402433 . 0FBFD0 movsx edx,ax
00402436 . 03FA add edi,edx
00402438 . 0F80 80020000 jo Afkayas_.004026BE
0040243E . 57 push edi ; msvbvm50.__vbaStrCat
0040243F . FF15 E0404000 call dword ptr ds:[<&MSVBVM50.__vbaStrI4>; msvbvm50.__vbaStrI4
00402445 . 8BD0 mov edx,eax
00402447 . 8D4D E0 lea ecx,dword ptr ss:[ebp-0x20]
0040244A . FF15 70414000 call dword ptr ds:[<&MSVBVM50.__vbaStrMo>; msvbvm50.__vbaStrMove
00402450 . 8BBD 50FFFFFF mov edi,dword ptr ss:[ebp-0xB0]
00402456 . 50 push eax
00402457 . 57 push edi ; msvbvm50.__vbaStrCat
00402458 . FF93 A4000000 call dword ptr ds:[ebx+0xA4]
0040245E . 85C0 test eax,eax
00402460 . 7D 12 jge short Afkayas_.00402474
00402462 . 68 A4000000 push 0xA4
00402467 . 68 5C1B4000 push Afkayas_.00401B5C
0040246C . 57 push edi ; msvbvm50.__vbaStrCat
0040246D . 50 push eax
0040246E . FF15 04414000 call dword ptr ds:[<&MSVBVM50.__vbaHresu>; msvbvm50.__vbaHresultCheckObj
00402474 > 8D45 E0 lea eax,dword ptr ss:[ebp-0x20]
00402477 . 8D4D E4 lea ecx,dword ptr ss:[ebp-0x1C]
0040247A . 50 push eax
0040247B . 8D55 E8 lea edx,dword ptr ss:[ebp-0x18]
0040247E . 51 push ecx
0040247F . 52 push edx
00402480 . 6A 03 push 0x3
00402482 . FF15 5C414000 call dword ptr ds:[<&MSVBVM50.__vbaFreeS>; msvbvm50.__vbaFreeStrList
00402488 . 83C4 10 add esp,0x10
0040248B . 8D45 D4 lea eax,dword ptr ss:[ebp-0x2C]
0040248E . 8D4D D8 lea ecx,dword ptr ss:[ebp-0x28]
00402491 . 8D55 DC lea edx,dword ptr ss:[ebp-0x24]
00402494 . 50 push eax
00402495 . 51 push ecx
00402496 . 52 push edx
00402497 . 6A 03 push 0x3
00402499 . FF15 F4404000 call dword ptr ds:[<&MSVBVM50.__vbaFreeO>; msvbvm50.__vbaFreeObjList
0040249F . 8B06 mov eax,dword ptr ds:[esi]
004024A1 . 83C4 10 add esp,0x10
004024A4 . 56 push esi
004024A5 . FF90 04030000 call dword ptr ds:[eax+0x304]
004024AB . 8B1D 0C414000 mov ebx,dword ptr ds:[<&MSVBVM50.__vbaOb>; msvbvm50.__vbaObjSet
004024B1 . 50 push eax
004024B2 . 8D45 DC lea eax,dword ptr ss:[ebp-0x24]
004024B5 . 50 push eax
004024B6 . FFD3 call ebx ; msvbvm50.__vbaStrMove; <&MSVBVM50.__vbaObjSet>
004024B8 . 8BF8 mov edi,eax
004024BA . 8D55 E8 lea edx,dword ptr ss:[ebp-0x18]
004024BD . 52 push edx
004024BE . 57 push edi ; msvbvm50.__vbaStrCat
004024BF . 8B0F mov ecx,dword ptr ds:[edi]
004024C1 . FF91 A0000000 call dword ptr ds:[ecx+0xA0]
004024C7 . 85C0 test eax,eax
004024C9 . 7D 12 jge short Afkayas_.004024DD
004024CB . 68 A0000000 push 0xA0
004024D0 . 68 5C1B4000 push Afkayas_.00401B5C
004024D5 . 57 push edi ; msvbvm50.__vbaStrCat
004024D6 . 50 push eax
004024D7 . FF15 04414000 call dword ptr ds:[<&MSVBVM50.__vbaHresu>; msvbvm50.__vbaHresultCheckObj
004024DD > 56 push esi
004024DE . FF95 40FFFFFF call dword ptr ss:[ebp-0xC0] ; msvbvm50.7412C368
004024E4 . 50 push eax
004024E5 . 8D45 D8 lea eax,dword ptr ss:[ebp-0x28]
004024E8 . 50 push eax
004024E9 . FFD3 call ebx ; msvbvm50.__vbaStrMove
004024EB . 8BF0 mov esi,eax
004024ED . 8D55 E4 lea edx,dword ptr ss:[ebp-0x1C]
004024F0 . 52 push edx
004024F1 . 56 push esi
004024F2 . 8B0E mov ecx,dword ptr ds:[esi]
004024F4 . FF91 A0000000 call dword ptr ds:[ecx+0xA0]
004024FA . 85C0 test eax,eax
004024FC . 7D 12 jge short Afkayas_.00402510
004024FE . 68 A0000000 push 0xA0
00402503 . 68 5C1B4000 push Afkayas_.00401B5C
00402508 . 56 push esi
00402509 . 50 push eax
0040250A . FF15 04414000 call dword ptr ds:[<&MSVBVM50.__vbaHresu>; msvbvm50.__vbaHresultCheckObj
00402510 > 8B45 E8 mov eax,dword ptr ss:[ebp-0x18]
00402513 . 8B4D E4 mov ecx,dword ptr ss:[ebp-0x1C]
00402516 . 8B3D 00414000 mov edi,dword ptr ds:[<&MSVBVM50.__vbaSt>; msvbvm50.__vbaStrCat
0040251C . 50 push eax
0040251D . 68 701B4000 push Afkayas_.00401B70 ; AKA-
00402522 . 51 push ecx ; /String = "D?"
00402523 . FFD7 call edi ; \__vbaStrCat
00402525 . 8B1D 70414000 mov ebx,dword ptr ds:[<&MSVBVM50.__vbaSt>; msvbvm50.__vbaStrMove
0040252B . 8BD0 mov edx,eax
0040252D . 8D4D E0 lea ecx,dword ptr ss:[ebp-0x20]
00402530 . FFD3 call ebx ; msvbvm50.__vbaStrMove; <&MSVBVM50.__vbaStrMove>
00402532 . 50 push eax
00402533 . FF15 28414000 call dword ptr ds:[<&MSVBVM50.__vbaStrCm>; msvbvm50.__vbaStrCmp
00402539 . 8BF0 mov esi,eax
然后仔细分析了下这附近的代码
00402415处 读取name的长度存入eax
0040241B处 把name的长度从eax转到edi
0040241D处 目测是name的复制?
00402420处 imul edi,edi,0x17CFB name的长度乘0x17cfb存到edi
00402427处 测试乘法是否溢出
0040242D处 获得首字母ascii码存到ax
00402433处 ax有符号扩展至edx
00402436处 edi=edi+edx edi中的值加上edx的值---------edi= name的长度*0x17cfb+name首字母的ascii码
00402438处 判断加法是否溢出
0040243F处 eax=__vbaStrI4(edi) 好吧,不认识,查也没查到
[Asm] 纯文本查看 复制代码
00402412 . 50 push eax ; /String = "AKA-585235"
00402413 . 8B1A mov ebx,dword ptr ds:[edx] ; |
00402415 . FF15 E4404000 call dword ptr ds:[<&MSVBVM50.__vbaLenBs>; \__vbaLenBstr
0040241B . 8BF8 mov edi,eax
0040241D . 8B4D E8 mov ecx,dword ptr ss:[ebp-0x18]
00402420 . 69FF FB7C0100 imul edi,edi,0x17CFB
00402427 . 0F80 91020000 jo Afkayas_.004026BE
0040242D . FF15 F8404000 call dword ptr ds:[<&MSVBVM50.#rtcAnsiVa>; \rtcAnsiValueBstr
00402433 . 0FBFD0 movsx edx,ax
00402436 . 03FA add edi,edx
00402438 . 0F80 80020000 jo Afkayas_.004026BE
0040243E . 57 push edi ;
0040243F . FF15 E0404000 call dword ptr ds:[<&MSVBVM50.__vbaStrI4>; msvbvm50.__vbaStrI4
00402445 . 8BD0 mov edx,eax
00402447 . 8D4D E0 lea ecx,dword ptr ss:[ebp-0x20]
随便输了个数算了下 name的长度*0x17cfb+name首字母的ascii码 的值
然后在strcmp处下断点和密码比对,发现和AKA- 后边的数字一样,我猜__vbaStrI4 是把数字转换成字符串把?
再回顾一下代码,在00402523处调用的strcat粘贴字符串 第一个参数是指向"AKA-"的指针 第二个参数我想应该就是之前算出来的那个东西了
[Asm] 纯文本查看 复制代码
00402513 . 8B4D E4 mov ecx,dword ptr ss:[ebp-0x1C]
00402516 . 8B3D 00414000 mov edi,dword ptr ds:[<&MSVBVM50.__vbaSt>; msvbvm50.__vbaStrCat
0040251C . 50 push eax
0040251D . 68 701B4000 push Afkayas_.00401B70 ; AKA-
00402522 . 51 push ecx ; /String = "D?"
00402523 . FFD7 call edi ; \__vbaStrCat
00402525 . 8B1D 70414000 mov ebx,dword ptr ds:[<&MSVBVM50.__vbaSt>; msvbvm50.__vbaStrMove
0040252B . 8BD0 mov edx,eax
0040252D . 8D4D E0 lea ecx,dword ptr ss:[ebp-0x20]
00402530 . FFD3 call ebx ; msvbvm50.__vbaStrMove; <&MSVBVM50.__vbaStrMove>
00402532 . 50 push eax
00402533 . FF15 28414000 call dword ptr ds:[<&MSVBVM50.__vbaStrCm>; msvbvm50.__vbaStrCmp
至此答案已经揭晓,然后试着写了个注册机
前面的代码就是我自己的输入输出模板 看后边就好了~
编译器g++ (gun c++)
[C++] 纯文本查看 复制代码
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<queue>
#include<set>
#include<string>
#define ll long long
#define ull unsigned long long
#define eps 1e-8
#define ms(x,y) (memset(x,y,sizeof(x)))
#define fr(i,x,y) for(int i=x;i<=y;i++)
#define rfr(i,x,y) for(int i=x;i>=y;i--)
#define sqr(x) ((x)*(x))
#define MP(x,y) make_pair(x,y)
#define PB(x) push_back(x)
#define f1 first
#define f2 second
#define DOUBLE_OUTPUT_LENGTH 6
using namespace std;
///const int INF=0x3f3f3f3f;
///const double D_INF=1e100;
///const double C=0.577215664901532860606;//欧拉常数
///const double pi=3.141592653589793238;//圆周率
///const double e=2.71828182845904523536;//自然对数
///const double fai=1.6180339887;//黄金分割数
template<class T>
T gcd(T a,T b){if(!b)return a;while(b^=a^=b^=a%=b);return a;}
template<class T>
T max(const T& t1,const T& t2,const T& t3){return max(max(t1,t2),t3);}
template<class T>
T max(const T& t1,const T& t2,const T& t3,const T& t4)
{return max(max(t1,t2),max(t3,t4));}
ll fpow(ll x,ll y,ll mod=0x7fffffffffffffffll){ll ret=1;while(y){if(y&1)ret*=x,ret%=mod;x*=x;x%=mod;y>>=1;}return ret;}
void ex_gcd(ll a,ll b,ll& x,ll& y){if(b==0){x=a;y=0;return;}ex_gcd(b,a%b,y,x);y=y-a/b*x;}
ll modrev(ll x,ll mod)///乘法逆元
{ll x1,x2;ex_gcd(x,mod,x1,x2);return x1;}
ull T_rand(){return (ull)(rand());}
ull Rand()///返回 0~2^64-1之间的一个随机数
{return (T_rand()<<48)|(T_rand()<<32)|(T_rand()<<16)|T_rand();}
#include <windows.h>
#define OUTCOL SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY | FOREGROUND_GREEN | FOREGROUND_BLUE)
#define INCOL SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY |FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE)
template<class T>
bool PRE_INPUT_INTENGER(T& ret)
{INCOL;ret=0;char c=getchar();if(c==-1)return 0;bool f=0;while((c<'0'||c>'9')&&(c!=-1)&&(c!='-'))c=getchar();if(c=='-'){f=1;c=getchar();}while(c>='0'&&c<='9')ret*=10,ret+=c-'0',c=getchar();if(f)ret=-ret;if(c==-1)return 0;return 1;}
bool input(int& ret){return PRE_INPUT_INTENGER(ret);}
bool input(ll& ret){return PRE_INPUT_INTENGER(ret);}
bool input(ull& ret){return PRE_INPUT_INTENGER(ret);}
bool input(unsigned int& ret){return PRE_INPUT_INTENGER(ret);}
template<class T>
bool PRE_INPUT_DOUBLE(T& ret)
{INCOL;ret=0;char c=getchar();if(c==-1)return 0;bool f=0;while((c<'0'||c>'9')&&(c!=-1)&&(c!='.')&&(c!='-'))c=getchar();bool isright=0;
if(c=='-'){f=1;c=getchar();}T t=1;while((c>='0'&&c<='9')||(c=='.')){if(c=='.')isright=1;else{ret*=10,ret+=c-'0';if(isright)t*=10;}c=getchar();}ret/=t;if(f)ret=-ret;if(c==-1)return 0;return 1;}
bool input(double& ret){return PRE_INPUT_DOUBLE(ret);}
bool input(float& ret){return PRE_INPUT_DOUBLE(ret);}
bool IS_SPECIAL_CHAR(const char& ret){return (ret==' '||ret=='\n'||ret=='\t'||ret=='\r'||ret=='\v');}
bool input(char& ret)///注意 用input输入char会滤过空格回车换行制表符
{INCOL;ret=getchar();if(ret==-1)return 0;while(IS_SPECIAL_CHAR(ret))ret=getchar();return ~ret;}
bool input(char* ret)///注意 用input输入char会滤过空格回车换行制表符
{INCOL;char c;if(!input(c))return 0;*ret++=c;while(!IS_SPECIAL_CHAR(*(ret-1)))*ret++=getchar();*(ret-1)=0;return 1;}
template<class T1,class T2>
bool input(T1& t1,T2& t2){return input(t1)&&input(t2);}
template<class T1,class T2,class T3>
bool input(T1& t1,T2& t2,T3& t3){return input(t1)&&input(t2)&&input(t3);}
template<class T1,class T2,class T3,class T4>
bool input(T1& t1,T2& t2,T3& t3,T4& t4){return input(t1)&&input(t2)&&input(t3)&&input(t4);}
template<class T1,class T2,class T3,class T4,class T5>
bool input(T1& t1,T2& t2,T3& t3,T4& t4,T5& t5){return input(t1)&&input(t2)&&input(t3)&&input(t4)&&input(t5);}
template<class T>
void PRE_OUTPUT_INTENGER(const T& t)
{OUTCOL;if(!t){putchar('0');return ;}T key=t;int tt[25];if(key<0){putchar('-');key=-key;}int cnt=0;
while(key)tt[cnt++]=key%10,key/=10;while(cnt)putchar(tt[--cnt]+'0');INCOL;}
void output(const int& t){PRE_OUTPUT_INTENGER(t);}
void output(const ll& t){PRE_OUTPUT_INTENGER(t);}
void output(const ull& t){PRE_OUTPUT_INTENGER(t);}
void output(const unsigned int& t){PRE_OUTPUT_INTENGER(t);}
template<class T>
void PRE_OUTPUT_DOUBLE(const T& key)
{OUTCOL;printf("%.*f",DOUBLE_OUTPUT_LENGTH,key);INCOL;}
void output(const double& t){PRE_OUTPUT_DOUBLE(t);}
void output(const float& t){PRE_OUTPUT_DOUBLE(t);}
void output(const char* ch){OUTCOL;int cnt=0;while(ch[cnt])putchar(ch[cnt++]);INCOL;}
void output(const char& c){OUTCOL;putchar(c);INCOL;}
template<class T1,class T2>
void output(const T1& t1,const T2& t2){output(t1);output(t2);}
template<class T1,class T2,class T3>
void output(const T1& t1,const T2& t2,const T3& t3){output(t1);output(t2);output(t3);}
template<class T1,class T2,class T3,class T4>
void output(const T1& t1,const T2& t2,const T3& t3,const T4& t4){output(t1);output(t2);output(t3);output(t4);}
template<class T1,class T2,class T3,class T4,class T5>
void output(const T1& t1,const T2& t2,const T3& t3,const T4& t4,const T5& t5){output(t1);output(t2);output(t3);output(t4);output(t5);}
template<class T1,class T2,class T3,class T4,class T5,class T6>
void output(const T1& t1,const T2& t2,const T3& t3,const T4& t4,const T5& t5,const T6& t6){output(t1);output(t2);output(t3);output(t4);output(t5);output(t6);}
template<class T1,class T2,class T3,class T4,class T5,class T6,class T7>
void output(const T1& t1,const T2& t2,const T3& t3,const T4& t4,const T5& t5,const T6& t6,const T7& t7){output(t1);output(t2);output(t3);output(t4);output(t5);output(t6);output(t7);}
#define EL putchar('\n')
template<class T>
void printal(T* a,int n)///print a line 在一行中打印数组的0~n-1空格分割结尾换行
{for(int i=0;i<n-1;i++)output(a[i],' ');output(a[n-1],'\n');}
template<class T>
void printel(T* a,int n)///print every line 在每行中打印数组的0~n-1 每行一个元素
{for(int i=0;i<n;i++)output(a[i],'\n');}
/**------------------------------------------------------分割线 下边写代码-------------------------------------------------------------**/
void sendToClipboard(char *str)
{
int lens=strlen(str)+1;
if(OpenClipboard(NULL))
{
HGLOBAL hmem=GlobalAlloc(GHND,lens);
char *pmem=(char*)GlobalLock(hmem);
EmptyClipboard();
memcpy(pmem,str,lens);
SetClipboardData(CF_TEXT,hmem);
CloseClipboard();
GlobalFree(hmem);
}
}
int getkey(char *s)
{
return strlen(s)*0x17cfb+((int)(s[0]));
}
void outkey(char *s)
{
char key[100];
sprintf(key,"AKA-%d",getkey(s));
output("密码为: ",key,"\n\n");
sendToClipboard(key);
}
int main(int argc,char **argv)
{
if(argc-1)
outkey(argv[1]);
else
{
char ch[100];
while(1)
{
output("结束程序请输入ctrl+z\n请输入name:");
if(!input(ch))return 0;
outkey(ch);
output("密码已经复制到剪贴板~\n");
EL;EL;
system("pause");
system("cls");
}
}
}
/*************copyright by sinianluoye ***********/
第一次做KM,虽然很简单,还是希望大大们多评价下
就是这样啦~
|
免费评分
-
查看全部评分
|