Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: MrYadro/go-ps3syscon
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.0.1
Choose a base ref
...
head repository: MrYadro/go-ps3syscon
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref

Commits on Apr 2, 2021

  1. Copy the full SHA
    ee45807 View commit details
  2. Copy the full SHA
    b130bae View commit details

Commits on Apr 3, 2021

  1. Copy the full SHA
    38485ec View commit details
  2. com -> cmd

    MrYadro committed Apr 3, 2021
    Copy the full SHA
    2f61f00 View commit details
  3. properer readme

    MrYadro committed Apr 3, 2021
    Copy the full SHA
    88d7815 View commit details
  4. properer readme

    MrYadro committed Apr 3, 2021
    Copy the full SHA
    d4bb159 View commit details

Commits on Apr 9, 2021

  1. WIP: more modes

    MrYadro committed Apr 9, 2021
    Copy the full SHA
    c12d293 View commit details

Commits on Apr 10, 2021

  1. WIP: more modes

    MrYadro committed Apr 10, 2021
    Copy the full SHA
    4a8807c View commit details

Commits on May 5, 2021

  1. Add new modes

    MrYadro committed May 5, 2021
    Copy the full SHA
    bcb4413 View commit details
  2. Copy the full SHA
    9e7e9a1 View commit details
  3. Add CXR mode to readme

    MrYadro committed May 5, 2021
    Copy the full SHA
    c1553a6 View commit details
  4. Skip windows arm build

    MrYadro committed May 5, 2021
    Copy the full SHA
    7b20dbe View commit details
  5. update go release action

    MrYadro committed May 5, 2021
    Copy the full SHA
    66acaf3 View commit details

Commits on May 6, 2021

  1. move files to cmd

    MrYadro committed May 6, 2021
    Copy the full SHA
    1dec70d View commit details
  2. rename files

    MrYadro committed May 6, 2021
    Copy the full SHA
    10a7ad5 View commit details
  3. tidy go modules

    MrYadro committed May 6, 2021
    Copy the full SHA
    2015fe9 View commit details
  4. Commands validation WIP

    MrYadro committed May 6, 2021
    Copy the full SHA
    2729508 View commit details
  5. commands p2

    MrYadro committed May 6, 2021
    Copy the full SHA
    abe1855 View commit details
  6. commands p3

    MrYadro committed May 6, 2021
    Copy the full SHA
    f7a20f3 View commit details
  7. commandsdone

    MrYadro committed May 6, 2021
    Copy the full SHA
    1903ab8 View commit details
  8. Dependabot

    MrYadro committed May 6, 2021
    Copy the full SHA
    4329133 View commit details
  9. Dependabot

    MrYadro committed May 6, 2021
    Copy the full SHA
    ed57d36 View commit details
  10. codeql

    MrYadro committed May 6, 2021
    Copy the full SHA
    13ea396 View commit details
  11. properer readme links

    MrYadro committed May 6, 2021
    Copy the full SHA
    f2397a8 View commit details
  12. properer readme links

    MrYadro committed May 6, 2021
    Copy the full SHA
    24b873e View commit details
  13. Fix building

    MrYadro committed May 6, 2021
    Copy the full SHA
    1c428df View commit details
  14. Add infocmd command

    MrYadro committed May 6, 2021
    Copy the full SHA
    27ae535 View commit details
  15. add command sample to readme

    MrYadro committed May 6, 2021
    Copy the full SHA
    5ba1a4f View commit details
  16. Move vars to separate file

    MrYadro committed May 6, 2021
    Copy the full SHA
    6c2c527 View commit details

Commits on May 12, 2021

  1. Add build test

    MrYadro committed May 12, 2021
    Copy the full SHA
    be8b596 View commit details
  2. yml -> yaml

    MrYadro committed May 12, 2021
    Copy the full SHA
    ec154a9 View commit details
  3. Fix readme

    MrYadro committed May 12, 2021
    Copy the full SHA
    1a2bd61 View commit details
  4. Fix readme

    MrYadro committed May 12, 2021
    Copy the full SHA
    ec02922 View commit details
  5. Edit readme

    MrYadro committed May 12, 2021
    Copy the full SHA
    4f2b22c View commit details

Commits on Jul 1, 2021

  1. Bump go.bug.st/serial from 1.1.3 to 1.3.0

    Bumps [go.bug.st/serial](https://github.com/bugst/go-serial) from 1.1.3 to 1.3.0.
    - [Release notes](https://github.com/bugst/go-serial/releases)
    - [Commits](bugst/go-serial@v1.1.3...v1.3.0)
    
    ---
    updated-dependencies:
    - dependency-name: go.bug.st/serial
      dependency-type: direct:production
      update-type: version-update:semver-minor
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Jul 1, 2021
    Copy the full SHA
    e848358 View commit details
  2. Merge pull request #7 from MrYadro/dependabot/go_modules/go.bug.st/se…

    …rial-1.3.0
    
    Bump go.bug.st/serial from 1.1.3 to 1.3.0
    MrYadro authored Jul 1, 2021
    Copy the full SHA
    28e7f3e View commit details

Commits on Jul 20, 2021

  1. Bump go.bug.st/serial from 1.3.0 to 1.3.1

    Bumps [go.bug.st/serial](https://github.com/bugst/go-serial) from 1.3.0 to 1.3.1.
    - [Release notes](https://github.com/bugst/go-serial/releases)
    - [Commits](bugst/go-serial@v1.3.0...v1.3.1)
    
    ---
    updated-dependencies:
    - dependency-name: go.bug.st/serial
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Jul 20, 2021
    Copy the full SHA
    9cac1d3 View commit details

Commits on Jul 24, 2021

  1. Merge pull request #8 from MrYadro/dependabot/go_modules/go.bug.st/se…

    …rial-1.3.1
    
    Bump go.bug.st/serial from 1.3.0 to 1.3.1
    MrYadro authored Jul 24, 2021
    Copy the full SHA
    4388145 View commit details

Commits on Sep 1, 2021

  1. Bump go.bug.st/serial from 1.3.1 to 1.3.2

    Bumps [go.bug.st/serial](https://github.com/bugst/go-serial) from 1.3.1 to 1.3.2.
    - [Release notes](https://github.com/bugst/go-serial/releases)
    - [Commits](bugst/go-serial@v1.3.1...v1.3.2)
    
    ---
    updated-dependencies:
    - dependency-name: go.bug.st/serial
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Sep 1, 2021
    Copy the full SHA
    2f257eb View commit details

Commits on Sep 2, 2021

  1. Merge pull request #9 from MrYadro/dependabot/go_modules/go.bug.st/se…

    …rial-1.3.2
    
    Bump go.bug.st/serial from 1.3.1 to 1.3.2
    MrYadro authored Sep 2, 2021
    Copy the full SHA
    84f3ce9 View commit details

Commits on Sep 13, 2021

  1. Bump go.bug.st/serial from 1.3.2 to 1.3.3

    Bumps [go.bug.st/serial](https://github.com/bugst/go-serial) from 1.3.2 to 1.3.3.
    - [Release notes](https://github.com/bugst/go-serial/releases)
    - [Commits](bugst/go-serial@v1.3.2...v1.3.3)
    
    ---
    updated-dependencies:
    - dependency-name: go.bug.st/serial
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Sep 13, 2021
    Copy the full SHA
    948643f View commit details

Commits on Sep 14, 2021

  1. Merge pull request #10 from MrYadro/dependabot/go_modules/go.bug.st/s…

    …erial-1.3.3
    
    Bump go.bug.st/serial from 1.3.2 to 1.3.3
    MrYadro authored Sep 14, 2021
    Copy the full SHA
    ce004dc View commit details

Commits on Jan 4, 2022

  1. Bump go.bug.st/serial from 1.3.3 to 1.3.4

    Bumps [go.bug.st/serial](https://github.com/bugst/go-serial) from 1.3.3 to 1.3.4.
    - [Release notes](https://github.com/bugst/go-serial/releases)
    - [Commits](bugst/go-serial@v1.3.3...v1.3.4)
    
    ---
    updated-dependencies:
    - dependency-name: go.bug.st/serial
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Jan 4, 2022
    Copy the full SHA
    2a907ab View commit details

Commits on Jan 5, 2022

  1. Merge pull request #11 from MrYadro/dependabot/go_modules/go.bug.st/s…

    …erial-1.3.4
    
    Bump go.bug.st/serial from 1.3.3 to 1.3.4
    MrYadro authored Jan 5, 2022
    Copy the full SHA
    316ca4b View commit details

Commits on Feb 21, 2022

  1. Bump go.bug.st/serial from 1.3.4 to 1.3.5

    Bumps [go.bug.st/serial](https://github.com/bugst/go-serial) from 1.3.4 to 1.3.5.
    - [Release notes](https://github.com/bugst/go-serial/releases)
    - [Commits](bugst/go-serial@v1.3.4...v1.3.5)
    
    ---
    updated-dependencies:
    - dependency-name: go.bug.st/serial
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Feb 21, 2022
    Copy the full SHA
    5b13f6e View commit details

Commits on Feb 22, 2022

  1. Merge pull request #12 from MrYadro/dependabot/go_modules/go.bug.st/s…

    …erial-1.3.5
    
    Bump go.bug.st/serial from 1.3.4 to 1.3.5
    MrYadro authored Feb 22, 2022
    Copy the full SHA
    3472999 View commit details

Commits on Sep 5, 2022

  1. Bump go.bug.st/serial from 1.3.5 to 1.4.0

    Bumps [go.bug.st/serial](https://github.com/bugst/go-serial) from 1.3.5 to 1.4.0.
    - [Release notes](https://github.com/bugst/go-serial/releases)
    - [Commits](bugst/go-serial@v1.3.5...v1.4.0)
    
    ---
    updated-dependencies:
    - dependency-name: go.bug.st/serial
      dependency-type: direct:production
      update-type: version-update:semver-minor
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Sep 5, 2022
    Copy the full SHA
    33b1165 View commit details

Commits on Sep 6, 2022

  1. Merge pull request #13 from MrYadro/dependabot/go_modules/go.bug.st/s…

    …erial-1.4.0
    
    Bump go.bug.st/serial from 1.3.5 to 1.4.0
    MrYadro authored Sep 6, 2022
    Copy the full SHA
    4008d35 View commit details
  2. Update build.yaml

    MrYadro authored Sep 6, 2022
    Copy the full SHA
    8ca487a View commit details
  3. Update build.yaml

    MrYadro authored Sep 6, 2022
    Copy the full SHA
    4968662 View commit details
10 changes: 10 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2
updates:
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "daily"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
14 changes: 14 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
on: [push, pull_request]
name: Build
jobs:
checks:
name: run
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: run
uses: actions/setup-go@v5
with:
check-latest: true
go-version: "1.21"
- run: go build ./cmd/go-ps3syscon
76 changes: 76 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ "main" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "main" ]
schedule:
- cron: '29 14 * * 0'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'go' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Use only 'java' to analyze code written in Java, Kotlin or both
# Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- name: Checkout repository
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality


# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
#- name: Autobuild
# uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
13 changes: 8 additions & 5 deletions .github/workflows/release.yaml → .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# .github/workflows/release.yaml

name: Publish Release

on:
release:
types: [created]
@@ -10,16 +12,17 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
# build and publish in parallel: linux/386, linux/amd64, windows/386, windows/amd64, darwin/amd64
goos: [linux, windows, darwin]
goarch: ["386", amd64]
goarch: ["386", amd64, arm64]
exclude:
- goarch: "386"
goos: darwin
steps:
- uses: actions/checkout@v2
- uses: wangyoucao577/go-release-action@v1.16
- uses: actions/checkout@v4
- uses: wangyoucao577/go-release-action@v1.53
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
goos: ${{ matrix.goos }}
goarch: ${{ matrix.goarch }}
goarch: ${{ matrix.goarch }}
project_path: ./cmd/go-ps3syscon
md5sum: false
7 changes: 7 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Copyright 2021-2023 Yaroslav Yadryshnikov

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# go-ps3syscon Syscon for PlayStation 3

[![Publish Release](https://github.com/MrYadro/go-ps3syscon/actions/workflows/release.yml/badge.svg)](https://github.com/MrYadro/go-ps3syscon/actions/workflows/release.yml) [![Build](https://github.com/MrYadro/go-ps3syscon/actions/workflows/build.yml/badge.svg)](https://github.com/MrYadro/go-ps3syscon/actions/workflows/build.yml) [![CodeQL](https://github.com/MrYadro/go-ps3syscon/actions/workflows/codeql.yml/badge.svg)](https://github.com/MrYadro/go-ps3syscon/actions/workflows/codeql.yml) [![report card](https://goreportcard.com/badge/github.com/MrYadro/go-ps3syscon)](https://goreportcard.com/report/github.com/MrYadro/go-ps3syscon) [![releases](https://img.shields.io/github/downloads-pre/MrYadro/go-ps3syscon/latest/total)](https://github.com/MrYadro/go-ps3syscon/releases) [![version](https://img.shields.io/github/v/release/MrYadro/go-ps3syscon?include_prereleases)](https://github.com/MrYadro/go-ps3syscon/releases)

![syscon preview](https://user-images.githubusercontent.com/1587606/212574878-ea04b9ab-2da7-4873-91e6-45992a43d59e.png)

## Building and releases

You can download pre build binaries from releases

If you want to build it yourself use (you sould have golang installed)
```
go install github.com/MrYadro/go-ps3syscon/cmd/go-ps3syscon@latest
```

## How to use it

You can provide `-port` and `-mode` params when running binary

`-port` is your USB to TTL port

`-mode` for now supports only `cxrf` and `cxr` mode

Every command has it's autocompleteon so use tab more often

List of non-standart commands to use:
* `auth` - authorises to use other commands
* `errinfo 0xa0093003` - prints info about `0xa0093003` error `Fatal booting error on step 09 with error info: POWER FAIL`
* `cmdinfo becount` - prints info about `becount` command `becount - Display bringup/shutdown count + Power-on time, command called with no parametres and no subcommands`

## Links

A PS3 Story: The Yellow Light Of Death: https://www.youtube.com/watch?v=I0UMG3iVYZI

Mostly based on: https://github.com/db260179/ps3syscon
13 changes: 13 additions & 0 deletions cmd/go-ps3syscon/command.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package main

import (
"strings"
"time"
)

func (sc syscon) proccessCommand(cmd string) (string, error) {
cmd = strings.TrimSpace(cmd)
sc.sendCommand(cmd)
time.Sleep(1 * time.Second)
return sc.receiveCommand()
}
10 changes: 10 additions & 0 deletions cmd/go-ps3syscon/command_auth.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package main

func (sc syscon) commandAuth() string {
switch sc.mode {
case "cxrf":
return sc.commandCXRFAuth()
default:
return sc.commandCXRAuth()
}
}
26 changes: 26 additions & 0 deletions cmd/go-ps3syscon/command_cmdinfo.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package main

import (
"fmt"
"strings"
)

func (sc syscon) commandCmdinfo(cmd string) string {
cm, ok := cmdList[cmd]
if ok {
params, ok := cm["parametres"]
if ok {
params = strings.Join(strings.Split(params, ","), ", ")
} else {
params = "no"
}
subcmd, ok := cm["subcommands"]
if ok {
subcmd = strings.Join(strings.Split(subcmd, ","), ", ")
} else {
subcmd = "no"
}
return fmt.Sprintf("%s - %s, command called with %s parametres and %s subcommands", cmd, cm["description"], params, subcmd)
}
return "Wrong command"
}
27 changes: 27 additions & 0 deletions cmd/go-ps3syscon/command_errinfo.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package main

import (
"fmt"
"regexp"
)

func (sc syscon) commandErrinfo(cmd string) string {
if len(cmd) == 0 {
return "Please provide error code!"
} else {
return parseErrorCode(cmd)
}
}

func parseErrorCode(err string) string {
re := regexp.MustCompile(`0xa[A-Fa-f0-9]{3}[1-4][0-9][0-6f][0-9f]`)
valErr := re.MatchString(err)
if valErr {
stepNo := err[4:6]
errCat := err[6:7]
errNo := err[6:10]
return fmt.Sprintf("%s on step %s with error info: %s", scErrors[errCat], stepNo, scErrors[errNo])
} else {
return "Unknown error!"
}
}
96 changes: 96 additions & 0 deletions cmd/go-ps3syscon/mode_cxr.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
package main

import (
"bytes"
"encoding/hex"
"errors"
"fmt"
"log"
"strconv"
"strings"
)

func (sc syscon) sendCXRCommand(cmd string) {
checksum := countChecksum(cmd)
fcmd := fmt.Sprintf("C:%02X:%s", checksum, cmd)
maxSize := 15 // for some reason we need to split every 15 symbols
length := len(fcmd)
var j int
for i := 0; i < length; i += maxSize {
j += maxSize
if j > length {
j = length
}
fmt.Println(fcmd[i:j])
sc.writeCommand(fcmd[i:j])
}
sc.writeCommand("\r\n")
}

func (sc syscon) receiveCXRCommand() (string, error) {
buff := make([]byte, 1000)
n, err := sc.port.Read(buff)
fmt.Printf("Read %v bytes\n", n)
if err != nil {
log.Fatal(err)
}
fmt.Println(string(buff[:n]))
respRaw := strings.TrimSpace(string(buff[:n]))
resp := strings.Split(respRaw, ":")
if len(resp) != 3 {
fmt.Println("wrong response length")
return "", errors.New("wrong response length")
}
if resp[0] != "R" && resp[0] != "E" {
fmt.Println("magic?")
return "", errors.New("magic?")
}
if resp[1] != fmt.Sprintf("%02X", countChecksum(resp[2])) {
fmt.Println("wrong checksum")
return "", errors.New("wrong chechsum")
}
respData := strings.Split(resp[2], " ")
if resp[0] == "R" && len(respData) < 2 || resp[0] == "E" && len(respData) != 2 {
fmt.Println("wrong data length")
return "", errors.New("wrong data length")
}
if respData[0] != "OK" || len(respData) < 2 {
respCode, err := strconv.Atoi(respData[1])
if err == nil && respCode == 0 {
return respData[2], nil
}
return "", errors.New("wrong response code")
}
respCode, err := strconv.Atoi(respData[1])
if err == nil && respCode == 0 {
return respData[2], nil
}
return "", errors.New("wrong response code")
}

func (sc syscon) commandCXRAuth() string {
res, err := sc.proccessCommand("AUTH1 " + auth)
resHex, _ := hex.DecodeString(res)
if err != nil || !bytes.Equal(resHex[0:0x10], auth1ResponseHeader) {
return "Wrong Auth1 response header"
}
fmt.Println("Right Auth1 response header")

data := decode(resHex[0x10:0x40])
if !bytes.Equal(data[0x8:0x10], zero[0x0:0x8]) || !bytes.Equal(data[0x10:0x20], auth1Response) || !bytes.Equal(data[0x20:0x30], zero) {
return "Wrong Auth1 response body"
}
fmt.Println("Right Auth1 response body")

newData := append(data[0x8:0x10], data[0x0:0x8]...)
newData = append(newData, zero...)
newData = append(newData, zero...)
auth2Body := encode(newData)
authBody := append(auth2RequestHeader, auth2Body...)
com := fmt.Sprintf("AUTH2 %02X", authBody)
_, err = sc.proccessCommand(com)
if err != nil {
return "Auth failed"
}
return "Auth successful"
}
Loading