Skip to content

Instantly share code, notes, and snippets.

@paralax
Created April 6, 2020 00:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paralax/0f7eca3590f527e63b214f3ed3a8b30e to your computer and use it in GitHub Desktop.
Save paralax/0f7eca3590f527e63b214f3ed3a8b30e to your computer and use it in GitHub Desktop.
Censys API via C#
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