3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Office365のURLやIPアドレスの一覧をCSVで取得する

Last updated at Posted at 2018-11-09

###公式ページ
https://docs.microsoft.com/en-us/office365/enterprise/urls-and-ip-address-ranges

#Office365の最新情報のURL
最新のリストがXML形式からJSON形式で取得できるようになっています。
https://endpoints.office.com/endpoints/worldwide?clientrequestid=XXXXXXX

そのままCSV形式でダウンロードするときは後ろに「&Format=CSV」をつけてあげる
https://endpoints.office.com/endpoints/worldwide?clientrequestid=XXXXXXX&Format=CSV

#Appendix
取得した情報を整形したり列とか行だけ取り出したりしたいのでちょっと書いてみた。

#Python

o365check.py
import ssl
import urllib2
import json
import pandas as pd
import csv
# ignore ssl certificate check error
ssl._create_default_https_context = ssl._create_unverified_context
# client_id for microsoft office365 ip address list web site
client_id = 'XXXX';
# URL generation
URL = "https://endpoints.office.com/endpoints/worldwide?clientrequestid=" + client_id
# Use python urllib2 *check current python version
req = urllib2.Request(URL)
response = urllib2.urlopen(req)
o365_dict = response.read()
# cvs generation
df = pd.read_json(o365_dict)
print df.iloc[:,[7,10,3,8,9]

#出力結果

o365check.py
[root@localhost ~]# ./o365check.py
                            serviceAreaDisplayName                                               urls                                                ips tcpPorts             udpPorts
0                                  Exchange Online        [outlook.office.com, outlook.office365.com]  [13.107.6.152/31, 13.107.9.152/31, 13.107.18.1...   80,443                  NaN
1                                  Exchange Online                               [smtp.office365.com]  [13.107.6.152/31, 13.107.9.152/31, 13.107.18.1...      587                  NaN
2                                  Exchange Online  [r1.res.office365.com, r3.res.office365.com, r...                                                NaN   80,443                  NaN
3                                  Exchange Online                                 [domains.live.com]                                                NaN   80,443                  NaN
4                                  Exchange Online      [*.outlook.office.com, outlook.office365.com]  [13.107.6.152/31, 13.107.9.152/31, 13.107.18.1...  143,993                  NaN
5                                  Exchange Online      [*.outlook.office.com, outlook.office365.com]  [13.107.6.152/31, 13.107.9.152/31, 13.107.18.1...      995                  NaN
6                                  Exchange Online  [*.store.core.windows.net, asl.configure.offic...                                                NaN   80,443                  NaN
7                                  Exchange Online              [*.outlook.com, *.outlook.office.com]                                                NaN   80,443                  NaN
8                                  Exchange Online                         [*.protection.outlook.com]  [23.103.132.0/22, 23.103.136.0/21, 23.103.144....      443                  NaN
9                                  Exchange Online                    [*.mail.protection.outlook.com]  [23.103.132.0/22, 23.103.136.0/21, 23.103.144....       25                  NaN
10   Skype for Business Online and Microsoft Teams                                                NaN                    [13.107.64.0/18, 52.112.0.0/14]      NaN  3478,3479,3480,3481
11   Skype for Business Online and Microsoft Teams  [*.lync.com, *.teams.microsoft.com, teams.micr...  [13.70.151.216/32, 13.71.127.197/32, 13.72.245...   80,443                  NaN
12   Skype for Business Online and Microsoft Teams       [*.broadcast.skype.com, broadcast.skype.com]  [13.70.151.216/32, 13.71.127.197/32, 13.72.245...      443                  NaN
13   Skype for Business Online and Microsoft Teams                   [quicktips.skypeforbusiness.com]                                                NaN      443                  NaN
14   Skype for Business Online and Microsoft Teams  [*.sfbassets.com, *.urlp.sfbassets.com, skypem...                                                NaN   80,443                  NaN
15   Skype for Business Online and Microsoft Teams  [*.keydelivery.mediaservices.windows.net, *.ms...                                                NaN      443                  NaN
3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?