2024-10-14 12:14:01 +03:00
|
|
|
package _VisualDVM.Passes.All;
|
2025-02-13 16:20:48 +03:00
|
|
|
import Common.Passes.Pass;
|
2025-02-19 22:47:56 +03:00
|
|
|
import _VisualDVM.Global;
|
2025-02-18 16:21:20 +03:00
|
|
|
|
|
|
|
|
import java.io.BufferedReader;
|
|
|
|
|
import java.io.File;
|
|
|
|
|
import java.io.FileWriter;
|
|
|
|
|
import java.io.InputStreamReader;
|
2025-02-13 16:20:48 +03:00
|
|
|
public class TestPass extends Pass {
|
2025-02-18 16:21:20 +03:00
|
|
|
public static String getMotherboardSN() {
|
|
|
|
|
String result = "";
|
|
|
|
|
try {
|
|
|
|
|
File file = File.createTempFile("realhowto",".vbs");
|
|
|
|
|
file.deleteOnExit();
|
|
|
|
|
FileWriter fw = new java.io.FileWriter(file);
|
|
|
|
|
String vbs =
|
|
|
|
|
"Set objWMIService = GetObject(\"winmgmts:\\\\.\\root\\cimv2\")\n"
|
|
|
|
|
+ "Set colItems = objWMIService.ExecQuery _ \n"
|
|
|
|
|
+ " (\"Select * from Win32_BaseBoard\") \n"
|
|
|
|
|
+ "For Each objItem in colItems \n"
|
|
|
|
|
+ " Wscript.Echo objItem.SerialNumber \n"
|
|
|
|
|
+ " exit for ' do the first cpu only! \n"
|
|
|
|
|
+ "Next \n";
|
|
|
|
|
|
|
|
|
|
fw.write(vbs);
|
|
|
|
|
fw.close();
|
|
|
|
|
Process p = Runtime.getRuntime().exec("cscript //NoLogo " + file.getPath());
|
|
|
|
|
BufferedReader input =
|
|
|
|
|
new BufferedReader
|
|
|
|
|
(new InputStreamReader(p.getInputStream()));
|
|
|
|
|
String line;
|
|
|
|
|
while ((line = input.readLine()) != null) {
|
|
|
|
|
result += line;
|
|
|
|
|
}
|
|
|
|
|
input.close();
|
|
|
|
|
}
|
|
|
|
|
catch(Exception e){
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
return result.trim();
|
|
|
|
|
}
|
2024-05-16 01:26:03 +03:00
|
|
|
@Override
|
2024-09-26 21:31:18 +03:00
|
|
|
protected void body() throws Exception {
|
2025-03-03 17:11:13 +03:00
|
|
|
int a= 1/0;
|
|
|
|
|
// System.out.println(Global.componentsServer.credentials_db.userAccounts.getPackedActiveRecipients());
|
2025-02-18 16:21:20 +03:00
|
|
|
// String cpuId = getMotherboardSN();
|
|
|
|
|
// UI.Info(cpuId);
|
|
|
|
|
/*
|
|
|
|
|
SystemInfo systemInfo = new SystemInfo();
|
|
|
|
|
HardwareAbstractionLayer hardware = systemInfo.getHardware();
|
|
|
|
|
CentralProcessor processor = hardware.getProcessor();
|
|
|
|
|
CentralProcessor.ProcessorIdentifier processorIdentifier = processor.getProcessorIdentifier();
|
|
|
|
|
System.out.println("Processor Vendor: " + processorIdentifier.getVendor());
|
|
|
|
|
System.out.println("Processor Name: " + processorIdentifier.getName());
|
|
|
|
|
System.out.println("Processor ID: " + processorIdentifier.getProcessorID());
|
|
|
|
|
System.out.println("Identifier: " + processorIdentifier.getIdentifier());
|
|
|
|
|
System.out.println("Microarchitecture: " + processorIdentifier.getMicroarchitecture());
|
|
|
|
|
System.out.println("Frequency (Hz): " + processorIdentifier.getVendorFreq());
|
|
|
|
|
System.out.println("Frequency (GHz): " + processorIdentifier.getVendorFreq() / 1000000000.0);
|
|
|
|
|
*/
|
|
|
|
|
/*
|
|
|
|
|
String serial = "";
|
|
|
|
|
Scanner sc = null;
|
|
|
|
|
Process process = null;
|
|
|
|
|
try {
|
|
|
|
|
process = Runtime.getRuntime().exec(new String[] { "wmic", "cpu", "get", "ProcessorId" });
|
|
|
|
|
process.getOutputStream().close();
|
|
|
|
|
sc = new Scanner(process.getInputStream());
|
|
|
|
|
sc.next();
|
|
|
|
|
serial = sc.next();
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
} dummy
|
|
|
|
|
UI.Info(Utils_.Brackets(serial));
|
|
|
|
|
*/
|
|
|
|
|
/*
|
|
|
|
|
KeyGenerator keyGenerator = KeyGenerator.getInstance("AES");
|
|
|
|
|
SecureRandom secureRandom = new SecureRandom();
|
|
|
|
|
int keyBitSize = 256;
|
|
|
|
|
keyGenerator.init(keyBitSize, secureRandom);
|
|
|
|
|
SecretKey secretKey = keyGenerator.generateKey();
|
|
|
|
|
System.out.println("====");
|
|
|
|
|
System.out.println(secretKey.getEncoded());
|
|
|
|
|
System.out.println("====");
|
|
|
|
|
*/
|
2024-05-16 01:26:03 +03:00
|
|
|
}
|
2023-09-17 22:13:42 +03:00
|
|
|
}
|