first commit
This commit is contained in:
139
bomblab/Decompilation.txt
Normal file
139
bomblab/Decompilation.txt
Normal file
@ -0,0 +1,139 @@
|
||||
|
||||
bomb_linux: 文件格式 elf64-x86-64
|
||||
|
||||
SYMBOL TABLE:
|
||||
0000000000000000 l df *ABS* 0000000000000000 crt1.o
|
||||
0000000000400354 l O .note.ABI-tag 0000000000000020 __abi_tag
|
||||
0000000000000000 l df *ABS* 0000000000000000 crtstuff.c
|
||||
0000000000401230 l F .text 0000000000000000 deregister_tm_clones
|
||||
0000000000401260 l F .text 0000000000000000 register_tm_clones
|
||||
00000000004012a0 l F .text 0000000000000000 __do_global_dtors_aux
|
||||
0000000000408808 l O .bss 0000000000000001 completed.0
|
||||
0000000000408578 l O .fini_array 0000000000000000 __do_global_dtors_aux_fini_array_entry
|
||||
00000000004012d0 l F .text 0000000000000000 frame_dummy
|
||||
0000000000408570 l O .init_array 0000000000000000 __frame_dummy_init_array_entry
|
||||
0000000000000000 l df *ABS* 0000000000000000 main.c
|
||||
0000000000000000 l df *ABS* 0000000000000000 phase_impossible.c
|
||||
0000000000000000 l df *ABS* 0000000000000000 phase1.c
|
||||
0000000000000000 l df *ABS* 0000000000000000 phase2.c
|
||||
0000000000000000 l df *ABS* 0000000000000000 phase3.c
|
||||
0000000000000000 l df *ABS* 0000000000000000 phase4.c
|
||||
0000000000000000 l df *ABS* 0000000000000000 support.c
|
||||
0000000000000000 l df *ABS* 0000000000000000 crtstuff.c
|
||||
000000000040756c l O .eh_frame 0000000000000000 __FRAME_END__
|
||||
0000000000000000 l df *ABS* 0000000000000000
|
||||
0000000000408580 l O .dynamic 0000000000000000 _DYNAMIC
|
||||
0000000000406954 l .eh_frame_hdr 0000000000000000 __GNU_EH_FRAME_HDR
|
||||
0000000000408760 l O .got.plt 0000000000000000 _GLOBAL_OFFSET_TABLE_
|
||||
0000000000405a79 g F .text 000000000000005e skip
|
||||
0000000000000000 F *UND* 0000000000000000 getenv@GLIBC_2.2.5
|
||||
0000000000401a35 g F .text 000000000000000c goto_buf_2
|
||||
0000000000000000 F *UND* 0000000000000000 __libc_start_main@GLIBC_2.34
|
||||
0000000000401a23 g F .text 0000000000000009 goto_buf_0
|
||||
00000000004087e8 w .data 0000000000000000 data_start
|
||||
0000000000408840 g O .bss 0000000000005000 input_strings
|
||||
00000000004023a5 g F .text 00000000000000ce phase_2_9
|
||||
000000000040383f g F .text 00000000000001b6 phase_3_10
|
||||
0000000000402214 g F .text 00000000000000ce phase_2_7
|
||||
0000000000401ef6 g F .text 00000000000000c5 phase_2_3
|
||||
000000000040207b g F .text 00000000000000cc phase_2_5
|
||||
0000000000403ddc g F .text 00000000000003ed phase_3_12
|
||||
0000000000000000 F *UND* 0000000000000000 puts@GLIBC_2.2.5
|
||||
0000000000401d82 g F .text 00000000000000a4 phase_2_1
|
||||
0000000000405216 g F .text 00000000000000d3 phase_4_21
|
||||
00000000004053bc g F .text 00000000000000d3 phase_4_23
|
||||
0000000000408800 g O .bss 0000000000000008 stdin@GLIBC_2.2.5
|
||||
0000000000000000 F *UND* 0000000000000000 clock_gettime@GLIBC_2.17
|
||||
00000000004087fc g .data 0000000000000000 _edata
|
||||
0000000000405c28 g F .fini 0000000000000000 .hidden _fini
|
||||
0000000000000000 F *UND* 0000000000000000 strlen@GLIBC_2.2.5
|
||||
0000000000404e9b g F .text 00000000000000d3 phase_4_12
|
||||
0000000000404cf5 g F .text 00000000000000d3 phase_4_10
|
||||
0000000000405041 g F .text 00000000000000d3 phase_4_14
|
||||
000000000040d840 g O .bss 0000000000000004 num_input_strings
|
||||
0000000000000000 F *UND* 0000000000000000 printf@GLIBC_2.2.5
|
||||
0000000000405a1e g F .text 000000000000005b blank_line
|
||||
0000000000408818 g O .bss 0000000000000008 rand1_l
|
||||
0000000000408810 g O .bss 0000000000000008 rand1_h
|
||||
0000000000402893 g F .text 0000000000000128 phase_3
|
||||
0000000000401b53 g F .text 000000000000003b phase_1
|
||||
0000000000000000 F *UND* 0000000000000000 memset@GLIBC_2.2.5
|
||||
000000000040478a g F .text 000000000000010b phase_4_00
|
||||
0000000000404bb6 g F .text 000000000000010b phase_4_04
|
||||
0000000000403325 g F .text 00000000000001b0 phase_3_7
|
||||
0000000000403001 g F .text 0000000000000183 phase_3_5
|
||||
00000000004049a0 g F .text 000000000000010b phase_4_02
|
||||
000000000040368b g F .text 00000000000001b4 phase_3_9
|
||||
0000000000401725 g F .text 0000000000000052 GetTickCount
|
||||
0000000000402d75 g F .text 000000000000014e phase_3_3
|
||||
0000000000402683 g F .text 00000000000000ae phase_2_13
|
||||
00000000004027df g F .text 00000000000000b4 phase_2_15
|
||||
0000000000402521 g F .text 00000000000000ae phase_2_11
|
||||
0000000000000000 F *UND* 0000000000000000 fgets@GLIBC_2.2.5
|
||||
0000000000405bf6 g F .text 0000000000000030 explode_bomb
|
||||
0000000000402aee g F .text 0000000000000139 phase_3_1
|
||||
00000000004087e8 g .data 0000000000000000 __data_start
|
||||
0000000000000000 F *UND* 0000000000000000 strcmp@GLIBC_2.2.5
|
||||
0000000000405592 g F .text 00000000000000d3 phase_4_30
|
||||
00000000004058dc g F .text 00000000000000d3 phase_4_34
|
||||
0000000000405736 g F .text 00000000000000d3 phase_4_32
|
||||
0000000000000000 w *UND* 0000000000000000 __gmon_start__
|
||||
0000000000405114 g F .text 000000000000002f func4_2
|
||||
0000000000404749 g F .text 0000000000000041 func4_0
|
||||
00000000004087f0 g O .data 0000000000000000 .hidden __dso_handle
|
||||
0000000000406000 g O .rodata 0000000000000004 _IO_stdin_used
|
||||
0000000000401a2c g F .text 0000000000000009 goto_buf_1
|
||||
0000000000408820 g O .bss 0000000000000008 rand_div
|
||||
00000000004087f8 g O .data 0000000000000004 result
|
||||
0000000000000000 F *UND* 0000000000000000 __isoc99_sscanf@GLIBC_2.7
|
||||
00000000004022e2 g F .text 00000000000000c3 phase_2_8
|
||||
0000000000402147 g F .text 00000000000000cd phase_2_6
|
||||
00000000004039f5 g F .text 00000000000003e7 phase_3_11
|
||||
0000000000401fbb g F .text 00000000000000c0 phase_2_4
|
||||
00000000004041c9 g F .text 00000000000003f2 phase_3_13
|
||||
000000000040d848 g .bss 0000000000000000 _end
|
||||
0000000000401220 g F .text 0000000000000005 .hidden _dl_relocate_static_pie
|
||||
0000000000401e26 g F .text 00000000000000d0 phase_2_2
|
||||
00000000004011f0 g F .text 0000000000000026 _start
|
||||
00000000004052e9 g F .text 00000000000000d3 phase_4_22
|
||||
0000000000401cd8 g F .text 00000000000000aa phase_2_0
|
||||
0000000000405143 g F .text 00000000000000d3 phase_4_20
|
||||
000000000040548f g F .text 00000000000000d3 phase_4_24
|
||||
0000000000408828 g O .bss 0000000000000008 infile
|
||||
00000000004087fc g .bss 0000000000000000 __bss_start
|
||||
0000000000401a41 g F .text 000000000000004a check_buf_valid
|
||||
00000000004012d6 g F .text 00000000000003d7 main
|
||||
0000000000401aad g F .text 00000000000000a6 GenerateRandomString
|
||||
0000000000405ad7 g F .text 000000000000011f read_line
|
||||
0000000000404f6e g F .text 00000000000000d3 phase_4_13
|
||||
0000000000404dc8 g F .text 00000000000000d3 phase_4_11
|
||||
00000000004045bb g F .text 000000000000018e phase_4
|
||||
0000000000000000 F *UND* 0000000000000000 fopen@GLIBC_2.2.5
|
||||
0000000000401b8e g F .text 000000000000014a phase_2
|
||||
0000000000000000 F *UND* 0000000000000000 atoi@GLIBC_2.2.5
|
||||
0000000000401777 g F .text 000000000000019c phase_impossible
|
||||
0000000000000000 F *UND* 0000000000000000 sprintf@GLIBC_2.2.5
|
||||
0000000000000000 F *UND* 0000000000000000 exit@GLIBC_2.2.5
|
||||
00000000004034d5 g F .text 00000000000001b6 phase_3_8
|
||||
0000000000404aab g F .text 000000000000010b phase_4_03
|
||||
0000000000408800 g O .data 0000000000000000 .hidden __TMC_END__
|
||||
0000000000404895 g F .text 000000000000010b phase_4_01
|
||||
0000000000403184 g F .text 00000000000001a1 phase_3_6
|
||||
0000000000402c27 g F .text 000000000000014e phase_3_2
|
||||
0000000000402731 g F .text 00000000000000ae phase_2_14
|
||||
0000000000402ec3 g F .text 000000000000013e phase_3_4
|
||||
0000000000402473 g F .text 00000000000000ae phase_2_10
|
||||
00000000004025cf g F .text 00000000000000b4 phase_2_12
|
||||
00000000004029bb g F .text 0000000000000133 phase_3_0
|
||||
00000000004016ad g F .text 0000000000000078 GenerateRandomNumber
|
||||
0000000000401000 g F .init 0000000000000000 .hidden _init
|
||||
0000000000401a8b g F .text 0000000000000022 phase_secret
|
||||
00000000004059af g F .text 000000000000006f read_six_numbers
|
||||
0000000000405809 g F .text 00000000000000d3 phase_4_33
|
||||
0000000000405665 g F .text 00000000000000d1 phase_4_31
|
||||
0000000000404cc1 g F .text 0000000000000034 func4_1
|
||||
0000000000401913 g F .text 0000000000000110 tohex
|
||||
0000000000405562 g F .text 0000000000000030 func4_3
|
||||
0000000000000000 F *UND* 0000000000000000 __ctype_b_loc@GLIBC_2.3
|
||||
|
||||
|
||||
BIN
bomblab/IDA Pro 快速指南.docx
Normal file
BIN
bomblab/IDA Pro 快速指南.docx
Normal file
Binary file not shown.
27
bomblab/Readme.txt
Normal file
27
bomblab/Readme.txt
Normal file
@ -0,0 +1,27 @@
|
||||
请使用IDA Pro工具,反汇编bomb.exe
|
||||
并调试该程序。
|
||||
|
||||
bomb.exe将要求你输入多个密码,只有输入正确的密码,才能继续执行程序,否则将“爆炸”。
|
||||
|
||||
利用IDA Pro的反汇编、调试功能,你应该可以破解该炸弹!
|
||||
|
||||
bomb.exe需要一个参数,这个参数是你学号的后6位,例如092224
|
||||
|
||||
bomb.exe 092224
|
||||
超级二进制炸弹2024版,欢迎你!
|
||||
你需要不断依据提示,输入信息,以便解除二进制炸弹,一旦出错,哇哈哈....
|
||||
以前尝试正确的密码,可以写入到bomb.key文件中,一个密码一行
|
||||
请输入第1级的密码:dfaadfddfdf
|
||||
牛刀小试~你已经通过了第1级考验!
|
||||
请输入第2级的密码:1 3 4 5 7 8 10
|
||||
不错不错~你已经通过了第2级考验!
|
||||
请输入第3级的密码:1 3 4 5 7 8 10
|
||||
今夜没加班? 你已经通过了第3级考验!
|
||||
请输入第4级的密码:1 3 4 5 7 8 10
|
||||
完美了~你已经通过了第4级考验!
|
||||
二进制炸弹之不可能任务,你的选择是继续前行(Y),或者放弃(N)
|
||||
友情提示:后面的代码,涉及到反调试、动态生成指令等,所以你要有思想准备......
|
||||
不可能任务,请输入突防指令:
|
||||
12345
|
||||
你已经通过了第5级考验,完成了不可能完成任务(终极考验)!
|
||||
不可能的...不可能的...指令和数据的世界已经混乱...SOS...
|
||||
BIN
bomblab/X86汇编指令速查.xlsx
Normal file
BIN
bomblab/X86汇编指令速查.xlsx
Normal file
Binary file not shown.
5240
bomblab/bomb.asm
Normal file
5240
bomblab/bomb.asm
Normal file
File diff suppressed because it is too large
Load Diff
BIN
bomblab/bomb.exe
Normal file
BIN
bomblab/bomb.exe
Normal file
Binary file not shown.
6
bomblab/bomb_723005.txt
Normal file
6
bomblab/bomb_723005.txt
Normal file
@ -0,0 +1,6 @@
|
||||
mJHurpQZtY
|
||||
47 47 47 47 47 47
|
||||
2 -41
|
||||
38000
|
||||
Y
|
||||
48B8F887400000000000C700FC03000048C704249618400048B88B1A400000000000FFE051
|
||||
0
bomblab/bomb_decompile.gpr
Normal file
0
bomblab/bomb_decompile.gpr
Normal file
11
bomblab/bomb_decompile.rep/idata/00/00000000.prp
Normal file
11
bomblab/bomb_decompile.rep/idata/00/00000000.prp
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<FILE_INFO>
|
||||
<BASIC_INFO>
|
||||
<STATE NAME="CONTENT_TYPE" TYPE="string" VALUE="Program" />
|
||||
<STATE NAME="PARENT" TYPE="string" VALUE="/" />
|
||||
<STATE NAME="FILE_ID" TYPE="string" VALUE="c0a82b469b8f17134149581882" />
|
||||
<STATE NAME="FILE_TYPE" TYPE="int" VALUE="0" />
|
||||
<STATE NAME="READ_ONLY" TYPE="boolean" VALUE="false" />
|
||||
<STATE NAME="NAME" TYPE="string" VALUE="bomb_linux" />
|
||||
</BASIC_INFO>
|
||||
</FILE_INFO>
|
||||
BIN
bomblab/bomb_decompile.rep/idata/00/~00000000.db/db.2.gbf
Normal file
BIN
bomblab/bomb_decompile.rep/idata/00/~00000000.db/db.2.gbf
Normal file
Binary file not shown.
5
bomblab/bomb_decompile.rep/idata/~index.bak
Normal file
5
bomblab/bomb_decompile.rep/idata/~index.bak
Normal file
@ -0,0 +1,5 @@
|
||||
VERSION=1
|
||||
/
|
||||
00000000:bomb_linux:c0a82b469b8f17134149581882
|
||||
NEXT-ID:1
|
||||
MD5:d41d8cd98f00b204e9800998ecf8427e
|
||||
5
bomblab/bomb_decompile.rep/idata/~index.dat
Normal file
5
bomblab/bomb_decompile.rep/idata/~index.dat
Normal file
@ -0,0 +1,5 @@
|
||||
VERSION=1
|
||||
/
|
||||
00000000:bomb_linux:c0a82b469b8f17134149581882
|
||||
NEXT-ID:1
|
||||
MD5:d41d8cd98f00b204e9800998ecf8427e
|
||||
6
bomblab/bomb_decompile.rep/project.prp
Normal file
6
bomblab/bomb_decompile.rep/project.prp
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<FILE_INFO>
|
||||
<BASIC_INFO>
|
||||
<STATE NAME="OWNER" TYPE="string" VALUE="gh0s7" />
|
||||
</BASIC_INFO>
|
||||
</FILE_INFO>
|
||||
15
bomblab/bomb_decompile.rep/projectState
Normal file
15
bomblab/bomb_decompile.rep/projectState
Normal file
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<PROJECT>
|
||||
<PROJECT_DATA_XML_NAME NAME="DISPLAY_DATA">
|
||||
<SAVE_STATE>
|
||||
<ARRAY NAME="EXPANDED_PATHS" TYPE="string">
|
||||
<A VALUE="bomb_decompile:" />
|
||||
</ARRAY>
|
||||
<STATE NAME="SHOW_TABLE" TYPE="boolean" VALUE="true" />
|
||||
</SAVE_STATE>
|
||||
</PROJECT_DATA_XML_NAME>
|
||||
<TOOL_MANAGER ACTIVE_WORKSPACE="Workspace">
|
||||
<WORKSPACE NAME="Workspace" ACTIVE="true" />
|
||||
</TOOL_MANAGER>
|
||||
</PROJECT>
|
||||
|
||||
11
bomblab/bomb_decompile.rep/user/00/00000000.prp
Normal file
11
bomblab/bomb_decompile.rep/user/00/00000000.prp
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<FILE_INFO>
|
||||
<BASIC_INFO>
|
||||
<STATE NAME="CONTENT_TYPE" TYPE="string" VALUE="ProgramUserData" />
|
||||
<STATE NAME="PARENT" TYPE="string" VALUE="/" />
|
||||
<STATE NAME="FILE_ID" TYPE="string" VALUE="c0a82b46af9f17465853183772" />
|
||||
<STATE NAME="FILE_TYPE" TYPE="int" VALUE="0" />
|
||||
<STATE NAME="READ_ONLY" TYPE="boolean" VALUE="false" />
|
||||
<STATE NAME="NAME" TYPE="string" VALUE="udf_c0a82b469b8f17134149581882" />
|
||||
</BASIC_INFO>
|
||||
</FILE_INFO>
|
||||
BIN
bomblab/bomb_decompile.rep/user/00/~00000000.db/db.7.gbf
Normal file
BIN
bomblab/bomb_decompile.rep/user/00/~00000000.db/db.7.gbf
Normal file
Binary file not shown.
4
bomblab/bomb_decompile.rep/user/~index.bak
Normal file
4
bomblab/bomb_decompile.rep/user/~index.bak
Normal file
@ -0,0 +1,4 @@
|
||||
VERSION=1
|
||||
/
|
||||
NEXT-ID:0
|
||||
MD5:d41d8cd98f00b204e9800998ecf8427e
|
||||
5
bomblab/bomb_decompile.rep/user/~index.dat
Normal file
5
bomblab/bomb_decompile.rep/user/~index.dat
Normal file
@ -0,0 +1,5 @@
|
||||
VERSION=1
|
||||
/
|
||||
00000000:udf_c0a82b469b8f17134149581882:c0a82b46af9f17465853183772
|
||||
NEXT-ID:1
|
||||
MD5:d41d8cd98f00b204e9800998ecf8427e
|
||||
2
bomblab/bomb_decompile.rep/user/~journal.bak
Normal file
2
bomblab/bomb_decompile.rep/user/~journal.bak
Normal file
@ -0,0 +1,2 @@
|
||||
IADD:00000000:/udf_c0a82b469b8f17134149581882
|
||||
IDSET:/udf_c0a82b469b8f17134149581882:c0a82b46af9f17465853183772
|
||||
4
bomblab/bomb_decompile.rep/versioned/~index.bak
Normal file
4
bomblab/bomb_decompile.rep/versioned/~index.bak
Normal file
@ -0,0 +1,4 @@
|
||||
VERSION=1
|
||||
/
|
||||
NEXT-ID:0
|
||||
MD5:d41d8cd98f00b204e9800998ecf8427e
|
||||
4
bomblab/bomb_decompile.rep/versioned/~index.dat
Normal file
4
bomblab/bomb_decompile.rep/versioned/~index.dat
Normal file
@ -0,0 +1,4 @@
|
||||
VERSION=1
|
||||
/
|
||||
NEXT-ID:0
|
||||
MD5:d41d8cd98f00b204e9800998ecf8427e
|
||||
BIN
bomblab/bomb_linux
Executable file
BIN
bomblab/bomb_linux
Executable file
Binary file not shown.
25
bomblab/phase_2_14.c
Normal file
25
bomblab/phase_2_14.c
Normal file
@ -0,0 +1,25 @@
|
||||
|
||||
void phase_2_14(undefined8 param_1)
|
||||
|
||||
{
|
||||
int local_28 [7];
|
||||
int local_c;
|
||||
|
||||
read_six_numbers(param_1,local_28);
|
||||
GenerateRandomNumber(0x32);
|
||||
if ((long)local_28[0] != rand_div + 0x10) {
|
||||
explode_bomb();
|
||||
}
|
||||
for (local_c = 0; local_c < 6; local_c = local_c + 1) {
|
||||
if (local_28[local_c] < 0) {
|
||||
explode_bomb();
|
||||
}
|
||||
}
|
||||
for (local_c = 1; local_c < 6; local_c = local_c + 1) {
|
||||
if ((local_28[local_c + -1] < local_28[local_c]) || (local_28[local_c] < 1)) {
|
||||
explode_bomb();
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
200
bomblab/strings_in_bomb.txt
Normal file
200
bomblab/strings_in_bomb.txt
Normal file
@ -0,0 +1,200 @@
|
||||
/lib64/ld-linux-x86-64.so.2
|
||||
fgets
|
||||
__libc_start_main
|
||||
strcmp
|
||||
atoi
|
||||
fopen
|
||||
memset
|
||||
__ctype_b_loc
|
||||
puts
|
||||
strlen
|
||||
getenv
|
||||
sprintf
|
||||
stdin
|
||||
exit
|
||||
__isoc99_sscanf
|
||||
clock_gettime
|
||||
libc.so.6
|
||||
GLIBC_2.3
|
||||
GLIBC_2.7
|
||||
GLIBC_2.17
|
||||
GLIBC_2.34
|
||||
GLIBC_2.2.5
|
||||
__gmon_start__
|
||||
PTE1
|
||||
2024
|
||||
============================
|
||||
....
|
||||
bomb_
|
||||
.txt
|
||||
bomb_%s.txt
|
||||
....
|
||||
1 2 3 4 5 6
|
||||
......
|
||||
....
|
||||
%08lX
|
||||
%08X
|
||||
....
|
||||
...SOS...
|
||||
%d %d
|
||||
%d %c %d
|
||||
%d %d %d %d %d %d
|
||||
GRADE_BOMB
|
||||
.....
|
||||
:*3$"
|
||||
GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
|
||||
crt1.o
|
||||
__abi_tag
|
||||
crtstuff.c
|
||||
deregister_tm_clones
|
||||
__do_global_dtors_aux
|
||||
completed.0
|
||||
__do_global_dtors_aux_fini_array_entry
|
||||
frame_dummy
|
||||
__frame_dummy_init_array_entry
|
||||
main.c
|
||||
phase_impossible.c
|
||||
phase1.c
|
||||
phase2.c
|
||||
phase3.c
|
||||
phase4.c
|
||||
support.c
|
||||
__FRAME_END__
|
||||
_DYNAMIC
|
||||
__GNU_EH_FRAME_HDR
|
||||
_GLOBAL_OFFSET_TABLE_
|
||||
skip
|
||||
getenv@GLIBC_2.2.5
|
||||
goto_buf_2
|
||||
__libc_start_main@GLIBC_2.34
|
||||
goto_buf_0
|
||||
phase_2_9
|
||||
phase_3_10
|
||||
phase_2_7
|
||||
phase_2_3
|
||||
phase_2_5
|
||||
phase_3_12
|
||||
puts@GLIBC_2.2.5
|
||||
phase_2_1
|
||||
phase_4_21
|
||||
phase_4_23
|
||||
stdin@GLIBC_2.2.5
|
||||
clock_gettime@GLIBC_2.17
|
||||
_edata
|
||||
_fini
|
||||
strlen@GLIBC_2.2.5
|
||||
phase_4_12
|
||||
phase_4_10
|
||||
phase_4_14
|
||||
num_input_strings
|
||||
blank_line
|
||||
rand1_l
|
||||
rand1_h
|
||||
phase_3
|
||||
phase_1
|
||||
memset@GLIBC_2.2.5
|
||||
phase_4_00
|
||||
phase_4_04
|
||||
phase_3_7
|
||||
phase_3_5
|
||||
phase_4_02
|
||||
phase_3_9
|
||||
GetTickCount
|
||||
phase_3_3
|
||||
phase_2_13
|
||||
phase_2_15
|
||||
phase_2_11
|
||||
fgets@GLIBC_2.2.5
|
||||
explode_bomb
|
||||
phase_3_1
|
||||
__data_start
|
||||
strcmp@GLIBC_2.2.5
|
||||
phase_4_30
|
||||
phase_4_34
|
||||
phase_4_32
|
||||
__gmon_start__
|
||||
func4_2
|
||||
func4_0
|
||||
__dso_handle
|
||||
_IO_stdin_used
|
||||
goto_buf_1
|
||||
rand_div
|
||||
result
|
||||
__isoc99_sscanf@GLIBC_2.7
|
||||
phase_2_8
|
||||
phase_2_6
|
||||
phase_3_11
|
||||
phase_2_4
|
||||
phase_3_13
|
||||
_end
|
||||
_dl_relocate_static_pie
|
||||
phase_2_2
|
||||
phase_4_22
|
||||
phase_2_0
|
||||
phase_4_20
|
||||
phase_4_24
|
||||
infile
|
||||
__bss_start
|
||||
check_buf_valid
|
||||
main
|
||||
GenerateRandomString
|
||||
read_line
|
||||
phase_4_13
|
||||
phase_4_11
|
||||
phase_4
|
||||
fopen@GLIBC_2.2.5
|
||||
phase_2
|
||||
atoi@GLIBC_2.2.5
|
||||
phase_impossible
|
||||
sprintf@GLIBC_2.2.5
|
||||
exit@GLIBC_2.2.5
|
||||
phase_3_8
|
||||
phase_4_03
|
||||
__TMC_END__
|
||||
phase_4_01
|
||||
phase_3_6
|
||||
phase_3_2
|
||||
phase_2_14
|
||||
phase_3_4
|
||||
phase_2_10
|
||||
phase_2_12
|
||||
phase_3_0
|
||||
GenerateRandomNumber
|
||||
_init
|
||||
phase_secret
|
||||
read_six_numbers
|
||||
phase_4_33
|
||||
phase_4_31
|
||||
func4_1
|
||||
tohex
|
||||
func4_3
|
||||
__ctype_b_loc@GLIBC_2.3
|
||||
.symtab
|
||||
.strtab
|
||||
.shstrtab
|
||||
.interp
|
||||
.note.gnu.property
|
||||
.note.gnu.build-id
|
||||
.note.ABI-tag
|
||||
.gnu.hash
|
||||
.dynsym
|
||||
.dynstr
|
||||
.gnu.version
|
||||
.gnu.version_r
|
||||
.rela.dyn
|
||||
.rela.plt
|
||||
.init
|
||||
.plt.sec
|
||||
.text
|
||||
.fini
|
||||
.rodata
|
||||
.eh_frame_hdr
|
||||
.eh_frame
|
||||
.init_array
|
||||
.fini_array
|
||||
.dynamic
|
||||
.got
|
||||
.got.plt
|
||||
.data
|
||||
.bss
|
||||
.comment
|
||||
BIN
bomblab/计算机系统-实验2.pptx
Normal file
BIN
bomblab/计算机系统-实验2.pptx
Normal file
Binary file not shown.
30
buflab/Readme.txt
Normal file
30
buflab/Readme.txt
Normal file
@ -0,0 +1,30 @@
|
||||
2017超级缓冲区炸弹
|
||||
|
||||
使用IDA Pro反汇编、调试bufbomb.exe文件。
|
||||
|
||||
你需要首先设置学号
|
||||
然后根据提示,输入一串特定的十六进制字符串,以便对bufbomb实现缓冲区溢出攻击。
|
||||
|
||||
例如:
|
||||
|
||||
2017超级缓冲区炸弹,欢迎你!
|
||||
============================
|
||||
你的通行密码是0X8E371DDA
|
||||
============================
|
||||
请输入攻击字符串(十六进制串):00 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF
|
||||
|
||||
鸟还活着!
|
||||
不错哦,缓冲区溢出成功,而且getbuf返回0X8E371DDA
|
||||
|
||||
恭喜你!你已经成功偷偷运行了第1只木马!
|
||||
通过第1只木马测试
|
||||
|
||||
不错哦!第2只木马运行了,而且通行密码是正确的!(0X8E371DDA)
|
||||
通过第2只木马测试
|
||||
|
||||
厉害!第3只木马运行了,而且你修改了全局变量正确!global_value = 0X8E371DDA
|
||||
通过第3只木马测试
|
||||
|
||||
不错哦,缓冲区溢出成功,而且getbuf返回0X8E371DDA
|
||||
厉害!第4只木马运行了,而且你修改了全局变量正确!global_value = 0X8E371DDA
|
||||
通过第4只木马测试
|
||||
560
buflab/bufbomb.asm
Normal file
560
buflab/bufbomb.asm
Normal file
@ -0,0 +1,560 @@
|
||||
|
||||
bufbomb_linux: 文件格式 elf64-x86-64
|
||||
|
||||
|
||||
Disassembly of section .init:
|
||||
|
||||
0000000000001000 <_init>:
|
||||
1000: f3 0f 1e fa endbr64
|
||||
1004: 48 83 ec 08 sub $0x8,%rsp
|
||||
1008: 48 8b 05 c1 2f 00 00 mov 0x2fc1(%rip),%rax # 3fd0 <__gmon_start__@Base>
|
||||
100f: 48 85 c0 test %rax,%rax
|
||||
1012: 74 02 je 1016 <_init+0x16>
|
||||
1014: ff d0 call *%rax
|
||||
1016: 48 83 c4 08 add $0x8,%rsp
|
||||
101a: c3 ret
|
||||
|
||||
Disassembly of section .plt:
|
||||
|
||||
0000000000001020 <puts@plt-0x10>:
|
||||
1020: ff 35 ca 2f 00 00 push 0x2fca(%rip) # 3ff0 <_GLOBAL_OFFSET_TABLE_+0x8>
|
||||
1026: ff 25 cc 2f 00 00 jmp *0x2fcc(%rip) # 3ff8 <_GLOBAL_OFFSET_TABLE_+0x10>
|
||||
102c: 0f 1f 40 00 nopl 0x0(%rax)
|
||||
|
||||
0000000000001030 <puts@plt>:
|
||||
1030: ff 25 ca 2f 00 00 jmp *0x2fca(%rip) # 4000 <puts@GLIBC_2.2.5>
|
||||
1036: 68 00 00 00 00 push $0x0
|
||||
103b: e9 e0 ff ff ff jmp 1020 <_init+0x20>
|
||||
|
||||
0000000000001040 <__stack_chk_fail@plt>:
|
||||
1040: ff 25 c2 2f 00 00 jmp *0x2fc2(%rip) # 4008 <__stack_chk_fail@GLIBC_2.4>
|
||||
1046: 68 01 00 00 00 push $0x1
|
||||
104b: e9 d0 ff ff ff jmp 1020 <_init+0x20>
|
||||
|
||||
0000000000001050 <printf@plt>:
|
||||
1050: ff 25 ba 2f 00 00 jmp *0x2fba(%rip) # 4010 <printf@GLIBC_2.2.5>
|
||||
1056: 68 02 00 00 00 push $0x2
|
||||
105b: e9 c0 ff ff ff jmp 1020 <_init+0x20>
|
||||
|
||||
0000000000001060 <getchar@plt>:
|
||||
1060: ff 25 b2 2f 00 00 jmp *0x2fb2(%rip) # 4018 <getchar@GLIBC_2.2.5>
|
||||
1066: 68 03 00 00 00 push $0x3
|
||||
106b: e9 b0 ff ff ff jmp 1020 <_init+0x20>
|
||||
|
||||
0000000000001070 <atoi@plt>:
|
||||
1070: ff 25 aa 2f 00 00 jmp *0x2faa(%rip) # 4020 <atoi@GLIBC_2.2.5>
|
||||
1076: 68 04 00 00 00 push $0x4
|
||||
107b: e9 a0 ff ff ff jmp 1020 <_init+0x20>
|
||||
|
||||
0000000000001080 <exit@plt>:
|
||||
1080: ff 25 a2 2f 00 00 jmp *0x2fa2(%rip) # 4028 <exit@GLIBC_2.2.5>
|
||||
1086: 68 05 00 00 00 push $0x5
|
||||
108b: e9 90 ff ff ff jmp 1020 <_init+0x20>
|
||||
|
||||
0000000000001090 <__ctype_b_loc@plt>:
|
||||
1090: ff 25 9a 2f 00 00 jmp *0x2f9a(%rip) # 4030 <__ctype_b_loc@GLIBC_2.3>
|
||||
1096: 68 06 00 00 00 push $0x6
|
||||
109b: e9 80 ff ff ff jmp 1020 <_init+0x20>
|
||||
|
||||
Disassembly of section .text:
|
||||
|
||||
00000000000010a0 <_start>:
|
||||
10a0: f3 0f 1e fa endbr64
|
||||
10a4: 31 ed xor %ebp,%ebp
|
||||
10a6: 49 89 d1 mov %rdx,%r9
|
||||
10a9: 5e pop %rsi
|
||||
10aa: 48 89 e2 mov %rsp,%rdx
|
||||
10ad: 48 83 e4 f0 and $0xfffffffffffffff0,%rsp
|
||||
10b1: 50 push %rax
|
||||
10b2: 54 push %rsp
|
||||
10b3: 45 31 c0 xor %r8d,%r8d
|
||||
10b6: 31 c9 xor %ecx,%ecx
|
||||
10b8: 48 8d 3d 3a 05 00 00 lea 0x53a(%rip),%rdi # 15f9 <main>
|
||||
10bf: ff 15 fb 2e 00 00 call *0x2efb(%rip) # 3fc0 <__libc_start_main@GLIBC_2.34>
|
||||
10c5: f4 hlt
|
||||
10c6: 66 2e 0f 1f 84 00 00 cs nopw 0x0(%rax,%rax,1)
|
||||
10cd: 00 00 00
|
||||
10d0: 48 8d 3d 79 2f 00 00 lea 0x2f79(%rip),%rdi # 4050 <__TMC_END__>
|
||||
10d7: 48 8d 05 72 2f 00 00 lea 0x2f72(%rip),%rax # 4050 <__TMC_END__>
|
||||
10de: 48 39 f8 cmp %rdi,%rax
|
||||
10e1: 74 1d je 1100 <_start+0x60>
|
||||
10e3: 48 8b 05 de 2e 00 00 mov 0x2ede(%rip),%rax # 3fc8 <_ITM_deregisterTMCloneTable@Base>
|
||||
10ea: 48 85 c0 test %rax,%rax
|
||||
10ed: 74 11 je 1100 <_start+0x60>
|
||||
10ef: ff e0 jmp *%rax
|
||||
10f1: 66 66 2e 0f 1f 84 00 data16 cs nopw 0x0(%rax,%rax,1)
|
||||
10f8: 00 00 00 00
|
||||
10fc: 0f 1f 40 00 nopl 0x0(%rax)
|
||||
1100: c3 ret
|
||||
1101: 66 66 2e 0f 1f 84 00 data16 cs nopw 0x0(%rax,%rax,1)
|
||||
1108: 00 00 00 00
|
||||
110c: 0f 1f 40 00 nopl 0x0(%rax)
|
||||
1110: 48 8d 3d 39 2f 00 00 lea 0x2f39(%rip),%rdi # 4050 <__TMC_END__>
|
||||
1117: 48 8d 35 32 2f 00 00 lea 0x2f32(%rip),%rsi # 4050 <__TMC_END__>
|
||||
111e: 48 29 fe sub %rdi,%rsi
|
||||
1121: 48 89 f0 mov %rsi,%rax
|
||||
1124: 48 c1 f8 03 sar $0x3,%rax
|
||||
1128: 48 c1 ee 3f shr $0x3f,%rsi
|
||||
112c: 48 01 c6 add %rax,%rsi
|
||||
112f: 48 d1 fe sar $1,%rsi
|
||||
1132: 74 1c je 1150 <_start+0xb0>
|
||||
1134: 48 8b 05 9d 2e 00 00 mov 0x2e9d(%rip),%rax # 3fd8 <_ITM_registerTMCloneTable@Base>
|
||||
113b: 48 85 c0 test %rax,%rax
|
||||
113e: 74 10 je 1150 <_start+0xb0>
|
||||
1140: ff e0 jmp *%rax
|
||||
1142: 66 66 2e 0f 1f 84 00 data16 cs nopw 0x0(%rax,%rax,1)
|
||||
1149: 00 00 00 00
|
||||
114d: 0f 1f 00 nopl (%rax)
|
||||
1150: c3 ret
|
||||
1151: 66 66 2e 0f 1f 84 00 data16 cs nopw 0x0(%rax,%rax,1)
|
||||
1158: 00 00 00 00
|
||||
115c: 0f 1f 40 00 nopl 0x0(%rax)
|
||||
1160: f3 0f 1e fa endbr64
|
||||
1164: 80 3d e5 2e 00 00 00 cmpb $0x0,0x2ee5(%rip) # 4050 <__TMC_END__>
|
||||
116b: 75 33 jne 11a0 <_start+0x100>
|
||||
116d: 48 83 3d 6b 2e 00 00 cmpq $0x0,0x2e6b(%rip) # 3fe0 <__cxa_finalize@GLIBC_2.2.5>
|
||||
1174: 00
|
||||
1175: 55 push %rbp
|
||||
1176: 48 89 e5 mov %rsp,%rbp
|
||||
1179: 74 0d je 1188 <_start+0xe8>
|
||||
117b: 48 8b 3d be 2e 00 00 mov 0x2ebe(%rip),%rdi # 4040 <__dso_handle>
|
||||
1182: ff 15 58 2e 00 00 call *0x2e58(%rip) # 3fe0 <__cxa_finalize@GLIBC_2.2.5>
|
||||
1188: e8 43 ff ff ff call 10d0 <_start+0x30>
|
||||
118d: 5d pop %rbp
|
||||
118e: c6 05 bb 2e 00 00 01 movb $0x1,0x2ebb(%rip) # 4050 <__TMC_END__>
|
||||
1195: c3 ret
|
||||
1196: 66 2e 0f 1f 84 00 00 cs nopw 0x0(%rax,%rax,1)
|
||||
119d: 00 00 00
|
||||
11a0: c3 ret
|
||||
11a1: 66 66 2e 0f 1f 84 00 data16 cs nopw 0x0(%rax,%rax,1)
|
||||
11a8: 00 00 00 00
|
||||
11ac: 0f 1f 40 00 nopl 0x0(%rax)
|
||||
11b0: f3 0f 1e fa endbr64
|
||||
11b4: e9 57 ff ff ff jmp 1110 <_start+0x70>
|
||||
|
||||
00000000000011b9 <GenerateRandomNumber>:
|
||||
11b9: 55 push %rbp
|
||||
11ba: 48 89 e5 mov %rsp,%rbp
|
||||
11bd: 48 89 7d e8 mov %rdi,-0x18(%rbp)
|
||||
11c1: 48 8b 05 90 2e 00 00 mov 0x2e90(%rip),%rax # 4058 <rand1_h>
|
||||
11c8: 48 89 45 f8 mov %rax,-0x8(%rbp)
|
||||
11cc: 48 8b 45 f8 mov -0x8(%rbp),%rax
|
||||
11d0: 48 69 c0 c5 90 c6 6a imul $0x6ac690c5,%rax,%rax
|
||||
11d7: 48 89 45 f8 mov %rax,-0x8(%rbp)
|
||||
11db: 48 8b 55 f8 mov -0x8(%rbp),%rdx
|
||||
11df: 48 8b 05 7a 2e 00 00 mov 0x2e7a(%rip),%rax # 4060 <rand1_l>
|
||||
11e6: 48 01 d0 add %rdx,%rax
|
||||
11e9: 48 89 45 f8 mov %rax,-0x8(%rbp)
|
||||
11ed: 48 8b 45 f8 mov -0x8(%rbp),%rax
|
||||
11f1: 48 89 05 60 2e 00 00 mov %rax,0x2e60(%rip) # 4058 <rand1_h>
|
||||
11f8: 48 8b 45 f8 mov -0x8(%rbp),%rax
|
||||
11fc: 48 c1 f8 20 sar $0x20,%rax
|
||||
1200: 48 89 05 59 2e 00 00 mov %rax,0x2e59(%rip) # 4060 <rand1_l>
|
||||
1207: 48 83 7d e8 00 cmpq $0x0,-0x18(%rbp)
|
||||
120c: 74 1c je 122a <GenerateRandomNumber+0x71>
|
||||
120e: 48 8b 05 43 2e 00 00 mov 0x2e43(%rip),%rax # 4058 <rand1_h>
|
||||
1215: ba 00 00 00 00 mov $0x0,%edx
|
||||
121a: 48 f7 75 e8 divq -0x18(%rbp)
|
||||
121e: 48 89 d0 mov %rdx,%rax
|
||||
1221: 48 89 05 40 2e 00 00 mov %rax,0x2e40(%rip) # 4068 <rand_div>
|
||||
1228: eb 01 jmp 122b <GenerateRandomNumber+0x72>
|
||||
122a: 90 nop
|
||||
122b: 5d pop %rbp
|
||||
122c: c3 ret
|
||||
|
||||
000000000000122d <getxs>:
|
||||
122d: 55 push %rbp
|
||||
122e: 48 89 e5 mov %rsp,%rbp
|
||||
1231: 48 83 ec 30 sub $0x30,%rsp
|
||||
1235: 48 89 7d d8 mov %rdi,-0x28(%rbp)
|
||||
1239: c7 45 e8 01 00 00 00 movl $0x1,-0x18(%rbp)
|
||||
1240: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%rbp)
|
||||
1247: 48 8b 45 d8 mov -0x28(%rbp),%rax
|
||||
124b: 48 89 45 f8 mov %rax,-0x8(%rbp)
|
||||
124f: e9 94 00 00 00 jmp 12e8 <getxs+0xbb>
|
||||
1254: e8 37 fe ff ff call 1090 <__ctype_b_loc@plt>
|
||||
1259: 48 8b 00 mov (%rax),%rax
|
||||
125c: 8b 55 f4 mov -0xc(%rbp),%edx
|
||||
125f: 48 63 d2 movslq %edx,%rdx
|
||||
1262: 48 01 d2 add %rdx,%rdx
|
||||
1265: 48 01 d0 add %rdx,%rax
|
||||
1268: 0f b7 00 movzwl (%rax),%eax
|
||||
126b: 0f b7 c0 movzwl %ax,%eax
|
||||
126e: 25 00 10 00 00 and $0x1000,%eax
|
||||
1273: 85 c0 test %eax,%eax
|
||||
1275: 74 71 je 12e8 <getxs+0xbb>
|
||||
1277: 83 7d f4 2f cmpl $0x2f,-0xc(%rbp)
|
||||
127b: 7e 11 jle 128e <getxs+0x61>
|
||||
127d: 83 7d f4 39 cmpl $0x39,-0xc(%rbp)
|
||||
1281: 7f 0b jg 128e <getxs+0x61>
|
||||
1283: 8b 45 f4 mov -0xc(%rbp),%eax
|
||||
1286: 83 e8 30 sub $0x30,%eax
|
||||
1289: 89 45 f0 mov %eax,-0x10(%rbp)
|
||||
128c: eb 20 jmp 12ae <getxs+0x81>
|
||||
128e: 83 7d f4 40 cmpl $0x40,-0xc(%rbp)
|
||||
1292: 7e 11 jle 12a5 <getxs+0x78>
|
||||
1294: 83 7d f4 46 cmpl $0x46,-0xc(%rbp)
|
||||
1298: 7f 0b jg 12a5 <getxs+0x78>
|
||||
129a: 8b 45 f4 mov -0xc(%rbp),%eax
|
||||
129d: 83 e8 37 sub $0x37,%eax
|
||||
12a0: 89 45 f0 mov %eax,-0x10(%rbp)
|
||||
12a3: eb 09 jmp 12ae <getxs+0x81>
|
||||
12a5: 8b 45 f4 mov -0xc(%rbp),%eax
|
||||
12a8: 83 e8 57 sub $0x57,%eax
|
||||
12ab: 89 45 f0 mov %eax,-0x10(%rbp)
|
||||
12ae: 83 7d e8 00 cmpl $0x0,-0x18(%rbp)
|
||||
12b2: 74 0f je 12c3 <getxs+0x96>
|
||||
12b4: 8b 45 f0 mov -0x10(%rbp),%eax
|
||||
12b7: 89 45 ec mov %eax,-0x14(%rbp)
|
||||
12ba: c7 45 e8 00 00 00 00 movl $0x0,-0x18(%rbp)
|
||||
12c1: eb 25 jmp 12e8 <getxs+0xbb>
|
||||
12c3: 8b 45 ec mov -0x14(%rbp),%eax
|
||||
12c6: c1 e0 04 shl $0x4,%eax
|
||||
12c9: 89 c2 mov %eax,%edx
|
||||
12cb: 8b 45 f0 mov -0x10(%rbp),%eax
|
||||
12ce: 8d 0c 02 lea (%rdx,%rax,1),%ecx
|
||||
12d1: 48 8b 45 f8 mov -0x8(%rbp),%rax
|
||||
12d5: 48 8d 50 01 lea 0x1(%rax),%rdx
|
||||
12d9: 48 89 55 f8 mov %rdx,-0x8(%rbp)
|
||||
12dd: 89 ca mov %ecx,%edx
|
||||
12df: 88 10 mov %dl,(%rax)
|
||||
12e1: c7 45 e8 01 00 00 00 movl $0x1,-0x18(%rbp)
|
||||
12e8: e8 73 fd ff ff call 1060 <getchar@plt>
|
||||
12ed: 89 45 f4 mov %eax,-0xc(%rbp)
|
||||
12f0: 83 7d f4 ff cmpl $0xffffffff,-0xc(%rbp)
|
||||
12f4: 74 10 je 1306 <getxs+0xd9>
|
||||
12f6: 83 7d f4 0a cmpl $0xa,-0xc(%rbp)
|
||||
12fa: 74 0a je 1306 <getxs+0xd9>
|
||||
12fc: 83 7d f4 0d cmpl $0xd,-0xc(%rbp)
|
||||
1300: 0f 85 4e ff ff ff jne 1254 <getxs+0x27>
|
||||
1306: 48 8b 45 f8 mov -0x8(%rbp),%rax
|
||||
130a: 48 8d 50 01 lea 0x1(%rax),%rdx
|
||||
130e: 48 89 55 f8 mov %rdx,-0x8(%rbp)
|
||||
1312: c6 00 00 movb $0x0,(%rax)
|
||||
1315: 48 8b 45 d8 mov -0x28(%rbp),%rax
|
||||
1319: c9 leave
|
||||
131a: c3 ret
|
||||
|
||||
000000000000131b <getbuf>:
|
||||
131b: 55 push %rbp
|
||||
131c: 48 89 e5 mov %rsp,%rbp
|
||||
131f: 48 83 ec 20 sub $0x20,%rsp
|
||||
1323: 64 48 8b 04 25 28 00 mov %fs:0x28,%rax
|
||||
132a: 00 00
|
||||
132c: 48 89 45 f8 mov %rax,-0x8(%rbp)
|
||||
1330: 31 c0 xor %eax,%eax
|
||||
1332: 48 8d 45 ec lea -0x14(%rbp),%rax
|
||||
1336: 48 89 c7 mov %rax,%rdi
|
||||
1339: e8 ef fe ff ff call 122d <getxs>
|
||||
133e: b8 01 00 00 00 mov $0x1,%eax
|
||||
1343: 48 8b 55 f8 mov -0x8(%rbp),%rdx
|
||||
1347: 64 48 2b 14 25 28 00 sub %fs:0x28,%rdx
|
||||
134e: 00 00
|
||||
1350: 74 05 je 1357 <getbuf+0x3c>
|
||||
1352: e8 e9 fc ff ff call 1040 <__stack_chk_fail@plt>
|
||||
1357: c9 leave
|
||||
1358: c3 ret
|
||||
|
||||
0000000000001359 <test>:
|
||||
1359: 55 push %rbp
|
||||
135a: 48 89 e5 mov %rsp,%rbp
|
||||
135d: 48 83 ec 20 sub $0x20,%rsp
|
||||
1361: 64 48 8b 04 25 28 00 mov %fs:0x28,%rax
|
||||
1368: 00 00
|
||||
136a: 48 89 45 f8 mov %rax,-0x8(%rbp)
|
||||
136e: 31 c0 xor %eax,%eax
|
||||
1370: c7 45 e8 ef be ad de movl $0xdeadbeef,-0x18(%rbp)
|
||||
1377: bf 17 00 00 00 mov $0x17,%edi
|
||||
137c: e8 38 fe ff ff call 11b9 <GenerateRandomNumber>
|
||||
1381: 48 8b 05 e0 2c 00 00 mov 0x2ce0(%rip),%rax # 4068 <rand_div>
|
||||
1388: 48 83 c0 01 add $0x1,%rax
|
||||
138c: 48 8d 50 08 lea 0x8(%rax),%rdx
|
||||
1390: b8 10 00 00 00 mov $0x10,%eax
|
||||
1395: 48 83 e8 01 sub $0x1,%rax
|
||||
1399: 48 01 d0 add %rdx,%rax
|
||||
139c: b9 10 00 00 00 mov $0x10,%ecx
|
||||
13a1: ba 00 00 00 00 mov $0x0,%edx
|
||||
13a6: 48 f7 f1 div %rcx
|
||||
13a9: 48 6b c0 10 imul $0x10,%rax,%rax
|
||||
13ad: 48 29 c4 sub %rax,%rsp
|
||||
13b0: 48 89 e0 mov %rsp,%rax
|
||||
13b3: 48 83 c0 0f add $0xf,%rax
|
||||
13b7: 48 c1 e8 04 shr $0x4,%rax
|
||||
13bb: 48 c1 e0 04 shl $0x4,%rax
|
||||
13bf: 48 89 45 f0 mov %rax,-0x10(%rbp)
|
||||
13c3: 48 8b 45 f0 mov -0x10(%rbp),%rax
|
||||
13c7: c6 00 6c movb $0x6c,(%rax)
|
||||
13ca: e8 4c ff ff ff call 131b <getbuf>
|
||||
13cf: 89 45 ec mov %eax,-0x14(%rbp)
|
||||
13d2: 8b 45 e8 mov -0x18(%rbp),%eax
|
||||
13d5: 3d ef be ad de cmp $0xdeadbeef,%eax
|
||||
13da: 75 11 jne 13ed <test+0x94>
|
||||
13dc: 48 8d 05 25 0c 00 00 lea 0xc25(%rip),%rax # 2008 <_IO_stdin_used+0x8>
|
||||
13e3: 48 89 c7 mov %rax,%rdi
|
||||
13e6: e8 45 fc ff ff call 1030 <puts@plt>
|
||||
13eb: eb 0f jmp 13fc <test+0xa3>
|
||||
13ed: 48 8d 05 24 0c 00 00 lea 0xc24(%rip),%rax # 2018 <_IO_stdin_used+0x18>
|
||||
13f4: 48 89 c7 mov %rax,%rdi
|
||||
13f7: e8 34 fc ff ff call 1030 <puts@plt>
|
||||
13fc: 8b 05 46 2c 00 00 mov 0x2c46(%rip),%eax # 4048 <cookie>
|
||||
1402: 39 45 ec cmp %eax,-0x14(%rbp)
|
||||
1405: 75 1b jne 1422 <test+0xc9>
|
||||
1407: 8b 45 ec mov -0x14(%rbp),%eax
|
||||
140a: 89 c6 mov %eax,%esi
|
||||
140c: 48 8d 05 3d 0c 00 00 lea 0xc3d(%rip),%rax # 2050 <_IO_stdin_used+0x50>
|
||||
1413: 48 89 c7 mov %rax,%rdi
|
||||
1416: b8 00 00 00 00 mov $0x0,%eax
|
||||
141b: e8 30 fc ff ff call 1050 <printf@plt>
|
||||
1420: eb 30 jmp 1452 <test+0xf9>
|
||||
1422: 83 7d ec 01 cmpl $0x1,-0x14(%rbp)
|
||||
1426: 75 11 jne 1439 <test+0xe0>
|
||||
1428: 48 8d 05 61 0c 00 00 lea 0xc61(%rip),%rax # 2090 <_IO_stdin_used+0x90>
|
||||
142f: 48 89 c7 mov %rax,%rdi
|
||||
1432: e8 f9 fb ff ff call 1030 <puts@plt>
|
||||
1437: eb 19 jmp 1452 <test+0xf9>
|
||||
1439: 8b 45 ec mov -0x14(%rbp),%eax
|
||||
143c: 89 c6 mov %eax,%esi
|
||||
143e: 48 8d 05 83 0c 00 00 lea 0xc83(%rip),%rax # 20c8 <_IO_stdin_used+0xc8>
|
||||
1445: 48 89 c7 mov %rax,%rdi
|
||||
1448: b8 00 00 00 00 mov $0x0,%eax
|
||||
144d: e8 fe fb ff ff call 1050 <printf@plt>
|
||||
1452: 90 nop
|
||||
1453: 48 8b 45 f8 mov -0x8(%rbp),%rax
|
||||
1457: 64 48 2b 04 25 28 00 sub %fs:0x28,%rax
|
||||
145e: 00 00
|
||||
1460: 74 05 je 1467 <test+0x10e>
|
||||
1462: e8 d9 fb ff ff call 1040 <__stack_chk_fail@plt>
|
||||
1467: c9 leave
|
||||
1468: c3 ret
|
||||
|
||||
0000000000001469 <Trojan1>:
|
||||
1469: 55 push %rbp
|
||||
146a: 48 89 e5 mov %rsp,%rbp
|
||||
146d: 48 8d 05 9c 0c 00 00 lea 0xc9c(%rip),%rax # 2110 <_IO_stdin_used+0x110>
|
||||
1474: 48 89 c7 mov %rax,%rdi
|
||||
1477: e8 b4 fb ff ff call 1030 <puts@plt>
|
||||
147c: 48 8d 05 c6 0c 00 00 lea 0xcc6(%rip),%rax # 2149 <_IO_stdin_used+0x149>
|
||||
1483: 48 89 c7 mov %rax,%rdi
|
||||
1486: e8 a5 fb ff ff call 1030 <puts@plt>
|
||||
148b: bf 00 00 00 00 mov $0x0,%edi
|
||||
1490: e8 eb fb ff ff call 1080 <exit@plt>
|
||||
|
||||
0000000000001495 <Trojan2>:
|
||||
1495: 55 push %rbp
|
||||
1496: 48 89 e5 mov %rsp,%rbp
|
||||
1499: 48 83 ec 10 sub $0x10,%rsp
|
||||
149d: 89 7d fc mov %edi,-0x4(%rbp)
|
||||
14a0: 8b 05 a2 2b 00 00 mov 0x2ba2(%rip),%eax # 4048 <cookie>
|
||||
14a6: 39 45 fc cmp %eax,-0x4(%rbp)
|
||||
14a9: 75 1b jne 14c6 <Trojan2+0x31>
|
||||
14ab: 8b 45 fc mov -0x4(%rbp),%eax
|
||||
14ae: 89 c6 mov %eax,%esi
|
||||
14b0: 48 8d 05 b1 0c 00 00 lea 0xcb1(%rip),%rax # 2168 <_IO_stdin_used+0x168>
|
||||
14b7: 48 89 c7 mov %rax,%rdi
|
||||
14ba: b8 00 00 00 00 mov $0x0,%eax
|
||||
14bf: e8 8c fb ff ff call 1050 <printf@plt>
|
||||
14c4: eb 19 jmp 14df <Trojan2+0x4a>
|
||||
14c6: 8b 45 fc mov -0x4(%rbp),%eax
|
||||
14c9: 89 c6 mov %eax,%esi
|
||||
14cb: 48 8d 05 e6 0c 00 00 lea 0xce6(%rip),%rax # 21b8 <_IO_stdin_used+0x1b8>
|
||||
14d2: 48 89 c7 mov %rax,%rdi
|
||||
14d5: b8 00 00 00 00 mov $0x0,%eax
|
||||
14da: e8 71 fb ff ff call 1050 <printf@plt>
|
||||
14df: 8b 05 63 2b 00 00 mov 0x2b63(%rip),%eax # 4048 <cookie>
|
||||
14e5: 39 45 fc cmp %eax,-0x4(%rbp)
|
||||
14e8: 75 0f jne 14f9 <Trojan2+0x64>
|
||||
14ea: 48 8d 05 23 0d 00 00 lea 0xd23(%rip),%rax # 2214 <_IO_stdin_used+0x214>
|
||||
14f1: 48 89 c7 mov %rax,%rdi
|
||||
14f4: e8 37 fb ff ff call 1030 <puts@plt>
|
||||
14f9: bf 00 00 00 00 mov $0x0,%edi
|
||||
14fe: e8 7d fb ff ff call 1080 <exit@plt>
|
||||
|
||||
0000000000001503 <Trojan3>:
|
||||
1503: 55 push %rbp
|
||||
1504: 48 89 e5 mov %rsp,%rbp
|
||||
1507: 48 83 ec 10 sub $0x10,%rsp
|
||||
150b: 89 7d fc mov %edi,-0x4(%rbp)
|
||||
150e: 8b 15 5c 2b 00 00 mov 0x2b5c(%rip),%edx # 4070 <global_value>
|
||||
1514: 8b 05 2e 2b 00 00 mov 0x2b2e(%rip),%eax # 4048 <cookie>
|
||||
151a: 39 c2 cmp %eax,%edx
|
||||
151c: 75 1e jne 153c <Trojan3+0x39>
|
||||
151e: 8b 05 4c 2b 00 00 mov 0x2b4c(%rip),%eax # 4070 <global_value>
|
||||
1524: 89 c6 mov %eax,%esi
|
||||
1526: 48 8d 05 03 0d 00 00 lea 0xd03(%rip),%rax # 2230 <_IO_stdin_used+0x230>
|
||||
152d: 48 89 c7 mov %rax,%rdi
|
||||
1530: b8 00 00 00 00 mov $0x0,%eax
|
||||
1535: e8 16 fb ff ff call 1050 <printf@plt>
|
||||
153a: eb 1c jmp 1558 <Trojan3+0x55>
|
||||
153c: 8b 05 2e 2b 00 00 mov 0x2b2e(%rip),%eax # 4070 <global_value>
|
||||
1542: 89 c6 mov %eax,%esi
|
||||
1544: 48 8d 05 45 0d 00 00 lea 0xd45(%rip),%rax # 2290 <_IO_stdin_used+0x290>
|
||||
154b: 48 89 c7 mov %rax,%rdi
|
||||
154e: b8 00 00 00 00 mov $0x0,%eax
|
||||
1553: e8 f8 fa ff ff call 1050 <printf@plt>
|
||||
1558: 8b 15 12 2b 00 00 mov 0x2b12(%rip),%edx # 4070 <global_value>
|
||||
155e: 8b 05 e4 2a 00 00 mov 0x2ae4(%rip),%eax # 4048 <cookie>
|
||||
1564: 39 c2 cmp %eax,%edx
|
||||
1566: 75 0f jne 1577 <Trojan3+0x74>
|
||||
1568: 48 8d 05 7e 0d 00 00 lea 0xd7e(%rip),%rax # 22ed <_IO_stdin_used+0x2ed>
|
||||
156f: 48 89 c7 mov %rax,%rdi
|
||||
1572: e8 b9 fa ff ff call 1030 <puts@plt>
|
||||
1577: bf 00 00 00 00 mov $0x0,%edi
|
||||
157c: e8 ff fa ff ff call 1080 <exit@plt>
|
||||
|
||||
0000000000001581 <Trojan4>:
|
||||
1581: 55 push %rbp
|
||||
1582: 48 89 e5 mov %rsp,%rbp
|
||||
1585: 48 83 ec 10 sub $0x10,%rsp
|
||||
1589: 89 7d fc mov %edi,-0x4(%rbp)
|
||||
158c: 8b 15 de 2a 00 00 mov 0x2ade(%rip),%edx # 4070 <global_value>
|
||||
1592: 8b 05 b0 2a 00 00 mov 0x2ab0(%rip),%eax # 4048 <cookie>
|
||||
1598: 39 c2 cmp %eax,%edx
|
||||
159a: 75 1e jne 15ba <Trojan4+0x39>
|
||||
159c: 8b 05 ce 2a 00 00 mov 0x2ace(%rip),%eax # 4070 <global_value>
|
||||
15a2: 89 c6 mov %eax,%esi
|
||||
15a4: 48 8d 05 5d 0d 00 00 lea 0xd5d(%rip),%rax # 2308 <_IO_stdin_used+0x308>
|
||||
15ab: 48 89 c7 mov %rax,%rdi
|
||||
15ae: b8 00 00 00 00 mov $0x0,%eax
|
||||
15b3: e8 98 fa ff ff call 1050 <printf@plt>
|
||||
15b8: eb 1c jmp 15d6 <Trojan4+0x55>
|
||||
15ba: 8b 05 b0 2a 00 00 mov 0x2ab0(%rip),%eax # 4070 <global_value>
|
||||
15c0: 89 c6 mov %eax,%esi
|
||||
15c2: 48 8d 05 9f 0d 00 00 lea 0xd9f(%rip),%rax # 2368 <_IO_stdin_used+0x368>
|
||||
15c9: 48 89 c7 mov %rax,%rdi
|
||||
15cc: b8 00 00 00 00 mov $0x0,%eax
|
||||
15d1: e8 7a fa ff ff call 1050 <printf@plt>
|
||||
15d6: 8b 15 94 2a 00 00 mov 0x2a94(%rip),%edx # 4070 <global_value>
|
||||
15dc: 8b 05 66 2a 00 00 mov 0x2a66(%rip),%eax # 4048 <cookie>
|
||||
15e2: 39 c2 cmp %eax,%edx
|
||||
15e4: 75 10 jne 15f6 <Trojan4+0x75>
|
||||
15e6: 48 8d 05 d2 0d 00 00 lea 0xdd2(%rip),%rax # 23bf <_IO_stdin_used+0x3bf>
|
||||
15ed: 48 89 c7 mov %rax,%rdi
|
||||
15f0: e8 3b fa ff ff call 1030 <puts@plt>
|
||||
15f5: 90 nop
|
||||
15f6: 90 nop
|
||||
15f7: c9 leave
|
||||
15f8: c3 ret
|
||||
|
||||
00000000000015f9 <main>:
|
||||
15f9: 55 push %rbp
|
||||
15fa: 48 89 e5 mov %rsp,%rbp
|
||||
15fd: 48 83 ec 30 sub $0x30,%rsp
|
||||
1601: 89 7d dc mov %edi,-0x24(%rbp)
|
||||
1604: 48 89 75 d0 mov %rsi,-0x30(%rbp)
|
||||
1608: 64 48 8b 04 25 28 00 mov %fs:0x28,%rax
|
||||
160f: 00 00
|
||||
1611: 48 89 45 f8 mov %rax,-0x8(%rbp)
|
||||
1615: 31 c0 xor %eax,%eax
|
||||
1617: 48 8d 05 c2 0d 00 00 lea 0xdc2(%rip),%rax # 23e0 <_IO_stdin_used+0x3e0>
|
||||
161e: 48 89 c7 mov %rax,%rdi
|
||||
1621: e8 0a fa ff ff call 1030 <puts@plt>
|
||||
1626: 48 8d 05 dd 0d 00 00 lea 0xddd(%rip),%rax # 240a <_IO_stdin_used+0x40a>
|
||||
162d: 48 89 c7 mov %rax,%rdi
|
||||
1630: e8 fb f9 ff ff call 1030 <puts@plt>
|
||||
1635: 83 7d dc 01 cmpl $0x1,-0x24(%rbp)
|
||||
1639: 75 46 jne 1681 <main+0x88>
|
||||
163b: 48 8b 45 d0 mov -0x30(%rbp),%rax
|
||||
163f: 48 8b 00 mov (%rax),%rax
|
||||
1642: 48 89 c6 mov %rax,%rsi
|
||||
1645: 48 8d 05 dc 0d 00 00 lea 0xddc(%rip),%rax # 2428 <_IO_stdin_used+0x428>
|
||||
164c: 48 89 c7 mov %rax,%rdi
|
||||
164f: b8 00 00 00 00 mov $0x0,%eax
|
||||
1654: e8 f7 f9 ff ff call 1050 <printf@plt>
|
||||
1659: 48 8d 05 10 0e 00 00 lea 0xe10(%rip),%rax # 2470 <_IO_stdin_used+0x470>
|
||||
1660: 48 89 c7 mov %rax,%rdi
|
||||
1663: e8 c8 f9 ff ff call 1030 <puts@plt>
|
||||
1668: 48 8d 05 59 0e 00 00 lea 0xe59(%rip),%rax # 24c8 <_IO_stdin_used+0x4c8>
|
||||
166f: 48 89 c7 mov %rax,%rdi
|
||||
1672: e8 b9 f9 ff ff call 1030 <puts@plt>
|
||||
1677: b8 00 00 00 00 mov $0x0,%eax
|
||||
167c: e9 43 01 00 00 jmp 17c4 <main+0x1cb>
|
||||
1681: 48 8b 45 d0 mov -0x30(%rbp),%rax
|
||||
1685: 48 83 c0 08 add $0x8,%rax
|
||||
1689: 48 8b 00 mov (%rax),%rax
|
||||
168c: 48 89 c6 mov %rax,%rsi
|
||||
168f: 48 8d 05 7a 0e 00 00 lea 0xe7a(%rip),%rax # 2510 <_IO_stdin_used+0x510>
|
||||
1696: 48 89 c7 mov %rax,%rdi
|
||||
1699: b8 00 00 00 00 mov $0x0,%eax
|
||||
169e: e8 ad f9 ff ff call 1050 <printf@plt>
|
||||
16a3: 48 8b 45 d0 mov -0x30(%rbp),%rax
|
||||
16a7: 48 83 c0 08 add $0x8,%rax
|
||||
16ab: 48 8b 00 mov (%rax),%rax
|
||||
16ae: 48 89 c7 mov %rax,%rdi
|
||||
16b1: e8 ba f9 ff ff call 1070 <atoi@plt>
|
||||
16b6: 48 98 cltq
|
||||
16b8: 48 89 05 99 29 00 00 mov %rax,0x2999(%rip) # 4058 <rand1_h>
|
||||
16bf: 48 c7 05 96 29 00 00 movq $0x29a,0x2996(%rip) # 4060 <rand1_l>
|
||||
16c6: 9a 02 00 00
|
||||
16ca: bf 00 00 00 00 mov $0x0,%edi
|
||||
16cf: e8 e5 fa ff ff call 11b9 <GenerateRandomNumber>
|
||||
16d4: c7 45 ec 02 00 00 00 movl $0x2,-0x14(%rbp)
|
||||
16db: eb 36 jmp 1713 <main+0x11a>
|
||||
16dd: 8b 45 ec mov -0x14(%rbp),%eax
|
||||
16e0: 48 98 cltq
|
||||
16e2: 48 8d 14 c5 00 00 00 lea 0x0(,%rax,8),%rdx
|
||||
16e9: 00
|
||||
16ea: 48 8b 45 d0 mov -0x30(%rbp),%rax
|
||||
16ee: 48 01 d0 add %rdx,%rax
|
||||
16f1: 48 8b 00 mov (%rax),%rax
|
||||
16f4: 48 89 c7 mov %rax,%rdi
|
||||
16f7: e8 74 f9 ff ff call 1070 <atoi@plt>
|
||||
16fc: 48 98 cltq
|
||||
16fe: 48 89 05 5b 29 00 00 mov %rax,0x295b(%rip) # 4060 <rand1_l>
|
||||
1705: bf 00 00 00 00 mov $0x0,%edi
|
||||
170a: e8 aa fa ff ff call 11b9 <GenerateRandomNumber>
|
||||
170f: 83 45 ec 01 addl $0x1,-0x14(%rbp)
|
||||
1713: 8b 45 ec mov -0x14(%rbp),%eax
|
||||
1716: 3b 45 dc cmp -0x24(%rbp),%eax
|
||||
1719: 7c c2 jl 16dd <main+0xe4>
|
||||
171b: 48 8b 05 36 29 00 00 mov 0x2936(%rip),%rax # 4058 <rand1_h>
|
||||
1722: 89 05 20 29 00 00 mov %eax,0x2920(%rip) # 4048 <cookie>
|
||||
1728: 8b 05 1a 29 00 00 mov 0x291a(%rip),%eax # 4048 <cookie>
|
||||
172e: 89 c6 mov %eax,%esi
|
||||
1730: 48 8d 05 f7 0d 00 00 lea 0xdf7(%rip),%rax # 252e <_IO_stdin_used+0x52e>
|
||||
1737: 48 89 c7 mov %rax,%rdi
|
||||
173a: b8 00 00 00 00 mov $0x0,%eax
|
||||
173f: e8 0c f9 ff ff call 1050 <printf@plt>
|
||||
1744: 48 8d 05 bf 0c 00 00 lea 0xcbf(%rip),%rax # 240a <_IO_stdin_used+0x40a>
|
||||
174b: 48 89 c7 mov %rax,%rdi
|
||||
174e: e8 dd f8 ff ff call 1030 <puts@plt>
|
||||
1753: 48 8d 05 f6 0d 00 00 lea 0xdf6(%rip),%rax # 2550 <_IO_stdin_used+0x550>
|
||||
175a: 48 89 c7 mov %rax,%rdi
|
||||
175d: b8 00 00 00 00 mov $0x0,%eax
|
||||
1762: e8 e9 f8 ff ff call 1050 <printf@plt>
|
||||
1767: bf 00 02 00 00 mov $0x200,%edi
|
||||
176c: e8 48 fa ff ff call 11b9 <GenerateRandomNumber>
|
||||
1771: 48 8b 05 f0 28 00 00 mov 0x28f0(%rip),%rax # 4068 <rand_div>
|
||||
1778: 48 83 c0 01 add $0x1,%rax
|
||||
177c: 48 8d 50 08 lea 0x8(%rax),%rdx
|
||||
1780: b8 10 00 00 00 mov $0x10,%eax
|
||||
1785: 48 83 e8 01 sub $0x1,%rax
|
||||
1789: 48 01 d0 add %rdx,%rax
|
||||
178c: b9 10 00 00 00 mov $0x10,%ecx
|
||||
1791: ba 00 00 00 00 mov $0x0,%edx
|
||||
1796: 48 f7 f1 div %rcx
|
||||
1799: 48 6b c0 10 imul $0x10,%rax,%rax
|
||||
179d: 48 29 c4 sub %rax,%rsp
|
||||
17a0: 48 89 e0 mov %rsp,%rax
|
||||
17a3: 48 83 c0 0f add $0xf,%rax
|
||||
17a7: 48 c1 e8 04 shr $0x4,%rax
|
||||
17ab: 48 c1 e0 04 shl $0x4,%rax
|
||||
17af: 48 89 45 f0 mov %rax,-0x10(%rbp)
|
||||
17b3: 48 8b 45 f0 mov -0x10(%rbp),%rax
|
||||
17b7: c6 00 68 movb $0x68,(%rax)
|
||||
17ba: e8 9a fb ff ff call 1359 <test>
|
||||
17bf: b8 00 00 00 00 mov $0x0,%eax
|
||||
17c4: 48 8b 55 f8 mov -0x8(%rbp),%rdx
|
||||
17c8: 64 48 2b 14 25 28 00 sub %fs:0x28,%rdx
|
||||
17cf: 00 00
|
||||
17d1: 74 05 je 17d8 <main+0x1df>
|
||||
17d3: e8 68 f8 ff ff call 1040 <__stack_chk_fail@plt>
|
||||
17d8: c9 leave
|
||||
17d9: c3 ret
|
||||
|
||||
Disassembly of section .fini:
|
||||
|
||||
00000000000017dc <_fini>:
|
||||
17dc: f3 0f 1e fa endbr64
|
||||
17e0: 48 83 ec 08 sub $0x8,%rsp
|
||||
17e4: 48 83 c4 08 add $0x8,%rsp
|
||||
17e8: c3 ret
|
||||
200
buflab/bufbomb.c
Normal file
200
buflab/bufbomb.c
Normal file
@ -0,0 +1,200 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#ifdef __linux__
|
||||
#define _alloca alloca
|
||||
#endif
|
||||
|
||||
int getbuf(void);
|
||||
void test(void);
|
||||
|
||||
int cookie=0x11223344;
|
||||
unsigned long rand1_h,rand1_l,rand_div;
|
||||
|
||||
/* 产生一个0~divv-1之间的随机数,同时更新随机数种子 */
|
||||
void GenerateRandomNumber(unsigned long divv)
|
||||
{
|
||||
long long x = rand1_h;
|
||||
x *= 0x6AC690C5;
|
||||
x += rand1_l;
|
||||
|
||||
rand1_h = (unsigned long)x;
|
||||
rand1_l = (unsigned long)(x>>32);
|
||||
if (divv==0) return;
|
||||
|
||||
rand_div = rand1_h % divv;
|
||||
}
|
||||
|
||||
/* 输入16进制字符串,并转换为对应的字符串,以\0结束 */
|
||||
char*getxs(char*dest)
|
||||
{
|
||||
int c;
|
||||
int even =1; /* Have read even number of digits */
|
||||
int otherd =0; /* Other hex digit of pair */
|
||||
char*sp = dest;
|
||||
while ((c = getchar()) != EOF && c !='\n' && c != '\r') {
|
||||
if (isxdigit(c)) {
|
||||
int val;
|
||||
if ('0'<= c && c <='9')
|
||||
val = c -'0';
|
||||
else if ('A'<= c && c <='F')
|
||||
val = c -'A'+10;
|
||||
else
|
||||
val = c -'a'+10;
|
||||
if (even) {
|
||||
otherd = val;
|
||||
even =0;
|
||||
}
|
||||
else {
|
||||
*sp++= otherd *16+ val;
|
||||
even =1;
|
||||
}
|
||||
}
|
||||
}
|
||||
*sp++='\0';
|
||||
return dest;
|
||||
}
|
||||
|
||||
/* 获取一行输入字符串 */
|
||||
int getbuf(void)
|
||||
{
|
||||
char buf[12];
|
||||
getxs(buf);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* 主测试程序 */
|
||||
void test(void)
|
||||
{
|
||||
int val;
|
||||
char *localbuf;
|
||||
volatile int bird = 0xdeadbeef; //金丝雀保护机制
|
||||
GenerateRandomNumber(23);
|
||||
localbuf = (char *)_alloca(rand_div+1); //在栈上分配随机空间
|
||||
localbuf[0] = 'l';
|
||||
|
||||
val = getbuf();
|
||||
/* 检测是否栈被破坏 */
|
||||
if (bird == 0xdeadbeef) {
|
||||
printf("鸟还活着!\n");
|
||||
}
|
||||
else
|
||||
printf("不妙!鸟被杀死,栈已经被你破坏了!\n");
|
||||
|
||||
if (val == cookie) {
|
||||
printf("不错哦,缓冲区溢出成功,而且getbuf返回 0X%08X\n", val);
|
||||
}
|
||||
else if (val == 1) {
|
||||
printf("缓冲区没有溢出.....攻击失败,请重来吧\n");
|
||||
}
|
||||
else {
|
||||
printf("不对哦,虽然缓冲区溢出成功,但是getbuf返回 0X%08X\n", val);
|
||||
}
|
||||
}
|
||||
|
||||
/* 第1只木马,只需要修改返回地址,即可进入 */
|
||||
void Trojan1(void)
|
||||
{
|
||||
printf("恭喜你!你已经成功偷偷运行了第1只木马!\n");
|
||||
printf("通过第1只木马测试\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
/* 第2只木马,不仅需要修改返回地址,而且要修改栈中返回的结果 */
|
||||
void Trojan2(int val)
|
||||
{
|
||||
if (val == cookie) {
|
||||
printf("不错哦!第2只木马运行了,而且通行密码是正确的!(0X%08X)\n", val);
|
||||
} else
|
||||
printf("需要加油!虽然第2只木马运行了,但是通行密码是不正确的!(0X%08X)\n", val);
|
||||
if (val == cookie)
|
||||
printf("通过第2只木马测试\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
/* 第3只木马,本关任务是构造特定的机器代码放置在栈内,然后将返回地址置为该段特定代码的入口。此段代码负责将global_value设置为想要的cookie值 */
|
||||
/* 汇编指令程序:
|
||||
MOV EAX,cookie
|
||||
MOV global_val,EAX
|
||||
PUSH Trojan3
|
||||
RET
|
||||
|
||||
0: a1 e4 c1 04 08 MOV EAX,0x804c1e4
|
||||
5: a3 ec c1 04 08 MOV 0x804c1ec,EAX
|
||||
a: 68 eb 8c 04 08 PUSH $0x8048ceb
|
||||
f: c3 RET
|
||||
*/
|
||||
int global_value = 0;
|
||||
void Trojan3(int val)
|
||||
{
|
||||
if (global_value == cookie) {
|
||||
printf("厉害!第3只木马运行了,而且你修改了全局变量正确!global_value = 0X%08X\n", global_value);
|
||||
} else
|
||||
printf("差一点!第3只木马运行了,但是全局变量修改错误!global_value = 0X%08X\n", global_value);
|
||||
if (global_value == cookie)
|
||||
printf("通过第3只木马测试\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
/* 第4只木马,本关任务是构造特定的机器代码放置在栈内,然后将返回地址置为该段特定代码的入口。此段代码负责将global_value设置为想要的cookie值,需要正常返回 */
|
||||
/* 汇编指令程序:
|
||||
MOV EAX,cookie
|
||||
MOV global_val,EAX
|
||||
PUSH Trojan3
|
||||
RET
|
||||
|
||||
0: a1 e4 c1 04 08 MOV EAX,0x804c1e4
|
||||
5: a3 ec c1 04 08 MOV 0x804c1ec,EAX
|
||||
a: 68 eb 8c 04 08 PUSH $0x8048ceb
|
||||
f: c3 RET
|
||||
*/
|
||||
void Trojan4(int val)
|
||||
{
|
||||
if (global_value == cookie) {
|
||||
printf("厉害!第4只木马运行了,而且你修改了全局变量正确!global_value = 0X%08X\n", global_value);
|
||||
} else
|
||||
printf("差一点!第4只木马运行了,但是全局变量不对!global_value = 0X%08X\n", global_value);
|
||||
if (global_value == cookie)
|
||||
printf("通过第4只木马测试\n");
|
||||
return; // 正常返回,需要修复栈
|
||||
}
|
||||
|
||||
/* 主程序,依据学号,随机生成cookie值 */
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int i;
|
||||
char *MyRandomBuffer;
|
||||
printf("\t2018超级缓冲区炸弹,欢迎你!\n");
|
||||
printf("============================\n");
|
||||
|
||||
if (argc == 1)
|
||||
{
|
||||
printf("使用方法:%s 学号后6位 [学号后6位] [学号后6位] ...\n",argv[0]);
|
||||
printf("你需要输入攻击字符串,以便种入木马,一旦出错,哇哈哈....\n");
|
||||
printf("请以十六进制形式输入攻击字符串,例如00 aa bb cc等等\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
printf("欢迎你前来挑战! %s \n",argv[1]);
|
||||
/*依据学号,初始化一个随机数发生器*/
|
||||
rand1_h = (unsigned long)atoi(argv[1]);
|
||||
rand1_l=0x29A;
|
||||
GenerateRandomNumber(0);
|
||||
for (i=2;i<argc;i++)
|
||||
{
|
||||
rand1_l = (unsigned long)atoi(argv[i]);
|
||||
GenerateRandomNumber(0);
|
||||
}
|
||||
|
||||
cookie = (int)rand1_h;
|
||||
printf("你的通行密码是0X%08X\n",cookie);
|
||||
printf("============================\n");
|
||||
printf("请输入攻击字符串(十六进制串):");
|
||||
GenerateRandomNumber(512);
|
||||
MyRandomBuffer = (char *)_alloca(rand_div+1); //在栈上分配随机空间
|
||||
MyRandomBuffer[0] = 'h';
|
||||
test();
|
||||
|
||||
return 0;
|
||||
}
|
||||
BIN
buflab/bufbomb.exe
Normal file
BIN
buflab/bufbomb.exe
Normal file
Binary file not shown.
560
buflab/bufbomb.txt
Normal file
560
buflab/bufbomb.txt
Normal file
@ -0,0 +1,560 @@
|
||||
|
||||
bufbomb_linux: 文件格式 elf64-x86-64
|
||||
|
||||
|
||||
Disassembly of section .init:
|
||||
|
||||
0000000000001000 <_init>:
|
||||
1000: f3 0f 1e fa endbr64
|
||||
1004: 48 83 ec 08 sub $0x8,%rsp
|
||||
1008: 48 8b 05 c1 2f 00 00 mov 0x2fc1(%rip),%rax # 3fd0 <__gmon_start__@Base>
|
||||
100f: 48 85 c0 test %rax,%rax
|
||||
1012: 74 02 je 1016 <_init+0x16>
|
||||
1014: ff d0 call *%rax
|
||||
1016: 48 83 c4 08 add $0x8,%rsp
|
||||
101a: c3 ret
|
||||
|
||||
Disassembly of section .plt:
|
||||
|
||||
0000000000001020 <puts@plt-0x10>:
|
||||
1020: ff 35 ca 2f 00 00 push 0x2fca(%rip) # 3ff0 <_GLOBAL_OFFSET_TABLE_+0x8>
|
||||
1026: ff 25 cc 2f 00 00 jmp *0x2fcc(%rip) # 3ff8 <_GLOBAL_OFFSET_TABLE_+0x10>
|
||||
102c: 0f 1f 40 00 nopl 0x0(%rax)
|
||||
|
||||
0000000000001030 <puts@plt>:
|
||||
1030: ff 25 ca 2f 00 00 jmp *0x2fca(%rip) # 4000 <puts@GLIBC_2.2.5>
|
||||
1036: 68 00 00 00 00 push $0x0
|
||||
103b: e9 e0 ff ff ff jmp 1020 <_init+0x20>
|
||||
|
||||
0000000000001040 <__stack_chk_fail@plt>:
|
||||
1040: ff 25 c2 2f 00 00 jmp *0x2fc2(%rip) # 4008 <__stack_chk_fail@GLIBC_2.4>
|
||||
1046: 68 01 00 00 00 push $0x1
|
||||
104b: e9 d0 ff ff ff jmp 1020 <_init+0x20>
|
||||
|
||||
0000000000001050 <printf@plt>:
|
||||
1050: ff 25 ba 2f 00 00 jmp *0x2fba(%rip) # 4010 <printf@GLIBC_2.2.5>
|
||||
1056: 68 02 00 00 00 push $0x2
|
||||
105b: e9 c0 ff ff ff jmp 1020 <_init+0x20>
|
||||
|
||||
0000000000001060 <getchar@plt>:
|
||||
1060: ff 25 b2 2f 00 00 jmp *0x2fb2(%rip) # 4018 <getchar@GLIBC_2.2.5>
|
||||
1066: 68 03 00 00 00 push $0x3
|
||||
106b: e9 b0 ff ff ff jmp 1020 <_init+0x20>
|
||||
|
||||
0000000000001070 <atoi@plt>:
|
||||
1070: ff 25 aa 2f 00 00 jmp *0x2faa(%rip) # 4020 <atoi@GLIBC_2.2.5>
|
||||
1076: 68 04 00 00 00 push $0x4
|
||||
107b: e9 a0 ff ff ff jmp 1020 <_init+0x20>
|
||||
|
||||
0000000000001080 <exit@plt>:
|
||||
1080: ff 25 a2 2f 00 00 jmp *0x2fa2(%rip) # 4028 <exit@GLIBC_2.2.5>
|
||||
1086: 68 05 00 00 00 push $0x5
|
||||
108b: e9 90 ff ff ff jmp 1020 <_init+0x20>
|
||||
|
||||
0000000000001090 <__ctype_b_loc@plt>:
|
||||
1090: ff 25 9a 2f 00 00 jmp *0x2f9a(%rip) # 4030 <__ctype_b_loc@GLIBC_2.3>
|
||||
1096: 68 06 00 00 00 push $0x6
|
||||
109b: e9 80 ff ff ff jmp 1020 <_init+0x20>
|
||||
|
||||
Disassembly of section .text:
|
||||
|
||||
00000000000010a0 <_start>:
|
||||
10a0: f3 0f 1e fa endbr64
|
||||
10a4: 31 ed xor %ebp,%ebp
|
||||
10a6: 49 89 d1 mov %rdx,%r9
|
||||
10a9: 5e pop %rsi
|
||||
10aa: 48 89 e2 mov %rsp,%rdx
|
||||
10ad: 48 83 e4 f0 and $0xfffffffffffffff0,%rsp
|
||||
10b1: 50 push %rax
|
||||
10b2: 54 push %rsp
|
||||
10b3: 45 31 c0 xor %r8d,%r8d
|
||||
10b6: 31 c9 xor %ecx,%ecx
|
||||
10b8: 48 8d 3d 3a 05 00 00 lea 0x53a(%rip),%rdi # 15f9 <main>
|
||||
10bf: ff 15 fb 2e 00 00 call *0x2efb(%rip) # 3fc0 <__libc_start_main@GLIBC_2.34>
|
||||
10c5: f4 hlt
|
||||
10c6: 66 2e 0f 1f 84 00 00 cs nopw 0x0(%rax,%rax,1)
|
||||
10cd: 00 00 00
|
||||
10d0: 48 8d 3d 79 2f 00 00 lea 0x2f79(%rip),%rdi # 4050 <__TMC_END__>
|
||||
10d7: 48 8d 05 72 2f 00 00 lea 0x2f72(%rip),%rax # 4050 <__TMC_END__>
|
||||
10de: 48 39 f8 cmp %rdi,%rax
|
||||
10e1: 74 1d je 1100 <_start+0x60>
|
||||
10e3: 48 8b 05 de 2e 00 00 mov 0x2ede(%rip),%rax # 3fc8 <_ITM_deregisterTMCloneTable@Base>
|
||||
10ea: 48 85 c0 test %rax,%rax
|
||||
10ed: 74 11 je 1100 <_start+0x60>
|
||||
10ef: ff e0 jmp *%rax
|
||||
10f1: 66 66 2e 0f 1f 84 00 data16 cs nopw 0x0(%rax,%rax,1)
|
||||
10f8: 00 00 00 00
|
||||
10fc: 0f 1f 40 00 nopl 0x0(%rax)
|
||||
1100: c3 ret
|
||||
1101: 66 66 2e 0f 1f 84 00 data16 cs nopw 0x0(%rax,%rax,1)
|
||||
1108: 00 00 00 00
|
||||
110c: 0f 1f 40 00 nopl 0x0(%rax)
|
||||
1110: 48 8d 3d 39 2f 00 00 lea 0x2f39(%rip),%rdi # 4050 <__TMC_END__>
|
||||
1117: 48 8d 35 32 2f 00 00 lea 0x2f32(%rip),%rsi # 4050 <__TMC_END__>
|
||||
111e: 48 29 fe sub %rdi,%rsi
|
||||
1121: 48 89 f0 mov %rsi,%rax
|
||||
1124: 48 c1 f8 03 sar $0x3,%rax
|
||||
1128: 48 c1 ee 3f shr $0x3f,%rsi
|
||||
112c: 48 01 c6 add %rax,%rsi
|
||||
112f: 48 d1 fe sar $1,%rsi
|
||||
1132: 74 1c je 1150 <_start+0xb0>
|
||||
1134: 48 8b 05 9d 2e 00 00 mov 0x2e9d(%rip),%rax # 3fd8 <_ITM_registerTMCloneTable@Base>
|
||||
113b: 48 85 c0 test %rax,%rax
|
||||
113e: 74 10 je 1150 <_start+0xb0>
|
||||
1140: ff e0 jmp *%rax
|
||||
1142: 66 66 2e 0f 1f 84 00 data16 cs nopw 0x0(%rax,%rax,1)
|
||||
1149: 00 00 00 00
|
||||
114d: 0f 1f 00 nopl (%rax)
|
||||
1150: c3 ret
|
||||
1151: 66 66 2e 0f 1f 84 00 data16 cs nopw 0x0(%rax,%rax,1)
|
||||
1158: 00 00 00 00
|
||||
115c: 0f 1f 40 00 nopl 0x0(%rax)
|
||||
1160: f3 0f 1e fa endbr64
|
||||
1164: 80 3d e5 2e 00 00 00 cmpb $0x0,0x2ee5(%rip) # 4050 <__TMC_END__>
|
||||
116b: 75 33 jne 11a0 <_start+0x100>
|
||||
116d: 48 83 3d 6b 2e 00 00 cmpq $0x0,0x2e6b(%rip) # 3fe0 <__cxa_finalize@GLIBC_2.2.5>
|
||||
1174: 00
|
||||
1175: 55 push %rbp
|
||||
1176: 48 89 e5 mov %rsp,%rbp
|
||||
1179: 74 0d je 1188 <_start+0xe8>
|
||||
117b: 48 8b 3d be 2e 00 00 mov 0x2ebe(%rip),%rdi # 4040 <__dso_handle>
|
||||
1182: ff 15 58 2e 00 00 call *0x2e58(%rip) # 3fe0 <__cxa_finalize@GLIBC_2.2.5>
|
||||
1188: e8 43 ff ff ff call 10d0 <_start+0x30>
|
||||
118d: 5d pop %rbp
|
||||
118e: c6 05 bb 2e 00 00 01 movb $0x1,0x2ebb(%rip) # 4050 <__TMC_END__>
|
||||
1195: c3 ret
|
||||
1196: 66 2e 0f 1f 84 00 00 cs nopw 0x0(%rax,%rax,1)
|
||||
119d: 00 00 00
|
||||
11a0: c3 ret
|
||||
11a1: 66 66 2e 0f 1f 84 00 data16 cs nopw 0x0(%rax,%rax,1)
|
||||
11a8: 00 00 00 00
|
||||
11ac: 0f 1f 40 00 nopl 0x0(%rax)
|
||||
11b0: f3 0f 1e fa endbr64
|
||||
11b4: e9 57 ff ff ff jmp 1110 <_start+0x70>
|
||||
|
||||
00000000000011b9 <GenerateRandomNumber>:
|
||||
11b9: 55 push %rbp
|
||||
11ba: 48 89 e5 mov %rsp,%rbp
|
||||
11bd: 48 89 7d e8 mov %rdi,-0x18(%rbp)
|
||||
11c1: 48 8b 05 90 2e 00 00 mov 0x2e90(%rip),%rax # 4058 <rand1_h>
|
||||
11c8: 48 89 45 f8 mov %rax,-0x8(%rbp)
|
||||
11cc: 48 8b 45 f8 mov -0x8(%rbp),%rax
|
||||
11d0: 48 69 c0 c5 90 c6 6a imul $0x6ac690c5,%rax,%rax
|
||||
11d7: 48 89 45 f8 mov %rax,-0x8(%rbp)
|
||||
11db: 48 8b 55 f8 mov -0x8(%rbp),%rdx
|
||||
11df: 48 8b 05 7a 2e 00 00 mov 0x2e7a(%rip),%rax # 4060 <rand1_l>
|
||||
11e6: 48 01 d0 add %rdx,%rax
|
||||
11e9: 48 89 45 f8 mov %rax,-0x8(%rbp)
|
||||
11ed: 48 8b 45 f8 mov -0x8(%rbp),%rax
|
||||
11f1: 48 89 05 60 2e 00 00 mov %rax,0x2e60(%rip) # 4058 <rand1_h>
|
||||
11f8: 48 8b 45 f8 mov -0x8(%rbp),%rax
|
||||
11fc: 48 c1 f8 20 sar $0x20,%rax
|
||||
1200: 48 89 05 59 2e 00 00 mov %rax,0x2e59(%rip) # 4060 <rand1_l>
|
||||
1207: 48 83 7d e8 00 cmpq $0x0,-0x18(%rbp)
|
||||
120c: 74 1c je 122a <GenerateRandomNumber+0x71>
|
||||
120e: 48 8b 05 43 2e 00 00 mov 0x2e43(%rip),%rax # 4058 <rand1_h>
|
||||
1215: ba 00 00 00 00 mov $0x0,%edx
|
||||
121a: 48 f7 75 e8 divq -0x18(%rbp)
|
||||
121e: 48 89 d0 mov %rdx,%rax
|
||||
1221: 48 89 05 40 2e 00 00 mov %rax,0x2e40(%rip) # 4068 <rand_div>
|
||||
1228: eb 01 jmp 122b <GenerateRandomNumber+0x72>
|
||||
122a: 90 nop
|
||||
122b: 5d pop %rbp
|
||||
122c: c3 ret
|
||||
|
||||
000000000000122d <getxs>:
|
||||
122d: 55 push %rbp
|
||||
122e: 48 89 e5 mov %rsp,%rbp
|
||||
1231: 48 83 ec 30 sub $0x30,%rsp
|
||||
1235: 48 89 7d d8 mov %rdi,-0x28(%rbp)
|
||||
1239: c7 45 e8 01 00 00 00 movl $0x1,-0x18(%rbp)
|
||||
1240: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%rbp)
|
||||
1247: 48 8b 45 d8 mov -0x28(%rbp),%rax
|
||||
124b: 48 89 45 f8 mov %rax,-0x8(%rbp)
|
||||
124f: e9 94 00 00 00 jmp 12e8 <getxs+0xbb>
|
||||
1254: e8 37 fe ff ff call 1090 <__ctype_b_loc@plt>
|
||||
1259: 48 8b 00 mov (%rax),%rax
|
||||
125c: 8b 55 f4 mov -0xc(%rbp),%edx
|
||||
125f: 48 63 d2 movslq %edx,%rdx
|
||||
1262: 48 01 d2 add %rdx,%rdx
|
||||
1265: 48 01 d0 add %rdx,%rax
|
||||
1268: 0f b7 00 movzwl (%rax),%eax
|
||||
126b: 0f b7 c0 movzwl %ax,%eax
|
||||
126e: 25 00 10 00 00 and $0x1000,%eax
|
||||
1273: 85 c0 test %eax,%eax
|
||||
1275: 74 71 je 12e8 <getxs+0xbb>
|
||||
1277: 83 7d f4 2f cmpl $0x2f,-0xc(%rbp)
|
||||
127b: 7e 11 jle 128e <getxs+0x61>
|
||||
127d: 83 7d f4 39 cmpl $0x39,-0xc(%rbp)
|
||||
1281: 7f 0b jg 128e <getxs+0x61>
|
||||
1283: 8b 45 f4 mov -0xc(%rbp),%eax
|
||||
1286: 83 e8 30 sub $0x30,%eax
|
||||
1289: 89 45 f0 mov %eax,-0x10(%rbp)
|
||||
128c: eb 20 jmp 12ae <getxs+0x81>
|
||||
128e: 83 7d f4 40 cmpl $0x40,-0xc(%rbp)
|
||||
1292: 7e 11 jle 12a5 <getxs+0x78>
|
||||
1294: 83 7d f4 46 cmpl $0x46,-0xc(%rbp)
|
||||
1298: 7f 0b jg 12a5 <getxs+0x78>
|
||||
129a: 8b 45 f4 mov -0xc(%rbp),%eax
|
||||
129d: 83 e8 37 sub $0x37,%eax
|
||||
12a0: 89 45 f0 mov %eax,-0x10(%rbp)
|
||||
12a3: eb 09 jmp 12ae <getxs+0x81>
|
||||
12a5: 8b 45 f4 mov -0xc(%rbp),%eax
|
||||
12a8: 83 e8 57 sub $0x57,%eax
|
||||
12ab: 89 45 f0 mov %eax,-0x10(%rbp)
|
||||
12ae: 83 7d e8 00 cmpl $0x0,-0x18(%rbp)
|
||||
12b2: 74 0f je 12c3 <getxs+0x96>
|
||||
12b4: 8b 45 f0 mov -0x10(%rbp),%eax
|
||||
12b7: 89 45 ec mov %eax,-0x14(%rbp)
|
||||
12ba: c7 45 e8 00 00 00 00 movl $0x0,-0x18(%rbp)
|
||||
12c1: eb 25 jmp 12e8 <getxs+0xbb>
|
||||
12c3: 8b 45 ec mov -0x14(%rbp),%eax
|
||||
12c6: c1 e0 04 shl $0x4,%eax
|
||||
12c9: 89 c2 mov %eax,%edx
|
||||
12cb: 8b 45 f0 mov -0x10(%rbp),%eax
|
||||
12ce: 8d 0c 02 lea (%rdx,%rax,1),%ecx
|
||||
12d1: 48 8b 45 f8 mov -0x8(%rbp),%rax
|
||||
12d5: 48 8d 50 01 lea 0x1(%rax),%rdx
|
||||
12d9: 48 89 55 f8 mov %rdx,-0x8(%rbp)
|
||||
12dd: 89 ca mov %ecx,%edx
|
||||
12df: 88 10 mov %dl,(%rax)
|
||||
12e1: c7 45 e8 01 00 00 00 movl $0x1,-0x18(%rbp)
|
||||
12e8: e8 73 fd ff ff call 1060 <getchar@plt>
|
||||
12ed: 89 45 f4 mov %eax,-0xc(%rbp)
|
||||
12f0: 83 7d f4 ff cmpl $0xffffffff,-0xc(%rbp)
|
||||
12f4: 74 10 je 1306 <getxs+0xd9>
|
||||
12f6: 83 7d f4 0a cmpl $0xa,-0xc(%rbp)
|
||||
12fa: 74 0a je 1306 <getxs+0xd9>
|
||||
12fc: 83 7d f4 0d cmpl $0xd,-0xc(%rbp)
|
||||
1300: 0f 85 4e ff ff ff jne 1254 <getxs+0x27>
|
||||
1306: 48 8b 45 f8 mov -0x8(%rbp),%rax
|
||||
130a: 48 8d 50 01 lea 0x1(%rax),%rdx
|
||||
130e: 48 89 55 f8 mov %rdx,-0x8(%rbp)
|
||||
1312: c6 00 00 movb $0x0,(%rax)
|
||||
1315: 48 8b 45 d8 mov -0x28(%rbp),%rax
|
||||
1319: c9 leave
|
||||
131a: c3 ret
|
||||
|
||||
000000000000131b <getbuf>:
|
||||
131b: 55 push %rbp
|
||||
131c: 48 89 e5 mov %rsp,%rbp
|
||||
131f: 48 83 ec 20 sub $0x20,%rsp
|
||||
1323: 64 48 8b 04 25 28 00 mov %fs:0x28,%rax
|
||||
132a: 00 00
|
||||
132c: 48 89 45 f8 mov %rax,-0x8(%rbp)
|
||||
1330: 31 c0 xor %eax,%eax
|
||||
1332: 48 8d 45 ec lea -0x14(%rbp),%rax
|
||||
1336: 48 89 c7 mov %rax,%rdi
|
||||
1339: e8 ef fe ff ff call 122d <getxs>
|
||||
133e: b8 01 00 00 00 mov $0x1,%eax
|
||||
1343: 48 8b 55 f8 mov -0x8(%rbp),%rdx
|
||||
1347: 64 48 2b 14 25 28 00 sub %fs:0x28,%rdx
|
||||
134e: 00 00
|
||||
1350: 74 05 je 1357 <getbuf+0x3c>
|
||||
1352: e8 e9 fc ff ff call 1040 <__stack_chk_fail@plt>
|
||||
1357: c9 leave
|
||||
1358: c3 ret
|
||||
|
||||
0000000000001359 <test>:
|
||||
1359: 55 push %rbp
|
||||
135a: 48 89 e5 mov %rsp,%rbp
|
||||
135d: 48 83 ec 20 sub $0x20,%rsp
|
||||
1361: 64 48 8b 04 25 28 00 mov %fs:0x28,%rax
|
||||
1368: 00 00
|
||||
136a: 48 89 45 f8 mov %rax,-0x8(%rbp)
|
||||
136e: 31 c0 xor %eax,%eax
|
||||
1370: c7 45 e8 ef be ad de movl $0xdeadbeef,-0x18(%rbp)
|
||||
1377: bf 17 00 00 00 mov $0x17,%edi
|
||||
137c: e8 38 fe ff ff call 11b9 <GenerateRandomNumber>
|
||||
1381: 48 8b 05 e0 2c 00 00 mov 0x2ce0(%rip),%rax # 4068 <rand_div>
|
||||
1388: 48 83 c0 01 add $0x1,%rax
|
||||
138c: 48 8d 50 08 lea 0x8(%rax),%rdx
|
||||
1390: b8 10 00 00 00 mov $0x10,%eax
|
||||
1395: 48 83 e8 01 sub $0x1,%rax
|
||||
1399: 48 01 d0 add %rdx,%rax
|
||||
139c: b9 10 00 00 00 mov $0x10,%ecx
|
||||
13a1: ba 00 00 00 00 mov $0x0,%edx
|
||||
13a6: 48 f7 f1 div %rcx
|
||||
13a9: 48 6b c0 10 imul $0x10,%rax,%rax
|
||||
13ad: 48 29 c4 sub %rax,%rsp
|
||||
13b0: 48 89 e0 mov %rsp,%rax
|
||||
13b3: 48 83 c0 0f add $0xf,%rax
|
||||
13b7: 48 c1 e8 04 shr $0x4,%rax
|
||||
13bb: 48 c1 e0 04 shl $0x4,%rax
|
||||
13bf: 48 89 45 f0 mov %rax,-0x10(%rbp)
|
||||
13c3: 48 8b 45 f0 mov -0x10(%rbp),%rax
|
||||
13c7: c6 00 6c movb $0x6c,(%rax)
|
||||
13ca: e8 4c ff ff ff call 131b <getbuf>
|
||||
13cf: 89 45 ec mov %eax,-0x14(%rbp)
|
||||
13d2: 8b 45 e8 mov -0x18(%rbp),%eax
|
||||
13d5: 3d ef be ad de cmp $0xdeadbeef,%eax
|
||||
13da: 75 11 jne 13ed <test+0x94>
|
||||
13dc: 48 8d 05 25 0c 00 00 lea 0xc25(%rip),%rax # 2008 <_IO_stdin_used+0x8>
|
||||
13e3: 48 89 c7 mov %rax,%rdi
|
||||
13e6: e8 45 fc ff ff call 1030 <puts@plt>
|
||||
13eb: eb 0f jmp 13fc <test+0xa3>
|
||||
13ed: 48 8d 05 24 0c 00 00 lea 0xc24(%rip),%rax # 2018 <_IO_stdin_used+0x18>
|
||||
13f4: 48 89 c7 mov %rax,%rdi
|
||||
13f7: e8 34 fc ff ff call 1030 <puts@plt>
|
||||
13fc: 8b 05 46 2c 00 00 mov 0x2c46(%rip),%eax # 4048 <cookie>
|
||||
1402: 39 45 ec cmp %eax,-0x14(%rbp)
|
||||
1405: 75 1b jne 1422 <test+0xc9>
|
||||
1407: 8b 45 ec mov -0x14(%rbp),%eax
|
||||
140a: 89 c6 mov %eax,%esi
|
||||
140c: 48 8d 05 3d 0c 00 00 lea 0xc3d(%rip),%rax # 2050 <_IO_stdin_used+0x50>
|
||||
1413: 48 89 c7 mov %rax,%rdi
|
||||
1416: b8 00 00 00 00 mov $0x0,%eax
|
||||
141b: e8 30 fc ff ff call 1050 <printf@plt>
|
||||
1420: eb 30 jmp 1452 <test+0xf9>
|
||||
1422: 83 7d ec 01 cmpl $0x1,-0x14(%rbp)
|
||||
1426: 75 11 jne 1439 <test+0xe0>
|
||||
1428: 48 8d 05 61 0c 00 00 lea 0xc61(%rip),%rax # 2090 <_IO_stdin_used+0x90>
|
||||
142f: 48 89 c7 mov %rax,%rdi
|
||||
1432: e8 f9 fb ff ff call 1030 <puts@plt>
|
||||
1437: eb 19 jmp 1452 <test+0xf9>
|
||||
1439: 8b 45 ec mov -0x14(%rbp),%eax
|
||||
143c: 89 c6 mov %eax,%esi
|
||||
143e: 48 8d 05 83 0c 00 00 lea 0xc83(%rip),%rax # 20c8 <_IO_stdin_used+0xc8>
|
||||
1445: 48 89 c7 mov %rax,%rdi
|
||||
1448: b8 00 00 00 00 mov $0x0,%eax
|
||||
144d: e8 fe fb ff ff call 1050 <printf@plt>
|
||||
1452: 90 nop
|
||||
1453: 48 8b 45 f8 mov -0x8(%rbp),%rax
|
||||
1457: 64 48 2b 04 25 28 00 sub %fs:0x28,%rax
|
||||
145e: 00 00
|
||||
1460: 74 05 je 1467 <test+0x10e>
|
||||
1462: e8 d9 fb ff ff call 1040 <__stack_chk_fail@plt>
|
||||
1467: c9 leave
|
||||
1468: c3 ret
|
||||
|
||||
0000000000001469 <Trojan1>:
|
||||
1469: 55 push %rbp
|
||||
146a: 48 89 e5 mov %rsp,%rbp
|
||||
146d: 48 8d 05 9c 0c 00 00 lea 0xc9c(%rip),%rax # 2110 <_IO_stdin_used+0x110>
|
||||
1474: 48 89 c7 mov %rax,%rdi
|
||||
1477: e8 b4 fb ff ff call 1030 <puts@plt>
|
||||
147c: 48 8d 05 c6 0c 00 00 lea 0xcc6(%rip),%rax # 2149 <_IO_stdin_used+0x149>
|
||||
1483: 48 89 c7 mov %rax,%rdi
|
||||
1486: e8 a5 fb ff ff call 1030 <puts@plt>
|
||||
148b: bf 00 00 00 00 mov $0x0,%edi
|
||||
1490: e8 eb fb ff ff call 1080 <exit@plt>
|
||||
|
||||
0000000000001495 <Trojan2>:
|
||||
1495: 55 push %rbp
|
||||
1496: 48 89 e5 mov %rsp,%rbp
|
||||
1499: 48 83 ec 10 sub $0x10,%rsp
|
||||
149d: 89 7d fc mov %edi,-0x4(%rbp)
|
||||
14a0: 8b 05 a2 2b 00 00 mov 0x2ba2(%rip),%eax # 4048 <cookie>
|
||||
14a6: 39 45 fc cmp %eax,-0x4(%rbp)
|
||||
14a9: 75 1b jne 14c6 <Trojan2+0x31>
|
||||
14ab: 8b 45 fc mov -0x4(%rbp),%eax
|
||||
14ae: 89 c6 mov %eax,%esi
|
||||
14b0: 48 8d 05 b1 0c 00 00 lea 0xcb1(%rip),%rax # 2168 <_IO_stdin_used+0x168>
|
||||
14b7: 48 89 c7 mov %rax,%rdi
|
||||
14ba: b8 00 00 00 00 mov $0x0,%eax
|
||||
14bf: e8 8c fb ff ff call 1050 <printf@plt>
|
||||
14c4: eb 19 jmp 14df <Trojan2+0x4a>
|
||||
14c6: 8b 45 fc mov -0x4(%rbp),%eax
|
||||
14c9: 89 c6 mov %eax,%esi
|
||||
14cb: 48 8d 05 e6 0c 00 00 lea 0xce6(%rip),%rax # 21b8 <_IO_stdin_used+0x1b8>
|
||||
14d2: 48 89 c7 mov %rax,%rdi
|
||||
14d5: b8 00 00 00 00 mov $0x0,%eax
|
||||
14da: e8 71 fb ff ff call 1050 <printf@plt>
|
||||
14df: 8b 05 63 2b 00 00 mov 0x2b63(%rip),%eax # 4048 <cookie>
|
||||
14e5: 39 45 fc cmp %eax,-0x4(%rbp)
|
||||
14e8: 75 0f jne 14f9 <Trojan2+0x64>
|
||||
14ea: 48 8d 05 23 0d 00 00 lea 0xd23(%rip),%rax # 2214 <_IO_stdin_used+0x214>
|
||||
14f1: 48 89 c7 mov %rax,%rdi
|
||||
14f4: e8 37 fb ff ff call 1030 <puts@plt>
|
||||
14f9: bf 00 00 00 00 mov $0x0,%edi
|
||||
14fe: e8 7d fb ff ff call 1080 <exit@plt>
|
||||
|
||||
0000000000001503 <Trojan3>:
|
||||
1503: 55 push %rbp
|
||||
1504: 48 89 e5 mov %rsp,%rbp
|
||||
1507: 48 83 ec 10 sub $0x10,%rsp
|
||||
150b: 89 7d fc mov %edi,-0x4(%rbp)
|
||||
150e: 8b 15 5c 2b 00 00 mov 0x2b5c(%rip),%edx # 4070 <global_value>
|
||||
1514: 8b 05 2e 2b 00 00 mov 0x2b2e(%rip),%eax # 4048 <cookie>
|
||||
151a: 39 c2 cmp %eax,%edx
|
||||
151c: 75 1e jne 153c <Trojan3+0x39>
|
||||
151e: 8b 05 4c 2b 00 00 mov 0x2b4c(%rip),%eax # 4070 <global_value>
|
||||
1524: 89 c6 mov %eax,%esi
|
||||
1526: 48 8d 05 03 0d 00 00 lea 0xd03(%rip),%rax # 2230 <_IO_stdin_used+0x230>
|
||||
152d: 48 89 c7 mov %rax,%rdi
|
||||
1530: b8 00 00 00 00 mov $0x0,%eax
|
||||
1535: e8 16 fb ff ff call 1050 <printf@plt>
|
||||
153a: eb 1c jmp 1558 <Trojan3+0x55>
|
||||
153c: 8b 05 2e 2b 00 00 mov 0x2b2e(%rip),%eax # 4070 <global_value>
|
||||
1542: 89 c6 mov %eax,%esi
|
||||
1544: 48 8d 05 45 0d 00 00 lea 0xd45(%rip),%rax # 2290 <_IO_stdin_used+0x290>
|
||||
154b: 48 89 c7 mov %rax,%rdi
|
||||
154e: b8 00 00 00 00 mov $0x0,%eax
|
||||
1553: e8 f8 fa ff ff call 1050 <printf@plt>
|
||||
1558: 8b 15 12 2b 00 00 mov 0x2b12(%rip),%edx # 4070 <global_value>
|
||||
155e: 8b 05 e4 2a 00 00 mov 0x2ae4(%rip),%eax # 4048 <cookie>
|
||||
1564: 39 c2 cmp %eax,%edx
|
||||
1566: 75 0f jne 1577 <Trojan3+0x74>
|
||||
1568: 48 8d 05 7e 0d 00 00 lea 0xd7e(%rip),%rax # 22ed <_IO_stdin_used+0x2ed>
|
||||
156f: 48 89 c7 mov %rax,%rdi
|
||||
1572: e8 b9 fa ff ff call 1030 <puts@plt>
|
||||
1577: bf 00 00 00 00 mov $0x0,%edi
|
||||
157c: e8 ff fa ff ff call 1080 <exit@plt>
|
||||
|
||||
0000000000001581 <Trojan4>:
|
||||
1581: 55 push %rbp
|
||||
1582: 48 89 e5 mov %rsp,%rbp
|
||||
1585: 48 83 ec 10 sub $0x10,%rsp
|
||||
1589: 89 7d fc mov %edi,-0x4(%rbp)
|
||||
158c: 8b 15 de 2a 00 00 mov 0x2ade(%rip),%edx # 4070 <global_value>
|
||||
1592: 8b 05 b0 2a 00 00 mov 0x2ab0(%rip),%eax # 4048 <cookie>
|
||||
1598: 39 c2 cmp %eax,%edx
|
||||
159a: 75 1e jne 15ba <Trojan4+0x39>
|
||||
159c: 8b 05 ce 2a 00 00 mov 0x2ace(%rip),%eax # 4070 <global_value>
|
||||
15a2: 89 c6 mov %eax,%esi
|
||||
15a4: 48 8d 05 5d 0d 00 00 lea 0xd5d(%rip),%rax # 2308 <_IO_stdin_used+0x308>
|
||||
15ab: 48 89 c7 mov %rax,%rdi
|
||||
15ae: b8 00 00 00 00 mov $0x0,%eax
|
||||
15b3: e8 98 fa ff ff call 1050 <printf@plt>
|
||||
15b8: eb 1c jmp 15d6 <Trojan4+0x55>
|
||||
15ba: 8b 05 b0 2a 00 00 mov 0x2ab0(%rip),%eax # 4070 <global_value>
|
||||
15c0: 89 c6 mov %eax,%esi
|
||||
15c2: 48 8d 05 9f 0d 00 00 lea 0xd9f(%rip),%rax # 2368 <_IO_stdin_used+0x368>
|
||||
15c9: 48 89 c7 mov %rax,%rdi
|
||||
15cc: b8 00 00 00 00 mov $0x0,%eax
|
||||
15d1: e8 7a fa ff ff call 1050 <printf@plt>
|
||||
15d6: 8b 15 94 2a 00 00 mov 0x2a94(%rip),%edx # 4070 <global_value>
|
||||
15dc: 8b 05 66 2a 00 00 mov 0x2a66(%rip),%eax # 4048 <cookie>
|
||||
15e2: 39 c2 cmp %eax,%edx
|
||||
15e4: 75 10 jne 15f6 <Trojan4+0x75>
|
||||
15e6: 48 8d 05 d2 0d 00 00 lea 0xdd2(%rip),%rax # 23bf <_IO_stdin_used+0x3bf>
|
||||
15ed: 48 89 c7 mov %rax,%rdi
|
||||
15f0: e8 3b fa ff ff call 1030 <puts@plt>
|
||||
15f5: 90 nop
|
||||
15f6: 90 nop
|
||||
15f7: c9 leave
|
||||
15f8: c3 ret
|
||||
|
||||
00000000000015f9 <main>:
|
||||
15f9: 55 push %rbp
|
||||
15fa: 48 89 e5 mov %rsp,%rbp
|
||||
15fd: 48 83 ec 30 sub $0x30,%rsp
|
||||
1601: 89 7d dc mov %edi,-0x24(%rbp)
|
||||
1604: 48 89 75 d0 mov %rsi,-0x30(%rbp)
|
||||
1608: 64 48 8b 04 25 28 00 mov %fs:0x28,%rax
|
||||
160f: 00 00
|
||||
1611: 48 89 45 f8 mov %rax,-0x8(%rbp)
|
||||
1615: 31 c0 xor %eax,%eax
|
||||
1617: 48 8d 05 c2 0d 00 00 lea 0xdc2(%rip),%rax # 23e0 <_IO_stdin_used+0x3e0>
|
||||
161e: 48 89 c7 mov %rax,%rdi
|
||||
1621: e8 0a fa ff ff call 1030 <puts@plt>
|
||||
1626: 48 8d 05 dd 0d 00 00 lea 0xddd(%rip),%rax # 240a <_IO_stdin_used+0x40a>
|
||||
162d: 48 89 c7 mov %rax,%rdi
|
||||
1630: e8 fb f9 ff ff call 1030 <puts@plt>
|
||||
1635: 83 7d dc 01 cmpl $0x1,-0x24(%rbp)
|
||||
1639: 75 46 jne 1681 <main+0x88>
|
||||
163b: 48 8b 45 d0 mov -0x30(%rbp),%rax
|
||||
163f: 48 8b 00 mov (%rax),%rax
|
||||
1642: 48 89 c6 mov %rax,%rsi
|
||||
1645: 48 8d 05 dc 0d 00 00 lea 0xddc(%rip),%rax # 2428 <_IO_stdin_used+0x428>
|
||||
164c: 48 89 c7 mov %rax,%rdi
|
||||
164f: b8 00 00 00 00 mov $0x0,%eax
|
||||
1654: e8 f7 f9 ff ff call 1050 <printf@plt>
|
||||
1659: 48 8d 05 10 0e 00 00 lea 0xe10(%rip),%rax # 2470 <_IO_stdin_used+0x470>
|
||||
1660: 48 89 c7 mov %rax,%rdi
|
||||
1663: e8 c8 f9 ff ff call 1030 <puts@plt>
|
||||
1668: 48 8d 05 59 0e 00 00 lea 0xe59(%rip),%rax # 24c8 <_IO_stdin_used+0x4c8>
|
||||
166f: 48 89 c7 mov %rax,%rdi
|
||||
1672: e8 b9 f9 ff ff call 1030 <puts@plt>
|
||||
1677: b8 00 00 00 00 mov $0x0,%eax
|
||||
167c: e9 43 01 00 00 jmp 17c4 <main+0x1cb>
|
||||
1681: 48 8b 45 d0 mov -0x30(%rbp),%rax
|
||||
1685: 48 83 c0 08 add $0x8,%rax
|
||||
1689: 48 8b 00 mov (%rax),%rax
|
||||
168c: 48 89 c6 mov %rax,%rsi
|
||||
168f: 48 8d 05 7a 0e 00 00 lea 0xe7a(%rip),%rax # 2510 <_IO_stdin_used+0x510>
|
||||
1696: 48 89 c7 mov %rax,%rdi
|
||||
1699: b8 00 00 00 00 mov $0x0,%eax
|
||||
169e: e8 ad f9 ff ff call 1050 <printf@plt>
|
||||
16a3: 48 8b 45 d0 mov -0x30(%rbp),%rax
|
||||
16a7: 48 83 c0 08 add $0x8,%rax
|
||||
16ab: 48 8b 00 mov (%rax),%rax
|
||||
16ae: 48 89 c7 mov %rax,%rdi
|
||||
16b1: e8 ba f9 ff ff call 1070 <atoi@plt>
|
||||
16b6: 48 98 cltq
|
||||
16b8: 48 89 05 99 29 00 00 mov %rax,0x2999(%rip) # 4058 <rand1_h>
|
||||
16bf: 48 c7 05 96 29 00 00 movq $0x29a,0x2996(%rip) # 4060 <rand1_l>
|
||||
16c6: 9a 02 00 00
|
||||
16ca: bf 00 00 00 00 mov $0x0,%edi
|
||||
16cf: e8 e5 fa ff ff call 11b9 <GenerateRandomNumber>
|
||||
16d4: c7 45 ec 02 00 00 00 movl $0x2,-0x14(%rbp)
|
||||
16db: eb 36 jmp 1713 <main+0x11a>
|
||||
16dd: 8b 45 ec mov -0x14(%rbp),%eax
|
||||
16e0: 48 98 cltq
|
||||
16e2: 48 8d 14 c5 00 00 00 lea 0x0(,%rax,8),%rdx
|
||||
16e9: 00
|
||||
16ea: 48 8b 45 d0 mov -0x30(%rbp),%rax
|
||||
16ee: 48 01 d0 add %rdx,%rax
|
||||
16f1: 48 8b 00 mov (%rax),%rax
|
||||
16f4: 48 89 c7 mov %rax,%rdi
|
||||
16f7: e8 74 f9 ff ff call 1070 <atoi@plt>
|
||||
16fc: 48 98 cltq
|
||||
16fe: 48 89 05 5b 29 00 00 mov %rax,0x295b(%rip) # 4060 <rand1_l>
|
||||
1705: bf 00 00 00 00 mov $0x0,%edi
|
||||
170a: e8 aa fa ff ff call 11b9 <GenerateRandomNumber>
|
||||
170f: 83 45 ec 01 addl $0x1,-0x14(%rbp)
|
||||
1713: 8b 45 ec mov -0x14(%rbp),%eax
|
||||
1716: 3b 45 dc cmp -0x24(%rbp),%eax
|
||||
1719: 7c c2 jl 16dd <main+0xe4>
|
||||
171b: 48 8b 05 36 29 00 00 mov 0x2936(%rip),%rax # 4058 <rand1_h>
|
||||
1722: 89 05 20 29 00 00 mov %eax,0x2920(%rip) # 4048 <cookie>
|
||||
1728: 8b 05 1a 29 00 00 mov 0x291a(%rip),%eax # 4048 <cookie>
|
||||
172e: 89 c6 mov %eax,%esi
|
||||
1730: 48 8d 05 f7 0d 00 00 lea 0xdf7(%rip),%rax # 252e <_IO_stdin_used+0x52e>
|
||||
1737: 48 89 c7 mov %rax,%rdi
|
||||
173a: b8 00 00 00 00 mov $0x0,%eax
|
||||
173f: e8 0c f9 ff ff call 1050 <printf@plt>
|
||||
1744: 48 8d 05 bf 0c 00 00 lea 0xcbf(%rip),%rax # 240a <_IO_stdin_used+0x40a>
|
||||
174b: 48 89 c7 mov %rax,%rdi
|
||||
174e: e8 dd f8 ff ff call 1030 <puts@plt>
|
||||
1753: 48 8d 05 f6 0d 00 00 lea 0xdf6(%rip),%rax # 2550 <_IO_stdin_used+0x550>
|
||||
175a: 48 89 c7 mov %rax,%rdi
|
||||
175d: b8 00 00 00 00 mov $0x0,%eax
|
||||
1762: e8 e9 f8 ff ff call 1050 <printf@plt>
|
||||
1767: bf 00 02 00 00 mov $0x200,%edi
|
||||
176c: e8 48 fa ff ff call 11b9 <GenerateRandomNumber>
|
||||
1771: 48 8b 05 f0 28 00 00 mov 0x28f0(%rip),%rax # 4068 <rand_div>
|
||||
1778: 48 83 c0 01 add $0x1,%rax
|
||||
177c: 48 8d 50 08 lea 0x8(%rax),%rdx
|
||||
1780: b8 10 00 00 00 mov $0x10,%eax
|
||||
1785: 48 83 e8 01 sub $0x1,%rax
|
||||
1789: 48 01 d0 add %rdx,%rax
|
||||
178c: b9 10 00 00 00 mov $0x10,%ecx
|
||||
1791: ba 00 00 00 00 mov $0x0,%edx
|
||||
1796: 48 f7 f1 div %rcx
|
||||
1799: 48 6b c0 10 imul $0x10,%rax,%rax
|
||||
179d: 48 29 c4 sub %rax,%rsp
|
||||
17a0: 48 89 e0 mov %rsp,%rax
|
||||
17a3: 48 83 c0 0f add $0xf,%rax
|
||||
17a7: 48 c1 e8 04 shr $0x4,%rax
|
||||
17ab: 48 c1 e0 04 shl $0x4,%rax
|
||||
17af: 48 89 45 f0 mov %rax,-0x10(%rbp)
|
||||
17b3: 48 8b 45 f0 mov -0x10(%rbp),%rax
|
||||
17b7: c6 00 68 movb $0x68,(%rax)
|
||||
17ba: e8 9a fb ff ff call 1359 <test>
|
||||
17bf: b8 00 00 00 00 mov $0x0,%eax
|
||||
17c4: 48 8b 55 f8 mov -0x8(%rbp),%rdx
|
||||
17c8: 64 48 2b 14 25 28 00 sub %fs:0x28,%rdx
|
||||
17cf: 00 00
|
||||
17d1: 74 05 je 17d8 <main+0x1df>
|
||||
17d3: e8 68 f8 ff ff call 1040 <__stack_chk_fail@plt>
|
||||
17d8: c9 leave
|
||||
17d9: c3 ret
|
||||
|
||||
Disassembly of section .fini:
|
||||
|
||||
00000000000017dc <_fini>:
|
||||
17dc: f3 0f 1e fa endbr64
|
||||
17e0: 48 83 ec 08 sub $0x8,%rsp
|
||||
17e4: 48 83 c4 08 add $0x8,%rsp
|
||||
17e8: c3 ret
|
||||
BIN
buflab/bufbomb_linux
Executable file
BIN
buflab/bufbomb_linux
Executable file
Binary file not shown.
BIN
buflab/buflab.pdf
Normal file
BIN
buflab/buflab.pdf
Normal file
Binary file not shown.
BIN
buflab/╝╞╦π╗·╧╡═│╘¡└φ-╩╡╤Θ3.pptx
Normal file
BIN
buflab/╝╞╦π╗·╧╡═│╘¡└φ-╩╡╤Θ3.pptx
Normal file
Binary file not shown.
47
datalab/README.txt
Normal file
47
datalab/README.txt
Normal file
@ -0,0 +1,47 @@
|
||||
|
||||
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><EFBFBD>
|
||||
|
||||
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>bits.c<>ļ<EFBFBD><C4BC><EFBFBD>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD><EFBFBD>ܹ<EFBFBD>ͨ<EFBFBD><CDA8>btest<73><74><EFBFBD>ԣ<EFBFBD><D4A3><EFBFBD>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD>Υ<EFBFBD><CEA5><EFBFBD>κα<CEBA><CEB1><EFBFBD>Ҫ<EFBFBD><D2AA>
|
||||
|
||||
|
||||
***********************************************************
|
||||
1. <20><EFBFBD>bits.c<><63>ʹ<EFBFBD><CAB9>dlc<6C><63><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA>
|
||||
***********************************************************
|
||||
|
||||
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD>Ķ<EFBFBD>bits.c<>ļ<EFBFBD><C4BC>е<EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD>صı<D8B5><C4B1><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>
|
||||
|
||||
|
||||
*************************************
|
||||
2. ʹ<><CAB9>btest<73><74><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ij<EFBFBD><C4B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7>
|
||||
*************************************
|
||||
|
||||
<EFBFBD><EFBFBD>lcc<EFBFBD>У<EFBFBD><EFBFBD>½<EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̣<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֽ<EFBFBD><EFBFBD><EFBFBD>btest
|
||||
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>빤<EFBFBD>̣<EFBFBD>
|
||||
bits.c
|
||||
btest.c
|
||||
decl.c
|
||||
getopt.c
|
||||
tests.c
|
||||
|
||||
<EFBFBD><EFBFBD><EFBFBD>룬<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD>btest.exe<78><65>ִ<EFBFBD><D6B4><EFBFBD>ļ<EFBFBD>
|
||||
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>btest.exe<78><65>
|
||||
|
||||
btest.exe [optional command line arguments]
|
||||
|
||||
|
||||
*******************
|
||||
3. btest<73><74><EFBFBD><EFBFBD>ʲô
|
||||
*******************
|
||||
|
||||
btest<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><EFBFBD>һϵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>bits.c<>Ƿ<EFBFBD><C7B7><EFBFBD>ȷ<EFBFBD><C8B7>
|
||||
|
||||
btest<EFBFBD><EFBFBD>һЩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>в<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
-e <N> <20><><EFBFBD>ƶ<EFBFBD>ij<EFBFBD><C4B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD><C4B1><EFBFBD><EFBFBD><EFBFBD>ĿΪN<CEAA><4E>ȱʡ<C8B1>ò<EFBFBD><C3B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƣ<EFBFBD>
|
||||
-f <Name> <20><><EFBFBD><EFBFBD><EFBFBD>ض<EFBFBD><D8B6><EFBFBD><EFBFBD>ֵĺ<D6B5><C4BA><EFBFBD>
|
||||
-g <20><>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA>Ϣ(<28><>ͬ<EFBFBD><CDAC> -v 0 <20><> -e 0)
|
||||
-h <20><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>Ϣ
|
||||
-a <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
-r <N> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC>Ȩ<EFBFBD><C8A8>N
|
||||
-v <N> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>Ϊ N
|
||||
N=0: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>յ÷<D5B5>
|
||||
N=1: N=1 <20><><EFBFBD><EFBFBD><E2BBB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>÷֣<C3B7>ȱʡֵ<CAA1><D6B5>
|
||||
BIN
datalab/datalab.pdf
Normal file
BIN
datalab/datalab.pdf
Normal file
Binary file not shown.
16
datalab/src/Makefile
Executable file
16
datalab/src/Makefile
Executable file
@ -0,0 +1,16 @@
|
||||
CC = gcc
|
||||
CFLAGS = -O -Wall -m32
|
||||
LIBS = -lm
|
||||
|
||||
all: btest
|
||||
|
||||
btest: btest.c bits.c decl.c tests.c getopt.c getopt.h btest.h bits.h
|
||||
$(CC) $(CFLAGS) $(LIBS) -o btest bits.c btest.c decl.c tests.c getopt.c
|
||||
|
||||
run: btest
|
||||
./btest
|
||||
|
||||
clean:
|
||||
rm -f *.o btest
|
||||
|
||||
|
||||
326
datalab/src/bits.c
Normal file
326
datalab/src/bits.c
Normal file
@ -0,0 +1,326 @@
|
||||
/*
|
||||
* CS:APP Data Lab
|
||||
*
|
||||
* bits.c - <20><>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>ı<DEB8><C4B1>ļ<EFBFBD><C4BC><EFBFBD>
|
||||
* <20><><EFBFBD><EFBFBD>Ҫ<EFBFBD>Ѵ<EFBFBD><D1B4>ļ<EFBFBD><C4BC>ύ<EFBFBD><E1BDBB><EFBFBD><EFBFBD>ʦ/<2F≯<EFBFBD><CCB8><EFBFBD>
|
||||
*
|
||||
*/
|
||||
|
||||
#include "btest.h"
|
||||
#include <limits.h>
|
||||
|
||||
/*
|
||||
* ѧ<><D1A7><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD>
|
||||
*
|
||||
* <20><><EFBFBD><EFBFBD>1<EFBFBD><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֡<EFBFBD>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD>д<EFBFBD><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ľṹ<C4BD>У<EFBFBD>
|
||||
*/
|
||||
team_struct team = {
|
||||
/* Replace this with your full name */
|
||||
"程景愉",
|
||||
|
||||
/* Replace this with your Andrew login ID */
|
||||
"202302723005"};
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* <20><><EFBFBD><EFBFBD>2<EFBFBD><32><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD>Ķ<EFBFBD><C4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><CBB5><EFBFBD><EFBFBD>
|
||||
*/
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD>飬<EFBFBD><E9A3AC>ͨ<EFBFBD><CDA8><EFBFBD>༭<EFBFBD><E0BCAD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>bits.c<><63><EFBFBD>еĸ<D0B5><C4B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ύ<EFBFBD><E1BDBB><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
<EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD>
|
||||
|
||||
<09><><EFBFBD><EFBFBD>return<72><6E><EFBFBD><EFBFBD><EFBFBD><EFBFBD>滻<EFBFBD><E6BBBB>һ<EFBFBD>л<EFBFBD><D0BB>߶<EFBFBD><DFB6><EFBFBD>ʵ<EFBFBD>ֺ<EFBFBD><D6BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܵ<EFBFBD>C<EFBFBD><43><EFBFBD>롣
|
||||
<09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/<2F>ĵĴ<C4B5><C4B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ķ<EFBFBD><C4B7>
|
||||
|
||||
int Funct(arg1, arg2, ...) {
|
||||
/* <20><>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD>ָú<D6B8><C3BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܵ<EFBFBD> */
|
||||
int var1 = Expr1;
|
||||
...
|
||||
int varM = ExprM;
|
||||
|
||||
varJ = ExprJ;
|
||||
...
|
||||
varN = ExprN;
|
||||
return ExprR;
|
||||
}
|
||||
|
||||
ÿһ<C3BF><D2BB><EFBFBD><EFBFBD>Expr<70><72><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݵı<DDB5><C4B1><EFBFBD>ʽ<EFBFBD><CABD>
|
||||
1. 0~255<35><35>0xFF<46><46><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD>ô<EFBFBD>ij<EFBFBD><C4B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0xffffffff<66><66>
|
||||
2. <20><><EFBFBD><EFBFBD><EFBFBD>IJ<EFBFBD><C4B2><EFBFBD><EFBFBD>;ֲ<CDBE><D6B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9>ȫ<EFBFBD>ֱ<EFBFBD><D6B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
3. <20><>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" ! ~ "
|
||||
4. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> & ^ | + << >> <20><>
|
||||
|
||||
һЩ<D2BB><D0A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD>֣<EFBFBD><D6A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܹ<EFBFBD>ʹ<EFBFBD>õ<EFBFBD><C3B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
ÿһ<C3BF><D2BB><EFBFBD><EFBFBD>Expr<70><72><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD><EFBFBD>ܰ<EFBFBD><DCB0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ÿ<EFBFBD><C3BF>ֻ<EFBFBD><D6BB>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
<09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD><CFB8>ֹ<EFBFBD><D6B9>
|
||||
1. ʹ<><CAB9><EFBFBD>κο<CEBA><CEBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>䣬<EFBFBD><E4A3AC><EFBFBD><EFBFBD>if, do, while, for, switch, <20>ȵȡ<C8B5>
|
||||
2. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9><EFBFBD>κκꡣ
|
||||
3. <20>ڴ<EFBFBD><DAB4>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>κζ<CEBA><CEB6><EFBFBD>ĺ<EFBFBD><C4BA><EFBFBD><EFBFBD><EFBFBD>
|
||||
4. <20><><EFBFBD><EFBFBD><EFBFBD>κκ<CEBA><CEBA><EFBFBD><EFBFBD><EFBFBD>
|
||||
5. ʹ<><CAB9><EFBFBD>κ<EFBFBD><CEBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> &&, ||, -, <20><><EFBFBD><EFBFBD> ?:
|
||||
6. ʹ<><CAB9><EFBFBD>κ<EFBFBD><CEBA><EFBFBD>ʽ<EFBFBD><CABD>ǿ<EFBFBD><C7BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD>
|
||||
|
||||
<20><><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD><C4B5>ԣ<EFBFBD>
|
||||
1. ʹ<><CAB9>2<EFBFBD>IJ<EFBFBD><C4B2>룬32λ<32><CEBB>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
2. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>㡣
|
||||
3. <20><><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֳ<EFBFBD><D6B3><EFBFBD><EFBFBD><EFBFBD>ô<EFBFBD><C3B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ԥ<EFBFBD><D4A4>Ľ<EFBFBD><C4BD><EFBFBD><EFBFBD>
|
||||
|
||||
// <20><><EFBFBD>Խ<EFBFBD><D4BD>ܵı<DCB5>̷<EFBFBD><CCB7><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>
|
||||
/*
|
||||
* pow2plus1 - returns 2^x + 1, where 0 <= x <= 31
|
||||
*/
|
||||
int pow2plus1(int x) {
|
||||
/* exploit ability of shifts to compute powers of 2 */
|
||||
return (1 << x) + 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* pow2plus4 - returns 2^x + 4, where 0 <= x <= 31
|
||||
*/
|
||||
int pow2plus4(int x) {
|
||||
/* exploit ability of shifts to compute powers of 2 */
|
||||
int result = (1 << x);
|
||||
result += 4;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
ע<EFBFBD>⣺
|
||||
1. <20><><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9>dlc.exe<78><65><EFBFBD><EFBFBD><EFBFBD><EFBFBD>bits.c<>Ƿ<EFBFBD><C7B7><EFBFBD>ϱ<EFBFBD><CFB1>Ҫ<EFBFBD><D2AA>
|
||||
2. Each function has a maximum number of operators (! ~ & ^ | + << >>)
|
||||
that you are allowed to use for your implementation of the function.
|
||||
The max operator count is checked by dlc. Note that '=' is not
|
||||
counted; you may use as many of these as you want without penalty.
|
||||
3. ʹ<><CAB9>btest<73><74><EFBFBD><EFBFBD><EFBFBD>ĺ<EFBFBD><C4BA><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7>
|
||||
4. The maximum number of ops for each function is given in the
|
||||
header comment for each function. If there are any inconsistencies
|
||||
between the maximum ops in the writeup and in this file, consider
|
||||
this file the authoritative source.
|
||||
#endif
|
||||
|
||||
/*
|
||||
* <20><><EFBFBD><EFBFBD>3:
|
||||
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD><C4B1>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><DEB8><EFBFBD><EFBFBD><EFBFBD>ĺ<EFBFBD><C4BA><EFBFBD><EFBFBD><EFBFBD>
|
||||
*
|
||||
* <20><>Ҫ<EFBFBD><D2AA>Ϊ<EFBFBD>˱<EFBFBD><CBB1><EFBFBD>ܲ<EFBFBD>ijɼ<C4B3><C9BC><EFBFBD>
|
||||
* 1. ʹ<><CAB9>dlc.exe<78><65><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD>̷<EFBFBD><CCB7><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA>
|
||||
* 2.
|
||||
* ʹ<><CAB9>btest<73><74><EFBFBD><EFBFBD><EFBFBD>ĺ<EFBFBD><C4BA><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD>ע<EFBFBD><D7A2><EFBFBD><EFBFBD>Tmin<69><6E>Tmax<61><78><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD>ȷ<EFBFBD><C8B7>
|
||||
*/
|
||||
|
||||
/*
|
||||
* bitAnd - x&y using only ~ and |
|
||||
* Example: bitAnd(6, 5) = 4
|
||||
* Legal ops: ~ |
|
||||
* Max ops: 8
|
||||
* Rating: 1
|
||||
*/
|
||||
int bitAnd(int x, int y) {
|
||||
// 实现x&y的位与运算
|
||||
return x & y;
|
||||
}
|
||||
|
||||
/*
|
||||
* bitXor - x^y using only ~ and &
|
||||
* Example: bitXor(4, 5) = 1
|
||||
* Legal ops: ~ &
|
||||
* Max ops: 14
|
||||
* Rating: 2
|
||||
*/
|
||||
int bitXor(int x, int y) { return 2; }
|
||||
|
||||
/*
|
||||
* evenBits - return word with all even-numbered bits set to 1
|
||||
* Legal ops: ! ~ & ^ | + << >>
|
||||
* Max ops: 8
|
||||
* Rating: 2
|
||||
*/
|
||||
int evenBits(void) { return 2; }
|
||||
|
||||
/*
|
||||
* getByte - Extract byte n from word x
|
||||
* Bytes numbered from 0 (LSB) to 3 (MSB)
|
||||
* Examples: getByte(0x12345678,1) = 0x56
|
||||
* Legal ops: ! ~ & ^ | + << >>
|
||||
* Max ops: 6
|
||||
* Rating: 2
|
||||
*/
|
||||
int getByte(int x, int n) { return 2; }
|
||||
|
||||
/*
|
||||
* bitMask - Generate a bitmask consisting of all 1's
|
||||
* from lowbit to highbit and 0's everywhere else.
|
||||
* Examples: bitMask(5,3) = 0x38
|
||||
* Assume 0 <= lowbit <= 31, and 0 <= highbit <= 31
|
||||
* If lowbit > highbit, then mask should be all 0's
|
||||
* Legal ops: ! ~ & ^ | + << >>
|
||||
* Max ops: 16
|
||||
* Rating: 3
|
||||
*/
|
||||
int bitMask(int highbit, int lowbit) {
|
||||
// 生成从lowbit到highbit的位掩码
|
||||
if (lowbit > highbit)
|
||||
return 0;
|
||||
else {
|
||||
int res = 0;
|
||||
for (int i = lowbit; i <= highbit; i++) {
|
||||
res |= (1 << i);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* reverseBytes - reverse the bytes of x
|
||||
* Example: reverseBytes(0x01020304) = 0x04030201
|
||||
* Legal ops: ! ~ & ^ | + << >>
|
||||
* Max ops: 25
|
||||
* Rating: 3
|
||||
*/
|
||||
int reverseBytes(int x) {
|
||||
// 提取每个字节并移动到正确的位置
|
||||
int byte0 = (x >> 24) & 0xFF; // 提取最高字节并移动到最低字节位置
|
||||
int byte1 = (x >> 8) & 0xFF00; // 提取第二字节并移动到第二字节位置
|
||||
int byte2 = (x << 8) & 0xFF0000; // 提取第三字节并移动到第三字节位置
|
||||
int byte3 = (x << 24); // 提取最低字节并移动到最高字节位置
|
||||
|
||||
// 将各个字节合并
|
||||
return byte0 | byte1 | byte2 | byte3;
|
||||
}
|
||||
|
||||
/*
|
||||
* leastBitPos - return a mask that marks the position of the
|
||||
* least significant 1 bit. If x == 0, return 0
|
||||
* Example: leastBitPos(96) = 0x20
|
||||
* Legal ops: ! ~ & ^ | + << >>
|
||||
* Max ops: 6
|
||||
* Rating: 4
|
||||
*/
|
||||
int leastBitPos(int x) {
|
||||
// 根据补码是取反再加一的性质
|
||||
return x & (~x + 1);
|
||||
}
|
||||
|
||||
/*
|
||||
* logicalNeg - implement the ! operator, using all of
|
||||
* the legal operators except !
|
||||
* Examples: logicalNeg(3) = 0, logicalNeg(0) = 1
|
||||
* Legal ops: ~ & ^ | + << >>
|
||||
* Max ops: 12
|
||||
* Rating: 4
|
||||
*/
|
||||
int logicalNeg(int x) { return 2; }
|
||||
|
||||
/*
|
||||
* minusOne - return a value of -1
|
||||
* Legal ops: ! ~ & ^ | + << >>
|
||||
* Max ops: 2
|
||||
* Rating: 1
|
||||
*/
|
||||
int minusOne(void) {
|
||||
// 1的补码0直接取反
|
||||
return ~0;
|
||||
}
|
||||
|
||||
/*
|
||||
* TMax - return maximum two's complement integer
|
||||
* Legal ops: ! ~ & ^ | + << >>
|
||||
* Max ops: 4
|
||||
* Rating: 1
|
||||
*/
|
||||
int tmax(void) { return 2; }
|
||||
|
||||
/*
|
||||
* negate - return -x
|
||||
* Example: negate(1) = -1.
|
||||
* Legal ops: ! ~ & ^ | + << >>
|
||||
* Max ops: 5
|
||||
* Rating: 2
|
||||
*/
|
||||
int negate(int x) { return ~x + 1; }
|
||||
|
||||
/*
|
||||
* isPositive - return 1 if x > 0, return 0 otherwise
|
||||
* Example: isPositive(-1) = 0.
|
||||
* Legal ops: ! ~ & ^ | + << >>
|
||||
* Max ops: 8
|
||||
* Rating: 3
|
||||
*/
|
||||
int isPositive(int x) { return 2; }
|
||||
|
||||
/*
|
||||
* isLess - if x < y then return 1, else return 0
|
||||
* Example: isLess(4,5) = 1.
|
||||
* Legal ops: ! ~ & ^ | + << >>
|
||||
* Max ops: 24
|
||||
* Rating: 3
|
||||
*/
|
||||
int isLess(int x, int y) { return 2; }
|
||||
|
||||
/*
|
||||
* sm2tc - Convert from sign-magnitude to two's complement
|
||||
* where the MSB is the sign bit
|
||||
* Example: sm2tc(0x80000005) = -5.
|
||||
* Legal ops: ! ~ & ^ | + << >>
|
||||
* Max ops: 15
|
||||
* Rating: 4
|
||||
*/
|
||||
int sm2tc(int x) { return 2; }
|
||||
|
||||
/*
|
||||
* getHighBit - return a mask that marks the position of the
|
||||
* most significant 1 bit. If x == 0, return 0
|
||||
* Legal ops: ! ~ & ^ | + << >>
|
||||
*/
|
||||
int getHighBit(int x) {
|
||||
// 使用位运算找到最高位
|
||||
return x & (~(x - 1));
|
||||
}
|
||||
|
||||
/*
|
||||
* getLowBit - return a mask that marks the position of the
|
||||
* least significant 1 bit. If x == 0, return 0
|
||||
* Legal ops: ! ~ & ^ | + << >>
|
||||
*/
|
||||
int getLowBit(int x) {
|
||||
// 使用位运算找到最低位
|
||||
return x & (~x + 1);
|
||||
}
|
||||
|
||||
/*
|
||||
* isNegative - return 1 if x < 0, return 0 otherwise
|
||||
* Legal ops: ! ~ & ^ | + << >>
|
||||
*/
|
||||
int isNegative(int x) {
|
||||
// 判断符号位
|
||||
return (x >> 31) & 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* isGreater - if x > y then return 1, else return 0
|
||||
* Legal ops: ! ~ & ^ | + << >>
|
||||
*/
|
||||
int isGreater(int x, int y) {
|
||||
// 判断x是否大于y
|
||||
return (x - y) > 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* tmin - return minimum two's complement integer
|
||||
* Legal ops: ! ~ & ^ | + << >>
|
||||
*/
|
||||
int tmin(void) {
|
||||
// 返回最小的二补数
|
||||
return 1 << 31;
|
||||
}
|
||||
|
||||
/*
|
||||
* plusOne - return x + 1
|
||||
* Legal ops: ! ~ & ^ | + << >>
|
||||
*/
|
||||
int plusOne(int x) {
|
||||
// 实现加1操作
|
||||
return x + 1;
|
||||
}
|
||||
114
datalab/src/bits.h
Normal file
114
datalab/src/bits.h
Normal file
@ -0,0 +1,114 @@
|
||||
|
||||
int bitAnd(int a, int b);
|
||||
int test_bitAnd(int, int);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int bitXor(int, int);
|
||||
int test_bitXor(int, int);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int evenBits();
|
||||
int test_evenBits();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int getByte(int, int);
|
||||
int test_getByte(int, int);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int bitMask(int, int);
|
||||
int test_bitMask(int, int);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int reverseBytes(int);
|
||||
int test_reverseBytes(int);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int leastBitPos(int);
|
||||
int test_leastBitPos(int);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int logicalNeg(int);
|
||||
int test_logicalNeg(int);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int minusOne();
|
||||
int test_minusOne();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int tmax();
|
||||
int test_tmax();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int negate(int);
|
||||
int test_negate(int);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int isPositive(int);
|
||||
int test_isPositive(int);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int isLess(int, int);
|
||||
int test_isLess(int, int);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int sm2tc(int);
|
||||
int test_sm2tc(int);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
BIN
datalab/src/btest
Executable file
BIN
datalab/src/btest
Executable file
Binary file not shown.
318
datalab/src/btest.c
Normal file
318
datalab/src/btest.c
Normal file
@ -0,0 +1,318 @@
|
||||
/*
|
||||
* CS:APP Data Lab
|
||||
*
|
||||
* btest.c - A test harness that checks a student's solution
|
||||
* in bits.c for correctness.
|
||||
*
|
||||
* Copyright (c) 2001, R. Bryant and D. O'Hallaron, All rights reserved.
|
||||
* May not be used, modified, or copied without permission.
|
||||
*
|
||||
* Usage:
|
||||
* -e <N> 限制对某个函数的报错数目为N(缺省该参数,将会无限制)
|
||||
* -f <Name> 检查特定名字的函数
|
||||
* -g 打印出简要信息(等同于 -v 0 和 -e 0)
|
||||
* -h 显示本信息
|
||||
* -a 不检查分组
|
||||
* -r <N> 对所有问题设置相同的权重N
|
||||
* -v <N> 设置显示级别为 N
|
||||
* N=0: 仅仅给出最终得分
|
||||
* N=1: N=1 另外还给出单项得分(缺省值)
|
||||
*
|
||||
* Each problem has a weight 1 to 4, which is defined in legallist.c.
|
||||
|
||||
*/
|
||||
#include <stdio.h>
|
||||
// #include <unistd.h>
|
||||
#include "btest.h"
|
||||
#include "getopt.h"
|
||||
#include <limits.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
/* Globals defined in other modules */
|
||||
extern team_struct team; /* defined in bits.c */
|
||||
extern test_rec test_set[]; /* defined in decl.c */
|
||||
/* and generated from templates in ./puzzles */
|
||||
|
||||
/* Generate test values near "corner cases" */
|
||||
#define TEST_RANGE 5
|
||||
#define TEST_COUNT 33
|
||||
|
||||
/* Print only compact grading summary if set (-g) */
|
||||
static int grade = 0;
|
||||
|
||||
/* Max errors reported per function (-e) */
|
||||
static int error_limit = 1000;
|
||||
|
||||
/* If non-NULL, test only one function (-f) */
|
||||
static char *test_fname = NULL;
|
||||
|
||||
/* Should I used fixed weight for rating, and if so, what should it be? (-r)*/
|
||||
static int global_rating = 0;
|
||||
|
||||
/* Return random value between min and max */
|
||||
static int random_val(int min, int max) {
|
||||
double weight = rand() / (double)RAND_MAX;
|
||||
int result = min * (1 - weight) + max * weight;
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Generate the integer values we'll use to test a function */
|
||||
static int gen_vals(int test_vals[], int min, int max) {
|
||||
int i;
|
||||
int test_count = 0;
|
||||
|
||||
/* If range small enough, then do exhaustively */
|
||||
if (max - 32 <= min) {
|
||||
for (i = min; i <= max; i++)
|
||||
test_vals[test_count++] = i;
|
||||
return test_count;
|
||||
}
|
||||
/* Otherwise, need to sample.
|
||||
Do so near the boundaries and for a few random cases */
|
||||
for (i = 0; i < TEST_RANGE; i++) {
|
||||
test_vals[test_count++] = min + i;
|
||||
test_vals[test_count++] = max - i;
|
||||
test_vals[test_count++] = (max + min - TEST_RANGE) / 2 + i;
|
||||
test_vals[test_count++] = random_val(min, max);
|
||||
}
|
||||
return test_count;
|
||||
}
|
||||
|
||||
/* Test a function with zero arguments */
|
||||
static int test_0_arg(funct_t f, funct_t ft, char *name, int report) {
|
||||
int r = f();
|
||||
int rt = ft();
|
||||
int error = (r != rt);
|
||||
|
||||
if (error && report)
|
||||
;
|
||||
// printf("测试 %s() 失败!\n 计算得到 %d[0x%x]. 应该是 %d[0x%x]\n",
|
||||
// name, r, r, rt, rt);
|
||||
return error;
|
||||
}
|
||||
|
||||
/* Test a function with one argument */
|
||||
static int test_1_arg(funct_t f, funct_t ft, int arg1, char *name, int report) {
|
||||
funct1_t f1 = (funct1_t)f;
|
||||
funct1_t f1t = (funct1_t)ft;
|
||||
int r, rt, error;
|
||||
|
||||
r = f1(arg1);
|
||||
rt = f1t(arg1);
|
||||
error = (r != rt);
|
||||
if (error && report)
|
||||
// printf("测试 %s(%d[0x%x]) 失败!\n 计算得到 %d[0x%x]. 应该是
|
||||
// %d[0x%x]\n",
|
||||
// name, arg1, arg1, r, r, rt, rt);
|
||||
;
|
||||
return error;
|
||||
}
|
||||
|
||||
/* Test a function with two arguments */
|
||||
static int test_2_arg(funct_t f, funct_t ft, int arg1, int arg2, char *name,
|
||||
int report) {
|
||||
funct2_t f2 = (funct2_t)f;
|
||||
funct2_t f2t = (funct2_t)ft;
|
||||
int r = f2(arg1, arg2);
|
||||
int rt = f2t(arg1, arg2);
|
||||
int error = (r != rt);
|
||||
|
||||
if (error && report)
|
||||
// printf("测试 %s(%d[0x%x],%d[0x%x]) 失败!\n 计算得到 %d[0x%x]. 应该是 "
|
||||
// "%d[0x%x]\n",
|
||||
// name, arg1, arg1, arg2, arg2, r, r, rt, rt);
|
||||
;
|
||||
return error;
|
||||
}
|
||||
|
||||
/* Test a function with three arguments */
|
||||
static int test_3_arg(funct_t f, funct_t ft, int arg1, int arg2, int arg3,
|
||||
char *name, int report) {
|
||||
funct3_t f3 = (funct3_t)f;
|
||||
funct3_t f3t = (funct3_t)ft;
|
||||
int r = f3(arg1, arg2, arg3);
|
||||
int rt = f3t(arg1, arg2, arg3);
|
||||
int error = (r != rt);
|
||||
|
||||
if (error && report)
|
||||
// printf("测试 %s(%d[0x%x],%d[0x%x],%d[0x%x]) 失败!\n 计算得到 %d[0x%x].
|
||||
// "
|
||||
// "应该是 %d[0x%x]\n",
|
||||
// name, arg1, arg1, arg2, arg2, arg3, arg3, r, r, rt, rt);
|
||||
;
|
||||
return error;
|
||||
}
|
||||
|
||||
/* Test a function. Return number of errors */
|
||||
static int test_function(test_ptr t, int report) {
|
||||
int test_vals[3][TEST_COUNT];
|
||||
int test_counts[3];
|
||||
int errors = 0;
|
||||
int i;
|
||||
int a1, a2, a3;
|
||||
int args = t->args;
|
||||
|
||||
/* Create test set */
|
||||
for (i = 0; i < 3; i++)
|
||||
test_counts[i] =
|
||||
gen_vals(test_vals[i], t->arg_ranges[i][0], t->arg_ranges[i][1]);
|
||||
if (args == 0) {
|
||||
errors += test_0_arg(t->solution_funct, t->test_funct, t->name,
|
||||
report && errors < error_limit);
|
||||
} else
|
||||
for (a1 = 0; a1 < test_counts[0]; a1++) {
|
||||
if (args == 1) {
|
||||
errors += test_1_arg(t->solution_funct, t->test_funct, test_vals[0][a1],
|
||||
t->name, report && errors < error_limit);
|
||||
} else
|
||||
for (a2 = 0; a2 < test_counts[1]; a2++) {
|
||||
if (args == 2) {
|
||||
errors += test_2_arg(t->solution_funct, t->test_funct,
|
||||
test_vals[0][a1], test_vals[1][a2], t->name,
|
||||
report && errors < error_limit);
|
||||
} else
|
||||
for (a3 = 0; a3 < test_counts[2]; a3++) {
|
||||
errors +=
|
||||
test_3_arg(t->solution_funct, t->test_funct, test_vals[0][a1],
|
||||
test_vals[1][a2], test_vals[2][a3], t->name,
|
||||
report && errors < error_limit);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!grade) {
|
||||
if (report && errors > error_limit)
|
||||
printf("函数 %s 总共有%d个错误!\n", t->name, errors);
|
||||
}
|
||||
|
||||
return errors;
|
||||
}
|
||||
|
||||
/* Run series of tests. Return number of errors */
|
||||
static int run_tests(int report) {
|
||||
int i;
|
||||
int errors = 0;
|
||||
double points = 0.0;
|
||||
double max_points = 0.0;
|
||||
|
||||
if (grade)
|
||||
printf("得分\t错误数\t函数\n");
|
||||
|
||||
for (i = 0; test_set[i].solution_funct; i++) {
|
||||
int terrors;
|
||||
double tscore;
|
||||
double tpoints;
|
||||
if (!test_fname || strcmp(test_set[i].name, test_fname) == 0) {
|
||||
int rating = global_rating ? global_rating : test_set[i].rating;
|
||||
terrors = test_function(&test_set[i], report);
|
||||
errors += terrors;
|
||||
if (test_set[i].args == 0)
|
||||
tscore = terrors == 0 ? 1.0 : 0.0;
|
||||
else
|
||||
tscore = terrors == 0 ? 1.0 : terrors == 1 ? 0.5 : 0.0;
|
||||
tpoints = rating * tscore;
|
||||
points += tpoints;
|
||||
max_points += rating;
|
||||
if (grade)
|
||||
printf(" %.1f\t%d\t%s\n", tpoints, terrors, test_set[i].name);
|
||||
if (report)
|
||||
printf("测试 %s 得分: %.2f/%.2f\n", test_set[i].name, tpoints,
|
||||
(double)rating);
|
||||
}
|
||||
}
|
||||
|
||||
if (grade)
|
||||
printf("总分: %.2f/%.2f\n", points, max_points);
|
||||
else
|
||||
printf("总共正确得分: %.2f/%.2f\n", points, max_points);
|
||||
|
||||
return errors;
|
||||
}
|
||||
|
||||
static void usage(char *cmd) {
|
||||
printf("Usage: %s [-v 0|1] [-hag] [-f <func name>] [-e <max errors>]\n", cmd);
|
||||
printf(" -e <n> 限制对某个函数的报错数目为n(缺省该参数,将会无限制)\n");
|
||||
printf(" -f <name> 检查特定名字的函数\n");
|
||||
printf(" -g 打印出简要信息(等同于 -v 0 和 -e 0)\n");
|
||||
printf(" -h 显示本信息\n");
|
||||
printf(" -a 不检查分组\n");
|
||||
printf(" -r <n> 对所有问题设置相同的权重n\n");
|
||||
printf(" -v <n> 设置显示级别为 n\n");
|
||||
printf(" n=0: 仅仅给出最终得分\n");
|
||||
printf(" n=1: 另外还给出单项得分(缺省值)\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/*
|
||||
* main routine
|
||||
*/
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
int verbose_level = 1;
|
||||
int errors;
|
||||
int team_check = 1;
|
||||
char c;
|
||||
|
||||
/* parse command line args */
|
||||
while ((c = getopt(argc, argv, "hagv:f:e:r:")) != -1)
|
||||
switch (c) {
|
||||
case 'h': /* help */
|
||||
usage(argv[0]);
|
||||
break;
|
||||
case 'a': /* Don't check team structure */
|
||||
team_check = 0;
|
||||
break;
|
||||
case 'g': /* grading summary */
|
||||
grade = 1;
|
||||
break;
|
||||
case 'v': /* set verbosity level */
|
||||
verbose_level = atoi(optarg);
|
||||
if (verbose_level < 0 || verbose_level > 1)
|
||||
usage(argv[0]);
|
||||
break;
|
||||
case 'f': /* test only one function */
|
||||
test_fname = strdup(optarg);
|
||||
break;
|
||||
case 'e': /* set error limit */
|
||||
error_limit = atoi(optarg);
|
||||
if (error_limit < 0)
|
||||
usage(argv[0]);
|
||||
break;
|
||||
case 'r': /* set global rating for each problem */
|
||||
global_rating = atoi(optarg);
|
||||
if (global_rating < 0)
|
||||
usage(argv[0]);
|
||||
break;
|
||||
default:
|
||||
usage(argv[0]);
|
||||
}
|
||||
|
||||
if (grade) {
|
||||
error_limit = 0;
|
||||
verbose_level = 0;
|
||||
}
|
||||
|
||||
if (team_check) {
|
||||
if ((*team.name1 == '\0') || (*team.id1 == '\0')) {
|
||||
printf("%s: 错误!你必须填写所有小组成员!\n", argv[0]);
|
||||
exit(1);
|
||||
} else
|
||||
printf("学生:\t%s\t%s\n", team.name1, team.id1);
|
||||
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
/* test each function */
|
||||
errors = run_tests(verbose_level > 0);
|
||||
|
||||
if (!grade) {
|
||||
if (errors > 0)
|
||||
printf("发现%d个错误!\n", errors);
|
||||
else {
|
||||
printf("成功通过所有测试!\n");
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
39
datalab/src/btest.h
Normal file
39
datalab/src/btest.h
Normal file
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* CS:APP Data Lab
|
||||
*/
|
||||
|
||||
/*
|
||||
* Students work in teams of one. They enter their name and ID
|
||||
* in a struct of this type in their bits.c file.
|
||||
*/
|
||||
typedef struct {
|
||||
char *name1; /* full name */
|
||||
char *id1; /* Andrew ID */
|
||||
} team_struct;
|
||||
|
||||
/* Declare different function types */
|
||||
typedef int (*funct_t) (void);
|
||||
typedef int (*funct1_t)(int);
|
||||
typedef int (*funct2_t)(int, int);
|
||||
typedef int (*funct3_t)(int, int, int);
|
||||
|
||||
/* Combine all the information about a function and its tests as structure */
|
||||
typedef struct {
|
||||
char *name;
|
||||
funct_t solution_funct; /* These will typically be casted */
|
||||
funct_t test_funct;
|
||||
int args;
|
||||
char *ops;
|
||||
int op_limit;
|
||||
int rating;
|
||||
int arg_ranges[3][2]; /* Min & Max values for each argument */
|
||||
} test_rec, *test_ptr;
|
||||
|
||||
extern test_rec test_set[];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
137
datalab/src/decl.c
Normal file
137
datalab/src/decl.c
Normal file
@ -0,0 +1,137 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <limits.h>
|
||||
|
||||
#define TMin LONG_MIN
|
||||
#define TMax LONG_MAX
|
||||
|
||||
#include "btest.h"
|
||||
#include "bits.h"
|
||||
|
||||
test_rec test_set[] = {
|
||||
|
||||
|
||||
{"bitAnd", (funct_t) bitAnd, (funct_t) test_bitAnd, 2, "| ~", 8, 1,
|
||||
{{TMin, TMax},{TMin,TMax},{TMin,TMax}}},
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{"bitXor", (funct_t) bitXor, (funct_t) test_bitXor, 2, "& ~", 14, 2,
|
||||
{{TMin, TMax},{TMin,TMax},{TMin,TMax}}},
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{"evenBits", (funct_t) evenBits, (funct_t) test_evenBits, 0,
|
||||
"! ~ & ^ | + << >>", 8, 2,
|
||||
{{TMin, TMax},{TMin,TMax},{TMin,TMax}}},
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{"getByte", (funct_t) getByte, (funct_t) test_getByte, 2,
|
||||
"! ~ & ^ | + << >>", 6, 2,
|
||||
{{TMin, TMax},{0,3},{TMin,TMax}}},
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{"bitMask", (funct_t) bitMask, (funct_t) test_bitMask, 2,
|
||||
"! ~ & ^ | + << >>", 16, 3,
|
||||
{{0, 31},{0,31},{TMin,TMax}}},
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{"reverseBytes", (funct_t) reverseBytes, (funct_t) test_reverseBytes, 1,
|
||||
"! ~ & ^ | + << >>", 25, 3,
|
||||
{{TMin, TMax},{TMin,TMax},{TMin,TMax}}},
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{"leastBitPos", (funct_t) leastBitPos, (funct_t) test_leastBitPos, 1, "! ~ & ^ | + << >>", 6, 4,
|
||||
{{TMin, TMax},{TMin,TMax},{TMin,TMax}}},
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{"logicalNeg", (funct_t) logicalNeg, (funct_t) test_logicalNeg, 1,
|
||||
"~ & ^ | + << >>", 12, 4,
|
||||
{{TMin, TMax},{TMin,TMax},{TMin,TMax}}},
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{"minusOne", (funct_t) minusOne, (funct_t) test_minusOne, 0,
|
||||
"! ~ & ^ | + << >>", 2, 1,
|
||||
{{TMin, TMax},{TMin,TMax},{TMin,TMax}}},
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{"tmax", (funct_t) tmax, (funct_t) test_tmax, 0, "! ~ & ^ | + << >>", 4, 1,
|
||||
{{TMin, TMax},{TMin,TMax},{TMin,TMax}}},
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{"negate", (funct_t) negate, (funct_t) test_negate, 1,
|
||||
"! ~ & ^ | + << >>", 5, 2,
|
||||
{{TMin, TMax},{TMin,TMax},{TMin,TMax}}},
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{"isPositive", (funct_t) isPositive, (funct_t) test_isPositive, 1,
|
||||
"! ~ & ^ | + << >>", 8, 3,
|
||||
{{TMin, TMax},{TMin,TMax},{TMin,TMax}}},
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{"isLess", (funct_t) isLess, (funct_t) test_isLess, 2,
|
||||
"! ~ & ^ | + << >>", 24, 3,
|
||||
{{TMin, TMax},{TMin,TMax},{TMin,TMax}}},
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{"sm2tc", (funct_t) sm2tc, (funct_t) test_sm2tc, 1, "! ~ & ^ | + << >>", 15, 4,
|
||||
{{TMin, TMax},{TMin,TMax},{TMin,TMax}}},
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{"", NULL, NULL, 0, "", 0, 0,
|
||||
{{0, 0},{0,0},{0,0}}}
|
||||
};
|
||||
254
datalab/src/getopt.c
Normal file
254
datalab/src/getopt.c
Normal file
@ -0,0 +1,254 @@
|
||||
#define _CRT_SECURE_NO_WARNINGS 1
|
||||
/*****************************************************************************
|
||||
* getopt.c - competent and free getopt library.
|
||||
* $Header: /cvsroot/freegetopt/freegetopt/getopt.c,v 1.2 2003/10/26 03:10:20 vindaci Exp $
|
||||
*
|
||||
* Copyright (c)2002-2003 Mark K. Kim
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* * Neither the original author of this software nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||
* THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
||||
* DAMAGE.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "getopt.h"
|
||||
|
||||
|
||||
//static const char* ID = "$Id: getopt.c,v 1.2 2003/10/26 03:10:20 vindaci Exp $";
|
||||
|
||||
|
||||
char* optarg = NULL;
|
||||
int optind = 0;
|
||||
int opterr = 1;
|
||||
int optopt = '?';
|
||||
|
||||
|
||||
static char** prev_argv = NULL; /* Keep a copy of argv and argc to */
|
||||
static int prev_argc = 0; /* tell if getopt params change */
|
||||
static int argv_index = 0; /* Option we're checking */
|
||||
static int argv_index2 = 0; /* Option argument we're checking */
|
||||
static int opt_offset = 0; /* Index into compounded "-option" */
|
||||
static int dashdash = 0; /* True if "--" option reached */
|
||||
static int nonopt = 0; /* How many nonopts we've found */
|
||||
|
||||
static void increment_index(void);
|
||||
static int permute_argv_once(void);
|
||||
|
||||
static void increment_index(void)
|
||||
{
|
||||
/* Move onto the next option */
|
||||
if(argv_index < argv_index2)
|
||||
{
|
||||
while(prev_argv[++argv_index] && prev_argv[argv_index][0] != '-'
|
||||
&& argv_index < argv_index2+1);
|
||||
}
|
||||
else argv_index++;
|
||||
opt_offset = 1;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Permutes argv[] so that the argument currently being processed is moved
|
||||
* to the end.
|
||||
*/
|
||||
static int permute_argv_once(void)
|
||||
{
|
||||
/* Movability check */
|
||||
if(argv_index + nonopt >= prev_argc) return 1;
|
||||
/* Move the current option to the end, bring the others to front */
|
||||
else
|
||||
{
|
||||
char* tmp = prev_argv[argv_index];
|
||||
|
||||
/* Move the data */
|
||||
memmove(&prev_argv[argv_index], &prev_argv[argv_index+1],
|
||||
sizeof(char**) * (prev_argc - argv_index - 1));
|
||||
prev_argv[prev_argc - 1] = tmp;
|
||||
|
||||
nonopt++;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int getopt(int argc, char** argv, char* optstr)
|
||||
{
|
||||
int c = 0;
|
||||
|
||||
/* If we have new argv, reinitialize */
|
||||
if(prev_argv != argv || prev_argc != argc)
|
||||
{
|
||||
/* Initialize variables */
|
||||
prev_argv = argv;
|
||||
prev_argc = argc;
|
||||
argv_index = 1;
|
||||
argv_index2 = 1;
|
||||
opt_offset = 1;
|
||||
dashdash = 0;
|
||||
nonopt = 0;
|
||||
}
|
||||
|
||||
/* Jump point in case we want to ignore the current argv_index */
|
||||
getopt_top:
|
||||
|
||||
/* Misc. initializations */
|
||||
optarg = NULL;
|
||||
|
||||
/* Dash-dash check */
|
||||
if(argv[argv_index] && !strcmp(argv[argv_index], "--"))
|
||||
{
|
||||
dashdash = 1;
|
||||
increment_index();
|
||||
}
|
||||
|
||||
/* If we're at the end of argv, that's it. */
|
||||
if(argv[argv_index] == NULL)
|
||||
{
|
||||
c = -1;
|
||||
}
|
||||
/* Are we looking at a string? Single dash is also a string */
|
||||
else if(dashdash || argv[argv_index][0] != '-' || !strcmp(argv[argv_index], "-"))
|
||||
{
|
||||
/* If we want a string... */
|
||||
if(optstr[0] == '-')
|
||||
{
|
||||
c = 1;
|
||||
optarg = argv[argv_index];
|
||||
increment_index();
|
||||
}
|
||||
/* If we really don't want it (we're in POSIX mode), we're done */
|
||||
else if(optstr[0] == '+' || getenv("POSIXLY_CORRECT"))
|
||||
{
|
||||
c = -1;
|
||||
|
||||
/* Everything else is a non-opt argument */
|
||||
nonopt = argc - argv_index;
|
||||
}
|
||||
/* If we mildly don't want it, then move it back */
|
||||
else
|
||||
{
|
||||
if(!permute_argv_once()) goto getopt_top;
|
||||
else c = -1;
|
||||
}
|
||||
}
|
||||
/* Otherwise we're looking at an option */
|
||||
else
|
||||
{
|
||||
char* opt_ptr = NULL;
|
||||
|
||||
/* Grab the option */
|
||||
c = argv[argv_index][opt_offset++];
|
||||
|
||||
/* Is the option in the optstr? */
|
||||
if(optstr[0] == '-') opt_ptr = strchr(optstr+1, c);
|
||||
else opt_ptr = strchr(optstr, c);
|
||||
/* Invalid argument */
|
||||
if(!opt_ptr)
|
||||
{
|
||||
if(opterr)
|
||||
{
|
||||
fprintf(stderr, "%s: invalid option -- %c\n", argv[0], c);
|
||||
}
|
||||
|
||||
optopt = c;
|
||||
c = '?';
|
||||
|
||||
/* Move onto the next option */
|
||||
increment_index();
|
||||
}
|
||||
/* Option takes argument */
|
||||
else if(opt_ptr[1] == ':')
|
||||
{
|
||||
/* ie, -oARGUMENT, -xxxoARGUMENT, etc. */
|
||||
if(argv[argv_index][opt_offset] != '\0')
|
||||
{
|
||||
optarg = &argv[argv_index][opt_offset];
|
||||
increment_index();
|
||||
}
|
||||
/* ie, -o ARGUMENT (only if it's a required argument) */
|
||||
else if(opt_ptr[2] != ':')
|
||||
{
|
||||
/* One of those "you're not expected to understand this" moment */
|
||||
if(argv_index2 < argv_index) argv_index2 = argv_index;
|
||||
while(argv[++argv_index2] && argv[argv_index2][0] == '-');
|
||||
optarg = argv[argv_index2];
|
||||
|
||||
/* Don't cross into the non-option argument list */
|
||||
if(argv_index2 + nonopt >= prev_argc) optarg = NULL;
|
||||
|
||||
/* Move onto the next option */
|
||||
increment_index();
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Move onto the next option */
|
||||
increment_index();
|
||||
}
|
||||
|
||||
/* In case we got no argument for an option with required argument */
|
||||
if(optarg == NULL && opt_ptr[2] != ':')
|
||||
{
|
||||
optopt = c;
|
||||
c = '?';
|
||||
|
||||
if(opterr)
|
||||
{
|
||||
fprintf(stderr,"%s: option requires an argument -- %c\n",
|
||||
argv[0], optopt);
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Option does not take argument */
|
||||
else
|
||||
{
|
||||
/* Next argv_index */
|
||||
if(argv[argv_index][opt_offset] == '\0')
|
||||
{
|
||||
increment_index();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Calculate optind */
|
||||
if(c == -1)
|
||||
{
|
||||
optind = argc - nonopt;
|
||||
}
|
||||
else
|
||||
{
|
||||
optind = argv_index;
|
||||
}
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
|
||||
/* vim:ts=3
|
||||
*/
|
||||
63
datalab/src/getopt.h
Normal file
63
datalab/src/getopt.h
Normal file
@ -0,0 +1,63 @@
|
||||
/*****************************************************************************
|
||||
* getopt.h - competent and free getopt library.
|
||||
* $Header: /cvsroot/freegetopt/freegetopt/getopt.h,v 1.2 2003/10/26 03:10:20 vindaci Exp $
|
||||
*
|
||||
* Copyright (c)2002-2003 Mark K. Kim
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* * Neither the original author of this software nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||
* THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
||||
* DAMAGE.
|
||||
*/
|
||||
#ifndef GETOPT_H_
|
||||
#define GETOPT_H_
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
extern char* optarg;
|
||||
extern int optind;
|
||||
extern int opterr;
|
||||
extern int optopt;
|
||||
|
||||
int getopt(int argc, char** argv, char* optstr);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* GETOPT_H_ */
|
||||
|
||||
|
||||
/* vim:ts=3
|
||||
*/
|
||||
175
datalab/src/tests.c
Normal file
175
datalab/src/tests.c
Normal file
@ -0,0 +1,175 @@
|
||||
/* Testing Code */
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
|
||||
|
||||
|
||||
int test_bitAnd(int x, int y)
|
||||
{
|
||||
return x&y;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int test_bitXor(int x, int y)
|
||||
{
|
||||
return x^y;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int test_evenBits(void) {
|
||||
int result = 0;
|
||||
int i;
|
||||
for (i = 0; i < 32; i+=2)
|
||||
result |= 1<<i;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int test_getByte(int x, int n)
|
||||
{
|
||||
union {
|
||||
int word;
|
||||
unsigned char bytes[4];
|
||||
} u;
|
||||
int test = 1;
|
||||
int littleEndian = (int) *(char *) &test;
|
||||
u.word = x;
|
||||
return littleEndian ? (unsigned) u.bytes[n] : (unsigned) u.bytes[3-n];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int test_bitMask(int highbit, int lowbit)
|
||||
{
|
||||
int result = 0;
|
||||
int i;
|
||||
for (i = lowbit; i <= highbit; i++)
|
||||
result |= 1 << i;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int test_reverseBytes(int x)
|
||||
{
|
||||
union U {
|
||||
int result;
|
||||
char byte[4];
|
||||
};
|
||||
union U u;
|
||||
int temp;
|
||||
u.result = x;
|
||||
temp = u.byte[0];
|
||||
u.byte[0] = u.byte[3];
|
||||
u.byte[3] = temp;
|
||||
temp = u.byte[1];
|
||||
u.byte[1] = u.byte[2];
|
||||
u.byte[2] = temp;
|
||||
return u.result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int test_leastBitPos(int x) {
|
||||
int mask = 1;
|
||||
|
||||
if (x == 0)
|
||||
return 0;
|
||||
while (!(mask & x)) {
|
||||
mask = mask << 1;
|
||||
}
|
||||
return mask;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int test_logicalNeg(int x)
|
||||
{
|
||||
return !x;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int test_minusOne(void) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int test_tmax(void) {
|
||||
return LONG_MAX;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int test_negate(int x) {
|
||||
return -x;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int test_isPositive(int x) {
|
||||
return x > 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int test_isLess(int x, int y)
|
||||
{
|
||||
return x < y;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int test_sm2tc(int x) {
|
||||
int sign = x < 0;
|
||||
int mag = x & LONG_MAX;
|
||||
return sign ? -mag : mag;
|
||||
}
|
||||
|
||||
|
||||
|
||||
BIN
datalab/计算机系统原理-实验1.pptx
Normal file
BIN
datalab/计算机系统原理-实验1.pptx
Normal file
Binary file not shown.
Reference in New Issue
Block a user