What do I need to enter in argv for the conditions if ( v8 && strstr(argv[1], "flag") )…
- User
What do I need to enter in argv for the conditions if ( v8 && strstr(argv[1], "flag") ) and if ( !strcmp(*argv, "./magic8ball") ) in code int __cdecl main(int argc, const char **argv, const char **envp) { unsigned int v3; // eax char *s[41]; // [rsp+10h] [rbp-160h] BYREF int v6; // [rsp+15Ch] [rbp-14h] __int64 v7; // [rsp+160h] [rbp-10h] int v8; // [rsp+16Ch] [rbp-4h]
setvbuf(stdout, 0LL, 2, 0LL); v3 = time(0LL); srand(v3); if ( argc != 2 ) { puts("Every question has answer... if you know how to ask"); printf("Go ahead, ask me anything.\n"); exit(0); } v8 = 0; if ( !strcmp(*argv, "./magic8ball") ) { puts("Why, I guess you're right... I am magic :D"); v8 = 1; } qmemcpy(s, off_4024A0, 0x140uLL); puts("You asked:"); msleep(0LL, 500LL); printf(""%s"\n", argv[1]); msleep(1LL, 0LL); printf("Hmmm"); msleep(1LL, 0LL); putchar(46); msleep(1LL, 0LL); putchar(46); msleep(1LL, 0LL); putchar(46); msleep(1LL, 0LL); puts("."); msleep(2LL, 0LL); if ( v8 && strstr(argv[1], "flag") ) { puts("Why yes, here is your flag!"); print_flag(); } else { v7 = 40LL; v6 = rand() % 0x28uLL; puts(s[v6]); } return 0; }
- Assistant
In order to satisfy the conditions
if ( v8 && strstr(argv[1], "flag") )andif ( !strcmp(*argv, "./magic8ball") ), you would need to pass command line arguments toargvwhen running the program.For the first condition
if ( v8 && strstr(argv[1], "flag") ), you would need to pass a second command line argument containing the string "flag" in order forstrstr(argv[1], "flag")to evaluate to true.For the second condition
if ( !strcmp(*argv, "./magic8ball") ), you would need to pass the string "./magic8ball" as the first command line argument in order for!strcmp(*argv, "./magic8ball")to evaluate to true.Here is an example of how you could execute the program with the correct command line arguments to satisfy both conditions:
./magic8ball ./magic8ball flagThis assumes that the program is named "magic8ball" and you want to check the conditions.
- User
What do I need to enter in zsh linux terminal argument for the conditions if ( v8 && strstr(argv[1], “flag”) ) and if ( !strcmp(*argv, “./magic8ball”) ) in code int __cdecl main(int argc, const char **argv, const char **envp) { unsigned int v3; // eax char *s[41]; // [rsp+10h] [rbp-160h] BYREF int v6; // [rsp+15Ch] [rbp-14h] __int64 v7; // [rsp+160h] [rbp-10h] int v8; // [rsp+16Ch] [rbp-4h]
setvbuf(stdout, 0LL, 2, 0LL); v3 = time(0LL); srand(v3); if ( argc != 2 ) { puts(“Every question has answer… if you know how to ask”); printf(“Go ahead, ask me anything.\n”); exit(0); } v8 = 0; if ( !strcmp(*argv, “./magic8ball”) ) { puts(“Why, I guess you’re right… I am magic :D”); v8 = 1; } qmemcpy(s, off_4024A0, 0x140uLL); puts(“You asked:”); msleep(0LL, 500LL); printf(“”%s"\n", argv[1]); msleep(1LL, 0LL); printf(“Hmmm”); msleep(1LL, 0LL); putchar(46); msleep(1LL, 0LL); putchar(46); msleep(1LL, 0LL); putchar(46); msleep(1LL, 0LL); puts(“.”); msleep(2LL, 0LL); if ( v8 && strstr(argv[1], “flag”) ) { puts(“Why yes, here is your flag!”); print_flag(); } else { v7 = 40LL; v6 = rand() % 0x28uLL; puts(s[v6]); } return 0; }
- Assistant
To satisfy the conditions
if ( v8 && strstr(argv[1], "flag") )andif ( !strcmp(*argv, "./magic8ball") )in the code, you will need to provide appropriate command line arguments when executing the program.For the first condition
if ( v8 && strstr(argv[1], "flag") ), you need to pass a second command line argument that contains the substring "flag". For example:./program_name argument flagReplace
program_namewith the actual name of the program you are running.For the second condition
if ( !strcmp(*argv, "./magic8ball") ), you need to pass the string "./magic8ball" as the first command line argument. For example:./magic8ball ./magic8ballIn this case, "./magic8ball" is passed twice to fulfill the condition.
Remember to adjust
program_nameaccording to the actual name of the program you are running. - User
how can i enter 2 arguments in terminal for this program int __cdecl main(int argc, const char **argv, const char **envp)
- Assistant
To enter two arguments in the terminal for the program, you simply need to separate each argument with a space.
Here is an example of how you can enter two arguments in the terminal for the program:
./program_name argument1 argument2Replace
program_namewith the actual name of your program, andargument1andargument2with the specific arguments you want to pass.