티스토리 뷰
반응형
iOS앱에서 frida를 이용해 접근하는 파일이벤트를 추적할 수 있는 스크립트이다.
// 'open' 함수 후킹
Interceptor.attach(Module.findExportByName(null, 'open'), {
onEnter: function(args) {
var path = Memory.readUtf8String(args[0]); // 첫 번째 인자는 파일 경로
console.log('File opened: ' + path);
},
onLeave: function(retval) {
// 파일 디스크립터 반환
}
});
// 'fopen' 함수 후킹
Interceptor.attach(Module.findExportByName(null, 'fopen'), {
onEnter: function(args) {
var path = Memory.readUtf8String(args[0]); // 첫 번째 인자는 파일 경로
console.log('File fopen: ' + path);
},
onLeave: function(retval) {
// 파일 포인터 반환
}
});
// 'read' 함수 후킹
Interceptor.attach(Module.findExportByName(null, 'read'), {
onEnter: function(args) {
var fd = args[0].toInt32(); // 파일 디스크립터
console.log('File read: FD=' + fd);
},
onLeave: function(retval) {
// 리턴 값은 읽은 바이트 수
}
});
// 'write' 함수 후킹
Interceptor.attach(Module.findExportByName(null, 'write'), {
onEnter: function(args) {
var fd = args[0].toInt32(); // 파일 디스크립터
var size = args[2].toInt32(); // 쓰여진 바이트 크기
console.log('File write: FD=' + fd + ' Bytes=' + size);
},
onLeave: function(retval) {
// 리턴 값은 실제로 쓰여진 바이트 수
}
});
// 'close' 함수 후킹
Interceptor.attach(Module.findExportByName(null, 'close'), {
onEnter: function(args) {
var fd = args[0].toInt32(); // 파일 디스크립터
console.log('File closed: FD=' + fd);
}
});반응형
'프로그래밍 > 보안' 카테고리의 다른 글
| [Frida/iOS] Frida 스크립트: NSString의 stringWithFormat: 후킹 (0) | 2024.10.04 |
|---|
반응형
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- SWiFT
- 생각
- Java
- MacOS
- 재테크
- Linux
- react
- 카톡업데이트
- Python
- 오리역
- AI
- openai
- 개발자
- golang
- Backend
- 내집마련
- ChatGPT
- Spring
- 주식투자
- 프로그래밍
- reactjs
- Frontend
- ios
- go
- HTML
- JavaScript
- 부동산
- 카카오톡
- 부동산분석
- CSS
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 |
글 보관함