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>