Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Go言語で行うメール解析
Search
Kyo Sato
July 07, 2024
Technology
0
1.2k
Go言語で行うメール解析
OPTiM × every Golang Developer Night 2024/07/02
https://optim.connpass.com/event/321331/
Kyo Sato
July 07, 2024
Tweet
Share
More Decks by Kyo Sato
See All by Kyo Sato
Gopher Enablement Internship
keyl0ve
0
730
作って学ぶ GraphQL
keyl0ve
0
1.3k
Other Decks in Technology
See All in Technology
AWS Media Services 最新サービスアップデート 2024
eijikominami
0
200
Python(PYNQ)がテーマのAMD主催のFPGAコンテストに参加してきた
iotengineer22
0
500
TypeScriptの次なる大進化なるか!? 条件型を返り値とする関数の型推論
uhyo
2
1.7k
飲食店データの分析事例とそれを支えるデータ基盤
kimujun
0
150
IBC 2024 動画技術関連レポート / IBC 2024 Report
cyberagentdevelopers
PRO
1
110
The Role of Developer Relations in AI Product Success.
giftojabu1
0
130
BLADE: An Attempt to Automate Penetration Testing Using Autonomous AI Agents
bbrbbq
0
320
SRE×AIOpsを始めよう!GuardDutyによるお手軽脅威検出
amixedcolor
0
170
OCI Vault 概要
oracle4engineer
PRO
0
9.7k
【Pycon mini 東海 2024】Google Colaboratoryで試すVLM
kazuhitotakahashi
2
540
SSMRunbook作成の勘所_20241120
koichiotomo
3
160
AI前提のサービス運用ってなんだろう?
ryuichi1208
8
1.4k
Featured
See All Featured
The Cult of Friendly URLs
andyhume
78
6k
Building Applications with DynamoDB
mza
90
6.1k
Faster Mobile Websites
deanohume
305
30k
Ruby is Unlike a Banana
tanoku
97
11k
RailsConf 2023
tenderlove
29
900
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.5k
Practical Orchestrator
shlominoach
186
10k
5 minutes of I Can Smell Your CMS
philhawksworth
202
19k
Documentation Writing (for coders)
carmenintech
65
4.4k
The World Runs on Bad Software
bkeepers
PRO
65
11k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
38
1.8k
Navigating Team Friction
lara
183
14k
Transcript
1 GoݴޠͰߦ͏ϝʔϧղੳ OPTiM × every Golang Developer Night 2024/07/02 גࣜձࣾΤϒϦʔ
͖ΐʔɻ
Copyright © 2015 every, Inc. All rights reserved. 2 ࣗݾհ
- ໊લ - ͖ΐʔɻ - ෦ॺ - ։ൃຊ෦ɺDELISH KITCHEN։ൃ෦ - ࠷ۙྑ͘ͳͬͨGoͷύοέʔδ - math/rand - Ωʔϫʔυ - ٶग़ - 3ͷ൧ͱຊञ - όΠΫ - Ϥʔϩούཱྀߦ - ίʔώʔ - Vtuber - ήʔϜ - Ξχϝ
Copyright © 2015 every, Inc. All rights reserved. 3 ຊͷ͓ॻ͖
- GoݴޠͰߦ͏ϝʔϧղੳ - ಋೖ - ϝʔϧϔομʔʹ͍ͭͯ - ࣮ࡍʹղੳͯ͠ΈΑ͏ - ͲͷΑ͏ͳ໘Ͱϝʔϧղੳ͍͔ͨ͠ - ·ͱΊ
Copyright © 2015 every, Inc. All rights reserved. 4 Έͳ͞ΜϝʔϧΛૹͬͨ͜ͱ͋Γ·͔͢ʁ
Copyright © 2015 every, Inc. All rights reserved. 5 Έͳ͞ΜϝʔϧΛૹͬͨ͜ͱ͋Γ·͔͢ʁ
Copyright © 2015 every, Inc. All rights reserved. 6
Copyright © 2015 every, Inc. All rights reserved. 7 Έͳ͞ΜϝʔϧΛૹͬͨ͜ͱ͋Γ·͔͢ʁ
Telnet
Copyright © 2015 every, Inc. All rights reserved. 8 Έͳ͞ΜϝʔϧΛૹͬͨ͜ͱ͋Γ·͔͢ʁ
Telnet - ϦϞʔτίϯϐϡʔλͱର͢ΔͨΊʹߏங͞ΕͨίϯϐϡʔλϓϩτίϧͷҰͭ - ଞͷϓϩτίϧͷྫ - SSH - SFTP - VNC
Copyright © 2015 every, Inc. All rights reserved. 9 $
docker run -d -p 8025:8025 -p 1025:1025 --name test_mailhog mailhog/mailhog Header - MAIL FROM: - RCPT TO: - SUBJECT: - FROM: - TO: Body - Hello, World! . Ͱғ͍ͬͯΔ෦ɿ͕ࣗೖྗͨ͠Օॴ
Copyright © 2015 every, Inc. All rights reserved. 10 $
docker run -d -p 8025:8025 -p 1025:1025 --name test_mailhog mailhog/mailhog
[email protected]
[email protected]
Copyright © 2015 every, Inc. All rights reserved. 11 $
docker run -d -p 8025:8025 -p 1025:1025 --name test_mailhog mailhog/mailhog Q. - ͳΓ͢·͠ରࡦͲ͏ͬͯΔͷʁ - ͲΜͳϝʔϧϔομʔ͕͋ͬͯɺͳΜͷͨΊʹΘΕ͍ͯΔͷʁ - GoͰϝʔϧΛղੳ͢ΔʹͲ͏͢Εྑ͍ʁ
12 ϝʔϧϔομʔʹ͍ͭͯ
Copyright © 2015 every, Inc. All rights reserved. 13 ͦͦϝʔϧϔομʔͱʁ
- ϝʔϧϔομͱɺϝʔϧͷৄࡉใ͕ॻ͔Ε͍ͯΔ෦ͷ͜ͱ - ϝʔϧ͕ૹ͞Εͨܦ࿏࣌ؒɺܦ༝ͨ͠αʔόʔͳͲ͕ه͞Ε͍ͯΔ - From: - ૹ৴ऀͷϝʔϧΞυϨε - To: - ड৴ऀͷϝʔϧΞυϨε - Subject: - ϝʔϧͷ໊݅ - Received: - ϝʔϧ͕ܦ༝ͨ͠αʔόʔͱͦͷ࣌ - Content-Type: - ϝʔϧͷຊจͷܗࣜʢྫɿtext/plain, text/htmlʣ - MIME-Version: - ϝʔϧ͕ MIMEن֨Λ༻͍ͯ͠Δ߹ͷόʔδϣϯ ϝʔϧϔομʔɺϝʔϧͷτϥϒϧγϡʔςΟϯάɺεύϜͷݕग़ɺηΩϡϦςΟੳͳͲʹ༻͞ΕΔ
Copyright © 2015 every, Inc. All rights reserved. 14
Copyright © 2015 every, Inc. All rights reserved. 15 -
RFC2822 Ͱنఆ͞Εͨϝʔϧϓϩ τίϧͰߏ͞Ε͍ͯΔ - ASCII ίʔυͰߏ͞ΕΔ͜ͱ - Ұߦ 78 จࣈҎԼ͕ਪ - Header ϑΟʔϧυɺϑΟʔϧυ ໊ͷޙʹίϩϯ(":")ɺϑΟʔϧυ ຊମ͕ଓ͖ɺCRLF Ͱऴྃ - Body ͕࢝·Δલۭߦʹ͢Δ
16 ࣮ࡍʹղੳͯ͠ΈΑ͏
Copyright © 2015 every, Inc. All rights reserved. 17 ࣮ࡍʹղੳͯ͠Έͨ
- net/mail - Go Packages - Goͷඪ४ύοέʔδͷҰͭ - ϝʔϧϝοηʔδͷղੳΛఏڙ͍ͯ͠Δ - جຊతͳ͍ํ
Copyright © 2015 every, Inc. All rights reserved. 18 ⚠
ݸਓใؚ͕·Ε͍ͯΔ෦ ɹফͯ͋͠Γ·͢
Copyright © 2015 every, Inc. All rights reserved. 19 Message.Header
Delivered-To: ϝʔϧ͕࠷ऴతʹ৴͞Εͨड৴ऀͷϝʔϧΞυϨε Received: ϝʔϧ͕ܦ༝֤ͨ͠αʔόʔʹΑͬͯՃ͞Εɺϝʔϧͷసૹܦ࿏ʢෳͷReceivedϔομʔ͕ଘࡏ͢Δ͜ͱ͕͋Δʣ ARC-Seal, ARC-Message-Signature, ARC-Authentication-Results: Authenticated Received Chain (ARC)ʹؔ࿈͢Δϔομʔʢϝʔϧ͕సૹ͞ΕΔաఔͰͷೝূ݁ՌΛอ࣋ʣ Return-Path: όϯεϝοηʔδʢ৴ෆೳ௨ʣ͕ૹΒΕΔࡍͷฦ৴ઌΞυϨε Received-SPF: Sender Policy Framework (SPF)ͷݕূ݁Ռʢϝʔϧ͕ਖ਼ͳૹ৴ݩ͔ΒૹΒΕ͔ͨͲ͏͔Λ֬ೝ͢Δʣ Authentication-Results: ϝʔϧ͕ೝূϓϩηεʢDKIMɺSPFɺDMARCͳͲʣΛ௨ա͔ͨ͠Ͳ͏͔ͷ݁Ռ DKIM-Signature: DomainKeys Identified Mail (DKIM)ͷॺ໊ʢϝʔϧͷ༰͕ૹ৴ऀʹΑͬͯॺ໊͞Εɺ్தͰվ͟Μ͞Ε͍ͯͳ͍͜ͱΛอূʣ X-Google-DKIM-Signature: Google͕Ճͨ͠DKIMॺ໊ʢGmail͕ϝʔϧΛॲཧͨ͜͠ͱΛࣔ͢ʣ X-Gm-Message-State: GmailʹΑͬͯՃ͞Εͨϔομʔʢϝʔϧͷঢ়ଶʹؔ͢ΔใΛؚΉʣ X-Google-Smtp-Source: GmailʹΑͬͯՃ͞Εͨϔομʔʢϝʔϧͷૹ৴ʹؔ͢ΔՃใΛؚΉʣ MIME-Version: MIME (Multipurpose Internet Mail Extensions)ͷόʔδϣϯʢϝʔϧ͕ςΩετҎ֎ͷίϯςϯπΛؚΉ͜ͱΛࣔ͢ʣ From: ϝʔϧͷૹ৴ऀͷ໊લͱϝʔϧΞυϨε Date: ϝʔϧ͕ૹ৴͞Εͨ࣌ Message-ID: ϝʔϧʹҰҙʹׂΓͯΒΕͨIDʢϝʔϧͷʹ༻͞ΕΔʣ Subject: ϝʔϧͷ໊݅ To: ϝʔϧͷѼઌΞυϨε Content-Type: ϝʔϧͷຊจఴϑΝΠϧͷܗࣜʢMIMEλΠϓʣ Content-Disposition: ఴϑΝΠϧͷදࣔํ๏ϑΝΠϧ໊ Content-Transfer-Encoding: ϝʔϧͷຊจఴϑΝΠϧ͕ͲͷΑ͏ʹΤϯίʔυ͞Ε͍ͯΔ͔ Content-ID: ఴϑΝΠϧʹؔ࿈͚ΒΕͨҰҙͷIDʢϝʔϧͰࢀর͢Δࡍʹ༻͞ΕΔʣ X-Attachment-Id: Gmail͕ఴϑΝΠϧʹׂΓͯͨIDʢϝʔϧͰͷఴϑΝΠϧͷࢀরʹ༻͞ΕΔʣ
Copyright © 2015 every, Inc. All rights reserved. 20 Message.Header
Delivered-To: ϝʔϧ͕࠷ऴతʹ৴͞Εͨड৴ऀͷϝʔϧΞυϨε Received: ϝʔϧ͕ܦ༝֤ͨ͠αʔόʔʹΑͬͯՃ͞Εɺϝʔϧͷసૹܦ࿏ʢෳͷReceivedϔομʔ͕ଘࡏ͢Δ͜ͱ͕͋Δʣ ARC-Seal, ARC-Message-Signature, ARC-Authentication-Results: Authenticated Received Chain (ARC)ʹؔ࿈͢Δϔομʔʢϝʔϧ͕సૹ͞ΕΔաఔͰͷೝূ݁ՌΛอ࣋ʣ Return-Path: όϯεϝοηʔδʢ৴ෆೳ௨ʣ͕ૹΒΕΔࡍͷฦ৴ઌΞυϨε Received-SPF: Sender Policy Framework (SPF)ͷݕূ݁Ռʢϝʔϧ͕ਖ਼ͳૹ৴ݩ͔ΒૹΒΕ͔ͨͲ͏͔Λ֬ೝ͢Δʣ Authentication-Results: ϝʔϧ͕ೝূϓϩηεʢDKIMɺSPFɺDMARCͳͲʣΛ௨ա͔ͨ͠Ͳ͏͔ͷ݁Ռ DKIM-Signature: DomainKeys Identified Mail (DKIM)ͷॺ໊ʢϝʔϧͷ༰͕ૹ৴ऀʹΑͬͯॺ໊͞Εɺ్தͰվ͟Μ͞Ε͍ͯͳ͍͜ͱΛอূʣ X-Google-DKIM-Signature: Google͕Ճͨ͠DKIMॺ໊ʢGmail͕ϝʔϧΛॲཧͨ͜͠ͱΛࣔ͢ʣ X-Gm-Message-State: GmailʹΑͬͯՃ͞Εͨϔομʔʢϝʔϧͷঢ়ଶʹؔ͢ΔใΛؚΉʣ X-Google-Smtp-Source: GmailʹΑͬͯՃ͞Εͨϔομʔʢϝʔϧͷૹ৴ʹؔ͢ΔՃใΛؚΉʣ MIME-Version: MIME (Multipurpose Internet Mail Extensions)ͷόʔδϣϯʢϝʔϧ͕ςΩετҎ֎ͷίϯςϯπΛؚΉ͜ͱΛࣔ͢ʣ From: ϝʔϧͷૹ৴ऀͷ໊લͱϝʔϧΞυϨε Date: ϝʔϧ͕ૹ৴͞Εͨ࣌ Message-ID: ϝʔϧʹҰҙʹׂΓͯΒΕͨIDʢϝʔϧͷʹ༻͞ΕΔʣ Subject: ϝʔϧͷ໊݅ To: ϝʔϧͷѼઌΞυϨε Content-Type: ϝʔϧͷຊจఴϑΝΠϧͷܗࣜʢMIMEλΠϓʣ Content-Disposition: ఴϑΝΠϧͷදࣔํ๏ϑΝΠϧ໊ Content-Transfer-Encoding: ϝʔϧͷຊจఴϑΝΠϧ͕ͲͷΑ͏ʹΤϯίʔυ͞Ε͍ͯΔ͔ Content-ID: ఴϑΝΠϧʹؔ࿈͚ΒΕͨҰҙͷIDʢϝʔϧͰࢀর͢Δࡍʹ༻͞ΕΔʣ X-Attachment-Id: Gmail͕ఴϑΝΠϧʹׂΓͯͨIDʢϝʔϧͰͷఴϑΝΠϧͷࢀরʹ༻͞ΕΔʣ ܦ༝ͨ͠αʔόʔɺIPΞυϨεͳͲ͔Β ෆ৹ͳαʔόʔ͔ΒૹΒΕ͍ͯͳ͍͔֬ೝͰ͖Δ ͳΓ͢·͠ରࡦ ͲͷΑ͏ͳίϯςϯπɺܗࣜͳͷ͔Θ͔Δ
Copyright © 2015 every, Inc. All rights reserved. 21
Copyright © 2015 every, Inc. All rights reserved. 22 Message.Body
Content-Type: multipart/mixed; boundary="000000000000367976061c1205d3" MIME Ϛϧνύʔτϝοηʔδ - ςΩετ htmlɺը૾ͳͲͦΕ ͧΕҟͳΔύʔτʹ͚ɺͦΕ ΒΛΈ߹Θͤߏ͞Εͨͷ - ෳͷϑΝΠϧΛిࢠϝʔϧʹ ఴ͢Δͱ͖ͳͲʹ༻͞ΕΔ
Copyright © 2015 every, Inc. All rights reserved. 23 Message.Body
Content-Type: multipart/mixed; boundary="000000000000367976061c1205d3" MIME Ϛϧνύʔτϝοηʔδ - ςΩετ htmlɺը૾ͳͲͦΕ ͧΕҟͳΔύʔτʹ͚ɺͦΕ ΒΛΈ߹Θͤߏ͞Εͨͷ - ෳͷϑΝΠϧΛిࢠϝʔϧʹ ఴ͢Δͱ͖ͳͲʹ༻͞ΕΔ
24 ͲͷΑ͏ͳ໘Ͱϝʔϧղੳ͍͔ͨ͠
Copyright © 2015 every, Inc. All rights reserved. 25 ྫ͑
- ސ٬αϙʔτͷࣗಈԽ - αϙʔτʹૹΒΕͯ͘ΔϝʔϧΛղੳɺ༰ʹج͍ͮͯαϙʔτνʔϜసૹ - https://tech.every.tv/entry/2024/06/06/192547 - Α͋͘Δ࣭ʹରͯࣗ͠ಈԠ AWSͰड͚औͬͨϝʔϧΛసૹ͢Δྫ→ - ϝʔϧαϚϦʔੜ - ͍ϝʔϧ͔ΒॏཁͳϙΠϯτ͚ͩΛநग़ https://aws.amazon.com/jp/blogs/messaging-and-targeting/forward-incoming-email-to-an-external-destination/
26 ·ͱΊ
Copyright © 2015 every, Inc. All rights reserved. 27 ·ͱΊ
- ීஈ͋·Γҙࣝͯ͜͠ͳ͔ͬͨϝʔϧͷ༰ɾߏʹ͍ͭͯΕͨྑ͍ػձʹͳͬ ͨʂ - ը૾ಈըͳͲͷఴϑΝΠϧ͕ͲͷΑ͏ʹૹΒΕ͍ͯΔͷֶ͔Μͩ - ͲͷΑ͏ʹͳΓ͢·͠ରࡦ͕ߦΘΕ͍ͯΔͷ͔Λϝʔϧϔομʔ͔ΒֶΜͩ͜ͱͰɺ ϝʔϧΛసૹฦ৴͢ΔࡍʹඞཁͳॲཧΛߟ͑Δ͖͔͚ͬʹͳͬͨ - GoΛ͍ͳ͕ΒखΛಈֶ͔ͯ͠Δͷָ͍͠ - ໘ന͔ͬͨษڧ༰ͳͲ͋Γ·ͨ͠Βڭ͍͑ͯͩ͘͞ʂ
None