본문 바로가기

전체 글

(387)
GDB PIE 디버깅하기 처음에 인자를 다 넣으면서 하기 힘들어서찾아보니 좋은자료 있어서 저장gdb 에서 b *0x0하고 r arg < input 하고,브레이크 포인터 삭제하고 디버깅. 퍼옴 : http://revers3r.tistory.com/368
python gdb 백업 d = subprocess.Popen("gdb -ex 'py rax = " + str(i) + "' -x ./gg.py ", shell=True, stdout=subprocess.PIPE).stdout.read().strip() #gg.py 파일import gdb class MyBreakpoint(gdb.Breakpoint): def stop (self): return True gdb.execute('file ./OS.BIN')gdb.execute("set environment LD_PRELOAD /home/sudhakar/tools/preeny/x86_64-linux-gnu/desleep.so")MyBreakpoint("*0x400a62")gdb.execute("run")gdb.execute('set ..
afl 설치 및 사용 123456789101112131415161718192021222324252627$git clone https://github.com/mirrorer/afl $cd afl $make all --------------기본 설치 완료-------------------- 1. source code base $./afl-gcc -o target target.c 2. binary base QEMU 모드 동작 시켜야함 $cd ./qemu_mode $CPU_TARGET=[core] ./build_qemu_support.sh [ex] CPU_TARGET=i386 ./build_qemu_support.sh 사용 ./afl-fuzz -i seed_folder -o output_folder target_binary [ex]..
SROP SwampCTF 2018 SROP 기본 문제이다. 보안 기법은 모두 꺼져있다. Arch: amd64-64-little RELRO: No RELRO Stack: No canary found NX: NX disabled PIE: No PIE (0x400000) text 영역에 rwx권한을 주고 다시 입력을 받게한다. 그리고 입력 받는 주소를 텍스트 영역에 가게하고 텍스트 영역을 쉘코드로 덮는다. 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768#!/usr/bin/env pythonfrom pwn import *import binas..
gdbserver script 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253#!/usr/bin/python import subprocessimport reimport sysimport os#gdbserver --attach :55555 1299 def execute(cmd) : fd = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) return fd def get_pid(proc): fd = execute("/bin/ps -x") pslist= fd.stdout.rea..
[알고리즘] DP-숫자 삼각형 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 #include#include#include#include using namespace std; int dp [1001][1001];int tr [1001][1001]; /* a == 0과 마지막줄은 max없음 dp[n] = board[n][a] + max(dp[n-1][a], dp[n-1][a-1])*/ int _max(int a, int b){ return a > b ? a : b;} int main(){ int n; cin >> n; for(int i =1 ; i tr[i][a]; }..
[알고리즘] 124나라의 숫자 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263#include#include#include#includeusing namespace std; /*8 / 3 = 2 ... 22 / 3 = 0 ... 29 / 3 = 3 ... 03 / 3 = 1 ... 010 /3 = 3 ... 13 / 3 = 1 ... 0 2 111 / 3= 3 ... 22 / 3 = 0 ... 23* 3 + 1* 312 / 3 =3 .. 0 33 / 3 =1 .. 0 313 / 3 = 4 ... 14 / 3 = 1 ... 11 / 3 = 0 ... 1*/string chang..
[알고리즘] 진법 변환 123456789101112131415161718192021222324252627282930313233#include#include#include#include using namespace std; int main(){ string n; long long m; long long ans = 0; int cnt = 0; cin >> n ; cin >> m ; for(int i = n.length()-1 ; i != -1 ; i--) { int tmp = 0; if(n[i] - '0'