Merge pull request #159 from moonD4rk/dev
refactor: formatting code used to pass golangci-lint rulespull/160/head
commit
ab6ca5abfa
@ -0,0 +1,69 @@ |
|||||||
|
run: |
||||||
|
timeout: '5m' |
||||||
|
skip-dirs: |
||||||
|
- 'assets' |
||||||
|
allow-parallel-runners: true |
||||||
|
modules-download-mode: 'readonly' |
||||||
|
|
||||||
|
linters: |
||||||
|
enable: |
||||||
|
- 'asciicheck' |
||||||
|
- 'deadcode' |
||||||
|
- 'depguard' |
||||||
|
- 'dogsled' |
||||||
|
- 'errorlint' |
||||||
|
- 'exportloopref' |
||||||
|
- 'gofmt' |
||||||
|
- 'goheader' |
||||||
|
- 'goimports' |
||||||
|
- 'gomodguard' |
||||||
|
- 'goprintffuncname' |
||||||
|
- 'gosec' |
||||||
|
- 'govet' |
||||||
|
- 'ineffassign' |
||||||
|
- 'makezero' |
||||||
|
- 'misspell' |
||||||
|
- 'paralleltest' |
||||||
|
- 'prealloc' |
||||||
|
- 'predeclared' |
||||||
|
- 'revive' |
||||||
|
- 'typecheck' |
||||||
|
- 'unconvert' |
||||||
|
- 'varcheck' |
||||||
|
- 'whitespace' |
||||||
|
disable: |
||||||
|
# unsupported lint with golang 1.18+ ref: https://github.com/golangci/golangci-lint/issues/2649 |
||||||
|
- 'bodyclose' |
||||||
|
- 'gosimple' |
||||||
|
- 'noctx' |
||||||
|
- 'sqlclosecheck' |
||||||
|
- 'staticcheck' |
||||||
|
- 'structcheck' |
||||||
|
- 'stylecheck' |
||||||
|
- 'unused' |
||||||
|
- 'errcheck' |
||||||
|
|
||||||
|
issues: |
||||||
|
exclude-use-default: false |
||||||
|
exclude: |
||||||
|
- should have a package comment |
||||||
|
- should have comment |
||||||
|
# G101: Potential hardcoded credentials |
||||||
|
- G101 |
||||||
|
# G103: Use of unsafe calls should be audited |
||||||
|
- G103 |
||||||
|
# G304: Potential file inclusion via variable |
||||||
|
- G304 |
||||||
|
# G404, G401, G502, G505: weak cryptographic list |
||||||
|
- G401 |
||||||
|
- G404 |
||||||
|
- G502 |
||||||
|
- G505 |
||||||
|
exclude-rules: |
||||||
|
- path: internal/browser/browser\.go |
||||||
|
linters: |
||||||
|
- 'deadcode' |
||||||
|
- 'varcheck' |
||||||
|
- 'unused' |
||||||
|
max-issues-per-linter: 0 |
||||||
|
max-same-issues: 0 |
@ -1,17 +1,21 @@ |
|||||||
package decrypter |
package decrypter |
||||||
|
|
||||||
|
var ( |
||||||
|
errSecurityKeyIsEmpty = errors.New("input [security find-generic-password -wa 'Chrome'] in terminal") |
||||||
|
) |
||||||
|
|
||||||
func Chromium(key, encryptPass []byte) ([]byte, error) { |
func Chromium(key, encryptPass []byte) ([]byte, error) { |
||||||
if len(encryptPass) > 3 { |
if len(encryptPass) <= 3 { |
||||||
if len(key) == 0 { |
return nil, errPasswordIsEmpty |
||||||
return nil, errSecurityKeyIsEmpty |
} |
||||||
} |
if len(key) == 0 { |
||||||
chromeIV := []byte{32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32} |
return nil, errSecurityKeyIsEmpty |
||||||
return aes128CBCDecrypt(key, chromeIV, encryptPass[3:]) |
|
||||||
} else { |
|
||||||
return nil, errDecryptFailed |
|
||||||
} |
} |
||||||
|
|
||||||
|
iv := []byte{32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32} |
||||||
|
return aes128CBCDecrypt(key, iv, encryptPass[3:]) |
||||||
} |
} |
||||||
|
|
||||||
func DPApi(data []byte) ([]byte, error) { |
func DPAPI(data []byte) ([]byte, error) { |
||||||
return nil, nil |
return nil, nil |
||||||
} |
} |
||||||
|
@ -1,17 +1,14 @@ |
|||||||
package decrypter |
package decrypter |
||||||
|
|
||||||
func Chromium(key, encryptPass []byte) ([]byte, error) { |
func Chromium(key, encryptPass []byte) ([]byte, error) { |
||||||
chromeIV := []byte{32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32} |
if len(encryptPass) < 3 { |
||||||
if len(encryptPass) > 3 { |
return nil, errPasswordIsEmpty |
||||||
if len(key) == 0 { |
|
||||||
return nil, errSecurityKeyIsEmpty |
|
||||||
} |
|
||||||
return aes128CBCDecrypt(key, chromeIV, encryptPass[3:]) |
|
||||||
} else { |
|
||||||
return nil, errDecryptFailed |
|
||||||
} |
} |
||||||
|
|
||||||
|
chromeIV := []byte{32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32} |
||||||
|
return aes128CBCDecrypt(key, chromeIV, encryptPass[3:]) |
||||||
} |
} |
||||||
|
|
||||||
func DPApi(data []byte) ([]byte, error) { |
func DPAPI(data []byte) ([]byte, error) { |
||||||
return nil, nil |
return nil, nil |
||||||
} |
} |
||||||
|
Loading…
Reference in new issue