|
|
|
[活动结束]看雪十周年论坛活动 [1楼己公布结果]
祝大家好运啦 |
|
[原创]PE感染型病毒的研究和代码实现,附上代码和论文
写的非常好,大赞 |
|
[分享]《WINDOWS程序设计》---高清版+配套代码
楼主太好了,谢谢分享 |
|
[邀请已发,结帖]16进制机器码查看的C++源码实现
谢谢Ivanov,下面我把这个程序的核心部分注释一下,还望大牛们多多指教 核心代码是一个循环,读到文件最后一个字节结束 while(in.good()) { in.read(&a,sizeof(a));//读取一个字节,也就是8个二进制数放入字节变量a中 m++;//m作为计数器,判断已经处理了多少个字节 for(i=0;i<2;i++)//每个字节分两次处理,先处理高四位,再处理低四位。 { c=0; for(j=0;j<4;j++)//此循环用于求每四个二进制数的和,然后将和用十六进制数字符表示。 { d=a&0x80;//将a的低七位二进制数置为0,最高位保留不变 a=a<<1;//a左移一位,用于处理下一位二进制数 if(d==0x00){b=0;}else b=1;//如果d=0x00则此时最高位为0,否则d=0x80则最高位为1. c=c*2+b;//将c乘以2后加上b,这是二进制转化为十进制的常用方法 } if(c<10){c=c+48;}//判断c是否小于10,小于则用数字表示 else if(c>9){c=c+87;}//否则用abcdef表示 out<<c;//将十六进制结果以字符形式输出到文本文件 } if(m%num==0){out<<'\n'<<m<<'\t'<<'\t';}else out<<'\t'; //在文本文件中每num个字节换一行。 } 为了再次对Ivanov表示感谢,小鸟把上述程序的逆过程也写出来供大家分享 所谓其逆过程就是把文本文件中的十六进制字符还原为数据文件,这样就可以实现用记事本来修改文件的二进制代码,比如去除bmp图片的背景,当然罗,你首先要知道bmp的文件格式,这里就不多说了,代码如下: #include <iostream> #include <fstream> using namespace std; int main() { int i,j,k,m,n,num; unsigned char a,b,c; char name[20],ci[20],co[20]; cout<<"输入文件名:"; cin>>name; strcpy(ci,name); strcat(ci,".dat"); strcpy(co,"back-"); strcat(co,name); ifstream in(ci); if(!in){cout<<"Cannot open file "<<ci<<endl;system("pause");exit(0);} cout<<"每行多少字节:";cin>>num; ofstream out(co,ios_base::binary); //这里是本程序的核心代码 in>>m; while(in.good())//这个循环用于读取文本文件的每一个字符 { n=0; for(i=0;i<num;i++)//该循环用于将文本文件的每行十六进制字符串转化为对应的二进制字节 { b=0; in>>a;//读取字符 if(a>47&&a<58){b=b+a-48;}else {b=b+a-87;}//将字符转化为四个二进制数 b=b<<4;//左移四位,也就是将上一行转化的四个二进制数填充到b的高四位 in>>a; //读取下一个字符 if(a>47&&a<58){b=b+a-48;}else {b=b+a-87;}//将字符转化为四个二进制数后填充到b的低四位。 out.write((char*)&b,sizeof(b)); //将填充好的字节b输出到二进制文件 n++; } in>>m;//跳过每行的行首地址字符串 } cout<<"共有字节数:"<<m+n<<endl; in.close(); out.close(); } |
|
[邀请已发,结帖]16进制机器码查看的C++源码实现
第一次发贴,考虑不周见谅 |
|
[求助]这个邀请码...
我也在期待中 |
|
[邀请已发,结帖]16进制机器码查看的C++源码实现
当然没有UE那么强大,只是把一个文件的机器码以16进制的形式用记事本显示出来 |
|
[原创]用汇编语言实现QQ自动登陆
写的很好,赞一个,怎么没人给邀请码阿 |
|
[讨论]诚心学习,望有邀请码~
为了邀请码奋斗 |
|
[讨论]建议购买正版看雪图书赠送邀请码!
要是这样就好罗,本人刚在当当订购了一本加密与解密3 |
操作理由
RANk
{{ user_info.golds == '' ? 0 : user_info.golds }}
雪币
{{ experience }}
课程经验
{{ score }}
学习收益
{{study_duration_fmt}}
学习时长
基本信息
荣誉称号:
{{ honorary_title }}
能力排名:
No.{{ rank_num }}
等 级:
LV{{ rank_lv-100 }}
活跃值:
在线值:
浏览人数:{{ visits }}
最近活跃:{{ last_active_time }}
注册时间:{{ user_info.create_date_jsonfmt }}
勋章
兑换勋章
证书
证书查询 >
能力值