mirror of
https://github.com/moonD4rk/HackBrowserData.git
synced 2026-05-19 18:58:03 +02:00
style: format code and update readme
This commit is contained in:
+47
-4
@@ -1,6 +1,9 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"crypto/cipher"
|
||||
"crypto/des"
|
||||
"encoding/asn1"
|
||||
"errors"
|
||||
"fmt"
|
||||
"hack-browser-data/log"
|
||||
@@ -84,11 +87,11 @@ func CopyDB(src, dst string) error {
|
||||
}
|
||||
sourceFile, err := ioutil.ReadFile(src)
|
||||
if err != nil {
|
||||
log.Println(err.Error())
|
||||
log.Debug(err.Error())
|
||||
}
|
||||
err = ioutil.WriteFile(dst, sourceFile, 0777)
|
||||
if err != nil {
|
||||
log.Println(err.Error())
|
||||
log.Debug(err.Error())
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -164,7 +167,7 @@ func MakeDir(dirName string) {
|
||||
}
|
||||
}
|
||||
|
||||
func paddingZero(s []byte, l int) []byte {
|
||||
func PaddingZero(s []byte, l int) []byte {
|
||||
h := l - len(s)
|
||||
if h <= 0 {
|
||||
return s
|
||||
@@ -180,4 +183,44 @@ func PKCS5UnPadding(src []byte) []byte {
|
||||
length := len(src)
|
||||
unpadding := int(src[length-1])
|
||||
return src[:(length - unpadding)]
|
||||
}
|
||||
}
|
||||
|
||||
func Des3Decrypt(key, iv []byte, src []byte) ([]byte, error) {
|
||||
block, err := des.NewTripleDESCipher(key)
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
return nil, err
|
||||
}
|
||||
blockMode := cipher.NewCBCDecrypter(block, iv)
|
||||
sq := make([]byte, len(src))
|
||||
blockMode.CryptBlocks(sq, src)
|
||||
return sq, nil
|
||||
}
|
||||
|
||||
/*
|
||||
SEQUENCE (3 elem)
|
||||
OCTET STRING (16 byte)
|
||||
SEQUENCE (2 elem)
|
||||
OBJECT IDENTIFIER 1.2.840.113549.3.7 des-EDE3-CBC (RSADSI encryptionAlgorithm)
|
||||
OCTET STRING (8 byte)
|
||||
OCTET STRING (16 byte)
|
||||
*/
|
||||
type LoginPBE struct {
|
||||
CipherText []byte
|
||||
SequenceLogin
|
||||
Encrypted []byte
|
||||
}
|
||||
|
||||
type SequenceLogin struct {
|
||||
asn1.ObjectIdentifier
|
||||
Iv []byte
|
||||
}
|
||||
|
||||
func DecodeLogin(decodeItem []byte) (pbe LoginPBE, err error) {
|
||||
_, err = asn1.Unmarshal(decodeItem, &pbe)
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
return
|
||||
}
|
||||
return pbe, nil
|
||||
}
|
||||
|
||||
+34
-2
@@ -5,6 +5,7 @@ import (
|
||||
"crypto/aes"
|
||||
"crypto/cipher"
|
||||
"crypto/sha1"
|
||||
"encoding/asn1"
|
||||
"errors"
|
||||
"hack-browser-data/log"
|
||||
"os/exec"
|
||||
@@ -68,12 +69,12 @@ func InitKey(key string) error {
|
||||
cmd.Stderr = &stderr
|
||||
err := cmd.Run()
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
log.Error(err)
|
||||
return err
|
||||
}
|
||||
if stderr.Len() > 0 {
|
||||
err = errors.New(stderr.String())
|
||||
log.Println(err)
|
||||
log.Error(err)
|
||||
}
|
||||
temp := stdout.Bytes()
|
||||
chromePass := temp[:len(temp)-1]
|
||||
@@ -110,5 +111,36 @@ func aes128CBCDecrypt(encryptPass []byte) (string, error) {
|
||||
return string(dst), nil
|
||||
}
|
||||
|
||||
/*
|
||||
SEQUENCE (2 elem)
|
||||
SEQUENCE (2 elem)
|
||||
OBJECT IDENTIFIER
|
||||
SEQUENCE (2 elem)
|
||||
OCTET STRING (20 byte)
|
||||
INTEGER 1
|
||||
OCTET STRING (16 byte)
|
||||
*/
|
||||
|
||||
type MetaPBE struct {
|
||||
SequenceA
|
||||
Encrypted []byte
|
||||
}
|
||||
|
||||
type SequenceA struct {
|
||||
DecryptMethod asn1.ObjectIdentifier
|
||||
SequenceB
|
||||
}
|
||||
|
||||
type SequenceB struct {
|
||||
EntrySalt []byte
|
||||
Len int
|
||||
}
|
||||
|
||||
func DecodeMeta(decodeItem []byte) (pbe MetaPBE, err error) {
|
||||
_, err = asn1.Unmarshal(decodeItem, &pbe)
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user