Fixed a potential scrurity vulnerability while also fixing the host tab being slow. yay for async methods!
This commit is contained in:
parent
ea806050c6
commit
e93a3e422a
|
|
@ -189,7 +189,6 @@ namespace NovetusCMD
|
|||
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
GlobalVars.PublicIP = SecurityFuncs.GetExternalIPAddress();
|
||||
string[] lines = File.ReadAllLines(GlobalVars.ConfigDir + "\\info.txt"); //File is in System.IO
|
||||
string version = lines[0];
|
||||
GlobalVars.DefaultClient = lines[1];
|
||||
|
|
@ -414,11 +413,11 @@ namespace NovetusCMD
|
|||
Environment.Exit(0);
|
||||
}
|
||||
|
||||
static void CreateTXT()
|
||||
static async void CreateTXT()
|
||||
{
|
||||
if (LocalVars.RequestToOutputInfo)
|
||||
{
|
||||
string IP = GlobalVars.PublicIP;
|
||||
string IP = await SecurityFuncs.GetExternalIPAddressAsync();
|
||||
string[] lines1 = {
|
||||
SecurityFuncs.Base64Encode(IP),
|
||||
SecurityFuncs.Base64Encode(GlobalVars.RobloxPort.ToString()),
|
||||
|
|
|
|||
|
|
@ -130,7 +130,6 @@ public static class GlobalVars
|
|||
public static AssetCacheDef ItemPantsTexture { get { return new AssetCacheDef("Pants", new string[] { "PantsTemplate" }, new string[] { ".png" }, new string[] { pantsdirTextures }, new string[] { pantsGameDirTextures }); } }
|
||||
|
||||
public static string IP = "localhost";
|
||||
public static string PublicIP = "";
|
||||
public static string Version = "";
|
||||
public static string SharedArgs = "";
|
||||
public static readonly string ScriptName = "CSMPFunctions";
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ using System.Security.Principal;
|
|||
using System.Linq;
|
||||
using System.ComponentModel;
|
||||
using System.Net;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
/// <summary>
|
||||
/// Description of SecurityFuncs.
|
||||
|
|
@ -206,4 +207,10 @@ public class SecurityFuncs
|
|||
|
||||
return ipAddress;
|
||||
}
|
||||
|
||||
public static async Task<string> GetExternalIPAddressAsync()
|
||||
{
|
||||
var task = Task.Run(() => GetExternalIPAddress());
|
||||
return await task;
|
||||
}
|
||||
}
|
||||
|
|
@ -206,12 +206,12 @@ namespace NovetusLauncher
|
|||
ConsolePrint("WebServer: Failed to stop WebServer. Some features may not function. (Did not run as Administrator)", 2);
|
||||
}
|
||||
}
|
||||
|
||||
void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
|
||||
|
||||
async void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (tabControl1.SelectedTab == tabControl1.TabPages["tabPage2"])//your specific tabname
|
||||
{
|
||||
string IP = GlobalVars.PublicIP;
|
||||
string IP = await SecurityFuncs.GetExternalIPAddressAsync();
|
||||
string[] lines1 = {
|
||||
SecurityFuncs.Base64Encode(IP),
|
||||
SecurityFuncs.Base64Encode(GlobalVars.RobloxPort.ToString()),
|
||||
|
|
@ -249,6 +249,8 @@ namespace NovetusLauncher
|
|||
textBox3.AppendText(Environment.NewLine);
|
||||
}
|
||||
}
|
||||
textBox3.SelectionStart = 0;
|
||||
textBox3.ScrollToCaret();
|
||||
treeView1.Nodes.Clear();
|
||||
_fieldsTreeCache.Nodes.Clear();
|
||||
textBox4.Text = "";
|
||||
|
|
@ -355,7 +357,6 @@ namespace NovetusLauncher
|
|||
|
||||
void MainFormLoad(object sender, EventArgs e)
|
||||
{
|
||||
GlobalVars.PublicIP = SecurityFuncs.GetExternalIPAddress();
|
||||
string[] lines = File.ReadAllLines(GlobalVars.ConfigDir + "\\info.txt"); //File is in System.IO
|
||||
string version = lines[0];
|
||||
GlobalVars.DefaultClient = lines[1];
|
||||
|
|
|
|||
Loading…
Reference in New Issue