본문으로 바로가기

marco

현재위치 :: HOME BLOG CATEGORY SEARCH ARCHIVE TAGS MEDIA LOCATION GUESTBOOK

네비게이션

  • 홈
  • 태그
  • 미디어로그
  • 위치로그
  • 방명록
관리자
  • 블로그 이미지
    MarcoKhan

    링크추가
  • 글쓰기
  • 환경설정
  • 로그인
  • 로그아웃

ASM to C with IDA - 041

C300_041 C300_소스코드 12345678910111213141516171819202122232425262728293031323334353637#include #define true 1#define false 0 typedef int bool; typedef struct{ int kor; int eng; int math;} SungJuk; typedef union{ char ch; int point;} Variant; main(){ bool bCondition; SungJuk SJ; Variant V; bCondition = true; if (bCondition == true) { printf("조건식은 true입니다."); } SJ.kor = 50; V.ch = 5;} cs IDA - Layou..

Reversing/ASM to C 2018. 7. 8. 13:23

ASM to C with IDA - 040

C300_040 C300_소스코드 123456789101112131415#include enum { Sun = 0, Mon, Tue, Wed, Thr, Fri, Sat }; main(){ printf("%d ", Sun); // 0 printf("%d ", Mon); // 1 printf("%d ", Tue); // 2 printf("%d ", Wed); // 3 printf("%d ", Thr); // 4 printf("%d ", Fri); // 5 printf("%d ", Sat); // 6} Colored by Color Scriptercs IDA - Layout Graph IDA - Text View pseudo code - 최종 의사코드 123456789101112131415#include ma..

Reversing/ASM to C 2018. 7. 6. 11:16

ASM to C with IDA - 039

C300_039 C300_소스코드 123456789101112131415161718#include union tagVariant{ int i; float d;}; main(){ union tagVariant V; V.i = 0; V.d = 5.5; printf("V.i = %d \n", V.i); // V.i = 1085276160 printf("V.d = %f \n", V.d); // V.d = 5.500000}Colored by Color Scriptercs IDA - Layout Graph IDA - Text View movss: 4바이트 float 단정도 부동 소수점을 대입(전달)한다. movsd: SI 또는 ESI 레지스터에 의해 지정된 메모리 주소의 내용을 DI 또는 EDI 레지스터에 의해 저..

Reversing/ASM to C 2018. 7. 6. 11:02

ASM to C with IDA - 038

C300_038 C300_소스코드 1234567891011121314151617181920#include struct tagSungJuk{ int kor; int eng; int math;}; main(){ struct tagSungJuk SJ; SJ.kor = 100; SJ.eng = 95; SJ.math = 99; printf("총합 = %d ", SJ.kor + SJ.eng + SJ.math); } Colored by Color Scriptercs IDA - Layout Graph IDA - Text View 지역변수를 12byte 할당한것을 확인할 수 있다.하지만 12byte 자료형이 없기 때문에 구조체 혹은 배열로 생각할 수 있다.변수 이름을 확인하면 SJ.math 와 같이 구조체 변수에 접근 ..

Reversing/ASM to C 2018. 7. 6. 10:19

ASM to C with IDA - 037

C300_037 C300_소스코드 1234567891011121314151617181920212223#include int length(char* pstr); main(){ int len = length("abcde"); printf("길이 = %d ", len); // 길이 = 5} int length(char* pstr){ int len = 0; while (*pstr != NULL) { pstr++; // pstr의 번지를 1만큼 증가 len++; // 문자열의 길이를 1만큼 } return len;}Colored by Color Scriptercs IDA - Layout Graph (main, length) IDA - Text View (main, length) movsx를 통해 문자열의 한 문자..

Reversing/ASM to C 2018. 7. 5. 10:43

ASM to C with IDA - 036

C300_036 C300_소스코드 12345678910111213141516171819202122232425#include main(){ int saram_A = 0; int saram_B = 0; int* pointer; int* psaram; pointer = &saram_A; *pointer = 1; printf("%d, %d \n", saram_A, *pointer); // 1, 1 psaram = &saram_A; *psaram = 2; printf("%d, %d, %d \n", saram_A, *pointer, *psaram); // 2, 2, 2 pointer = &saram_B; *pointer = 3; printf("%d, %d, %d \n", saram_A, saram_B, *point..

Reversing/ASM to C 2018. 7. 5. 10:14

ASM to C with IDA - 035

C300_035 C300_소스코드 12345678910#include main(){ int i = 0; int j = 1; printf("값=%d, 메모리주소=%p \n", i, &i); printf("값=%d, 메모리주소=%p \n", j, &j); }Colored by Color Scriptercs IDA - Layout Graph IDA - Text View mov 는 값을 전달하고, lea는 주소를 전달한다. pseudo code - 의사코드 123456789101112131415161718192021#include main(){ int i; int j; i=0; j=1; eax = &i; ecx = i; printf(_Format, ecx, eax); edx = &j eax = j printf(..

Reversing/ASM to C 2018. 7. 5. 09:29

어셈블리 프로그래밍 심화 및 CPU 구조

1. C언어 와 어셈블리어 주소 vs 메모리 C언어- 포인터: 메모리에 대한 직접 접근이 가능하다.어셈블리어- 변수를 선언해서 사용하지 않는다.- 메모리를 직접 사용한다.(레이블) 1) 주소- 단순히 메모리 상의 위치이다.- 파일 offset과 동일한 용어이다.- 정수이다. 2) 메모리- 데이터가 들어있는 실제 메모리를 의미한다.- size [주소]: 주소에 해당하는 메모리(값)를 나타낸다. c언어 -> 어셈블리어 1234567891011121314#include int a;int b; int main(){ scanf("%d", &a); // &a -> 주소 scanf("%d", &b); // &b -> 주소 printf("a: %d\n", a); // a -> 메모리 printf("b: %d\n", b..

Pwnable 2018. 7. 4. 14:38

어셈블리 와 C언어, 리눅스의 이해

1. objdump 를 이용해 elf 파일 내부를 자세히 보자. objdump -x 옵션을 모든 이용가능한 헤더 정보를 준다.아래 그림을 보고 이해해보자. 굉장히 복잡해 보이지만 차근 차근 하나씩 알아보도록 하자. hello2: file format elf32-i386 //파일 형식이 elf라는것을 알 수 있다.architecture: i386, flags 0x00000112 //하드웨어 타입을 알 수 있다.start address 0x08048080 //메모리 상의 주소( 여기부터 프로세스가 올라간다.) LOAD off 0x00000000 vaddr 0x08048000 paddr 0x08048000 align 2**12(4kb) // off(파일 오프셋), vaddr(가상 메모리) filesz 0x00..

Pwnable 2018. 7. 4. 11:15

ASM to C with IDA - 034

C300_034 C300_소스코드 12345678910111213#include main(){ int kor[10] = { 100, 90, 35, 60, 75, 55, 95, 80, 90, 70 }; int i; for (i = 0; i

Reversing/ASM to C 2018. 7. 4. 09:41
  • 이전
  • 1
  • ···
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • ···
  • 27
  • 다음

사이드바

NOTICE

  • 전체 보기
MORE+

LINK

  • About Me
  • Gtihub

CATEGORY

  • M4RC0 (262)
    • CPU side-channel attack (7)
      • Resource contention-based a.. (1)
      • Meltdown-type attacks (3)
      • Spectre-type attacks (0)
      • MDS (0)
      • Whitepaper (0)
    • Drone (0)
    • Linux (42)
    • GitHub management (0)
    • Vulnerabilties on Drones (0)
    • Programming (42)
      • C언어 (6)
      • TIPS 17기 (17)
      • JAVA (12)
      • JSP (4)
      • Python (3)
    • Wargame (61)
      • LOB (20)
      • FTZ (22)
      • Protostar (7)
      • pwnable.kr (12)
    • Reversing (75)
      • Keygen (4)
      • ASM to C (70)
      • CodeEngn (1)
    • Pwnable (8)
    • Crypto, Access Control, Pro.. (2)
    • SEEDLAB (5)
    • Paper review (1)
    • Github 관리 (1)
    • ETC... (17)

RECENTLY

  • 최근 글
  • 최근 댓글

최근 글

최근댓글

Trackback

TAG

  • Tips프로그래밍강좌
  • tipsware
  • Tips프로그래밍
  • 김성엽
  • TIPS강좌
  • tipssoft
MORE+

ARCHIVE

CALENDAR

«   2025/12   »
일 월 화 수 목 금 토
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

VISITOR

오늘
어제
전체
  • 홈으로
  • 방명록
  • 로그인
  • 로그아웃
  • 맨위로
SKIN BY COPYCATZ COPYRIGHT marco, ALL RIGHT RESERVED.
marco
블로그 이미지 MarcoKhan 님의 블로그
MENU
  • 홈
  • 태그
  • 미디어로그
  • 위치로그
  • 방명록
CATEGORY
  • M4RC0 (262)
    • CPU side-channel attack (7)
      • Resource contention-based a.. (1)
      • Meltdown-type attacks (3)
      • Spectre-type attacks (0)
      • MDS (0)
      • Whitepaper (0)
    • Drone (0)
    • Linux (42)
    • GitHub management (0)
    • Vulnerabilties on Drones (0)
    • Programming (42)
      • C언어 (6)
      • TIPS 17기 (17)
      • JAVA (12)
      • JSP (4)
      • Python (3)
    • Wargame (61)
      • LOB (20)
      • FTZ (22)
      • Protostar (7)
      • pwnable.kr (12)
    • Reversing (75)
      • Keygen (4)
      • ASM to C (70)
      • CodeEngn (1)
    • Pwnable (8)
    • Crypto, Access Control, Pro.. (2)
    • SEEDLAB (5)
    • Paper review (1)
    • Github 관리 (1)
    • ETC... (17)
VISITOR 오늘 / 전체
  • 글쓰기
  • 환경설정
  • 로그인
  • 로그아웃
  • 취소

검색

티스토리툴바