软件作者:kebin
信息来源:邪恶八进制信息安全团队(
www.eviloctal.com)
以下是源码 c#编写
小的菜 也玩把开源精神 哈哈
复制内容到剪贴板
代码:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Microsoft.Win32;
using System.Runtime.InteropServices;
using System.IO;
using System.Net;
using System.Management;
namespace WindowsApplication8
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
textBox1.Clear();
RegistryKey i;
i = Registry.LocalMachine.OpenSubKey("Software\\Microsoft\\Windows NT\\CurrentVersion"); //读取注册表
string s = "当前操作系统版本:" + i.GetValue("ProductName").ToString();
s = s + "\r\n" + i.GetValue("CurrentBuildNumber").ToString();
s = s + "\r\n当前操作系统安装序列号:\r\n" + i.GetValue("ProductId").ToString();
s = s + "\r\n当前系统版本号:" + i.GetValue("CurrentBuildNumber").ToString();
i.Close();
textBox1.Text = textBox1.Text + "\r\n" + s;
}
private void Form1_Load(object sender, EventArgs e)
{
label1.Text = "东方不败3:" + DateTime.Now.ToString();
RegistryKey i;
i = Registry.LocalMachine.OpenSubKey("Software\\Microsoft\\Windows NT\\CurrentVersion");
string s = i.GetValue("ProductName").ToString();
if (System.Text.RegularExpressions.Regex.IsMatch(s, "Windows XP"))
{
textBox2.Text = "您的操作系统:Windows XP";
}
if (System.Text.RegularExpressions.Regex.IsMatch(s, "Windows 2000"))
{
textBox2.Text = "您的操作系统:Windows Server 2000";
}
if (System.Text.RegularExpressions.Regex.IsMatch(s, "Windows Server 2003"))
{
textBox2.Text = "您的操作系统:Windows Server 2003";
}
i.Close();
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct USER_INFO_0
{
public string Username;
}
[DllImport("Netapi32.dll")]
extern static int NetUserEnum(
[MarshalAs(UnmanagedType.LPWStr)]
string servername,
int level,
int filter,
out IntPtr bufptr,
int prefmaxlen,
out int entriesread,
out int totalentries,
out int resume_handle);
[DllImport("Netapi32.dll")]
extern static int NetApiBufferFree(IntPtr Buffer);
private void button2_Click(object sender, EventArgs e)
{
textBox1.Clear();
int EntriesRead;
int TotalEntries;
int Resume;
IntPtr bufPtr;
NetUserEnum(null, 0, 2, out bufPtr, -1, out EntriesRead,
out TotalEntries, out Resume);
if (EntriesRead > 0)
{
USER_INFO_0[] Users = new USER_INFO_0[EntriesRead];
IntPtr iter = bufPtr;
for (int i = 0; i < EntriesRead; i++)
{
Users = (USER_INFO_0)Marshal.PtrToStructure(iter,
typeof(USER_INFO_0));
iter = (IntPtr)((int)iter + Marshal.SizeOf(typeof(USER_INFO_0)));
textBox1.AppendText("当前帐户:" + Users.Username + "\r\n");
}
NetApiBufferFree(bufPtr);
}
}
private void button3_Click(object sender, EventArgs e)
{
string stringMAC = "";
string stringIP = "";
ManagementClass MC = new ManagementClass("Win32_NetworkAdapterConfiguration");
ManagementObjectCollection MOC = MC.GetInstances();
foreach (ManagementObject MO in MOC)
{
if ((bool)MO["IPEnabled"] == true)
{
stringMAC += MO["MACAddress"].ToString();
string[] IPAddresses = (string[])MO["IPAddress"];
if (IPAddresses.Length > 0) stringIP = IPAddresses[0];
textBox1.Text = "IP地址:" + stringIP.ToString() + "\r\n" + "网卡地址:" + stringMAC.ToString();
}
}
}
private void button4_Click(object sender, EventArgs e)
{
Form2 f2 = new Form2();
f2.ShowDialog();
}
}
}