Created
April 20, 2021 00:08
-
-
Save ken39arg/991b280d3457472800bf62efdbdc8e53 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bytes" | |
"encoding/base64" | |
"io/ioutil" | |
"log" | |
"os" | |
) | |
func main() { | |
src, err := ioutil.ReadAll(os.Stdin) | |
if err != nil { | |
log.Fatal(err) | |
} | |
for i := 0; ; i++ { | |
src = bytes.TrimSpace(src) | |
src = bytes.Trim(src, `"`) | |
src = bytes.ReplaceAll(src, []byte("\n"), []byte{}) | |
src = bytes.ReplaceAll(src, []byte("\\n"), []byte{}) | |
next, err := decode(src) | |
if err != nil { | |
if len(src) > 100 { | |
log.Printf("[%d] code `%s`, err: %s", i, src[0:100], err) | |
} else { | |
log.Printf("[%d] code `%s`, err: %s", i, src, err) | |
} | |
//log.Printf("code `%s`, err: %s", src[178033430:], err) | |
return | |
} | |
src = next | |
} | |
} | |
func decode(src []byte) ([]byte, error) { | |
return base64.StdEncoding.DecodeString(string(src)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment