728x90
반응형
Open to Debate 1(domestic topic)
&
Open to Debate 2(International topic)

additional Arirang TV(News)

 

Contents

Acknowledgements

Introduction

Suggestions to the teacher

 

Open to Debate 1 (Revised Edition) : 70 Korean Issues Open to Dabate 2 (Revised Edition) : 70 International Issues
UNIT 01 Korea’s Greatest Hero
UNIT 02 Smart Phone Addiction
UNIT 03 An Evening of Pork, Rice & Soju
UNIT 04 Most Stressful Day of the Week?
UNIT 05 The Value of a Woman’s Work?
UNIT 06 Rising Obesity in Korea
UNIT 07 Plastic Surgery
UNIT 08 Subway Suicides
UNIT 09 Healthy Supplements
UNIT 10 Korean Special Days for Couples
UNIT 11 Are boys Better?
UNIT 12 TV: Good or Bad Influence?
UNIT 13 Foreign Car Ownership
UNIT 14 Gambling & Suicide
UNIT 15 English for kindergartners
UNIT 16 Life Expectancy
UNIT 17 Teenagers Smoking
UNIT 18 Traffic Accidents in Korea
UNIT 19 Adoption in Korea
UNIT 20 Business & Social Responsibility
UNIT 21 Planning for Retirement
UNIT 22 Conscientious Objectors
UNIT 22 Low Birth Rate
UNIT 24 Sexual Harassment
UNIT 25 Cleaning Up Dog Poop
UNIT 26 Studying Overseas
UNIT 27 Internet Etiquette
UNIT 28 Soju = The National Drink?
UNIT 29 Charitable Giving in Korea
UNIT 30 Dog Owners & Dog Meat
UNIT 31 Discrimination Based in Looks
UNIT 32 What Is Happiness?
UNIT 33 Spam Spam & More Spam!
UNIT 34 The Gender Gap in Korea
UNIT 35 US Troops in Korea
UNIT 36 Korean Elderly Living Alone
UNIT 37 The Physically Disabled in Korea
UNIT 38 Not in My Backyard (NIMBY)
UNIT 39 Do the Japanese Trust Koreans?
UNIT 40 Foreign Visitors to Korea
UNIT 41 20-Something Korean Women
UNIT 42 A Bounty on Fake Goods
UNIT 43 Taxes!
UNIT 44 Trouble at Work
UNIT 45 Divorce in Korea
UNIT 46 Indebtedness
UNIT 47 Pre-marital Sex
UNIT 48 The High Cost of Dying
UNIT 49 Yellow Dust
UNIT 50 Miss Korea: A Sexist Contest?
UNIT 51 College Admission for Sale?
UNIT 52 Adultery Law Abolished
UNIT 53 Sex Offenders: Punished Enough?
UNIT 54 Wasted Welfare?
UNIT 55 Prostitution in Korea
UNIT 56 Career Students
UNIT 57 Reduce Military Service?
UNIT 58 Labor Unions
UNIT 59 Organ Trafficking
UNIT 60 Delayed Marriage Registration
UNIT 61 Low Construction Standards
UNIT 62 Korean PhDs
UNIT 63 Childless Couples
UNIT 64 Avoiding Foreigners
UNIT 65 Transsexuals & Gender Registration
UNIT 66 Abolish the Death Penalty?
UNIT 67 How Transparent Is Korea?
UNIT 68 Benefits of the FTA
UNIT 69 Plagiarism in Korea
UNIT 70 North-South Reunification
UNIT 01 The Five Biggest Regrets before Death
UNIT 02 Dangerous Sports
UNIT 03 Internet Addiction
UNIT 04 Road Rage
UNIT 05 Frivolous Lawsuits
UNIT 06 Domestic Violence
UNIT 07 Cage-Free Eggs and Animal Welfare
UNIT 08 Wasted Food
UNIT 09 Social Networking Services
UNIT 10 Human Trafficking
UNIT 11 Excessive Police Violence against Minorities
UNIT 12 Bullfighting
UNIT 13 Gun Violence in America
UNIT 14 Wrongfully Imprisoned
UNIT 15 Breastfeeding in Public
UNIT 16 Sugar Daddies and Sugar Babies
UNIT 17 Legalization of Marijuana?
UNIT 18 The Blame for Internet Spam
UNIT 19 Same-Sex Marriage
UNIT 20 Transgender Restrooms
UNIT 21 Asian Americans: Facing Discrimination?
UNIT 22 Eating Live Animals
UNIT 23 Cruelty to Animals
UNIT 24 An Apology for Hiroshima?
UNIT 25 Fur Coats
UNIT 26 Discrimination against Muslims
UNIT 27 Once a Cheater, Always a Cheater?
UNIT 28 Finding Mr./Ms. Right
UNIT 29 Bullying in Public Schools
UNIT 30 The Death of Marriage?
UNIT 31 Wealthy Pastors: Truly Serving God?
UNIT 32 Proliferation of Drones
UNIT 33 Future Foods
UNIT 34 Grade Inflation
UNIT 35 Underpaid Actresses
UNIT 36 American Universities and Chinese Students
UNIT 37 Cosmetics for Men?
UNIT 38 The 40-Year-Old Virgin
UNIT 39 Secret Lottery Winners?
UNIT 40 Male and Female: Attitudes toward Sex
UNIT 41 Date Rape
UNIT 42 Sexting
UNIT 43 Cheating Students
UNIT 44 Nonstop Hacking
UNIT 45 Preserving the Rain Forest
UNIT 46 Drug Cartels
UNIT 47 Euthanasia
UNIT 48 Israel versus Palestine
UNIT 49 Democrats and Republicans
UNIT 50 Racial Equality in the U.S.
UNIT 51 Artificial Intelligence
UNIT 52 An Apology for Slavery?
UNIT 53 Climate Change
UNIT 54 The British Monarchy
UNIT 55 Climbing Mount Everest
UNIT 56 World Religions
UNIT 57 Scientology
UNIT 58 China versus the U.S.
UNIT 59 Illegal Immigration to the U.S.
UNIT 60 The Death Penalty
UNIT 61 Religious Veils in Public Places
UNIT 62 Women’s Rights in Saudi Arabia
UNIT 63 Indian Housewives: Shocking Rate of Suicide
UNIT 64 Addiction to Prescription Drugs
UNIT 65 Claiming the Arctic and Antarctic
UNIT 66 India versus Pakistan
UNIT 67 The Sunni and the Shia
UNIT 68 Chemical Weapons
UNIT 69 A Colony on Mars?
UNIT 70 National Foods

 

 

728x90
728x90
728x90
반응형
목차
1. 입력
  1) 변수
  2) 형 변환
2. 논리 자료형(Boolean Data)
  1) 논리 자료형
  2) 비교 연산자
  3) 논리 연산자
3. 조건문
  1) if문
  2) elif문
  3) else문

[Review] (1주차) 기초 자료형

2022.07.10 - [Dev/Python] - [Python] 01 기초 자료형 - week.01

 

[Python] 01 기초 자료형 - week.01

목차 1. print() 2. 기본 자료형: 숫자형, 문자열, 리스트 3. 변수 4. 연산: 사칙연산, 특수연산, 문자열 연산 5. 인덱싱과 슬라이싱 1. print() Point I print() : 문자열을 출력하는 명령어 print("Hello Rabbit..

sarahee.tistory.com


1. 입력

Point I
변수 = input() : 변수에 입력받은 값을 집어넣겠다는 의미

var = input()

Point II
어떤 것을 입력하든 문자열로 입력되기 때문에 형 변환이 필요
int() : 정수형 변환, str() : 문자열 변환 등…

var1 = input() #4 입력
var1 = int(var1)
var2 = int(input()) #3 입력
print(3+var1+var2) #10 출력

2. 논리 자료형(Boolean Data)

Point I
논리 자료형 : 참(True) 혹은 거짓(False)을 나타내는 자료형

True, False

Point II
비교 연산자 : 숫자나 문자의 값을 비교하는 연산자
주어진 진술이 참이면 True, 거짓이면 False

A == B #A와 B가 같다
A != B #A와 B가 다르다
A >= B #A가 B보다 크거나 같다
A <= B #A가 B보다 작거나 같다
A > B #A가 B보다 크다
A < B #A가 B보다 작다

print(3 == 3) #True
print(3 != 3) #False

Point III
논리 연산자 : 논리 자료형 사이의 연산

AND : 각 논리가 모두 True이면 결과가 True  
OR : 각 논리 중 True가 존재하면 결과가 True  
NOT : 논리값을 뒤집는 연산

3. 조건문

조건에 따라 특정 명령을 수행하는 구문

Point I
if문 : 조건이 참이면 명령을 수행

if a >= 5:
    print("a는 5 이상입니다!")

Point II
elif문 : 이전 조건이 거짓인 상황에서 조건이 참이면 명령을 수행

if a >= 5:
    print("a는 5 이상입니다!")
elif a >= 3:
    print("a는 3 이상 5 미만입니다!")

Point III
else문 : 위의 조건에 해당하지 않는 모든 경우에 수행

if a >= 5:
    print("a는 5 이상입니다!")
elif a >= 3:
    print("a는 3 이상 5 미만입니다!")
else:
    print("a는 3 미만입니다!")

Point IV
조건문에 들어가는 명령들은 같은 들여쓰기로 구분(Tab 사용)


[Next] (3주차) 리스트

2022.07.28 - [Development/Python] - [Python] 03 리스트 - week.03

 

[Python] 03 리스트 - week.03

목차 1. 리스트 활용 1) append(d) 2) insert(i, d) 3) remove(d) 4) sort() 2. 시퀀스 자료형 1) 인덱싱, 슬라이싱 2) in: 멤버 조회 3) len: 길이 확인 4) 연결(+), 반복(*) [Review] (2주차) 조건문 2022.07.22..

sarahee.tistory.com

 

728x90
728x90
728x90
반응형

[Review] (5주차) 실습

2022.07.16 - [Dev/Swift] - [Xcode] iOS Swift 앱 개발 Byte Degree - week.05

 

[Xcode] iOS Swift 앱 개발 Byte Degree - week.05

[Review] (4주차) 실습 2022.07.10 - [Dev/Swift] - [Xcode] iOS Swift 앱 개발 Byte Degree - week.04 [Xcode] iOS Swift 앱 개발 Byte Degree - week.04 [Review] (3주차) 실습 2022.07.01 - [Swift] - [Xcode]..

sarahee.tistory.com


최종 구현

 

그리드 레이아웃 변경 작업

FocusViewController 및 QuickFocusListViewController의  레이아웃 작업 변경(UICollectionViewCompositionalLayout 응용)

 

FocusViewController code 기존 수정 해설
item의 .fractionalWidth(1) 1 0.9 크기 조절
let group = NSCollectionLayoutGroup.vertical(layoutSize: groupSize, subitems: [item]) vertical horizontal 스크롤 방향: 세로 → 가로
section.orthogonalScrollingBehavior = .groupPagingCentered   신규 추가 스크롤 시 item 중앙 정렬
section.contentInsets = NSDirectionalEdgeInsets(top: 10, leading: 20, bottom: 10, trailing: 20) leading: 20, trailing: 20 leading: 5, trailing: 5 좌우 padding 줄이기
group의 .fractionalWidth(1) 1 0.9 item과 동일하게 설정(group padding이 별도로 설정되지 않도록)
section.interGroupSpacing = 10 10 -25 좌우 여백값 조절

 

QuickFocusListViewController code 기존 수정 해설
let group = NSCollectionLayoutGroup.horizontal(layoutSize: groupSize, subitem: item, count: 2) subitem: item, count: 2 subitems: [item] 동적으로 할당하도록 개수  설정 해제
section.orthogonalScrollingBehavior = .continuous   신규 추가 스크롤 시 item 정렬되지 않도록(이동한 만큼 위치)
let group = NSCollectionLayoutGroup.horizontal(layoutSize: groupSize, subitems: [item])
subitems: [item] subitem: item, count: 1 변경사항 복구
section.interGroupSpacing = 20 20 10 좌우 padding 줄이기

QuickFocusListViewController의 UIViewController에서

        let groupSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1), heightDimension: .estimated(50))
        // 기존
//        let group = NSCollectionLayoutGroup.horizontal(layoutSize: groupSize, subitem: item, count: 2)
        // 변경: 유연하게 할당될 수 있도록
		let group = NSCollectionLayoutGroup.horizontal(layoutSize: groupSize, subitems: [item])
        group.interItemSpacing = .fixed(10)
        
        let section = NSCollectionLayoutSection(group: group)
        section.contentInsets = NSDirectionalEdgeInsets(top: 30, leading: 20, bottom: 30, trailing: 20)
        section.interGroupSpacing = 20
        // 추가: .continuous, .groupPagingCentered
        section.orthogonalScrollingBehavior = .continuous

Collection View Cell

수평적으로 화면 조회되지만, 각 화면에 하나의 group만 존재하도록 설정됨

(참고) corner의 값 조절 - 코드에 반영하지 않음

collectionView.collectionViewLayout = layout()
collectionView.delegate = self
// 추가: width의 값이 동적으로 조절
collectionView.clipsToBounds = true

→ group의 fractionalWidth도 item과 동일하게 설정해 주어야 함 + spacing 값 또한 조절


UICollectionViewCompositionalLayout

출처:  https://developer.apple.com/documentation/uikit/uicollectionviewcompositionallayout

func createBasicListLayout() -> UICollectionViewLayout { 
    let itemSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1.0),                                  
                                         heightDimension: .fractionalHeight(1.0))    
    let item = NSCollectionLayoutItem(layoutSize: itemSize)  
  
    let groupSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1.0),                                          
                                          heightDimension: .absolute(44))    
    let group = NSCollectionLayoutGroup.horizontal(layoutSize: groupSize,                                                   
                                                     subitems: [item])  
  
    let section = NSCollectionLayoutSection(group: group)    

    let layout = UICollectionViewCompositionalLayout(section: section)    
    return layout
}

group.interItemSpacing에 int 값을 넣으면 다음과 같은 오류 발생

Cannot assign value of type 'int' to type 'NSCollectionLayoutSpacing?'

 

group size의 fractionWidth를 item size와 동일하게 0.5로 설정할 경우 다음과 같은 화면 조회

두 item처럼 보이는 부분이 하나의 item으로 설정됨

QuickFocusCell의 count를 subitems: [item] → subitem: item, count: 1 설정

좌측부터 차례대로 FocusViewController, QuickFocusListViewController

최종 코드

//
//  FocusViewController.swift
//  HeadSpaceFocus
//
//  Created by sehee on 2022/07/10.
//

import UIKit

class FocusViewController: UIViewController {
    
    @IBOutlet weak var collectionView: UICollectionView!
    @IBOutlet weak var refreshButton: UIButton!
    
    var curated: Bool = false
    var items: [Focus] = Focus.list
    
    typealias Item = Focus
    enum Section {
        case main
    }
    var datasource: UICollectionViewDiffableDataSource<Section, Item>!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        refreshButton.layer.cornerRadius = 10
        
        // Presentation: Diffable Datasource + Cell Provider
        datasource = UICollectionViewDiffableDataSource<Section, Item>(collectionView: collectionView, cellProvider: { collectionView, indexPath, item in
            guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "FocusCell", for: indexPath) as? FocusCell else {
                return nil
            }
            cell.configure(item)
            return cell
        })
        
        // Data: Snapshot
        var snapshot = NSDiffableDataSourceSnapshot<Section, Item>()
        snapshot.appendSections([.main])
        snapshot.appendItems(items, toSection: .main)
        datasource.apply(snapshot)
        
        // Layout
        collectionView.collectionViewLayout = layout()
        collectionView.delegate = self
        
        updateButtonTitle()
    }
    
    private func layout() -> UICollectionViewCompositionalLayout {
        
        let itemSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(0.9), heightDimension: .estimated(50))
        let item = NSCollectionLayoutItem(layoutSize: itemSize)
        
        let groupSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(0.9), heightDimension: .estimated(50))
        let group = NSCollectionLayoutGroup.horizontal(layoutSize: groupSize, subitems: [item])
        
        let section = NSCollectionLayoutSection(group: group)
        section.contentInsets = NSDirectionalEdgeInsets(top: 10, leading: 5, bottom: 10, trailing: 5)
        section.interGroupSpacing = -25
        section.orthogonalScrollingBehavior = .groupPagingCentered
        
        let layout = UICollectionViewCompositionalLayout(section: section)
        return layout
    }
    
    func updateButtonTitle() {
        let title = curated ? "See All" : "See Recommendation"
        refreshButton.setTitle(title, for: .normal)
    }
    
    @IBAction func refreshButtonTapped(_ sender: Any) {
        curated.toggle()
        
        self.items = curated ? Focus.recommendations : Focus.list
        
        var snapshot = NSDiffableDataSourceSnapshot<Section, Item>()
        snapshot.appendSections([.main])
        snapshot.appendItems(items, toSection: .main)
        datasource.apply(snapshot)
        
        updateButtonTitle()
    }
}

extension FocusViewController: UICollectionViewDelegate {
    func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
        let item = items[indexPath.item]
//        print(">>> \(item.title)")
        
        let storyboard = UIStoryboard(name: "QuickFocus", bundle: nil)
        let vc = storyboard.instantiateViewController(withIdentifier: "QuickFocusListViewController") as! QuickFocusListViewController
        vc.title = item.title
//        present(vc, animated: true)
        navigationController?.pushViewController(vc, animated: true)
    }
}
//
//  QuickFocusListViewController.swift
//  HeadSpaceFocus
//
//  Created by sehee on 2022/07/21.
//

import UIKit

class QuickFocusListViewController: UIViewController {
    
    @IBOutlet weak var collectionView: UICollectionView!
    
    let breathingList = QuickFocus.breathing
    let walkingList = QuickFocus.walking
    
    enum Section: CaseIterable {
        case breathe
        case walking
        
        var title: String {
            switch self {
            case .breathe: return "Breathing exercises"
            case .walking: return "Mindful walks"
            }
        }
    }
    
    typealias Item = QuickFocus
    var datasource: UICollectionViewDiffableDataSource<Section, Item>!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        // enum Section CaseIterable 생성한 코드가 다음 내용과 동일
//        Section.allCases
//        let allItems: [Section] = [.breathe, .walking]
        // 생성 코드가 다음과 같이 쓰일 수 있음
//        let section: Section = .breathe
//        section.title
        
        // Presentation
        datasource = UICollectionViewDiffableDataSource<Section, Item>(collectionView: collectionView, cellProvider: { collectionView, indexPath, item in
            guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "QuickFocusCell", for: indexPath) as? QuickFocusCell else {
                return nil
            }
            cell.configure(item)
            return cell
        })
        
        datasource.supplementaryViewProvider = { (collectionView, kind, indexPath) in
            guard let header = collectionView.dequeueReusableSupplementaryView(ofKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier: "QuickFocusHeaderView", for: indexPath) as? QuickFocusHeaderView else {
                return nil
            }
            let allSections = Section.allCases
            let section = allSections[indexPath.section]
            header.configure(section.title)
            return header
        }
        
        // Data
        var snapshot = NSDiffableDataSourceSnapshot<Section, Item>()
        snapshot.appendSections([.breathe, .walking])
        // 위의 코드와 동일
//        snapshot.appendSections(Section.allCases)
        snapshot.appendItems(breathingList, toSection: .breathe)
        snapshot.appendItems(walkingList, toSection: .walking)
        datasource.apply(snapshot)
        
        // Layout
        collectionView.collectionViewLayout = layout()
        self.navigationItem.largeTitleDisplayMode = .never
    }
    private func layout() -> UICollectionViewCompositionalLayout {
        let itemSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(0.5), heightDimension: .estimated(50))
        let item = NSCollectionLayoutItem(layoutSize: itemSize)
        
        let groupSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(0.5), heightDimension: .estimated(50))
        let group = NSCollectionLayoutGroup.horizontal(layoutSize: groupSize, subitem: item, count: 1)
        group.interItemSpacing = .fixed(10)
        
        let section = NSCollectionLayoutSection(group: group)
        section.contentInsets = NSDirectionalEdgeInsets(top: 30, leading: 20, bottom: 30, trailing: 20)
        section.interGroupSpacing = 10
        section.orthogonalScrollingBehavior = .continuous
        
        let headerSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1), heightDimension: .absolute(50))
        let header = NSCollectionLayoutBoundarySupplementaryItem(layoutSize: headerSize, elementKind: UICollectionView.elementKindSectionHeader, alignment: .top)
        section.boundarySupplementaryItems = [header]
        
        let layout = UICollectionViewCompositionalLayout(section: section)
        return layout
    }
}

 

 

728x90
728x90
728x90
반응형

NTP

개념 Network Time Protocol, 가장 오래된 인터넷 프로토콜, 네트워크를 통해 컴퓨터 간 시간 동기화를 위한 네트워크 프로토콜
사용 포트 123/UDP port, CVE-2013-5211
원리 NTP 프로토콜에 '몬리스트(monlist)'라는 명령어를 보냄
'monlist'라는 명령으로 요청받으면, 최근에 해당 서버에 접속한 최대 600개의 호스트들에 대한 최신 정보를 응답으로 보내줌
기본 monlist 요청은 8byte로 가능, 수백~수천 배의 응답
찾는 방법 nmap 등의 스캐닝 툴
예시 프랑스에서 초당 400Gbps 규모의 DDoS 공격 탐지(2014년 2월 13일)
NTP 프로토콜을 이용한 증폭 공격 사례
대량의 정보를 요청하는 명령 전송하여 대량의 응답 받음
해결 방안 NTP 서버가 취약한 버전일 경우 NTP-4.2.7p26 이상 버전으로 업그레이드

Intro

NTP에 대해 이해하고 서버 구축하기

 

서버의 설정

1. NTP 서버 설치

2. 파일 설정(/etc/ntp.conf 변경)

3. 방화벽 허용 및 서비스 시작

 

클라이언트 설정

1. NTP 서버 상태 확인(ntpq -p)

2. NTP 서버 시간 동기화(ntpdate 서버 IP주소 명령)

 

NTP 서버 설정

NTP server: 192.168.17.134

NTP client: 192.168.17.145

 

NTP DRDoS Attack 기본 원리

공격자가 자신의 IP를 희생자 IP(client IP)로 바꿔서 NTP에게 시간을 질의

NTP는 클라이언트에게 시간을 알려줌

해커가 클라이언트 IP로 NTP에게 monlist를 요청

클라이언트에게 600개의 정보가 날라감

 

yum: Yellowdog Updater Modified, rpm 기반의 시스템을 위한 자동 업데이트 및 패키지 설치/삭제 도구

sudo apt-get install yum

 

1. 서버 및 클라이언트에 NTP 설치

# yum -y install ntp 혹은

apt install -y ntp

2. NTP 서버 설정

root@ubuntu:/etc# vi ntp.conf

# /etc/ntp.conf, configuration for ntpd; see ntp.conf(5) for help

driftfile /var/lib/ntp/ntp.drift

# Leap seconds definition provided by tzdata
leapfile /usr/share/zoneinfo/leap-seconds.list

# Enable this if you want statistics to be logged.
#statsdir /var/log/ntpstats/

statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable

# Specify one or more NTP servers.

# Use servers from the NTP Pool Project. Approved by Ubuntu Technical Board
# on 2011-02-08 (LP: #104525). See 
http://www.pool.ntp.org/join.html
 for
# more information.
pool 0.ubuntu.pool.ntp.org iburst
pool 1.ubuntu.pool.ntp.org iburst
pool 2.ubuntu.pool.ntp.org iburst
pool 3.ubuntu.pool.ntp.org iburst

# Use Ubuntu's ntp server as a fallback.
pool ntp.ubuntu.com

# Access control configuration; see /usr/share/doc/ntp-doc/html/accopt.html for
# details.  The web page <
http://support.ntp.org/bin/view/Support/AccessRestrictions>

# might also be helpful.
#
# Note that "restrict" applies to both servers and clients, so a configuration
# that might be intended to block requests from certain clients could also end
# up blocking replies from your own upstream servers.

# By default, exchange time with everybody, but don't allow configuration.
restrict -4 default kod notrap nomodify nopeer noquery limited
restrict -6 default kod notrap nomodify nopeer noquery limited

# Local users may interrogate the ntp server more closely.
restrict 127.0.0.1
restrict ::1

# Needed for adding pool entries
restrict source notrap nomodify noquery

# Clients from this (example!) subnet have unlimited access, but only if
# cryptographically authenticated.
#restrict 192.168.123.0 mask 255.255.255.0 notrust


# If you want to provide time to your local subnet, change the next line.
# (Again, the address is an example only.)
#broadcast 192.168.123.255

# If you want to listen to time broadcasts on your local subnet, de-comment the
# next lines.  Please do this only if you trust everybody on the network!
#disable auth
#broadcastclient

 

해당 부분 주석 처리하여 설정 변경

# restrict -4 default kod notrap nomodify nopeer noquery limited
# restrict -6 default kod notrap nomodify nopeer noquery limited

 

192.168.17.0/16 네트워크에서의 NTP 요청 허용

restrict 192.168.17.0 mask 255.255.255.0 nomodify notrap

service ntp restart

 

Kali에서 ntp-monlist scan 시 다음과 같이 filtered

서버 iptables 기본 설정(NTP port: 123/UDP)

iptables -I INPUT 1 -p udp --dport 123 -j ACCEPT

script output


참고 자료

NTP 서버 구축 및 관리

NTP DrDoS Attack

NTP 증폭 공격

 

728x90
728x90
728x90
반응형
개요
* Easy_KeygenMe.exe 파일 실습
1. 레지스터 활용 분석
- 메모리 주소 및 스택 프레임의 이해
- ESP(스택 포인터), EBP(프레임 포인터), EIP 등 개념 정리
2. 어셈블리 명령어 이해 및 알고리즘 분석
- Pseudo code 기반 소스코드 작성

목차
0. 파일 버전 확인(32bit, 64bit)
1. 정의된 데이터(db)
2. 어셈블리어: CMP, LEA, TEST, XOR, MOV, MOVZX, MOVSX
3. 메모리의 구조
   1) 코드 영역
   2) 데이터 영역
   3) 힙 영역
   4) 스택 영역 - 레지스터: ESP, EBP, EIP, ECX, EAX

4. IDA 메모리 주소 표시 차이

[Review] (3주차) 실습

2022.07.04 - [Security & Analysis/IDA Pro] - IDA Pro 악성코드 정적분석 툴 사용법&실습 - week.03(Easy_KeygenMe) (1)

 

IDA Pro 악성코드 정적분석 툴 사용법&실습 - week.03(Easy_KeygenMe) (1)

개요 * Easy_CrackMe.exe 실습 리뷰 및 Easy_KeygenMe.exe 파일 실습 1. 디스어셈블리 상세 기능 - 스택 프레임 및 함수 호출 규약의 이해 - 동적 디버깅 사용 및 코드 실행 - 데이터 타입과 데이터 구조 - 기

sarahee.tistory.com


0. 파일 버전 확인(32bit,  64bit)

실행파일 32bit, 64bit 버전 확인(e.g. exe, dll, ocx)

ExeProperties 프로그램: 윈도우 탐색기에 플러그인, 실행파일이나 프로그램 내부적으로 사용하는 라이브러리(dll, ocx 등)가 사용하는 비트 확인

Download ExeProperties

 

Download ExeProperties

<!--   ExtraBit Software Ltd. Products | Contact --> ExtraBit Software Home ExeProperties Download Download ExeProperties Download the ExeProperties installer for Windows 11/10/8/7 Download ExeProperties v1.4 To install ExeProperties on your system, run t

www.extrabit.com

설치 이후, 해당 파일 우클릭 > 속성(R) > Exe/Dll Info 탭 추가되어, Additional Exe/Dll Properties 확인 가능

Type: x86 (32-bit) or x64 (64-bit)

기본 속성(Alt+Enter)
Download ExeProperties v1.4
32-bit 확인


1. 정의된 데이터(db)

# define 식별자 문자열

  • 식별자: 매개변수, 전달인자, ...
  • 문자열: 치환텍스트

2. 어셈블리어: CMP, LEA, TEST, XOR, MOV, MOVZX, MOVSX

CMP

cmp [esp+68h+var_63], 61h: esp+68h+var_63의 값이 61h 위치에 있는 값과 같은지 비교(값을 빼서 비교)

LEA

lea edi, [esp+68h+var_63]: esp+68h+var_63에 저장된 주소를 esp에 저장

TEST

: 인수1과 인수2 내용을 AND 연산하여 결과가 0이면 ZF = 1로 설정(보통 NULL check할 때 사용)

(두 operand가 0이 아닌 경우를 제외하고는 값을 판별하기 어려움 → eax, eax와 같은 형태로 사용하여 0인지 아닌지 확인)

Byte 단위로 각각 스택에 넣어줌, 사용자가 입력한 문자열을 첫번째 글자부터 순서대로 Byte 단위로 레지스터에 넣음

XOR

두 입력 신호가 서로 같으면 0, 다르면 1, 동일한 두 값 → 초기화

MOV

데이터 복사 명령어

MOVZX

소스의 내용을 목적지로 복사, 목적지의 나머지 부분을 0 padding

(목적지에 32bit register → 소스에 16bit register)

MOVSX

소스의 내용을 목적지로 복사, 목적지의 나머지 부분을 소스의 맨 처음 bit로 채움

(목적지에 32bit register → 소스에 16bit register)


3.  메모리의 구조

1) 코드(code) 영역

const int constval = 30;  // 상수

int function() {  // 함수
    return 20;
}

실행할 프로그램의 코드가 저장되는 영역 (= 텍스트 영역)

2) 데이터(data) 영역

int uniintial;  // 초기화되지 않은 전역변수
int initial = 30;  // 초기화된 전역변수
static int staticval = 70;  // 정적변수

프로그램의 전역 변수와 정적(static) 변수가 저장되는 영역

프로그램 시작 시 할당, 프로그램 종료 시 소멸

3) 힙(heap) 영역

int main(int argc, const char * argv[]) {
    char *arr = malloc(sizeof(char) * 10);  // 동적 할당 변수
    return 0;
}

사용자가 직접 관리하는 메모리 영역

사용자에 의해 메모리 공간이 동적으로 할당되고 해제됨

메모리의 낮은 주소에서 높은 주소로의 방향으로 할당

4) 스택(stack) 영역

int main(int argc, const char * argv[]) {
    int localval1 = 30;  // 지역변수 1
    int localval2;  // 지역변수 2
    return 0;
}

지역 변수와 매개변수가 저장되는 영역(함수의 호출과 관련)

함수의 호출과 함께 할당, 함수의 호출이 완료되면 소멸

스택 영역에 저장되는 함수의 호출 정보: 스택 프레임(stack frame)

 

스택에 할당된 메모리 블록, 호출된 함수에 지정

함수가 호출되면,

1) 함수 호출자가 파라미터 형태로 정보를 넘겨줄 때 어딘가에 저장되고, 호출된 함수가 정보를 찾게 해야 한다.

2) 함수의 작업을 위한 임시 저장소가 필요하다.

* 스택: 제한적으로 접근할 수 있는 자료 구조(LIFO, Last In First Out)

* 임시 저장소: 주로 지역 변수가 사용, 함수가 종료되면 더 이상 접근 불가

전역변수가 저장되는 곳이 스택이라는  메모리 공간

먼저 선언된 변수일수록  높은 주소값을 할당 받음

→ ESP, EBP는 이러한 스택 공간의 주소값을 저장하기 위해 설계된 레지스터


레지스터: ESP, EBP, EIP, ECX, EAX

* E: Extended(16bit → 32bit system), 64bit에서는 R로 표현

ESP(Stack Pointer)

: 현재의 스택 지점(stack의 가장 아래 부분), 스택의 크기를 조정할 때 사용

  • 현재 스택의 최상단 주소값(가장 작은값) 저장(∵ 스택의 주소는 높은 주소에서 낮은 주소로 할당)
  • 스택에 값을 넣을 때마다 ESP가 4만큼 줄어듦

EBP(Base Pointer)  (= Frame Pointer)

: 프레임 포인터를 사용하는 함수를 가리킴(함수가 프레임 포인터를 쓰는지 여부의 분석이 필요할 때, 이 속성을 이용해 수작업으로 지정 가능 - 레지스터의 크기 보정 필요)

  • 현재 스택 프레임의 베이스 주소(스택의 가장 윗 부분)
  • 스택 프레임(함수나 지역변수의 경계를 구분짓기 위한 하나의 블록으로 묶임)의 base 주소
  • 스택 프레임 형태로 저장된 함수의 지역 변수나 전달인자를 참조/변경시 사용하는 레지스터
  • 고정적, 코드 유지에 용이(스택프레임 생성시)

EIP(instruction pointer)

: 다음에 실행할 명령어 위치를 담는 레지스터

ECX(Extended Counter Register)

: 주로 반복 명령어 사용시 반복 카운터로 사용

EAX(Extended Accum ulator Register)

: 산술(덧셈, 곱셈, 나눗셈 등) 논리 연산을 수행할 때 사용, 함수의 반환값이 이 레지스터에 저장


4. IDA 메모리 주소 표시 차이

var_(숫자): 함수의 지역변수, EBP보다 더 낮은 메모리 주소에 위치하므로 음수 값을 가짐

스택 메모리 구조 상 지정된 주소는 초기 스택 포인터보다 낮은 주소에 있어야 하므로, 스택 포인터가 양수 값을 가지면 에러

디버거 메모리 주소 형태 비고
Ollydbg ESP + n 일반적인 형태
IDA Pro ESP + 현재 스택 포인터 + var_? 자동으로 스택의 사용을 조사해서 지역 변수를 찾아내는데 용이하도록 설정

IDA 디스어셈블러 화면 시작 부분의 var_? 형태로 특정 값이 설정되어 있음

함수 시작 시 EBP 주소를 기준으로 스택 상에 변수가 위치하는 오프셋 값

단축키

1) (지역 변수 선택 후) + x

해당 지역 변수가 또 다른 어디에서 참조되었는지 확인 가능

2) (지역 변수 선택 후) + Enter

"Stack of ..." 창 조회, 해당 함수에서 추측된 스택 프레임 보여줌


[Next] (5주차) 실습

2022.08.06 - [Security & Analysis/IDA Pro] - [IDA Pro] 악성코드 정적분석 툴 사용법&이론 - week.05(Easy ELF)

 

[IDA Pro] 악성코드 정적분석 툴 사용법&이론 - week.05(Easy ELF)

목차 1. Easy ELF 실습 - 실습을 위한 사전 단계(Linux 파일 실행) 2. 분기문 분석 3. byte 및 배열 정리 4. 소스코드 작성(어셈블리어 기반) [Review] (4주차) 이론 - 총정리 2022.07.19 - [Security & Analysis/..

sarahee.tistory.com

 

728x90
728x90
728x90
반응형

DRDoS 개념

Distributed Reflection Denial of Service (분산 반사 서비스 거부 공격)

 

특징

출발지 IP를 위조(Source IP Spoofing)

공격자는 IP를 공격 대상으로 Spoofing, 대량의 공격 요청을 반사 대상(서버 등)에 보냄

→ IP를 기반으로 공격을 방어하거나 공격자 역추적이 어려움

다수의 정상 동작 서버에 공격 트래픽 발생시켜, 정상 트래픽과의 구분이 어려움

공격 트래픽이 수백 Gbps 이상의 대규모로 발생하여, 탐지 하더라도 방어하기 어려움


UDP 기반 증폭 공격

DNS

개념 Domain Name System, 호스트와 도메인 이름과 아이피 주소와의 변환을 수행할 수 있도록 만들어진 주소 변환 프로토콜
사용 포트 53/UDP port, CVE-2006-0987
원리 DNS 레코드 값을 서버에 재귀적인 방식으로 질의를 하여 찾을 수 있음
DNS 서버에 dig 명령을 이용해 ANY 타입의 쿼리로 질의를 보냄(취약한 서버 찾기)
DNS 서버는 질의를 받은 도메인과 관련된 모든 타입의 레코드 정보를 보내줌(대량의 응답)
* dig 명령: DNS 질의응답이 정상적으로 이루어지는지를 확인 점검하는 경우에 주로 사용

기존 DNS 프로토콜: 512byte로 사이즈 제한
확장 버전인 EDNS: 4096byte까지 전송이 가능하여 더 큰 증폭 효과를 만들 수 있음
찾는 방법 DNS 서버에 dig 명령을 이용해 ANY 타입의 쿼리를 보내 취약한 서버 찾음

 

NTP

개념 Network Time Protocol, 가장 오래된 인터넷 프로토콜, 네트워크를 통해 컴퓨터 간 시간 동기화를 위한 네트워크 프로토콜
사용 포트 123/UDP port, CVE-2013-5211
원리 NTP 프로토콜에 '몬리스트(monlist)'라는 명령어를 보냄
'monlist'라는 명령으로 요청받으면, 최근에 해당 서버에 접속한 최대 600개의 호스트들에 대한 최신 정보를 응답으로 보내줌
기본 monlist 요청은 8byte로 가능, 수백~수천 배의 응답
찾는 방법 nmap 등의 스캐닝 툴
예시 프랑스에서 초당 400Gbps 규모의 DDoS 공격 탐지(2014년 2월 13일)
NTP 프로토콜을 이용한 증폭 공격 사례
대량의 정보를 요청하는 명령 전송하여 대량의 응답 받음
해결 방안 NTP 서버가 취약한 버전일 경우 NTP-4.2.7p26 이상 버전으로 업그레이드

 

SSDP

개념 Simple Service Discovery Protocol, UPnP(Universal Plug and Play) 프로토콜에서 근거리 혹은 인터넷에 연결된 디바이스를 찾는데 사용되는 프로토콜
사용 포트 1900/UDP port
원리 SSDP를 이용해 네트워크 서버나 정적인 호스트 설정 없이 디바이스 탐지가 가능(like DHCP, DNS)
M-Search 메서드를 이용하여 멀티캐스트 방식으로 로컬 네트워크에 연결된 디바이스 조회 가능
응답 패킷에는 다양한 정보 포함(e.g. 헤더, 배너정보 OS, UUID 정보)
40byte 정도의 M-Search 요청에 대해 서버는 평균적으로 30배 이상의 크기를 갖는 응답을 보내줌
찾는 방법 UDP 1900번 포트로 SSDP M-Search 패킷으로 인터넷 스캐닝하여 서버 찾음

 

SNMP

개념 Simple Network Management Protocol, 네트워크 디바이스를 관리하는 목적으로 만들어진 프로토콜, 네트워크 구성/성능/장비/보안관리가 가능
기존: 네트워크 디바이스의 모니터링은 ICMP와 같은 프로토콜을 사용
신규: 네트워크가 복잡해짐에 따라 더 효율적으로 네트워크 디바이스를 관리하기 위함
대량의 트래픽을 유발하는 명령 전송하여 대량의 응답 받음
사용 포트 161/UDP port
원리 장비 관리에 접근제어는 SNMP 패킷의 community 필드의 값으로, 보통 public과 같은 값으로 세팅
GetBulkRequest 명령을 이용
테이블에 있는 객체데이터를 요청하는 GetBulkRequest 명령을 반복적으로 수행
70byte의 GetBulkRequest 요청으로 최대 수만 byte의 응답을 받음
찾는 방법 community 값을 public으로 SNMP 패킷을 생성하여 스캐닝하여 증폭 공격에 이용 가능한 서버 찾음

 

Chargen

개념 Character Generator Protocol, 클라이언트의 요청에 대해 랜덤한 개수(0-512)의 문자열을 응답으로 보내주는 프로토콜
사용 포트 19/UDP port (네트워크 연결에 대한 디버깅, 대역폭 테스팅 등에 사용)
원리 60byte의 요청 패킷에 대해 랜덤한(74~1472bytes) 크기의 응답을 보내줌
(수백 배 정도의 증폭 효과)
찾는 방법 nmap 등의 스캐닝 툴

 

Others

NetBios

PC의 이름 등록(name registration)과 resolution을 수행하는 프로토콜의 디버깅을 위한 nbtstat 명령 이용

약 3배 정도의 증폭 효과

 

QOTD

Quote Of The Day, CharGen 프로토콜과 거의 유사한 형태

17/UDP port

 

TCP SYN Flooding

공격자가 IP를 목표물로 설정

반사 서버로 Syn 요청

반사 서버는 목표물에게 SYN+ACK 보냄

일정 시간 이후 목표물이 SYN+ANK 재전송(TCP 연결 특성상)

 

P2P


프로토콜별 증폭 공격이 가능한 이유, 공격 기법

공격자는 보통 네트워크 스캐너를 이용하여 증폭 공격에 이용할 취약 서버 리스트를 확보

(e.g. 디바이스 검색엔진 Shodan 이용)

 

과정

증폭 공격에 대한 공격 대상이 네트워크에 존재하는 경우

공격에 사용되는 서버가 네트워크에 존재하는 경우

공격자가 네트워크에 존재하는 경우

 

보안 대책

ISP에서 IP Spoofing 패킷 진입 불가(Ingress Filtering) 설정

네트워크 보안 장비(e.g. 방화벽)에서 동일 IP에 대해 일정 요청 이상은 차단하도록 설정

NTP의 경우 monlist 기능 비활성화(ntpdc -c monlist (NTP server add))

 

Proactive Attack Prevention

사전에 DRDoS 증폭 공격을 방어하는 방법

1) IP spoofing을 원천적으로 막는 안티스푸핑(Anti spoofing) 기법 적용

2) 프로토콜 취약점을 패치

 

1. 안티 스푸핑(Anti-Spoofing)

: 인증을 이용한 안티 스푸핑 기법

1) 세션 토큰을 이용한 인증

2) 암호화 기법을 이용한 인증

3) 제삼자(third-party)를 이용한 인증

성능 상의 오버헤드나 추가적으로 트래픽 발생

 

2. 네트워크 토폴로지를 이용한 방법

 


[참조]

 

최현상,박현도,이희조, "DRDoS 증폭 공격 기법과 방어 기술 연구(A Study on Amplification DRDoS Attacks and Defenses)", 한국정보전자통신기술학회논문지, 15-08-05-429 Vol.8 No.5 (2015), 9page.

 

김효종, 한군희, 신승수, "DRDoS 증폭 공격 대응 시스템(Response System for DRDoS Amplification Attacks)", 융합정보논문지(Journal of Convergence for Information Technology), Vol.10 No12 (2020), 22~30page

 

 

728x90
728x90
728x90
반응형
목차
1. 더 빠르고 쾌적한 공공와이파이가 온다! (220708)
2. 2022년 국가연구개발 우수성과 100선 선정 추진 (220711)
3. 가상융합경제 안전한 성장을 위해 보안업계 맞손 (220714)
4. 무인기 기반의 안전한 데이터 수집을 위한 클러스터 헤드 선출 보안 기술 동향 (220713)
4. 2022년 상반기 KISA 사이버 위협 동향 보고서 (220715)

1. 더 빠르고 쾌적한 공공와이파이가 온다! (220708)

(출처: 과학기술정보통신부, 보도자료, 정보보호네트워크정책관 네트워크안전기획과 구본준 과장(044-202-6430), 송창종 사무관(044-202-6431))

  • 22년 7월 시내버스 4,200대부터 5세대(5G) 백홀 와이파이로 단계적 전환
  • 올해는 신기술인 와이파이 6E*를 활용하여 공공와이파이를 구축할 예정

21년 하반기 제품 출시된 와이파이 규격으로, 2.4, 5㎓만 활용하는 기존의 와이파이 6 비해 6㎓ 대역을 추가 사용하여 체감속도 및 동시접속 안정성 향상


2. 2022년 국가연구개발 우수성과 100선 선정 추진 (220711)

(출처: 과학기술정보통신부, 보도자료, 성과평가정책국 성과평가정책과 이은영 과장(044-202-6920), 성인제 사무관(044-202-6922))

  • 국가연구개발사업을 통해 창출된 전년도 연구성과 중 기술 분야별 가장 우수한 성과를 선정하는 대한민국 유일의 범부처급 국가연구개발 우수성과 선정제도

[사례1] 다양한 나노물질에서의 광반응 현상 연구

  • 핵심 연구성과: 초극단시간 분해 분광 실험장비의 개발 및 최적화

[사례2] 간암치료를 목적으로 비수술적 치료법인 동맥화학색전술에 사용되는 미세구체의 개발

  • 핵심 연구성과: 부작용은 줄이고 사용은 편리한 국산제품 상용화

[사례3] 세노바메이트, 미국 FDA 시판허가 및 유럽지역 기술 수출 계약

  • 핵심 연구성과: 우리나라 최초로 신약 후보물질 발굴부터 글로벌 임상 개발, 판매 허가까지 전 과정을 독자적으로 진행하여 미국 FDA 승인 및 진출에 성공한 뇌전증 치료제 개발

[사례4] 고 에너지밀도 전지 제조를 위한 핵심 원천 기술 개발 및 지식 재산권 확보

  • 핵심 연구성과: 순수 우리 기술로 만든 전기자동차용 양극재 개발

3. 가상융합경제 안전한 성장을 위해 보안업계 맞손 (220714)

(출처: 과학기술정보통신부, 보도자료, 정보보호네트워크정책관 정보보호기획과 신대식 과장(044-202-6440), 김장호 서기관(044-202-6441))

  • 과학기술정보통신부와 한국인터넷진흥원은 가상융합경제의 확산에 따라 「확장가상세계(메타버스)‧대체불가토큰(NFT) 보안협의체」 발대식 개최
  • 사이버보안 패러다임 변화에 대응하여, 제로트러스트, 공급망 보안 등 보안체계를 기반시설에 적용하기 위한 '사이버보안 패러다임 대응 연구반' 운영

4. 무인기 기반의 안전한 데이터 수집을 위한 클러스터 헤드 선출 보안 기술 동향 (220713)

(출처: 정보통신기획평가원, 주간기술동향 2054호, 한국전자통신연구원 왕기철 책임연구원(062-970-6531), 김재인 선임연구원, 김성창 책임연구원)

  • 무인기 기반의 IoT 네트워크에서 효율적인 데이터 수집 및 분배를 위해서는 클러스터 구조의 활용이 필요
  • 데이터 수집을 안전하게 하기 위해서는 클러스터 헤드(Cluster Head: CH)들의 선출을 안전하게 수행하는 것이 필수적

5. 2022년 상반기 KISA 사이버 위협 동향 보고서 (220715)

(출처: 한국인터넷진흥원 인터넷침해대응센터(KISA 인터넷보호나라&KrCERT), 보고서, 침해사고분석단 종합분석팀)

(출처2: (220725) 한국인터넷진흥원, 지식플랫폼 > 동향분석 > 사이버 위협 동향, 침해사고분석단 종합분석팀, https://www.kisa.or.kr/20205/form?postSeq=1022&page=1#fndoDocumentPreview)

  • 요약: 랜섬웨어 갱단의 활발한 활동과 가상자산의 공격 피해
  • 랩서스(Lapsus$): 가장 활발하게 활동한 랜섬웨어 갱단, 2021년 12월 브라질 보건부 해킹을 시작으로 올해 마이크로소프트, 엔비디아, 옥타(Okta) 등 글로벌 보안 전문기업 해킹
  • 블랙캣(BlackCat): 2022년 상반기 새로 모습을 드러낸 랜섬웨어 갱단
  • + 콘티(Conti), 락빗(Lockbit), ...

국내외 사이버 위협 동향

1. 세계 주요 기업 Lapsus$ 공격으로 인해 피해 발생

세계 주요 기업 Lapsus$ 공격으로 인해 피해 발생
Lapsus$의 주요 공격 방식

2. 러시아-우크라이나 하이브리드 전쟁, 또 하나의 전쟁터가 된 사이버 공간

3. 사이버 공격 하는 북한, 사이버 공격 받는 북한

  • 북한 연계 피싱 공격 지속: 2월, 국내 군사 연구 및 동북아 평화 협회인 것처럼 위장해 외교·안보·국방분야 전문가를 겨냥해 프로필을 보내달라면서 프로필 양식 문서로 위장한 MS 워드 악성 파일을 첨부한 피싱 메일 발송

4. 여전히 기업 비즈니스의 큰 위협인 랜섬웨어

5. 블록체인 브리지, 해킹으로 대규모 가상자산 피해 잇따라 발생

  • 블록체인 브리지에서 사고가 나는 이유: 복잡한 요구사항을 처리하고, 많은 가상자산을 보유해 주요 공격 대상이 됨
  • 다양한 가상자산을 처리하는 크로스체인 DeFi에서 브리지를 많이 사용

6. 비밀번호 해킹과 피싱으로 피해가 계속되는 NFT

7. 클레이튼 기반 DeFi KLAYswap, 해킹으로 약 22억 원 피해

  • 국내 대형 DeFi 중 하나인 클레이스왑(KLAYswap)에 대한 공격은 BGP 하이재킹 이용

8. 공격 대상을 정부로 넓혀가는 러시아 사이버범죄 집단 - Conti, Lockbit2.0, Killnet

취약점 동향

1. 오픈소스 보안 라이브러리 잠재적 위협 - OpenSSL 취약점

  • 2014년 4월 OpenSSL 라이브러리에 HeartBleed 취약점 발견
  • 2022년 3월 OpenSSL 내 BN_mod_sqrt() 함수에서 연산시 무한루프가 발생하는 서비스 거부 취약점(CVE-2022-0778) 발견
  • 2022년 5월 OpenSSL 내 명령 주입 취약점(CVE-2022-1292), 인증 오류 취약점(CVE-2022-1343), 비밀번호 오류 취약점(CVE-2022-1434), 서비스 거부 취약점(CVE-2022-1473) 발표

2. 방심이 불러온 취약점의 부활 - 사파리 취약점

  • 특정 버전 이하의 소프트웨어를 사용하는 이용자 단말에서 악의적으로 제작된 웹 컨텐츠를 처리하면 임의의 코드를 실행할 수 있으며, 권한을 탈취하고 정보를 유출할 수 있음
  • 대응방법: Zero-day 공격에 노출되어 있어, 보안패치 및 업데이트 발표시 최신 버전으로 적용

* macOS Monterey 12.2.1, iOS 15.3.1 and iPadOS 15.3.1, Safari 15.3(v. 16612.4.9.1.8 and 15612.4.9.1.8)

3. 협업의 도구의 숨은 위협 - 아틀라시안 컨플루언스 취약점

  • End-Point에 사용자가 계정을 만들어 가입하도록 허용되어 있는 경우 관리자가 아닌 사용자 또는 인증되지 않은 사용자가 컨플루언스 또는 데이터센터 인스턴스에서 html 필드를 대상으로 임의의 코드 실행을 통해 원격 명령어의 실행을 통한 이용자에 대한 2차 공격 및 등록된 자료의 유출이 가능함
  • 공격자가 제공한 URI가 네임스페이스로 변환되어 OGNL 표현식 평가로 이어져 공격자가 임의의 명령어를
    수행할 수 있음

* Atlassian: 소프트웨어 개발 및 협업 도구

 

[참고] Log4j 위협 대응 보고서 v1.0

21년 12월, 全 세계를 공포로 몰아넣을 만한 심각한 취약점 공격 기법이 Github에 공개되었다. 당시 공개된 공격
기법은 Log4j라는 오픈소스 프로그램이 가지고 있는 취약점을 악용하는 것이었다.

 

 

728x90
728x90
728x90
반응형

[Review] (4주차) 실습

2022.07.10 - [Dev/Swift] - [Xcode] iOS Swift 앱 개발 Byte Degree - week.04

 

[Xcode] iOS Swift 앱 개발 Byte Degree - week.04

[Review] (3주차) 실습 2022.07.01 - [Swift] - [Xcode] iOS Swift 앱 개발 Byte Degree - week.03 [Xcode] iOS Swift 앱 개발 Byte Degree - week.03 [Review] (2주차) 실습 2022.06.26 - [Swift] - [Xcode] iOS..

sarahee.tistory.com


애플 프레임워크 모달 - 상세뷰로 진입하거나, 새로운 뷰 띄워보기

// 위임 self
override func viewOldLoad() {
	collectionView.delegate = self
}

extension FrameworkListViewController: UICollectionViewDelegate {
	func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
    	let framework = list[indexPath.item]
        print(">>> selected: \(framework.name)")
        
        // FrameworkDetailViewController 띄우고자 함
        let storyboard = UIStoryboard(name: "Detail", bundle: nil)
        let vc = storyboard.instantiateViewController(withIdentifier: "FrameworkDetailViewController")
        	as! FrameworkDetailViewController
        vc.framework = framework
        present(vc, animated: true)
    }
}

멀티라인으로 설정하기 위해서는..

Label의 Lines: 1 → 0

 

Combine Overview

주요 컴포넌트 3가지

Publisher: 생산자, 크리에이터

Subscriber: 소비자, 구독자

Operator: 변경시키는 사람, 가공하는 사람

-

실습

Class: QuickFocusListViewController, Subclass of: UIViewController 추가

Class: QuickFocusCell, Subclass of: UICollectionViewCell 추가

//
//  QuickFocusListViewController.swift
//  HeadSpaceFocus
//
//  Created by sehee on 2022/07/21.
//

import UIKit

class QuickFocusListViewController: UIViewController {
    
    @IBOutlet weak var collectionView: UICollectionView!
    
    let breathingList = QuickFocus.breathing
    let walkingList = QuickFocus.walking
    
    enum Section: CaseIterable {
        case breathe
        case walking
        
        var title: String {
            switch self {
            case .breathe: return "Breathing exercises"
            case .walking: return "Mindful walks"
            }
        }
    }
    
    typealias Item = QuickFocus
    var datasource: UICollectionViewDiffableDataSource<Section, Item>!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        // enum Section CaseIterable 생성한 코드가 다음 내용과 동일
//        Section.allCases
//        let allItems: [Section] = [.breathe, .walking]
        // 생성 코드가 다음과 같이 쓰일 수 있음
//        let section: Section = .breathe
//        section.title
        
        // Presentation
        datasource = UICollectionViewDiffableDataSource<Section, Item>(collectionView: collectionView, cellProvider: { collectionView, indexPath, item in
            guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "QuickFocusCell", for: indexPath) as? QuickFocusCell else {
                return nil
            }
            cell.configure(item)
            return cell
        })
        
        // Data
        var snapshot = NSDiffableDataSourceSnapshot<Section, Item>()
        snapshot.appendSections([.breathe, .walking])
        // 위의 코드와 동일
//        snapshot.appendSections(Section.allCases)
        snapshot.appendItems(breathingList, toSection: .breathe)
        snapshot.appendItems(walkingList, toSection: .walking)
        datasource.apply(snapshot)
        
        // Layout
        collectionView.collectionViewLayout = layout()
    }
    private func layout() -> UICollectionViewCompositionalLayout {
        let itemSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(0.5), heightDimension: .estimated(50))
        let item = NSCollectionLayoutItem(layoutSize: itemSize)
        
        let groupSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1), heightDimension: .estimated(50))
        let group = NSCollectionLayoutGroup.horizontal(layoutSize: groupSize, subitem: item, count: 2)
        
        let section = NSCollectionLayoutSection(group: group)
        
        let layout = UICollectionViewCompositionalLayout(section: section)
        return layout
    }
}

코드를 연결하기 위해, FocusViewController의 Layout에 다음 코드 추가

collectionView.delegate = self

하단 코드 연결

extension FocusViewController: UICollectionViewDelegate {
    func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
        let item = items[indexPath.item]
        print(">>> \(item.title)")
        
        let storyboard = UIStoryboard(name: "QuickFocus", bundle: nil)
        let vc = storyboard.instantiateViewController(withIdentifier: "QuickFocusListViewController") as! QuickFocusListViewController
        present(vc, animated: true)
    }
}

좌우 padding

1) section.contentInsets

2) section.interGroupSpacing, group.interItemSpacing

private func layout() -> UICollectionViewCompositionalLayout {
        let itemSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(0.5), heightDimension: .estimated(50))
        let item = NSCollectionLayoutItem(layoutSize: itemSize)
        
        let groupSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1), heightDimension: .estimated(50))
        let group = NSCollectionLayoutGroup.horizontal(layoutSize: groupSize, subitem: item, count: 2)
        group.interItemSpacing = .fixed(10)
        
        let section = NSCollectionLayoutSection(group: group)
        section.contentInsets = NSDirectionalEdgeInsets(top: 30, leading: 20, bottom: 30, trailing: 20)
        section.interGroupSpacing = 20
        
        let layout = UICollectionViewCompositionalLayout(section: section)
        return layout
    }

헤더 추가

+ > Collection Reusable View

해당 View의 custom class 생성 - Class: QuickFocusListHeaderView, Subclass of: UICollectionReusableView 추가

//
//  QuickFocusHeaderView.swift
//  HeadSpaceFocus
//
//  Created by sehee on 2022/07/22.
//

import UIKit

class QuickFocusHeaderView: UICollectionReusableView {
    @IBOutlet weak var titleLabel: UILabel!
    
    func configure(_ title: String) {
        titleLabel.text = title
    }
}

QuickFocusListViewController 코드 삽입

datasource.supplementaryViewProvider = { (collectionView, kind, indexPath) in
            guard let header = collectionView.dequeueReusableSupplementaryView(ofKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier: "QuickFocusHeaderView", for: indexPath) as? QuickFocusHeaderView else {
                return nil
            }
            let allSections = Section.allCases
            let section = allSections[indexPath.section]
            header.configure(section.title)
            return header
        }

QuickFocusListViewController 하단 UICollectionViewCompositionalLayout

let headerSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1), heightDimension: .absolute(50))
        let header = NSCollectionLayoutBoundarySupplementaryItem(layoutSize: headerSize, elementKind: UICollectionView.elementKindSectionHeader, alignment: .top)
        section.boundarySupplementaryItems = [header]

Focus View Controller UI 클릭 후, Editor > Embed in > Navigation Controller

FocusViewController의 UICollectionViewDelegate

// 기존
		present(vc, animated: true)
// 변경: Navigation - Back
		navigationController?.pushViewController(vc, animated: true)

Navigation Bar의 ☑ Prefers Large Titles, Title 이름은 Focus로 설정

FocusViewController의 UICollectionViewDelegate 코드 추가

vc.title = item.title

QuickFocusListViewController의 Layout 코드 추가

self.navigationItem.largeTitleDisplayMode = .never

Navigation Bar의 Tint color: Default에서 White Color로 변경

최종 코드

//
//  QuickFocusListViewController.swift
//  HeadSpaceFocus
//
//  Created by sehee on 2022/07/21.
//

import UIKit

class QuickFocusListViewController: UIViewController {
    
    @IBOutlet weak var collectionView: UICollectionView!
    
    let breathingList = QuickFocus.breathing
    let walkingList = QuickFocus.walking
    
    enum Section: CaseIterable {
        case breathe
        case walking
        
        var title: String {
            switch self {
            case .breathe: return "Breathing exercises"
            case .walking: return "Mindful walks"
            }
        }
    }
    
    typealias Item = QuickFocus
    var datasource: UICollectionViewDiffableDataSource<Section, Item>!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        // enum Section CaseIterable 생성한 코드가 다음 내용과 동일
//        Section.allCases
//        let allItems: [Section] = [.breathe, .walking]
        // 생성 코드가 다음과 같이 쓰일 수 있음
//        let section: Section = .breathe
//        section.title
        
        // Presentation
        datasource = UICollectionViewDiffableDataSource<Section, Item>(collectionView: collectionView, cellProvider: { collectionView, indexPath, item in
            guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "QuickFocusCell", for: indexPath) as? QuickFocusCell else {
                return nil
            }
            cell.configure(item)
            return cell
        })
        
        datasource.supplementaryViewProvider = { (collectionView, kind, indexPath) in
            guard let header = collectionView.dequeueReusableSupplementaryView(ofKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier: "QuickFocusHeaderView", for: indexPath) as? QuickFocusHeaderView else {
                return nil
            }
            let allSections = Section.allCases
            let section = allSections[indexPath.section]
            header.configure(section.title)
            return header
        }
        
        // Data
        var snapshot = NSDiffableDataSourceSnapshot<Section, Item>()
        snapshot.appendSections([.breathe, .walking])
        // 위의 코드와 동일
//        snapshot.appendSections(Section.allCases)
        snapshot.appendItems(breathingList, toSection: .breathe)
        snapshot.appendItems(walkingList, toSection: .walking)
        datasource.apply(snapshot)
        
        // Layout
        collectionView.collectionViewLayout = layout()
        self.navigationItem.largeTitleDisplayMode = .never
    }
    private func layout() -> UICollectionViewCompositionalLayout {
        let itemSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(0.5), heightDimension: .estimated(50))
        let item = NSCollectionLayoutItem(layoutSize: itemSize)
        
        let groupSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1), heightDimension: .estimated(50))
        let group = NSCollectionLayoutGroup.horizontal(layoutSize: groupSize, subitem: item, count: 2)
        group.interItemSpacing = .fixed(10)
        
        let section = NSCollectionLayoutSection(group: group)
        section.contentInsets = NSDirectionalEdgeInsets(top: 30, leading: 20, bottom: 30, trailing: 20)
        section.interGroupSpacing = 20
        
        let headerSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1), heightDimension: .absolute(50))
        let header = NSCollectionLayoutBoundarySupplementaryItem(layoutSize: headerSize, elementKind: UICollectionView.elementKindSectionHeader, alignment: .top)
        section.boundarySupplementaryItems = [header]
        
        let layout = UICollectionViewCompositionalLayout(section: section)
        return layout
    }
}
//
//  QuickFocusCell.swift
//  HeadSpaceFocus
//
//  Created by sehee on 2022/07/21.
//

import UIKit

class QuickFocusCell: UICollectionViewCell {
    @IBOutlet weak var thumbnailImageView: UIImageView!
    @IBOutlet weak var titleLabel: UILabel!
    @IBOutlet weak var descriptionLabel: UILabel!
    
    func configure(_ quickFocus: QuickFocus) {
        thumbnailImageView.image = UIImage(named: quickFocus.imageName)
        titleLabel.text = quickFocus.title
        descriptionLabel.text = quickFocus.description
    }
}
//
//  FocusViewController.swift
//  HeadSpaceFocus
//
//  Created by sehee on 2022/07/10.
//

import UIKit

class FocusViewController: UIViewController {
    
    @IBOutlet weak var collectionView: UICollectionView!
    @IBOutlet weak var refreshButton: UIButton!
    
    var curated: Bool = false
    var items: [Focus] = Focus.list
    
    typealias Item = Focus
    enum Section {
        case main
    }
    var datasource: UICollectionViewDiffableDataSource<Section, Item>!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        refreshButton.layer.cornerRadius = 10
        
        // Presentation: Diffable Datasource + Cell Provider
        datasource = UICollectionViewDiffableDataSource<Section, Item>(collectionView: collectionView, cellProvider: { collectionView, indexPath, item in
            guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "FocusCell", for: indexPath) as? FocusCell else {
                return nil
            }
            cell.configure(item)
            return cell
        })
        
        // Data: Snapshot
        var snapshot = NSDiffableDataSourceSnapshot<Section, Item>()
        snapshot.appendSections([.main])
        snapshot.appendItems(items, toSection: .main)
        datasource.apply(snapshot)
        
        // Layout
        collectionView.collectionViewLayout = layout()
        collectionView.delegate = self
        
        updateButtonTitle()
    }
    
    private func layout() -> UICollectionViewCompositionalLayout {
        
        let itemSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1), heightDimension: .estimated(50))
        let item = NSCollectionLayoutItem(layoutSize: itemSize)
        
        let groupSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1), heightDimension: .estimated(50))
        let group = NSCollectionLayoutGroup.vertical(layoutSize: groupSize, subitems: [item])
        
        let section = NSCollectionLayoutSection(group: group)
        section.contentInsets = NSDirectionalEdgeInsets(top: 10, leading: 20, bottom: 10, trailing: 20)
        section.interGroupSpacing = 10
        
        let layout = UICollectionViewCompositionalLayout(section: section)
        return layout
    }
    
    func updateButtonTitle() {
        let title = curated ? "See All" : "See Recommendation"
        refreshButton.setTitle(title, for: .normal)
    }
    
    @IBAction func refreshButtonTapped(_ sender: Any) {
        curated.toggle()
        
        self.items = curated ? Focus.recommendations : Focus.list
        
        var snapshot = NSDiffableDataSourceSnapshot<Section, Item>()
        snapshot.appendSections([.main])
        snapshot.appendItems(items, toSection: .main)
        datasource.apply(snapshot)
        
        updateButtonTitle()
    }
}

extension FocusViewController: UICollectionViewDelegate {
    func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
        let item = items[indexPath.item]
        print(">>> \(item.title)")
        
        let storyboard = UIStoryboard(name: "QuickFocus", bundle: nil)
        let vc = storyboard.instantiateViewController(withIdentifier: "QuickFocusListViewController") as! QuickFocusListViewController
        vc.title = item.title
//        present(vc, animated: true)
        navigationController?.pushViewController(vc, animated: true)
    }
}

[Next] (6주차) 실습

2022.07.22 - [Development/Swift] - [Swift] iOS 앱 개발(Xcode) Byte Degree - week.06

 

[Swift] iOS 앱 개발(Xcode) Byte Degree - week.06

[Review] (5주차) 실습 2022.07.16 - [Dev/Swift] - [Xcode] iOS Swift 앱 개발 Byte Degree - week.05 [Xcode] iOS Swift 앱 개발 Byte Degree - week.05 [Review] (4주차) 실습 2022.07.10 - [Dev/Swift] - [Xco..

sarahee.tistory.com

 

728x90
728x90

+ Recent posts