Created
April 6, 2020 00:25
-
-
Save paralax/0f7eca3590f527e63b214f3ed3a8b30e to your computer and use it in GitHub Desktop.
Censys API via C#
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.IO; | |
using System.Net; | |
using System.Text; | |
var api_id = Environment.GetEnvironmentVariable("CENSYS_API_ID"); | |
var api_secret = Environment.GetEnvironmentVariable("CENSYS_API_SECRET"); | |
var credentials = System.Convert.ToBase64String(Encoding.ASCII.GetBytes(api_id + ":" + api_secret)); | |
var wc = new WebClient(); | |
wc.Headers.Add("Authorization", "Basic " + credentials); | |
var data = wc.DownloadString("https://censys.io/api/v1/view/ipv4/1.1.1.1"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment