Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
cipheras committed Apr 21, 2021
1 parent e39a65a commit f0fad31
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 78 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
v1.4.2
- CLI enhancement

v1.4.1
- Filtering of exe files and self
- Process in new console
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Or you can either use a **precompiled binary** package for your architecture or
### Download precompiled binary
Windows | Linux
--------|-------
[win-x64](https://github.com/cipheras/gopkgr/releases/download/v1.4.1/gopkgr-win-x64.exe) | [linux-x64](https://github.com/cipheras/gopkgr/releases/download/v1.4.1/gopkgr-linux-x64)
[win-x64](https://github.com/cipheras/gopkgr/releases/download/v1.4.3/gopkgr-win-x64.exe) | [linux-x64](https://github.com/cipheras/gopkgr/releases/download/v1.4.3/gopkgr-linux-x64)

For other versions or releases go to [release page](https://github.com/cipheras/gopkgr/releases).

Expand Down
5 changes: 4 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@ module github.com/cipheras/gopkgr

go 1.15

require golang.org/x/sys v0.0.0-20201101102859-da207088b7d1
require (
github.com/cipheras/gohelper v1.4.3
golang.org/x/sys v0.0.0-20201101102859-da207088b7d1 // indirect
)
3 changes: 3 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
github.com/cipheras/gohelper v1.4.3 h1:MpnhLek/cXWjEtThj8mZFc7+kloULsaVVPGQrI92AIk=
github.com/cipheras/gohelper v1.4.3/go.mod h1:LAdAhKloC2GntpxN9mRKANRL/4eo18cYxEgVgRzq9oQ=
golang.org/x/sys v0.0.0-20201009025420-dfb3f7c4e634/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201101102859-da207088b7d1 h1:a/mKvvZr9Jcc8oKfcmgzyp7OwF73JPWsQLvH1z2Kxck=
golang.org/x/sys v0.0.0-20201101102859-da207088b7d1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
43 changes: 22 additions & 21 deletions gopkgr.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ package main
import (
"fmt"
"io/ioutil"
"log"
"os"
"os/signal"
"path/filepath"
"regexp"
"strings"
"syscall"
"time"

. "github.com/cipheras/gohelper"
)

func main() {
Expand All @@ -20,6 +22,7 @@ func main() {
fmt.Println("\nExiting...")
os.Exit(0)
}()
Flog()
Cwindows()
pkr()
fmt.Printf("\n\nPress any key to exit...")
Expand All @@ -28,30 +31,27 @@ func main() {

func pkr() {
f, err := os.OpenFile("pkg.go", os.O_CREATE|os.O_RDWR|os.O_TRUNC, 0644)
if err != nil {
log.Fatalln(err)
}
Try(err, true, "Creating \"pkg.go\" file")
fmt.Fprintln(f, p)
var bytstr []string
// fmt.Fprintln(f, "func pkg() ([]string, [][]byte) {") //main function start
fmt.Fprintf(f, "pth := []string{") //open pth
// count := 0
ignore := map[string]bool{
"pkg.go": true,
"go.mod": true,
"LICENSE": true,
"README.md": true,
"gopkgrWin.go": true,
"gopkgrLinux.go": true,
os.Args[0]: true,
"log.txt": true,
"pkg.go": true,
"go.mod": true,
"go.sum": true,
"LICENSE": true,
"README.md": true,
"CHANGELOG": true,
strings.ReplaceAll(os.Args[0], "./", ""): true,
}
Cprint(N, "Reading dir structure")
time.Sleep(1 * time.Second)
err = filepath.Walk(".", func(path string, info os.FileInfo, err error) error {
exe, _ := regexp.MatchString("^(.*\\.exe)$", info.Name())
if info.Mode().IsRegular() && !ignore[info.Name()] && !exe {
if info.Mode().IsRegular() && !ignore[info.Name()] && !exe && !strings.Contains(path, ".git") {
filebyt, err := ioutil.ReadFile(path)
if err != nil {
log.Println(err)
}
Try(err, false, "Reading file \""+path+"\"")
fmt.Println(path)
fmt.Fprintf(f, "\"%v\",", path)
replacer := strings.NewReplacer("[", "{", "]", "}", " ", ",")
Expand All @@ -60,11 +60,11 @@ func pkr() {
}
return nil
})
if err != nil {
log.Println(err)
}
Try(err, false)
fmt.Fprintln(f, "}") //close pth
fmt.Fprintf(f, "file := [][]byte{") //open byt
Cprint(N, "Starting packing")
time.Sleep(1 * time.Second)
replacer := strings.NewReplacer("[", "", "]", "", " ", "")
for i, v := range bytstr {
var ss []string
Expand All @@ -80,9 +80,10 @@ func pkr() {
fmt.Fprintln(f, "}") //close byt
fmt.Fprintln(f, "return pth, file") //return all paths
fmt.Fprintln(f, "}") //end main
// fmt.Println("\nFiles Packed:", count)
fmt.Fprintln(f, u)
f.Close()
fmt.Printf("\n")
Cprint(N, "Packing complete")
}

var p string = `
Expand Down
8 changes: 0 additions & 8 deletions gopkgrLinux.go

This file was deleted.

47 changes: 0 additions & 47 deletions gopkgrWin.go

This file was deleted.

0 comments on commit f0fad31

Please sign in to comment.