2019年1月16日【第三天学习】
2019年1月16日星期三
任務一、運行CrackMe1.exe,提示 "嗯,對了" 代表成功。首先修改exe使得出現成功提示,其次不修改exe輸入正確的密碼達到成功的目的。
hint:https://blog.csdn.net/Nagi_Way/article/details/68961121
使用.Net的Reflector反編譯器,使用F3查找該函數
?
?
byte[] bytes = Encoding.ASCII.GetBytes("wctf{wol");
byte[] rgbIV = Encoding.ASCII.GetBytes("dy_crack}");
DESCryptoServiceProvider provider = new DESCryptoServiceProvider();
int keySize = provider.KeySize;
MemoryStream stream = new MemoryStream();
CryptoStream stream2 = new CryptoStream(stream, provider.CreateEncryptor(bytes, rgbIV), CryptoStreamMode.Write);
StreamWriter writer = new StreamWriter(stream2);
writer.Write(data);
writer.Flush();
stream2.FlushFinalBlock();
writer.Flush();
return Convert.ToBase64String(stream.GetBuffer(), 0, (int) stream.Length);
?
密文:fOCPTVF0diO+B0IMXntkPoRJDUj5CCsT
密鑰:wctf{wol
偏移量:dy_crack}
明文:wctf{dotnet_crackme1}
?
任務二、閱讀下面文章,寫出閱讀心得
http://www.vuln.cn/7115
http://www.vuln.cn/7116
http://www.vuln.cn/7117
http://www.vuln.cn/7118
?
博客一:
1、JVM字節碼比其他的X86低級代碼更加容易反編譯
1)多很多相關類型的信息
2)JVM(java虛擬機)內存模式更加嚴格和概括
3)Java編譯器沒有做任何優化工作(JAM JIT不是實時)
?
2、JVM知識何時有用?
1)分析混淆代碼
2)創建自己的混淆器
3)創造編譯器代碼生成器
?
3、javap –c?? 反編譯器??????
1)通過編譯確定內存申請狀況
編譯:
Int i=2;
Int j=3;
?
? Code:
?? 0:?? iconst_2????//把2放到棧頂
?? 1:?? istore_1????//把棧頂的值放到局部變量1中,即i中
?? 2:?? iconst_3????//把3放到棧頂
?? 3:?? istore_2????//把棧頂的值放到局部變量1中,即j中
?? 4:?? return
?
編譯:
Int i=2;
Int j=2;
?
? Code:
?? 0:?? iconst_2????//把2放到棧頂
?? 1:?? istore_1????//把棧頂的值放到局部變量1中,即i中
?? 2:?? iconst_2????//把2放到棧頂
?? 3:?? istore_2????//把棧頂的值放到局部變量2中,即j中(i 和 j同時指向2)
?? 4:?? return
?
編譯:
Int i=2;
Int j=i;
?
? Code:
?? 0:?? iconst_2????//把2放到棧頂
?? 1:?? istore_1????//把棧頂的值放到局部變量1中,即i中
?? 2:?? iload_1?????//把i的值放到棧頂,也就是說此時棧頂的值是2
?? 3:?? istore_2????//把棧頂的值放到局部變量2中,即j中
?? 4:?? return
?
2)通過編譯確定i++與++i的區別與聯系
Int i=1;?? I++;
Int j=1;?? J++
?
?Code:
? 0:?? iconst_1
? 1:?? istore_1
? 2:?? iinc??? 1, 1?//這個個指令,把局部變量1,也就是i,增加1,這個指令不會導致棧的變 ?化,i此時變成2了
? 5:?? iconst_1
? 6:?? istore_2
? 7:?? iinc??? 2, 1//這個個指令,把局部變量2,也就是j,增加1,這個指令不會導致棧的變化,j此時變成2了
? 10:? return
?
Int i=1;?? I++;
Int j=1;?? ++J;
?
? Code:
?? 0:?? iconst_1
?? 1:?? istore_1
?? 2:?? iload_1
?? 3:?? iinc??? 1, 1??//局部變量1(即i)加1變為2,注意這時棧中仍然是1,沒有改變
?? 6:?? istore_1????//把棧頂的值放到局部變量1中,即i這時候由2變成了1
?? 7:?? iconst_1
?? 8:?? istore_2
?? 9:?? iinc??? 2, 1?//局部變量2(即j)加1變為2,注意這時棧中仍然是1,沒有改變
?? 12:? iload_2????//把局部變量2(即j)的值放到棧頂,此時棧頂的值變為2
?? 13:? istore_2???//把棧頂的值放到局部變量2中,即j這時候真正由1變成了2
?? 14:? return
?
理解了上面的程序,我們來看一個很有趣的程序:
public class a{
?????? public static void main(String[] args){
?????? int m=0;
?????? for(int i=0;i<100;i++)
????????????? m=m++;
?????? System.out.println(m);
}
}
先看結果:
?
是不是很驚艷!至少我被驚艷了!
當執行m=m++的時候m的值加一了,但是棧中的值還是0
?
Python中是沒有i++的
Java的i++輸出為0
C的i++輸出是100
?
證明參考博客:
http://www.cnblogs.com/beautiful-code/p/6424977.html
https://www.cnblogs.com/tutuu/p/4115172.html
https://blog.csdn.net/qq_37937537/article/details/79931157
證明如下:
?
【這里有圖片無法上傳,便不再上傳,感興趣同學自行研究】
程序如下:
?
?
?
m++的:
Code:
?????? 0: iconst_0??????????????????????????? //把0放到棧頂
?????? 1: istore_1???????????????????????????? //把棧頂元素放到1號存儲塊中,即為m=0
?????? 2: iconst_0??????????????????????????? //把0放到棧頂
?????? 3: istore_2???????????????????????????? //把棧頂元素放到1號存儲塊中,即為i=0
?????? 4: iload_2????????????????????????????? //把局部變量2(m)放到棧頂
?????? 5: bipush??????? 100?????????? //循環100次
?????? 7: if_icmpge???? 19
????? 10: iinc????????? 1, 1??????????? //把局部變量1加一,m++
????? 13: iinc????????? 2, 1??????????? //把局部變量2加一,i++
????? 16: goto????????? 4????????????? //前往4號地址塊
????? 19: getstatic?? ????????????????????? // Field java/lang/System.out:Ljava/io/PrintStream;
????? 22: iload_1
????? 23: invokevirtual #3??? ???????? // Method java/io/PrintStream.println:(I)V
?
m=m++的:
??? Code:
?????? 0: iconst_0??????????????????????????? //把0放到棧頂
?????? 1: istore_1???????????????????????????? //把棧頂元素放到局部變量表第1個位置中,即為m=0
?????? 2: iconst_0??????????????????????????? //把0放到棧頂
?????? 3: istore_2???????????????????????????? //把棧頂元素放到局部變量表第2個位置號中,即為i=0
?????? 4: iload_2????????????????????????????? //復制變量2入棧
?????? 5: bipush??????? 100?????????? //循環100次
?????? 7: if_icmpge???? 21
????? 10: iload_1????????????????????????????? //m++
????? 11: iinc????????? 1, 1
????? 14: istore_1????????????????????? 重點//將命令10的結果賦給變量1,組合命令,勿單看
????? 15: iinc????????? 2, 1??????????? //i++
????? 18: goto????????? 4????????????? //跳轉到4
????? 21: getstatic?? ????????????????????? // Field java/lang/System.out:Ljava/io/PrintStream;
????? 24: iload_1
????? 25: invokevirtual #3?????? ??? // Method java/io/PrintStream.println:(I)V
????? 28: return
?
轉載于:https://www.cnblogs.com/wuruixin/p/10281605.html
總結
以上是生活随笔為你收集整理的2019年1月16日【第三天学习】的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: UDS协议入门
- 下一篇: 图像坐标:我想和世界坐标谈谈(A) 【计