Skip to content

Instantly share code, notes, and snippets.

@flagranterror
Created August 22, 2016 19:06
Show Gist options
  • Save flagranterror/b0d8e7baf52e18ec4af241bef4d440ea to your computer and use it in GitHub Desktop.
Save flagranterror/b0d8e7baf52e18ec4af241bef4d440ea to your computer and use it in GitHub Desktop.
List Exchange Online netblocks
#!/bin/ruby
require 'net/http'
require 'nokogiri'
response = Net::HTTP.get_response(URI.parse('https://support.content.office.net/en-us/static/O365IPAddresses.xml'))
xml = Nokogiri::XML(response.body)
xml.xpath("//product[@name='EXO']/addresslist[@type='IPv4']/address").each { |a| puts a.text }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment