Process.Start("C:\\Program Files\\Tencent\\QQ\\QQ.exe", "/START QQUIN:QQ號碼 PWDHASH:密碼的雜湊 /STAT:40");
/STAT:40表示隱藏,41表示線上.
一開始我在網上找了下PWDHASH的演算法是Base64(md5(QQ密碼,16));當然,因為網上的大都是去年的所以我也考慮了其他演算法,不過最終都登陸失敗.困了我一天,還好bbs.pfan.cn有個傢伙叫我自己寫演算法,跟蹤後發現正確的演算法應該是Base64String(md5(QQ密碼,32)).其實這個演算法我也試過,不過不是自己寫的,失敗原因評鑑為我把QQ密碼拿到線上Data Encryption Service器去轉化.//最終認定QQ2008的PWDHASH計算方法是先把QQ密碼(eg:124dfs5216)加密成32位的MD5位元流:9AE46DFB2512CA1191A51F66C8A9A35B再兩個一組9A E4 6D FB 25 12 CA 11 91 A5 1F 66 C8 A9 A3 5B變回16個ASCII碼字串,再對其Base64加密(難怪很多人誤以為是拿16位的MD5去Base64變換).而我當時拿小寫9AE46DFB2512CA1191A51F66C8A9A35B去Base64加密,所以錯誤了,問題還是在自己.
後來我就寫了個Form形式的迷你QQ登陸器.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Security.Cryptography;
using System.Diagnostics;
namespace 密你QQ登陸器
{
public partial class Form1 : Form
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.btn_Login = new System.Windows.Forms.Button();
this.txB_Account = new System.Windows.Forms.TextBox();
this.chkB_Hide = new System.Windows.Forms.CheckBox();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.txB_Psw = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// btn_Login
//
this.btn_Login.BackColor = System.Drawing.Color.Red;
this.btn_Login.Location = new System.Drawing.Point(188, 4);
this.btn_Login.Name = "btn_Login";
this.btn_Login.Size = new System.Drawing.Size(41, 23);
this.btn_Login.TabIndex = 0;
this.btn_Login.Text = "登陸";
this.btn_Login.UseVisualStyleBackColor = false;
this.btn_Login.Click += new System.EventHandler(this.btn_Login_Click);
//
// txB_Account
//
this.txB_Account.Location = new System.Drawing.Point(65, 6);
this.txB_Account.Name = "txB_Account";
this.txB_Account.Size = new System.Drawing.Size(117, 21);
this.txB_Account.TabIndex = 1;
//
// chkB_Hide
//
this.chkB_Hide.AutoSize = true;
this.chkB_Hide.Location = new System.Drawing.Point(188, 38);
this.chkB_Hide.Name = "chkB_Hide";
this.chkB_Hide.Size = new System.Drawing.Size(48, 16);
this.chkB_Hide.TabIndex = 2;
this.chkB_Hide.Text = "隱藏";
this.chkB_Hide.UseVisualStyleBackColor = true;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 9);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(47, 12);
this.label1.TabIndex = 3;
this.label1.Text = "QQ帳號:";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(24, 36);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(35, 12);
this.label2.TabIndex = 4;
this.label2.Text = "密碼:";
//
// txB_Psw
//
this.txB_Psw.Location = new System.Drawing.Point(65, 33);
this.txB_Psw.Name = "txB_Psw";
this.txB_Psw.PasswordChar = '*';
this.txB_Psw.Size = new System.Drawing.Size(117, 21);
this.txB_Psw.TabIndex = 5;
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.PaleGreen;
this.ClientSize = new System.Drawing.Size(241, 61);
this.Controls.Add(this.txB_Psw);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.chkB_Hide);
this.Controls.Add(this.txB_Account);
this.Controls.Add(this.btn_Login);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.Name = "Form1";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "迷你QQ登陸器";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button btn_Login;
private System.Windows.Forms.TextBox txB_Account;
private System.Windows.Forms.CheckBox chkB_Hide;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox txB_Psw;
public Form1()
{
InitializeComponent();
}
private void btn_Login_Click(object sender, EventArgs e)
{
try
{
string QQNum = txB_Account.Text.ToString().Trim();
string pswStr = txB_Psw.Text.ToString().Trim();
byte[] pwbyte = new byte[pswStr.Length];
MD5 myMd5 = new MD5CryptoServiceProvider();
pwbyte = myMd5.ComputeHash(Encoding.UTF8.GetBytes(pswStr));
string Is_Hide = (chkB_Hide.Checked) ? "40" : "41";
Process.Start("C:\\Program Files\\Tencent\\QQ\\QQ.exe", "/START QQUIN:" + QQNum + " PWDHASH:" +
Convert.ToBase64String(pwbyte) + " /STAT:" + Is_Hide);
}
catch
{
MessageBox.Show("自己找錯誤!");
}
}
}
}
有了這個,就可以自己先用演算法酸楚PSWDHASH,後建個控制台程式.用
Process.Start("C:\\Program Files\\Tencent\\QQ\\QQ.exe", "/START QQUIN:QQ號碼 PWDHASH:密碼的雜湊 /STAT:40");
實現快速登陸了.