Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Threading;
- using System.Management;
- class TestProgram {
- public static void test(object ip) {
- string target = (string)ip;
- ConnectionOptions options = new ConnectionOptions();
- options.Username = "Administrator";
- options.Password = "dRum&5853";
- options.Authentication = (AuthenticationLevel)Enum.Parse(typeof(AuthenticationLevel), "Packet");
- options.Impersonation = (ImpersonationLevel)Enum.Parse(typeof(ImpersonationLevel), "Impersonate");
- options.Authority = "ntlmdomain:WORKGROUP";
- ManagementScope scope = new ManagementScope( "\\\\" + target + "\\root\\cimv2", options );
- try {
- scope.Connect();
- // Console.WriteLine("Connection successful.");
- } catch (Exception e) {
- Console.WriteLine("An exception has occured for IP address " + target);
- Console.WriteLine(e.Message);
- System.Environment.Exit(1);
- }
- string[] WMIClasses = {"Win32_PerfFormattedData_PerfDisk_LogicalDisk","Win32_PerfFormattedData_PerfOS_Memory","Win32_PerfFormattedData_PerfDisk_PhysicalDisk","Win32_PerfFormattedData_PerfOS_Processor"};
- foreach (string WMIClass in WMIClasses) {
- SelectQuery query = new SelectQuery(WMIClass, " name IS NOT NULL OR name IS NULL" );
- ManagementObjectSearcher searcher = new ManagementObjectSearcher(scope, query);
- try {
- ManagementObjectCollection result = searcher.Get();
- // Console.WriteLine("There are " + result.Count + " rows.");
- if (result.Count == 0) {
- Console.WriteLine("There are 0 results in " + target + " for class " + WMIClass);
- }
- foreach( ManagementBaseObject row in result ) {
- foreach( PropertyData property in row.Properties ) {
- // Console.WriteLine(property.Name + " = " + property.Value);
- }
- }
- } catch (Exception e) {
- Console.WriteLine("An exception has occured when running query for " + target);
- Console.WriteLine(e.Message);
- System.Environment.Exit(1);
- }
- }
- // Thread.Sleep(5000);
- test(ip);
- }
- public static void Main(string[] args) {
- string[] ips = {"10.129.12.121","10.129.12.121","10.129.12.122","10.129.12.123","10.129.12.124","10.129.12.125","10.129.12.126","10.129.12.135","10.129.12.138","10.129.12.140","10.129.12.160","10.129.12.161","10.129.12.162","10.129.12.163","10.129.12.164","10.129.12.171","10.129.12.174","10.129.12.182","10.129.12.196","10.129.12.197","10.129.12.198","10.129.12.199","10.129.12.218","10.129.12.219","10.129.12.22","10.129.12.225","10.129.12.226","10.129.12.227","10.129.12.228","10.129.12.23","10.129.12.234","10.129.12.236","10.129.12.246","10.129.12.247","10.129.12.248","10.129.12.249","10.129.12.26","10.129.12.27","10.129.12.38","10.129.12.43","10.129.12.48","10.129.12.52","10.129.12.55","10.129.12.69","10.129.12.79","10.129.12.84","10.129.12.85","10.129.12.99","10.129.13.120","10.129.13.163","10.129.13.167","10.129.13.180","10.129.13.195","10.129.13.204","10.129.13.205","10.129.13.206","10.129.13.216","10.129.13.23","10.129.13.24","10.129.13.254","10.129.13.32","10.129.13.33","10.129.13.37","10.129.13.38","10.129.13.39","10.129.13.44","10.129.13.45","10.129.13.48","10.129.13.57","10.129.13.59","10.129.13.60","10.129.13.61","10.129.13.63","10.129.14.1","10.129.14.103","10.129.14.11","10.129.14.124","10.129.14.139","10.129.14.142","10.129.14.148","10.129.14.201","10.129.14.218","10.129.14.35","10.129.14.50","10.129.14.57","10.129.14.68","10.129.14.83","10.129.15.101","10.129.15.128","10.129.15.143","10.129.15.151","10.129.15.32","10.129.15.38","10.129.15.51","10.129.15.52","10.129.15.57","10.129.15.59","10.129.15.6","10.129.15.70","10.129.15.82"};
- foreach (string ip in ips) {
- Thread newThread = new Thread(test);
- newThread.Start(ip);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement