I'm a newbie developer! I study C# now, i want to change Mac address only use C# (with registry) (not bat OR cmd) how can I do? This code is Make Random 12 random string with english and number and i want to change mac address to the random string.. Thanks!
using System;
using System.Timers;
using System;
using System.Net;
using System.IO;
using System.Diagnostics;
using System.Linq;
using Microsoft.Win32;
namespace auto_mac_address_changer
{
class MainClass
{
public static string GetRandomPassword(int _totLen)
{
Random rand = new Random(); string input = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; var chars = Enumerable.Range(0, _totLen).Select(x => input[rand.Next(0, input.Length)]); return new string(chars.ToArray());
}
public static void Main(string[] args)
{
bool networkUp = System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable();
reg = reg.OpenSubKey("Software\\Your Program Name", true);
while (true)
{
if (networkUp == false)
{
string a = GetRandomPassword(12);
//here need to be change registry relative Mac Address
}
}
}
}
}