Last active
August 29, 2015 14:19
-
-
Save DinisCruz/9a208ee312079b6d8f96 to your computer and use it in GitHub Desktop.
Misc Azure repl scripts
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
// a) Public IP address | |
WebClient webClient = new WebClient(); | |
var IP = webClient.DownloadString("http://checkip.dyndns.org/"); | |
return IP; // Current IP Address: 104.45.82.120 | |
//using System.Net; | |
//b) current hostname | |
return Dns.GetHostName(); // RD000D3AB0B28A | |
//using System.Net; | |
//c) current ip | |
var host = Dns.GetHostEntry(Dns.GetHostName()); // same result if this is "localhost" or "127.0.0.1" | |
var result = ""; | |
foreach(var address in host.AddressList) | |
result+= address.str() + " , "; | |
return result; | |
//d) external dns resolution | |
var host = Dns.GetHostEntry("www.google.com"); | |
var result = ""; | |
foreach(var address in host.AddressList) | |
result+= address.str() + " , "; | |
return result; // 74.125.24.105 , 74.125.24.147 , 74.125.24.99 , 74.125.24.103 , 74.125.24.106 , 74.125.24.104 , | |
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
var folder = @"C:\DWASFiles\Sites\csharp-repl\Config"; | |
var file = "administration.config"; | |
return "<pre><span style='color:black'>{0}</span></pre>".format(folder.pathCombine(file).fileContents().replace("<","<")); | |
//note that this file is not visiable via kudo | |
//Other interesting files | |
// D:\Program Files (x86)\SiteExtensions\Kudu\45.40422.1508\bin\scripts\dnvm.ps1 | |
C:\DWASFiles\Sites\csharp-repl\Config\rootweb.config |
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
//a) view ping help | |
var cmdToExec = "ping"; | |
var data = "cmd.exe".startProcess_getConsoleOut("/c " + cmdToExec); | |
return "<pre><span style='color:black'>" + data + "</span></pre>"; | |
// running ping on an IP address will return: 'Unable to contact IP driver. General failure.' | |
//b) start notepad (which will stay open for a while, https://csharp-repl.scm.azurewebsites.net/ProcessExplorer/) | |
var cmdToExec = "notepad"; | |
"cmd.exe".startProcess_getConsoleOut("/c " + cmdToExec); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment