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.3k
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
740
作って学ぶ GraphQL
keyl0ve
0
1.3k
Other Decks in Technology
See All in Technology
AWS re:Invent 2024 Recap in ZOZO - Serverless で好きなものをしゃべってみた
chongmyungpark
0
1.1k
サイバー攻撃を想定したセキュリティガイドライン 策定とASM及びCNAPPの活用方法
syoshie
3
1.7k
SpiderPlus & Co. エンジニア向け会社紹介資料
spiderplus_cb
0
430
12 Days of OpenAIから読み解く、生成AI 2025年のトレンド
shunsukeono_am
0
1k
三菱電機で社内コミュニティを立ち上げた話
kurebayashi
0
210
型情報を用いたLintでコード品質を向上させる
sansantech
PRO
2
220
OPENLOGI Company Profile
hr01
0
57k
20241228 - 成為最強魔法使!AI 實時生成比賽的策略 @ 2024 SD AI 年會
dpys
0
340
ハイテク休憩
sat
PRO
2
190
.NET 9 のパフォーマンス改善
nenonaninu
0
2.2k
.NET 最新アップデート ~ AI とクラウド時代のアプリモダナイゼーション
chack411
0
140
株式会社ログラス − エンジニア向け会社説明資料 / Loglass Comapany Deck for Engineer
loglass2019
3
33k
Featured
See All Featured
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5.1k
Making Projects Easy
brettharned
116
6k
Done Done
chrislema
182
16k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
29
940
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
49
2.2k
A better future with KSS
kneath
238
17k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
656
59k
Building a Scalable Design System with Sketch
lauravandoore
460
33k
Building an army of robots
kneath
302
44k
Designing for humans not robots
tammielis
250
25k
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
Automating Front-end Workflow
addyosmani
1366
200k
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