August 18, 2022

How to call solidity functions with Web3, metamask library

Public view/pure functions can be simply called. However, in other cases, you need to log in because of gas fee. It can be done with metamask.


public view/pure 함수는 간단히 호출할 수 있다. 그러나 그 외의 경우는 가스비를 제출해야하므로 로그인이 필요하다. 이를 위해 여기서는 메타마스크를 활용하는 방법을 알아본다.



1. public view/pure function

<script src="https://cdn.jsdelivr.net/npm/web3@1.7.3/dist/web3.min.js"></script>

<script>
const rpcPolygon = "https://polygon-rpc.com";
let web3 = "";
let contract1 = "";
async function main(){
    web3 = await new Web3(rpcPolygon);
    contract1 = await new web3.eth.Contract( [ABI], [Contract Address] );
} main();

async function callTmp(){
    contract1.methods.[function name]().call({from: [wallet address]})
    .then(function(result){
        console.log(result);
    })
    .catch(async function(e){
        console.log(e);
    });
}
</script>


Write the JavaScript code as above. It is used by calling the callTmp() function when necessary.


위와 같이 자바스크립트 코드를 작성한다. 필요할 때 callTmp() 함수를 호출하여 사용한다.

 

 

2. public function

<script src="https://cdn.jsdelivr.net/npm/web3@1.7.3/dist/web3.min.js"></script>

<script>
let web3 = "";
let contract1 = "";
async function main(){
    web3 = await new Web3(window.ethereum);
    contract1 = await new web3.eth.Contract( [ABI], [Contract Address] );
} main();

async function callTmp(){
    let param = {
        from: [my address],
        to: [contract1 address],
        value: [send coins if you want],
        data: contract1.methods.[function name]().encodeABI()
    };

    ethereum.request(
    {
        method: 'eth_sendTransaction',
        params: [param]
    })
    .then(async function(txHash){
        let receipt = null;
        while(receipt == null){
            receipt = await web3.eth.getTransactionReceipt(txHash);
            await sleep(3000);
        }
        console.log("Txhash:", receipt.transactionHash);
    })
    .catch(async function(error){
        console.log(error);
    });
}

async function sleep(milliseconds) {
    return new Promise(resolve => setTimeout(resolve, milliseconds))
}
</script>


Metamask uses the ethereum.request() function to generate a transaction. As before, proper use of the callTmp() function can help.


메타마스크에서는 트랜잭션 발생을 위해 ethereum.request() 함수를 사용한다. 이전과 마찬가지로 callTmp() 함수를 적절히 사용하면 도움이 될 수 있다.


August 17, 2022

How to initialize Web3 library in Javascript

To use Web3, there are two ways to enter an RPC address or use a metamask.
Web3를 사용하려면 RPC 주소를 입력하거나 메타마스크를 이용하는 방법이 있다.

 

1. Using RPC Address (Polygon Network).
1. RPC 주소를 입력하는 방법(폴리곤 네트워크).

<script src="https://cdn.jsdelivr.net/npm/web3@1.7.3/dist/web3.min.js"></script>

<script>
const rpcPolygon = "https://polygon-rpc.com";
let web3 = "";
let contract1 = "";
async function main(){
    web3 = await new Web3(rpcPolygon);
    contract1 = await new web3.eth.Contract( [ABI], [Contract Address] );
} main();
</script>



2. Using metamask.
2. 메타마스크를 이용하는 방법.

<script src="https://cdn.jsdelivr.net/npm/web3@1.7.3/dist/web3.min.js"></script>

<script>
let web3 = "";
let contract1 = "";
async function main(){
    web3 = await new Web3(window.ethereum);
    contract1 = await new web3.eth.Contract( [ABI], [Contract Address] );
} main();
</script>


April 13, 2022

Square CTF postfuscator write up

 

< getFlag #4, Own this NFT! (Link) >


▶ How to play
Download the provided file(Link).
제공되는 파일 다운로드.

The humans who designed C9 were afraid that the Charvises would disavow their pact.

인류는 차비스가 약속을 파기할 가능성에 대해 두려워했다.

The humans therefore decided to build an additional defense system, C9, using an ancient programming language. A programming language that Charvises didn’t even know is a programming language!

그래서 그들은 추가 방호 시스템인 C9을 구축하게 된다. 이때 고대의 프로그래밍 언어를 사용하였는데, 차비스는 그 내용이 프로그래밍 언어인지조차 인지하지 못하였다.

Can you figure out the correct input?
관련하여 올바른 입력값을 찾도록 한다.

 

여기서 말하는 고대 언어는 포스트스크립트이다. 쉘 스크립트 파일이 제공되지만 이는 포스트스크립트(PS) 파일을 추출하기 위한 용도이다. 포스트스크립트는 문서를 기술하기 위한 언어(PDL)이며 인터프리터가 존재하며 구글드라이브에서도 열람할 수 있다. PS 파일을 이해하고 요구사항을 준수하여 입력값을 구성하면 플래그를 획득할 수 있다.

The ancient language we are talking about here is PostScript. A shell script file is provided, but this is for extracting a PostScript(PS) file. PostScript is a language for describing documents(PDL), has an interpreter, and also can be viewed on Google Drive. If you understand the PS file and configure the input to comply with the requirements, you can get the flag.

 

 

Hint 1.

A proper debugger can help save time.

적절한 디버거는시간을 단축하는 데 도움이 된다.

https://github.com/luser-dr00g/debug.ps

 

Hint 2.

PostScript works on a stack basis. As soon as a string is entered, it is already put in the stack.

포스트 스크립트는 스택 기반으로 동작한다. 문자열을 입력하는 순간 스택에 들어간다.

 

Hint 3.

XOR operation is everything.

XOR 연산이 전부이다.

 

 

* Check the link below for full write-up details.   

* 전체 라잇업 내용은 아래 링크 확인.    

 

< FULL WRITE UP >

 

 

March 11, 2022

Square CTF 2018 gofuscated write up

 

< Success #3, Own this NFT! (Link) > 

Just click the ♡ of the NFT to receive the free airdrop.


▶ How to play
Download the provided file(Link).
제공되는 파일 다운로드.

The very first settlers didn't have a lot of confidence in their hand-assembled C6 system. They therefore built C7, an advanced defense system written in Golang.
초기에 제작된 C6 시스템은 저수준 언어로 한땀 한땀 제작되었으나 확신을 주지 못했다. 그래서 이후 C7 시스템을 Go 언어로 견고하게 제작하여 도입하였다.

Given the source code, can you find the correct input?
여기 그 소스 코드가 있다. 올바른 입력값을 찾도록 한다.

 

The source code is provided and it is a reversing challenge to analyze it. In the past, challenges with the -fuscated keyword were characterized by difficulties in understanding due to rarely used grammar, etc., but there is a possibility this time as well.

소스 코드가 제공되며 이를 분석하는 리버싱 챌린지이다. 과거에도 -fuscated(혼란스러운) 키워드가 붙은 챌린지는 잘 활용하지 않는 문법 등으로 이해하기 어려운 것이 특징이었는데 이번에도 그럴 가능성이 있다.

 

Hint 1. 

Changing the order of the source code allows for quick testing.

소스 코드의 순서를 변경하면 빠른 테스트를 수행할 수 있다.


Hint 2.

You must pass the test to get the correct flags.

테스트를 통과해야 올바른 플래그를 획득할 수 있다. 


Hint 3.

Characteristics of random functions.

랜덤 함수의 특징.


 

* Check the link below for full write-up details.   

* 전체 라잇업 내용은 아래 링크 확인.    

 

< FULL WRITE UP >


February 22, 2022

Square CTF 2018 gates of hell write up

< Success #2, Own this NFT! (Link) > 

Just click the ♡ of the NFT to receive the free airdrop. 


▶ How to play
# docker run --rm --env PORT=80 -p 8081:80 squarectf/gates-of-hell

C6 is a Linux based system. It was brought to Charvis by the very first settlers. You found a USB drive with a copy of the executable.

C6은 리눅스 기반 시스템으로, 초기 정착민들이 차비스로부터 가져왔다. 여기 USB에 해당 시스템의 복사본 실행 파일이 있다.

Now, all you need to do is figure out the correct input to disable C6 through its online interface.

이제, 해당 시스템의 온라인 인터페이스에 올바른 값을 입력하여 비활성화한다.

 

This is a reversing challenge where an online interface and an executable file are provided for analyzing. The provided file is gates_of_hell.tar.gz, and when decompressing twice, the gates_of_hell file is created. This is a 32-bit Linux executable file with symbol information removed. No other protection techniques such as PIE were applied.

온라인 인터페이스와 실행 파일이 제공되며 이를 분석하는 리버싱 챌린지이다. 제공되는 파일은 gates_of_hell.tar.gz이며 2회 압축 해제 시 gates_of_hell 파일이 생성된다. 이는 심볼 정보가 제거된 32비트 리눅스 실행 파일이다. 기타 PIE 등 보호 기법은 적용되지 않았다.

 

Hint 1. 

When entering parameters, do not exceed the 1-byte range.

파라미터를 입력할 때 1바이트 범위를 초과하지 않는다.


Hint2.

There is assembly code that cannot be viewed by the decompiler.

디컴파일러로 확인할 수 없는 어셈블리 코드가 존재한다.


 

* Check the link below for full write-up details.   

* 전체 라잇업 내용은 아래 링크 확인.    

 

< FULL WRITE UP > 


February 01, 2022

How to print coordinates on the screen with Python

 


 

import matplotlib.pyplot as plt

x = [100, 500, 100, 500 ]
y = [100, 500, 500, 100 ]

plt.fill(x, y, color="lightgray")
plt.show()

 

Using Python's matplotlib module, displaing coordinates is simple. However, the system must support GUI.

파이썬의 matplotlib 모듈을 이용하면 간단히 좌표를 표시할 수 있다. 다만, 시스템이 GUI를 지원해야 한다.

 

Make two lists to store X, Y coordinates. And enter it in the fill() function. Then, the coordinates are automatically represented by the pair. If you specify a color in the color option, you can paint the interior of the coordinate.

x, y 좌표는 각각의 리스트로 생성한다. 이를 fill() 함수에 입력하면 자동으로 쌍을 지어 좌표가 표현된다. color 옵션에 색을 지정하면 좌표 내부 공간을 칠할 수도 있다.

 

How to convert TTF to TTX(XML) with Python


Converting font files using Python is simple. Just call the saveXML() function of the fontTools module. 

 

파이썬을 이용한 폰트 파일 변환은 간단하다. fontTools 모듈의 saveXML() 함수를 호출하면 된다.


from fontTools.ttLib import TTFont

font = TTFont("xxx.ttf")
font.saveXML("xxx.ttx")

1. Input TTF and create an object with TTFont().
2. Call the saveXML() method of the object to save it.
3. Check the generated TTX file in the same directory as the Python file.

1. TTF를 입력하여 TTFont()로 객체를 생성한다.
2. 해당 객체의 saveXML() 메소드를 호출하여 저장한다.
3. 파이썬 파일과 같은 디렉터리에 생성된 TTX 파일을 확인한다.

January 27, 2022

Square CTF 2018 captcha write up


< Success #1, Own this NFT! (Link) >

Just click the ♡ of the NFT to receive the free airdrop. 


▶ How to play
# docker run --rm --env PORT=80 -p 8082:80 squarectf/captcha

 

Charvises(the native species which lived on Charvis 8HD before the first settlers arrived) were very good at math. In a surprising symbiosis relationship between humans and Charvises, it was agreed that the Charvises would be responsible for C8.

차비스족(최초 정착민이 도달하기 전 차비스 8HD 지역에 거주했던 원주민)은 수학에 능통했다. 인간과 차비스족은 서로 우호적이었으며 함께 지냈는데, C8 시스템에 대한 책임은 차비스족이 담당하기로 하였다.

Can you pass their CAPTCHA (Completely Automated Public Turing Test to tell Charvises and Humans Apart)?

자 이제 해당 CAPTCHA(차비스족과 인간을 구분하는 완전 자동화된 공개 튜링 테스트)를 통과해보라.

  

In general, CAPTCHA is a technology used to distinguish between a human and a computer. It means a quiz that requires fluid thinking that humans can do but computers find difficult and If it passes, it is evaluated as a human. There are various methods, such as reading superimposed strings or understanding real images such as bridges and buses.

 

일반적으로 캡차(CAPTCHA)는 사람과 컴퓨터를 구별하기 위해 사용되는 기술이다. 사람은 가능하지만 컴퓨터는 어려워하는 유동적 사고를 요구하는 퀴즈가 출제되며, 만약 통과하면 사람인 것으로 평가한다. 겹쳐져 있는 문자열을 읽거나 교량이나 버스와 같은 실사 이미지를 이해하는 등 다양한 방식이 있다.

 

In this challenge, the middle C in the spelling of captcha is replaced with chavis instead of computer. However, referring to the mention that Chavis is good at math, we can think of the possibility that it is a quiz related to mathematics that is difficult for humans to solve.

 

여기서는 캡차 스펠링 중 중간의 C를 컴퓨터가 아닌 차비스로 바꾸어 사용한다. 그런데 차비스는 수학을 잘한다고 언급된 것을 참고할 때 인간이 풀기 어려운 수학과 관련된 퀴즈일 가능성을 생각해볼 수 있다.

 

 

Hint 1. 

The formula is changed by the font, not the JavaScript code.   

 

수식은 자바스크립트 코드가 것이 아니라 폰트에 의해서 변경된다.   

 

 

Hint 2. 

The correct answer must be submitted with the token.  

 

정답은 토큰과 함께 제출해야 한다.   

 

 

* Check the link below for full write-up details. 

* 전체 라잇업 내용은 아래 링크 확인. 

 

< FULL WRITE UP > 


December 13, 2021

How to update WSL1 to WSL2

 

WSL1 cannot run 32-bit ELF files, so the update to WSL2 is required. The process is as follows.

 

WSL1은 32비트 ELF 파일을 실행할 수 없으므로 WSL2로 업데이트가 필요하다. 해당 과정은 아래와 같다.

 

 

 

1. Check the version.
버전 확인.

> wsl -l -v
  NAME            STATE           VERSION
* Ubuntu-20.04    Stopped         1

 

If the WSL version is 1 when you enter the above command in CMD or Powershell, you need to update it.

 

CMD 또는 파워쉘에서 위와 같이 명령어를 입력했을 때 WSL 버전이 1로 나온다면 업데이트할 필요가 있다.




2. Enable VirtualMachinePlatform option.
VirtualMachinePlatform 옵션 활성화.

> dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

 

Reboot after entering the above command. 


위 명령어를 입력 후에는 재부팅한다.




3. Install Linux Kernel Components.
리눅스 커널 구성요소 설치.

Windows Subsystem for Linux Update Setup (Link)


Reboot after installation is complete. 

 

설치 완료 후 재부팅한다.




4. Apply WSL2.
WSL2 적용.

> wsl --set-version Ubuntu-20.04 2

변환이 진행 중입니다. 몇 분 정도 걸릴 수 있습니다...
WSL 2와의 주요 차이점에 대한 자세한 내용은 https://aka.ms/wsl2를 참조하세요
변환이 완료되었습니다.

> wsl -l -v
  NAME            STATE          VERSION
* Ubuntu-20.04    Stopped        2

 

For the application target, input what is written in "NAME". If the WSL2 application is successful, you can see the string "Conversion is complete" and the number in "VERSION" is changed.


적용 대상은 "NAME"에 적혀있는 것을 입력한다. WSL2 적용 성공 시 "변환이 완료되었습니다."라는 문자열을 확인할 수 있으며 "VERSION"의 숫자가 변경된다.


August 20, 2020

How to free TCP port 9001

 

TCP 9001 port

 

If the System process occupies port 9001 as shown in the picture above, the following solution can be helpful.

 

만약 위 그림과 같이 9001번 포트를 System 프로세스가 점유하고 있다면, 아래와 같은 해결 방법이 도움이 될 수 있다.

 

 

 


Intel(R) Graphics Command Center Service at services


Stop "Intel(R) Graphics Command Center Service" from "run → compmgmt.msc → services". Then the occupied port 9001 is released.

 

"실행 → compmgmt.msc → 서비스"에서 "Intel(R) Graphics Command Center Service"를 중지한다. 그러면 점유 중이던 9001번 포트가 해제된다.

 

August 12, 2020

How to use scapy Python module

❑ How to read packets from pcap.
pcap 파일로부터 패킷 읽기.
from scapy.all import *

pks = rdpcap("./filename.pcap")

for pk in pks:
    if pk.getlayer("IP").sport == 4321:
        layerRaw = pk.getlayer("Raw")

❍ getlayer(): Select a specific network layer.
특정 네트워크 계층을 선택한다.

❍ sport: Source port. 소스 포트.



❑ continue...

July 17, 2020

cURL(Communicate using various protocols)


cURL is a communication tool using various protocols.
cURL은 다양한 프로토콜을 지원하는 통신용 툴.

* Supported: DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP,  IMAPS,  LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, TELNET, TFTP.




1. Feature  특징
❑ Even with minimal installation of the operating system, it is installed.
최소한으로 운영체제를 설치해도 함께 설치됨.
❑ Various references on the Internet.
인터넷에 존재하는 다양한 레퍼런스.




2. How to install  설치 방법
   : No need to install.  설치 불필요.




3. How to use  사용법
❑ GET method - defalt
GET 메소드 - 일반
$ curl -v --get http://ifconfig.me
*   Trying 216.239.36.21:80...
* TCP_NODELAY set
* Connected to ifconfig.me (216.239.36.21) port 80 (#0)
> GET / HTTP/1.1
> Host: ifconfig.me
> User-Agent: curl/7.68.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Date: Thu, 16 Jul 2020 13:45:23 GMT
< Content-Type: text/plain; charset=utf-8
< Content-Length: 13
< Access-Control-Allow-Origin: *
< Via: 1.1 google
<
* Connection #0 to host ifconfig.me left intact
12.xxx.xxx.xxx
$
$ curl -i --get http://ifconfig.me
HTTP/1.1 200 OK
Date: Thu, 16 Jul 2020 13:45:44 GMT
Content-Type: text/plain; charset=utf-8
Content-Length: 13
Access-Control-Allow-Origin: *
Via: 1.1 google

12.xxx.xxx.xxx

-i: Include header.
헤더 포함.

-v: Include detailed description(verbose).
세부 사항 포함.




❑ GET method - parameter
GET 메소드 - 파라미터
$ curl -v --get --data-urlencode "bb=12345<>#" http://ifconfig.me
*   Trying 216.239.34.21:80...
* TCP_NODELAY set
* Connected to ifconfig.me (216.239.34.21) port 80 (#0)
> GET /?bb=12345%3C%3E%23 HTTP/1.1
> Host: ifconfig.me
> User-Agent: curl/7.68.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Date: Thu, 16 Jul 2020 16:06:18 GMT
< Content-Type: text/plain; charset=utf-8
< Content-Length: 13
< Access-Control-Allow-Origin: *
< Via: 1.1 google
<
* Connection #0 to host ifconfig.me left intact
12.xxx.xxx.xxx

--data-urlencode: Transfer parameters using URL encoding.
URL 인코딩을 사용하여 파라미터 전송.




❑ POST method - default
POST 메소드 - 일반
$ curl -X POST --data-urlencode "param1=1<>#" --trace-ascii /dev/stdout http://ifconfig.me
Note: Unnecessary use of -X or --request, POST is already inferred.
== Info:   Trying 216.239.32.21:80...
== Info: TCP_NODELAY set
== Info: Connected to ifconfig.me (216.239.32.21) port 80 (#0)
=> Send header, 145 bytes (0x91)
0000: POST / HTTP/1.1
0011: Host: ifconfig.me
0024: User-Agent: curl/7.68.0
003d: Accept: */*
004a: Content-Length: 17
005e: Content-Type: application/x-www-form-urlencoded
008f:
=> Send data, 17 bytes (0x11)
0000: param1=1%3C%3E%23
== Info: upload completely sent off: 17 out of 17 bytes
== Info: Mark bundle as not supporting multiuse
<= Recv header, 17 bytes (0x11)
0000: HTTP/1.1 200 OK
<= Recv header, 37 bytes (0x25)
0000: Date: Thu, 16 Jul 2020 17:01:14 GMT
<= Recv header, 47 bytes (0x2f)
0000: Content-Type: application/json; charset=utf-8
<= Recv header, 21 bytes (0x15)
0000: Content-Length: 235
<= Recv header, 23 bytes (0x17)
0000: Vary: Accept-Encoding
<= Recv header, 32 bytes (0x20)
0000: Access-Control-Allow-Origin: *
<= Recv header, 67 bytes (0x43)
0000: Set-Cookie: flash=; Path=/; Expires=Thu, 01 Jan 1970 00:00:00 GM
0040: T
<= Recv header, 33 bytes (0x21)
0000: X-Content-Type-Options: nosniff
<= Recv header, 17 bytes (0x11)
0000: Via: 1.1 google
<= Recv header, 40 bytes (0x28)
0000: Expires: Thu, 16 Jul 2020 17:01:14 GMT
<= Recv header, 24 bytes (0x18)
0000: Cache-Control: private
<= Recv header, 2 bytes (0x2)
0000:
<= Recv data, 235 bytes (0xeb)
0000: {.  "ip": "xxx",.  "city": "xxx",.  "region": "xxx
0040: ",.  "country": "xxx",.  "loc": "xxx",.  "org": "xxx
0080: xxx",.  "postal": "xxx",.  "timezone": "xxx",.
00c0: "readme": "https://ipinfo.io/missingauth".}
{
  "ip": "xxx",
  "city": "xxx",
  "region": "xxx",
  "country": "xxx",
  "loc": "xxx",
  "org": "xxx",
  "postal": "xxx",
  "timezone": "xxx",
  "readme": "https://ipinfo.io/missingauth"
== Info: Connection #0 to host ifconfig.me left intact

-i: Include header.
헤더 포함.

--trace-ascii /dev/stdout: Print sending/receiving contents to the standard output device. This can identify the body.
표준 출력 장치로 송수신 내용을 출력. 이렇게 하면 바디를 확인할 수 있다.




❑ POST method - JSON
POST 메소드 - JSON
$ curl -X POST -d '{"param1":1, "param2":2}' -H "Content-Type: application/json" --trace-ascii /dev/stdout http://ifconfig.me
Note: Unnecessary use of -X or --request, POST is already inferred.
== Info:   Trying 216.239.38.21:80...
== Info: TCP_NODELAY set
== Info: Connected to ifconfig.me (216.239.38.21) port 80 (#0)
=> Send header, 128 bytes (0x80)
0000: POST / HTTP/1.1
0011: Host: ifconfig.me
0024: User-Agent: curl/7.68.0
003d: Accept: */*
004a: Content-Type: application/json
006a: Content-Length: 24
007e:
=> Send data, 24 bytes (0x18)
0000: {"param1":1, "param2":2}
== Info: upload completely sent off: 24 out of 24 bytes
== Info: Mark bundle as not supporting multiuse
<= Recv header, 17 bytes (0x11)
0000: HTTP/1.1 200 OK
<= Recv header, 37 bytes (0x25)
0000: Date: Thu, 16 Jul 2020 16:57:27 GMT
<= Recv header, 47 bytes (0x2f)
0000: Content-Type: application/json; charset=utf-8
<= Recv header, 21 bytes (0x15)
0000: Content-Length: 235
<= Recv header, 23 bytes (0x17)
0000: Vary: Accept-Encoding
<= Recv header, 32 bytes (0x20)
0000: Access-Control-Allow-Origin: *
<= Recv header, 67 bytes (0x43)
0000: Set-Cookie: flash=; Path=/; Expires=Thu, 01 Jan 1970 00:00:00 GM
0040: T
<= Recv header, 33 bytes (0x21)
0000: X-Content-Type-Options: nosniff
<= Recv header, 17 bytes (0x11)
0000: Via: 1.1 google
<= Recv header, 40 bytes (0x28)
0000: Expires: Thu, 16 Jul 2020 16:57:27 GMT
<= Recv header, 24 bytes (0x18)
0000: Cache-Control: private
<= Recv header, 2 bytes (0x2)
0000:
<= Recv data, 235 bytes (0xeb)
0000: {.  "ip": "12.xxx.xxx.xxx",.  "city": "Seoul",.  "region": "xxx
0040: ",.  "country": "xxx",.  "loc": "xxx",.  "org": "xxx
0080: xxx",.  "postal": "xxx",.  "timezone": "xxx",.
00c0: "readme": "https://ipinfo.io/missingauth".}
{
  "ip": "12.xxx.xxx.xxx",
  "city": "xxx",
  "region": "xxx",
  "country": "xxx",
  "loc": "37xxx",
  "org": "xxx",
  "postal": "xxx",
  "timezone": "xxx",
  "readme": "https://ipinfo.io/missingauth"
== Info: Connection #0 to host ifconfig.me left intact

-d: Include unencoded body.
인코딩 되지 않은 바디를 포함.

-H: Set header.
헤더 설정.




❑ File download
파일 다운로드
$ curl -O https://github.com/blackbird71SR/Hello-World/archive/master.zip
% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current100   130  100   130    0     0   4814      0 --:--:-- --:--:-- --:--:--  4814

-O: Download without changing the file name.
파일 이름을 변경 없이 다운로드.

June 10, 2020

What is REST(Representational State Transfer)


❑ REST(Representational State Transfer)
❍ Communication way of client↔server.
클라이언트↔서버의 통신 방식.
❍ An architecture style (type) for the purpose of communication using URI and HTTP.
URI와 HTTP를 이용한 통신 목적의 아키텍처 스타일(유형).
* URI(Uniform Resource Identifier): Name for identifying resources such as pictures, documents and videos.
그림, 영상 등의 자원 식별용 이름.
* Architecture style(아키텍처 스타일): Type of architecture(structure). 아키텍처(구조)의 종류(유형, 스타일, 타입).
e.g.
Client-Server(클라이언트/서버)
Repository(저장소)
Pipe/Filter(파이프/필터)
REST.

❑ RESTful: REST applied system.
REST가 적용된 시스템.

❑ REST API: REST applied API.
REST가 적용된 API.

❑ The system that provides REST API is RESTful.
REST API를 제공하는 시스템은 RESTful이다.




To be precise, REST should satisfy the following conditions.
정확하게는, REST는 아래 조건을 만족해야 한다.

1. Uniform interface: It conforms to the interface specified by URI use, HTTP method use, RPC not called, etc.

1. 일관된 인터페이스(Uniform interface): URI 사용, HTTP 메소드 사용, RPC 미호출 등으로 지정된 인터페이스를 준수한다.



2. Client-Server: The client sends a request message to the server, and the server sends a response message about the request.

2. 클라이언트/서버(Client-Server): 클라이언트는 서버에 요청(request) 메시지를 전송하고 서버는 요청에 대한 응답(response) 메시지를 전송한다.



3. Statelessness: Communication is possible without a previous situation(context) such as a session.

3. 비연결성(Statelessness): 세션 등 이전 상황(문맥) 없이도 통신할 수 있다.



4. Cacheable: The server's response message can be cached (stored and reused).

4. 캐시 가능(Cacheable): 서버의 응답 메시지는 캐싱(저장 후 재사용)될 수 있다.



5. Layered system: Roles are separated by hierarchy. Therefore, even if roles (load balancing, authentication, etc.) are added/removed in the middle, communication is not affected.

5. 계층화된 시스템(Layered system): 계층별로 기능이 분리된다. 그러므로 중간에 기능(로드 밸런싱, 인증 등)이 추가/제거되어도 통신에 영향을 주지 않는다.



6. Code on demand(option): For easy data processing, the server can send a script to be executed on the client.

6. 주문형 코드(Code on demand)(선택): 손쉬운 데이터 처리를 위해 서버는 클라이언트에서 실행될 스크립트를 전송할 수 있다.

June 04, 2020

How to send a link message using javascript in KAKAO talk.


To send a link message using javascript in KAKAO talk, the API source provided by Kakao Developers is requred.

자바스크립트를 이용하여 카톡 링크 메시지를 전송하려면 카카오 개발자(Kakao Developers) 페이지에서 제공하는 API 관련 소스가 필요합니다.

Follow the steps below.
다음의 순서를 따라하면 됩니다.

1. Create an application on the Kakao Developers site.
1. Kakao Developers 사이트에서 애플리케이션 생성.

2. Obtain the Javascript API key from "App Key" and reflect it in the source code below.
2. "앱 키"에서 Javascript API 키를 획득 후 아래 소스코드에 반영.

3. In "Platform" → "Web", add the domain to add the source code below and the domain to connect to.
3. "플랫폼" → "Web"에서 아래의 소스코드를 추가할 도메인과 연결할 도메인 추가.
*e.g. http://localhost:8081

4. Create a message template in "Kakao Link".
4. "카카오링크"에서 메시지 템플릿 작성.

5. Execute the source code below.
5. 아래 소스코드를 실행.
* python3 -m http.server 8081 → http://localhost:8081

< index.html >

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>카톡 공유</title>
<script type="text/JavaScript" src="https://developers.kakao.com/sdk/js/kakao.min.js"></script>
</head>
<body>
    <input type="button" onClick="sendLinkCustom();" value="Custom"/>
    <input type="button" onClick="sendLinkDefault();" value="Default"/>

<script type="text/javascript">
    function sendLinkCustom() {
        Kakao.init("[Javascript API key]");
        Kakao.Link.sendCustom({
            templateId: [templete id]
        });
    }
</script>

<script>
try {
  function sendLinkDefault() {
    Kakao.init('[Javascript API key]')
    Kakao.Link.sendDefault({
      objectType: 'feed',
      content: {
        title: '딸기 치즈 케익',
        description: '#케익 #딸기 #삼평동 #카페 #분위기 #소개팅',
        imageUrl:
          'http://k.kakaocdn.net/dn/Q2iNx/btqgeRgV54P/VLdBs9cvyn8BJXB3o7N8UK/kakaolink40_original.png',
        link: {
          mobileWebUrl: 'https://developers.kakao.com',
          webUrl: 'https://developers.kakao.com',
        },
      },
      social: {
        likeCount: 286,
        commentCount: 45,
        sharedCount: 845,
      },
      buttons: [
        {
          title: '웹으로 보기',
          link: {
            mobileWebUrl: 'https://developers.kakao.com',
            webUrl: 'https://developers.kakao.com',
          },
        },
        {
          title: '앱으로 보기',
          link: {
            mobileWebUrl: 'https://developers.kakao.com',
            webUrl: 'https://developers.kakao.com',
          },
        },
      ],
    })
  }
; window.kakaoDemoCallback && window.kakaoDemoCallback() }
catch(e) { window.kakaoDemoException && window.kakaoDemoException(e) }
</script>
   
</body>
</html>

May 25, 2020

no-more-secrets(decryption effect)


https://github.com/bartobri/no-more-secrets

The Linux software for data decryption effect.
암호 복호화(해독) 효과를 위한 리눅스 소프트웨어.


1. Feature  특징
❑ Open source(GPL 3.0).
오픈소스(GPL 3.0).
❑ Easy-to-use interface.
사용하기 쉬운 인터페이스.
❑ Realizing the decryption effect that viewed in movie(Link).
영화 속 복호화 효과를 구현.




2. How to install  설치 방법
❑ Linux
# git clone https://github.com/bartobri/no-more-secrets.git
# cd ./no-more-secrets
# make nms
# make sneakers   → If you want to imitate a movie.
# make install




3. How to use  사용법
❑ Ordinary usage.  
일반적인 사용방법.
$ ls -al | nms
(And press any key to decrypt. 복호화 하려면 아무 키나 입력)

Like the movie.
영화 따라하기.
 $ sneakers

May 02, 2020

How to add line number and syntax highlight using JavaScript.

SyntaxHighlighter.js library makes it easy to highlight line numbers and highlights.
SyntaxHighlighter.js 라이브러리를 이용하면 쉽게 라인 번호와 하이라이트가 가능하다.

Based on the code below, you can modify and use according to your preference.
아래의 코드를 바탕으로 개인에 기호에 따라 수정하여 사용하면 된다.






 
// Insert Source code Here.
function abc(){
    console.log("Hello, world!");
}

The "shBrushXXX.min.js" code is used for highlighting purposes. The computer language(syntax) you wish to highlight can be set to "class = 'brush: XXX;'" in the "pre" element.
"shBrushXXX.min.js" 코드는 하이라이트 목적으로 사용된다. 하이라이트를 희망하는 컴퓨터 언어(문법)는 "pre" 엘리먼트에 "class='brush:XXX;'"로 설정한다.

See the link below for detailed highlight settings.
세부 하이라이트 설정은 아래 링크를 참조한다.


You can specify the line number to start with "first-line: XXX". See the links below for detailed options.
"first-line: XXX"로 시작할 라인 번호를 지정할 수 있다. 기타 세부 옵션은 아래 링크를 참조한다.



CORS and JavaScript.

This summary is not available. Please click here to view the post.

December 31, 2019

What is Cyber kill chain



Cyber kill chain
사이버 킬 체인

Kill Chain is a preemptive attack strategy proposed to defend Iraqi missiles in the Gulf War (1991).
킬 체인은 걸프전(1991)에서 이라크군의 미사일을 방어하기 위해 제시된 선제 공격형 방어 전략이다.

The term is generally means to detect missile launch signs and strike missile launcher in advance.
일반적으로는 발사 징후를 탐지하여 사전에 미사일 시설을 타격한다는 의미로 사용된다.

This is because it is technically easier than shooting down missiles that have already been launched.
이는 이미 발사된 미사일을 격추하는 것보다 기술적으로 수월하기 때문이다.

The key of this strategy is the concept of blocking an attack by breaking(kill) the intermediate process(chain) of enemy activity leading to an attack.
이 전략의 핵심은 적의 활동이 공격으로 이어지는 중간 과정을(chain) 끊어버림으로써(kill) 공격을 차단한다는 개념이다.

The first use of the word cyber kill chain was weapon company Lockheed Martin(2011).
사이버 킬 체인이란 단어를 최초 사용한 곳은 방위산업체 록히드 마틴(2011)이다.

Cyber Kill Chain is a defense strategy against cyber attacks and suggests each countermeasure according to the 7 stages of enemy APT attacks.
사이버 킬 체인은 사이버 공격에 대한 방어 전략이며, 적의 APT 공격의 7단계에 따른 각각의 대응 방법을 제시한다.

The key here is to prevent the final attack by taking appropriate steps at each stage.
여기에서의 핵심은 각 단계별 적절한 대응을 통해 최종적인 공격을 예방하는 것이다.

This does not include the meaning of preemptive strikes against attackers as in the kill chains used by the military.
이는 군에서 사용하는 킬 체인에서처럼 공격 주체에 대한 선제 타격의 의미는 포함되어 있지는 않다.

However, they have something in common in terms of proactive attack prevention.
그러나 사전 대응을 통한 공격 차단이라는 측면에서는 공통점이 있다.

The reason this strategy can defended is in the property of the attack.
이러한 전략으로 방어가 가능한 이유는 공격의 특성에 있다.

There are many steps in the attack, and the previous stage is required to move on to the next stage.
공격에는 단계가 있으며 이전 단계는 다음 단계로 진행하기 위해 필수적으로 요구되기 때문이다.

For example, in order to launch a missile, there are steps to enter the target's coordinates.
예를 들어 미사일을 발사하기 위해서는 목표물의 좌표를 입력해야 하는 단계가 있다.

When this process takes place, disturbing the enemy's information system causes malfunctions such as entering wrong coordinates, the attack can be fails.
이 과정이 이루어지는 시점에 적의 정보 체계를 교란하면 잘못된 좌표를 기입하게되는 등의 오작동이 유발되어 결국 공격에 실패하게 된다는 원리이다.

This strategy is more active than traditional action that only after an attack occurs, since the concept of "prevention" is included.
이러한 전략은 "예방"이라는 개념이 포함되기에 비로소 공격이 발생한 이후에야 급히 대응하는 전통적인 대응 방식보다 적극적이다.

Lockheed Martin's cyber kill chain concept presents seven steps leading up to an attack. If you interrupt any of the intermediate steps, the attack will fail.
록히드 마틴의 사이버 킬 체인 개념은 공격으로 귀결되기까지의 단계를 7가지로 제시하였으며 다음과 같다. 중간 과정 중 하나라도 끊으면 공격은 실패하게 된다.

1. Reconnaissance: Identify, investigate, and select attack targets.
정찰: 공격 목표 식별, 조사, 선정.
2. Weaponization: Select and prepare cyber weapons for intrusion.
무기화: 침투용 사이버 웨폰 선정, 준비.
3. Delivery: Deploy cyber weapon.
운반: 사이버 웨폰 배치.
4. Exploitation: Intrude the system through the use of cyber weapons.
취약점 공격: 사이버 웨폰 사용을 통한 시스템 침투.
5. Installation: Install malicious code on intruded systems.
설치: 침투한 시스템에 악성 코드 설치.
6. C&C(command & control): Build a remote control environment with the malicious code.
지휘통제: 악성 코드로 원격 제어 환경 구축.
7. Actions on objectives: Achieve goals such as information leakage and system destruction.
공격 전개: 정보 유출, 시스템 파괴 등의 목표 달성.

See the links below for how to respond to each step.
각 단계에 대한 대응 방법은 아래 링크를 참조한다.
https://www.lockheedmartin.com/content/dam/lockheed-martin/rms/documents/cyber/Gaining_the_Advantage_Cyber_Kill_Chain.pdf

October 22, 2019

What is Browser fingerprinting #1


How to track activity by identifying users via a browser.
브라우저를 매개로 사용자를 식별하여 활동을 추적하는 방법.

In many cases, cookie is used to track user activity, but browser fingerprinting can be used to track users without cookies.
많은 경우 쿠키를 통해 사용자 활동을 추적하지만, 브라우저 핑거프린팅을 이용하면 쿠키 없이도 추적할 수 있다.

Information can be collected includes:
수집 가능하다고 알려진 정보로는 아래와 같은 것들이 있다.

Language, location, operating system, browser type/version, resolution, search keyword, voice, web cam image, time zone, plugins, keyboard/mouse gestures, available fonts, GPU information, sites visited, etc.
사용 언어, 위치, 운영 체제, 브라우저 종류/버전, 해상도, 검색어, 목소리, 웹 캠 영상, 타임 존, 사용하는 플러그인, 키보드/마우스 동작, 가용한 폰트, GPU 정보, 방문했던 사이트 등

The collected information can be combined to identify each individual.
수집된 정보들을 조합하면 각 개인을 식별할 수 있다.

Browser fingerprinting information is rarely the same. There was a claim that one in every 280,000 was the same.
브라우저 핑거프린팅 정보가 동일한 경우는 드물다. 28만명당 1명꼴로 동일하다는 주장도 있었다.
https://panopticlick.eff.org/static/browser-uniqueness.pdf

Browser fingerprinting is typically used for the purpose of targeting advertising.
브라우저 핑거프린팅은 타게팅 광고를 목적으로 사용되는 것이 대표적이다.

One YouTuber did an experiment. When he launched a Chrome browser and mentioned a certain keyword several times, the related advertisements appeared.
어느 유튜버가 관련된 실험을 하기도 했었다. 크롬 브라우저를 띄운 상태에서 자연스럽게 특정 키워드를 여러 번 언급했더니 관련 광고가 나오더라는 것이다.
https://youtu.be/zBnDWSvaQ1I

It can be a little creepy for someone to intercept personal information, but it's usually harmless. But if someone has a bad heart, it can be misused, so be careful.
개인정보를 누군가 감청한다는 것이 조금 크리피할 수는 있지만 대체로 무해하다. 하지만 누군가 나쁜 마음을 먹으면 악용될 소지가 있으므로 주의가 요구된다.

October 07, 2019

What is the credential stuffing




크리덴셜 스터핑(Credential stuffing)

- 크리덴셜(Credential): Encrypted authentication information.
암호화된 인증 정보.

- 스터핑(Stuffing): Fill it up. Push. → Large amount of attempt.
채워 넣기. 밀어 넣기. → 다량의 시도.

크리덴셜 스터핑(Credential stuffing)
Submitting a large amount of credentials to the certification system. Mass login attempt. Brute Force.
인증 시스템에 크리덴셜을 다량으로 제출하는 것. 다량 로그인 시도. 브루트 포스.


[Process] 발생 과정
1. Inappropriate security habits of individuals: Use the same password on multiple sites, or reuse old passwords on other sites.
1. 개인의 부적절한 보안 습관: 여러 사이트에서 동일한 비밀번호를 사용하거나, 과거 사용하던 비밀번호를 다른 사이트에서 재활용한다.

2. Security issue occurs: Due to security vulnerabilities, personal information (credentials) of certain institutions are leaked and distributed on the black market.
2. 보안 이슈 발생: 보안 취약점으로 인해 특정 기관의 개인정보(크리덴셜)가 유출되며 암시장에서 유통된다.

3. Inappropriate security response of institution: Failure to detect credential stuffing attacks or lack of capability or manpower may be limited timely response.
3. 기관의 부적절한 보안 대응: 크리덴셜 스터핑 공격을 탐지하지 못하거나, 능력이나 인력 부족 등으로 적시 적절한 대응이 제한될 수 있다.

4. Account hijacked by credential stuffing attack:
Although the success rate is low, it is reported that hijacking hundreds of thousands of accounts is possible if attempted at various sites using tens of millions of credentials. There is also a popular attack tool for this.
4. 크리덴션 스터핑 공격으로 계정 탈취: 성공률은 낮지만, 수백-수천만 개의 크리덴셜로 다양한 사이트에서 시도하다 보면 수십만 개의 계정을 탈취하는 것이 확률상 불가능하지 않은 것으로 보고되고 있다. 이를 위한 유명한 공격 툴도 존재한다
* SentryMBA, Vertex Cracker, Account Hitman etc.

5. Damages: Various threats such as public threats to social media, account deletion, account sales, opening of fake accounts, theft of photos, and withdrawal of funds can occur.
5. 피해 발생: SNS 등에 공개 협박을 받거나, 계정 삭제, 계정 판매, 대포통장 개설, 사진 도용, 자금 인출 등의 다양한 피해가 발생할 수 있다.