ADD A3 solution, miss report
This commit is contained in:
		
							
								
								
									
										0
									
								
								03-Average3/A3
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
						
						
									
										0
									
								
								03-Average3/A3
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
								
								
									
										6
									
								
								03-Average3/A3.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								03-Average3/A3.txt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,6 @@ | ||||
| 1. What is the algorithm used to check the validity of a password? | ||||
|  | ||||
| 2. This program relies on a specific trick. How does it work? | ||||
|  | ||||
| 3. Can you recover the secret password? You must send 1 the valid password by email to pascal+sre25@mod-p.ch before Apr. 28th, 2025, 12h00 CET to validate this lab and get 10 points. | ||||
| JFuzhFSI4YShfqE7 | ||||
							
								
								
									
										30153
									
								
								03-Average3/code.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30153
									
								
								03-Average3/code.c
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										52
									
								
								03-Average3/pw.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										52
									
								
								03-Average3/pw.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,52 @@ | ||||
|  #include <stdio.h> | ||||
|  #include <stdint.h> | ||||
|  #include <stdbool.h> | ||||
|  #include <string.h> | ||||
|  #include <sys/types.h> | ||||
|  #include <signal.h> | ||||
|  #include <sys/ptrace.h> | ||||
|  | ||||
|  // uVar4 = 1396505404 = 0x533CFB3C | ||||
|  // uVar5 = 2294410125 = 0x88C1EB8D | ||||
|  // uVar6 = 2929865363 = 0xAEA23293 | ||||
|  | ||||
| uint8_t main(int argc, char** argv) { | ||||
|     char* list = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ+-"; | ||||
|     uint32_t uVar4 = 1396505404; | ||||
|     uint32_t uVar5 = 929308192; | ||||
|     uint32_t uVar6 = 2929865363; | ||||
|     char password[17]; | ||||
|     password[16] = '\0'; | ||||
|     password[0] = list[uVar6 >> 0x1a]; | ||||
|     password[1] = list[uVar6 >> 0x14 & 0x3f]; | ||||
|     password[2] = list[uVar6 >> 0xe & 0x3f]; | ||||
|      // [uVar6 >> 8 & 0x3f] ^ password[3] | | ||||
|     password[3] = list[uVar6 >> 8 & 0x3f]; | ||||
|      // [uVar6 >> 2 & 0x3f] ^ password[4] | | ||||
|     password[4] = list[uVar6 >> 2 & 0x3f]; | ||||
|      // [(uVar6 & 3) << 4 | uVar4 >> 0x1c] ^ password[5] | | ||||
|     password[5] = list[(uVar6 & 3) << 4 | uVar4 >> 0x1c]; | ||||
|      // [uVar4 >> 0x16 & 0x3f] ^ password[6] | | ||||
|     password[6] = list[uVar4 >> 0x16 & 0x3f]; | ||||
|      // [uVar4 >> 0x10 & 0x3f] ^ password[7] | | ||||
|     password[7] = list[uVar4 >> 0x10 & 0x3f]; | ||||
|      // [uVar4 >> 10 & 0x3f] ^ password[8] | | ||||
|     password[8] = list[uVar4 >> 10 & 0x3f]; | ||||
|      // [uVar4 >> 4 & 0x3f] ^ password[9] | | ||||
|     password[9] = list[uVar4 >> 4 & 0x3f]; | ||||
|      // [uVar5 >> 0x1e | (uVar4 & 0xf) << 2] ^ password[10] | | ||||
|     password[10] = list[uVar5 >> 0x1e | (uVar4 & 0xf) << 2]; | ||||
|      // [uVar5 >> 0x18 & 0x3f] ^ password[11] | | ||||
|     password[11] = list[uVar5 >> 0x18 & 0x3f]; | ||||
|      // [uVar5 >> 0x12 & 0x3f] ^ password[12] | | ||||
|     password[12] = list[uVar5 >> 0x12 & 0x3f]; | ||||
|      // [uVar5 >> 0xc & 0x3f] ^ password[13] | | ||||
|     password[13] = list[uVar5 >> 0xc & 0x3f]; | ||||
|      // [uVar5 >> 6 & 0x3f] ^ password[14] | | ||||
|     password[14] = list[uVar5 >> 6 & 0x3f]; | ||||
|      // [uVar5 & 0x3f] ^ password[15] | ||||
|     password[15] = list[uVar5 & 0x3f]; | ||||
|  | ||||
|     printf("%s\n", password); | ||||
|     return 0; | ||||
| } | ||||
		Reference in New Issue
	
	Block a user