특수한 경우에 한하지만, PHP가 없는 환경에서 기존 환경을 최대한 해치지 않고 PHP 라이브러리를 호출하는 최선의 방법을 고민하며 나온 결과물을 공유해봅니다.
사용 예시:
> set target https://public-api.example.org
> set method relay_invoke_method
method(relay_invoke_method)> set requires https://raw.githubusercontent.com/dimamedia/PHP-Simple-TOTP-and-PubKey/refs/heads/master/class.tfa.php
method(relay_invoke_method)> show env
{
"target": "https://public-api.example.org",
"method": "relay_invoke_method",
"filename": null,
"requires": [
]
}
method(relay_invoke_method)> do load_script "$tfa = new tfa(); return $tfa->getPubKey()"
RESB 4Y24 3U2K OA2W
method(relay_invoke_method)> do load_script "$tfa = new tfa(); return $tfa->getOtp('RESB 4Y24 3U2K OA2W')"
174053
method(relay_invoke_method)>
서버에 "class.tfa.php"라는 클래스 파일을 전혀 업로드하지 않았으나, 깃허브(또는 공개된 URL)에서 호스팅되고 있는 PHP 파일 주소를 입력하는 것만으로도 바로 불러와서 라이브러리로 활용한 사례입니다.
사용 방법:
1. JSON-RPC 2.0 형식을 해석하고 명령 수행이 가능한 PHP 스크립트를 내려받고 서버에 올린다.
https://github.com/gnh1201/caterpillar/blob/main/assets/php/index.php
2. 사용 예시의 실제 메시지는 다음과 같다. 스크립트가 있는 위치에 POST 요청을 보내어 사용할 수 있다.
요청 예시:
{
"jsonrpc": "2.0",
"method": "relay_invoke_method",
"params": {
"callback": "load_script",
"requires": [
"https://raw.githubusercontent.com/dimamedia/PHP-Simple-TOTP-and-PubKey/refs/heads/master/class.tfa.php"
],
"args": [
"$tfa = new tfa(); return $tfa->getPubKey()"
]
},
"id": null
}
응답 예시:
{
"jsonrpc": "2.0",
"result": {
"status": 200,
"data": "B7FJ 43QC 7WCX CLAY"
},
"id": null,
"_execution_time": 0.017116069793701
}
보안 정책만 잘 조정하여 사용할 수 있다면 특수한 경우에 유용할 것으로 보입니다.
댓글 4개
게시글 목록
| 번호 | 제목 |
|---|---|
| 18200 | |
| 18195 | |
| 18193 | |
| 18181 | |
| 18179 | |
| 18173 | |
| 18170 | |
| 18164 | |
| 18158 | |
| 18155 | |
| 18152 |
JavaScript
한글과컴퓨터 키워드추출스크립트.
2
|
| 18151 | |
| 18150 |
JavaScript
위에서 아래로 내려오는 효과 6가지
|
| 18140 | |
| 18139 | |
| 18138 |
JavaScript
마우스로 td 간격 조정하기.
1
|
| 18131 | |
| 18130 |
JavaScript
엘레먼트에 다이렉트로 변수,배열,객체 심기
|
| 18120 | |
| 18119 | |
| 18118 |
jQuery
0원팁- 숫자형 아이디에 접근하기
1
|
| 18117 |
jQuery
유용하게 써먹는 반응형 grid
1
|
| 18116 | |
| 18111 |
MySQL
db에서 트리거 만들기
|
| 18110 | |
| 18108 |
JavaScript
디바운스 debounce의 개념
1
|
| 18107 |
JavaScript
jquery 타이머 만들기
2
|
| 18106 | |
| 18100 | |
| 18090 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기