2020년 3월 26일 목요일

mitmproxy 설치(mac), iPhone Proxy 연결

mitmproxy(man in the middle proxy) 설치 메모

https://mitmproxy.org/ 에서 설치 방법 확인


brew를 사용해서 설치 진행
 - $ brew install mitmproxy
 - 설치후 mitmproxy 명령으로 터미널 모드 실행 가능
 - 설치후 mitmweb 명령으로 웹 모드 실행 가능


설치후 인증서 설치
 - ~/.mitmproxy 폴더 아래 mitmproxy-ca.p12 파일 확인
 - 파인더에서 해당파일 열기 하여 "키체인  접근.app" 실행
 - 암호 팝업은 입력없이 확인
 - 인증서 정보 가져오기에서 신뢰 항목 열어 항상 신뢰 선택


네트워크 환경설정 열어서 프록시 세팅
 - 웹 프록시(HTTP), 보안 웹 프록시(HTTPS) 선택하여 프록시 서버(로컬 주소) 와 포트 입력(기본 8080)
 - 프록시 암호는 사용하지 않음


WIFI연결 상태인 폰에서 Proxy서버 연결
 - 설정 > Wi-Fi > 접속하고 있는 Wifi SSID > 프록시 구성
 - 수동 선택후, 서버와 포트를 위에 셋팅한것과 같이 설정


프록시 인증서 설치를 위해 사파리를 열어 mitm.it 주소를 입력(크롬 안됨, 반드시 사파리)
 - 페이지에서 Apple 아이콘 클릭 하여 설치
  


다운로드 받은 프로파일 승인 처리
 - 설정 > 일반 > 프로파일 > mitmproxy >  오른쪽 위 "설치" 버튼 탭
  

  


인증서 신뢰설정 처리
 - 설정 > 일반 > 정보 > 인증서 신뢰 설정
 - mitmproxy 루트인증서 신뢰 처리 활성화


proxyweb에서 테스트
 - iPhone 소프트웨어 업데이트 https 확인

2020년 3월 23일 월요일

Unity3d에서 Rust함수 호출

Unity3d에서 Rust 라이브러리를 생성하여 rust함수를 호출해 보기

Rust를 사용하여 라이브러리를 생성/빌드 한 뒤 유니티에서 Plugin으로 dll import하여 함수 사용

-- Rust --

숫자 2개를 더해 리턴하는 간단한 라이브러리 생성

Library생성을 위해 Cargo.toml 에 lib정보 추가
[package]
name = "unity-rust"version = "0.1.0"authors = ["xxx "]
edition = "2018"
[dependencies]

[lib]
name = "unity_rust"crate-type = ["dylib"]

lib.rs 소스 추가(단순한 2개 숫자 합산후 리턴)
#[no_mangle]pub extern fn sum(input1: i32, input2: i32) -> i32 {
    input1 + input2
}

생성된 파일 ./unity-rust/target/debug/libunity_rust.dylib 파일을
Unity ./Assets/Plugins 에 복사


--- Unity ---

RustBehaviour.cs 파일 추가

클래스 안에 DllImport속성을 지정하여 함수 추가(dll확장자는 생략 가능)

using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.InteropServices;

public class RustBehaviour : MonoBehaviour
{
    [DllImport("libunity_rust")]
    private static extern int sum(int v1, int v2);

    // Start is called before the first frame update
    void Start()
    {
        Debug.Log("sum : " + sum(3, 4));
    }

}

아래와 같은 결과를 Console에서 확인 가능