Skip to content
This repository has been archived by the owner on Sep 9, 2022. It is now read-only.

Commit

Permalink
finally, end from problems
Browse files Browse the repository at this point in the history
  • Loading branch information
abdfnx committed Mar 13, 2021
1 parent 5ce4816 commit eaf23ea
Show file tree
Hide file tree
Showing 12 changed files with 53 additions and 235 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

- Secman Dockerfile
- New version of shell plugin **v3.0.0**
- Remove backup command

### Fixed

Expand Down
53 changes: 39 additions & 14 deletions api/sync/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,48 @@ package sync

import (
"fmt"
"os"
"os/exec"
"log"
"runtime"
"time"

"github.com/briandowns/spinner"
"github.com/secman-team/shell"
)

func PushSync() {
if _, err := os.Stat("~/.secman/.git"); err != nil {
if os.IsNotExist(err) {
fmt.Println("syncing...")
cmd := exec.Command("secman-sync", "phx")
stdout, err := cmd.Output()

if err != nil {
fmt.Println(err.Error())
return
}

fmt.Print(string(stdout))
if runtime.GOOS == "windows" {
err, out, errout := shell.PWSLOut("& $HOME/sm/sync.ps1")

fmt.Print(out)

if err != nil {
log.Printf("error: %v\n", err)
fmt.Print(errout)
} else if out != "" {
s := spinner.New(spinner.CharSets[9], 100*time.Millisecond)
s.Suffix = " Syncing..."
s.Start()

shell.PWSLCmd("& $HOME/sm/secman-sync.ps1 ph")

s.Stop()
}
} else {
err, out, errout := shell.ShellOut("/home/sm/sync.sh")

fmt.Print(out)

if err != nil {
log.Printf("error: %v\n", err)
fmt.Print(errout)
} else if out != "" {
s := spinner.New(spinner.CharSets[9], 100*time.Millisecond)
s.Suffix = " Syncing..."
s.Start()

shell.ShellCmd("secman-sync phx")

s.Stop()
}
}
}
2 changes: 1 addition & 1 deletion core/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ directory, and initialize your cryptographic keys.`,
verxCmd = &cobra.Command{
Use: "verx",
Run: func(cmd *cobra.Command, args []string) {
fmt.Println(version)
fmt.Print(version)
},
}

Expand Down
6 changes: 3 additions & 3 deletions fetch/fetch.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ func FetchSECDIR() {
err, out, errout := shell.ShellOut("")

if runtime.GOOS == "windows" {
err, out, errout = shell.PWSLOut("~/sm/secman-sync.ps1 --sm")
err, out, errout = shell.PWSLOut("& ~/sm/secman-sync.ps1 pl")
} else {
err, out, errout = shell.ShellOut("secman-sync pl")
}

if err != nil {
log.Printf("error: %v\n", err)
fmt.Println(errout)
fmt.Print(errout)
}

s.Stop()
fmt.Println(out)
fmt.Print(out)
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/atotto/clipboard v0.1.4
github.com/briandowns/spinner v1.12.0
github.com/fatih/color v1.10.0 // indirect
github.com/secman-team/shell v0.3.0
github.com/secman-team/shell v0.3.1
github.com/spf13/cobra v1.1.3
golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83
golang.org/x/sys v0.0.0-20210305034016-7844c3c200c3 // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
github.com/secman-team/shell v0.3.0 h1:bsC8SQUq4rfxVYmgR9R+ol8Dq9zW4IJdAMhCyqoi9D0=
github.com/secman-team/shell v0.3.0/go.mod h1:+kAfttTSmyjzVbKIksunNkDxJONomZp52cwY/PgCHHs=
github.com/secman-team/shell v0.3.1 h1:o3/0nrH0sPcEZKvkDKIGcgOOGE7SbMGvcc2rs1yN5uw=
github.com/secman-team/shell v0.3.1/go.mod h1:+kAfttTSmyjzVbKIksunNkDxJONomZp52cwY/PgCHHs=
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
Expand Down
192 changes: 0 additions & 192 deletions packages/backup/backup.py

This file was deleted.

11 changes: 0 additions & 11 deletions packages/backup/test.py

This file was deleted.

2 changes: 1 addition & 1 deletion plugins/shell
Submodule shell updated from 86da95 to 74fc5e
6 changes: 3 additions & 3 deletions plugins/v_checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ func Checker() {
err, out, errout := shell.ShellOut("")

if runtime.GOOS == "windows" {
err, out, errout = shell.PWSLOut("~/sm/vx.ps1 --sm")
err, out, errout = shell.PWSLOut("& ~/sm/vx.ps1 --sm")
} else {
err, out, errout = shell.ShellOut("verx --sm")
}

if err != nil {
log.Printf("error: %v\n", err)
fmt.Println(errout)
fmt.Print(errout)
}

s.Stop()
fmt.Println(out)
fmt.Print(out)
}
9 changes: 1 addition & 8 deletions show/show.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"log"
"os"
"path/filepath"
"runtime"
"strings"

"github.com/secman-team/secman/v5/pc"
Expand All @@ -34,13 +33,7 @@ const (
Search
)

func init() {
/* Windows doesn't work with ambiguous width characters */
if runtime.GOOS == "windows" {
lastPrefix = "+--"
regPrefix = "+--"
}
}
// func init() {}

func handleErrors(allErrors []error) {
errorStr := "Error"
Expand Down
2 changes: 1 addition & 1 deletion tools
Submodule tools updated from 163260 to c53c18

0 comments on commit eaf23ea

Please sign in to comment.