大概一年多了,瑞星一直都没更改其序列号保存方式。这还是偶在学校时无聊研究的。
偶是菜鸟,就不多说了。
关键代码如下:
1 string risingpath;
2 int i, j = 0; long snoffset, idoffset;
3
4 //以下读取
5 //HKEY_LOCAL_MACHINE\SOFTWARE\rising\Rav,并存在risingpath
6 RegistryKey hklm = Registry.LocalMachine;
7 RegistryKey software = hklm.OpenSubKey("SOFTWARE", true);
8 RegistryKey rising = software.OpenSubKey("rising");
9 RegistryKey rav = rising.OpenSubKey("Rav");
10 risingpath = rav.GetValue("installpath").ToString() + "\\RsConfig.cfg";
11
12 //以下操作RsConfig.cfg
13 File.Copy(risingpath, "C:\\RsConfig.cfg", true);
14
15 FileStream bf = new FileStream("C:\\RsConfig.cfg", FileMode.Open, FileAccess.ReadWrite);
16
17 byte[] key = new byte[8];
18 byte[] data = new byte[bf.Length];
19 byte[] newdata = new byte[bf.Length];
20 byte[] sndata = new byte[] { 67, 117, 114, 114, 101, 110, 116, 83, 110 };
21 byte[] iddata = new byte[] { 67, 117, 114, 114, 101, 110, 116, 85, 115, 101, 114, 073, 068 };
22 byte[] sn = new byte[27];
23
24 //将RsConfig.cfg文件读入data数组,将解密KEY读入key数组
25 bf.Read(data, 0, data.Length);
26 bf.Seek(128, System.IO.SeekOrigin.Begin);
27 bf.Read(key, 0, 8);
28
29 //解密配置文件
30 for (i = 0; i < data.Length; i++)
31 {
32 newdata[i] = (byte)((int)(data[i]) ^ (int)(key[j]));
33 j++;
34 if (j == 8) j = 0;
35 }
36
37 snoffset = searchchar(newdata, sndata) - 27;
38
39
40 for (i = 0; i < 27; i++)
41 {
42 textBox1.Text += ((char)(newdata[snoffset + i])).ToString();
43 }
44 idoffset = searchchar(newdata, iddata) - 15;
45 for (i = 0; i < 12; i++)
46 {
47 textBox2.Text += ((char)(newdata[idoffset + i])).ToString();
48 }
49 bf.Close();
50 File.Delete("C:\\RsConfig.cfg");
2 int i, j = 0; long snoffset, idoffset;
3
4 //以下读取
5 //HKEY_LOCAL_MACHINE\SOFTWARE\rising\Rav,并存在risingpath
6 RegistryKey hklm = Registry.LocalMachine;
7 RegistryKey software = hklm.OpenSubKey("SOFTWARE", true);
8 RegistryKey rising = software.OpenSubKey("rising");
9 RegistryKey rav = rising.OpenSubKey("Rav");
10 risingpath = rav.GetValue("installpath").ToString() + "\\RsConfig.cfg";
11
12 //以下操作RsConfig.cfg
13 File.Copy(risingpath, "C:\\RsConfig.cfg", true);
14
15 FileStream bf = new FileStream("C:\\RsConfig.cfg", FileMode.Open, FileAccess.ReadWrite);
16
17 byte[] key = new byte[8];
18 byte[] data = new byte[bf.Length];
19 byte[] newdata = new byte[bf.Length];
20 byte[] sndata = new byte[] { 67, 117, 114, 114, 101, 110, 116, 83, 110 };
21 byte[] iddata = new byte[] { 67, 117, 114, 114, 101, 110, 116, 85, 115, 101, 114, 073, 068 };
22 byte[] sn = new byte[27];
23
24 //将RsConfig.cfg文件读入data数组,将解密KEY读入key数组
25 bf.Read(data, 0, data.Length);
26 bf.Seek(128, System.IO.SeekOrigin.Begin);
27 bf.Read(key, 0, 8);
28
29 //解密配置文件
30 for (i = 0; i < data.Length; i++)
31 {
32 newdata[i] = (byte)((int)(data[i]) ^ (int)(key[j]));
33 j++;
34 if (j == 8) j = 0;
35 }
36
37 snoffset = searchchar(newdata, sndata) - 27;
38
39
40 for (i = 0; i < 27; i++)
41 {
42 textBox1.Text += ((char)(newdata[snoffset + i])).ToString();
43 }
44 idoffset = searchchar(newdata, iddata) - 15;
45 for (i = 0; i < 12; i++)
46 {
47 textBox2.Text += ((char)(newdata[idoffset + i])).ToString();
48 }
49 bf.Close();
50 File.Delete("C:\\RsConfig.cfg");