qprotocal

package module
v0.0.0-...-fc0084f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 9, 2019 License: Apache-2.0 Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

qprotocal

安卓qq协议golang库

Install

go get github.com/longhaoteng/qprotocal

Usage
import (
	"bytes"
	"encoding/hex"
	"fmt"
	"io"
	"log"
	"os"
	qq "github.com/longhaoteng/qprotocal"
)

func main() {
	q, err := qq.Init("1151018295", "123456")
	if err != nil {
		log.Fatal(err)
	}
	err = q.Login()
	if err != nil {
		log.Fatal(err)
	}

	if q.LoginState == 0 {
		log.Println(q.LastError)
	} else if q.LoginState == 1 {
		out, err := os.Create("./verification_code.jpg")
		if err != nil {
			log.Fatal(err)
		}
		defer out.Close()
		for {
			code := ""
			_, err = io.Copy(out, bytes.NewReader(q.Verification))
			log.Printf("verification code img path:%s", out.Name())
			log.Printf("%s:", q.LastError)
			_, _ = fmt.Scanln(&code)
			err := q.SendCode(code)
			if err != nil {
				log.Fatal(err)
			}
			if q.LoginState != 1 {
				break
			}
		}
	} else {
		log.Printf("nick:%s", q.Nick)
		log.Printf("face:%d", q.Face)
		log.Printf("age:%d", q.Age)
		log.Printf("gender:%d", q.Gender)
		log.Printf("token002c:%s", hex.EncodeToString(q.Token002c))
		log.Printf("token004c:%s", hex.EncodeToString(q.Token004c))
		log.Printf("sessionKey:%s", hex.EncodeToString(q.SessionKey))
	}
}
声明

使用本项目代码产生的任何后果与本人无关。

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type QQ

type QQ struct {
	// tcp
	Conn net.Conn

	Caption  string
	Uin      uint
	UinLong  []byte
	Password string
	Md5Pwd   []byte
	Md5Pwd2  []byte
	KSid     []byte

	Imei        []byte
	ApkVer      []byte
	ShareKey    []byte
	PubKey      []byte
	AppId       uint
	PcVer       []byte
	OsType      []byte
	OsVersion   []byte
	NetworkType uint
	Apn         []byte
	Device      []byte
	ApkId       []byte
	ApkSig      []byte
	Time        int64
	TgtKey      []byte
	RandKey     []byte
	Mst1Key     []byte
	StWeb       []byte

	// sso_seq
	RequestId uint
	PcSubCmd  uint

	// sessions
	Token002c  []byte
	Token004c  []byte
	Token0058  []byte
	SessionKey []byte

	// login state
	// 0 logining, 1 verify, 2 success
	LoginState uint
	LastError  string

	// account info
	Nick               string
	Face               uint
	Age                uint
	Gender             uint
	Key                []byte
	SKey               []byte
	VKey               []byte
	Sid                []byte
	Verification       []byte
	VerificationToken1 []byte
	VerificationToken2 []byte
	PsKey              []byte
	SuperKey           []byte
}

func Init

func Init(uin, password string) (*QQ, error)

func (*QQ) Login

func (qq *QQ) Login() error

func (*QQ) SendCode

func (qq *QQ) SendCode(code string) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址