changing code binary file

so i have this code and i need to change the binary file .by changing the password to grant access to user only if user enters password that would have previously been denied. so i need to read byte by byte and find the address of the byte to change and change that byte


so i understand that i need to treat the binary file as a txt file by reading it byte by byte but how to find the memory address and change it. I know that this program is probably max 10 lines but im not really familiar with c

can anyone help

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
 int main(int argc, char ** argv) {
    int8_t str[255];
    int8_t v1[255];
    // bb
    printf("Enter your username:");
    scanf("%s", v1);
    printf("Enter password:");
    scanf("%s", str);
    int32_t puts_rc; // 0x80485a6
    if (v1[0] == 101) {
        // 0x8048562
        if (v1[1] == 116) {
            // 0x804856e
            if (v1[2] == 0) {
                int32_t str_as_i = atoi(str); // 0x8048581
                if (str_as_i < 13) {
                    // 0x804859f
                    puts_rc = puts("Incorrect username or password. Goodbye.");
                    if (str_as_i == 12) {
                        // 0x80485ce
                        return puts_rc;
                    }
                } else {
                    // 0x80485b9
                    puts_rc = puts("Welcome");
                    // branch -> 0x80485c9
                }
                // 0x80485c9
                __stack_chk_fail();
                // branch -> 0x80485ce
                // 0x80485ce
                return puts_rc;
            }
        }
    }
    // 0x80485b9
    puts_rc = puts("Incorrect username and/or password. Goodbye.");
    // branch -> 0x80485c9
    // 0x80485c9
    __stack_chk_fail();
    // branch -> 0x80485ce
    // 0x80485ce
    return puts_rc;
Topic archived. No new replies allowed.