22018, 1/1101 회원가입  로그인  
   해킹잘하고싶다
   http://없음
   lob 연습할 때 도움되는 자료 (직접 만들었음)

http://www.hackerschool.org/HS_Boards/zboard.php?id=Free_Board&no=37877 [복사]


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>

#define MAX_LEN 256

// Convert input string like "\\x31\\xc0..." into actual byte array
int decode_shellcode(const char *input, unsigned char *output) {
    int len = strlen(input);
    int out_idx = 0;
    
    for (int i = 0; i < len;) {
        // Check for "\xNN" pattern
        if (input[i] == '\\' && input[i+1] == 'x' &&
            isxdigit(input[i+2]) && isxdigit(input[i+3])) {
            char hex[3] = { input[i+2], input[i+3], '\0' };
            output[out_idx++] = (unsigned char)strtol(hex, NULL, 16);
            i += 4;
        } else {
            return -1; // Invalid format
        }
    }
    return out_idx; // Number of bytes converted
}

int main(void)
{
    char your_answer[MAX_LEN];
    char *shellcode_25bytes = "\x31\xc0\x50\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e"
                               "\x89\xe3\x50\x53\x89\xe1\x31\xd2\xb0\x0b\xcd\x80";

    unsigned char decoded_input[MAX_LEN];

    while (1) {
        // Prompt user for shellcode input
        printf("Enter the shellcode('q' to exit) : ");
        fgets(your_answer, MAX_LEN, stdin);
        your_answer[strcspn(your_answer, "\n")] = '\0';  // Remove newline character

        // Exit if input is "q"
        if (strcmp(your_answer, "q") == 0) {
            exit(0);
        }

        // Decode input into raw bytes
        int decoded_len = decode_shellcode(your_answer, decoded_input);

        if (decoded_len < 0) {
            printf("Invalid format. Use \\xNN format.\n");
            continue;
        }

        // Compare decoded input with actual shellcode
        if (decoded_len == strlen(shellcode_25bytes) &&
            memcmp(decoded_input, shellcode_25bytes, decoded_len) == 0) {
            printf("correct!!!\n");
            break;
        } else {
            printf("fail...\n");
        }
    }

    return 0;
}

  Hit : 1622     Date : 2025/05/07 06:30



    
     [공지]해커스쿨 이용수칙 2021/04/11 수정판 [55] 한승재 01/05 12730
22017   시스코 라우터랑 스위치 케이블 장비 질문이에요.[1]     해킹잘하고싶다
09/22 36
22016   ㅇㅅㅇ     해킹잘하고싶다
08/15 270
22015   요즘 하고 있는 거     해킹잘하고싶다
07/13 479
22014   2위 ㅇㅅㅇ     해킹잘하고싶다
07/13 414
22013   ...     해킹잘하고싶다
03/31 799
22012   ...     해킹잘하고싶다
03/25 759
22011   15년전쯤 이 사이트 보고 꿈을 정했었는데~~~[1]     ambition65
03/20 1150
22010   으앙!!![1]     해킹잘하고싶다
02/05 923
22009   오랜만~     DarkSlayer
12/11 1110
22008   해커스쿨 옛날 BGM[1]     wkfhddl4041
11/07 1225
22007   히잉...     해킹잘하고싶다
11/02 1051
22006   바둑과 장기     해킹잘하고싶다
10/30 1126
22005   나는 언제 애인이 생기나욤...     해킹잘하고싶다
10/27 1214
22004   전국 1위     해킹잘하고싶다
10/27 1165
22003   담배 ㅋㅋ[1]     해킹잘하고싶다
10/27 1158
22002   매트릭스의 파란약을 아십니까..?     해킹잘하고싶다
10/27 1119
22001   ㅇㅇ[1]     해킹잘하고싶다
10/20 1080
22000   옵치 핵감지 프로그램좀 만들어주세요[1]     powerima
10/15 1205
21999   해킹팀원 모집[1]     koromoon
08/27 1815
1 [2][3][4][5][6][7][8][9][10]..[1101]

Copyright 1999-2026 Zeroboard / skin by Hackerschool.org / Secure Patch by Hackerschool.org