(source, target string, password string)
| 27 | } |
| 28 | |
| 29 | func Zipit(source, target string, password string) { |
| 30 | var input string |
| 31 | base := filepath.Base(source) |
| 32 | f, _ := os.Open(source) |
| 33 | reader := bufio.NewReader(f) |
| 34 | content, _ := ioutil.ReadAll(reader) |
| 35 | contents := []byte(content) |
| 36 | fzip, err := os.Create(target) |
| 37 | if err != nil { |
| 38 | log.Fatalln(err) |
| 39 | } |
| 40 | zipw := zip.NewWriter(fzip) |
| 41 | defer zipw.Close() |
| 42 | if strings.Contains(source, "\\") || strings.Contains(source, "/") { |
| 43 | input = base |
| 44 | } else { |
| 45 | input = base |
| 46 | } |
| 47 | w, err := zipw.Encrypt(input, password, zip.StandardEncryption) |
| 48 | if err != nil { |
| 49 | log.Fatal(err) |
| 50 | } |
| 51 | _, err = io.Copy(w, bytes.NewReader(contents)) |
| 52 | if err != nil { |
| 53 | log.Fatal(err) |
| 54 | } |
| 55 | zipw.Flush() |
| 56 | } |
| 57 | |
| 58 | func JScriptLoader_Buff(name string, outFile string, sandbox bool) string { |
| 59 | var buffer bytes.Buffer |
no outgoing calls
no test coverage detected