aboutsummaryrefslogtreecommitdiffstats
path: root/gosrc
diff options
context:
space:
mode:
authorsalaaad2 <arthurdurant263@gmail.com>2022-04-01 21:33:45 +0200
committersalaaad2 <arthurdurant263@gmail.com>2022-04-01 21:33:45 +0200
commit516b165421855538e10f41919f1fa72e1fa58912 (patch)
tree81c3f9a6e6af2d84493b87893ed633a470f7cfe0 /gosrc
parent0.0.1.1 (diff)
downloadsmith-516b165421855538e10f41919f1fa72e1fa58912.tar.gz
smith-516b165421855538e10f41919f1fa72e1fa58912.tar.bz2
smith-516b165421855538e10f41919f1fa72e1fa58912.tar.xz
smith-516b165421855538e10f41919f1fa72e1fa58912.tar.zst
smith-516b165421855538e10f41919f1fa72e1fa58912.zip
hehe
Diffstat (limited to 'gosrc')
-rw-r--r--gosrc/colors.go27
-rw-r--r--gosrc/main.go47
2 files changed, 74 insertions, 0 deletions
diff --git a/gosrc/colors.go b/gosrc/colors.go
new file mode 100644
index 0000000..6fdf98a
--- /dev/null
+++ b/gosrc/colors.go
@@ -0,0 +1,27 @@
+package main
+
+// Theme defines the colors used when primitives are initialized.
+type Theme struct {
+ colorReset string // Main background color for primitives.
+ colorRed string // Background color for contrasting elements.
+ colorGreen string // Background color for even more contrasting elements.
+ colorYellow string // Box borders.
+ colorBlue string // Box titles.
+ colorPurple string // Graphics.
+ colorCyan string // Primary text.
+ colorWhite string // Secondary text (e.g. labels).
+}
+
+// Styles defines the theme for applications. The default is for a black
+// background and some basic colors: black, white, yellow, green, cyan, and
+// blue.
+var Styles = Theme{
+ colorReset: "\033[0m",
+ colorRed : "\033[31m",
+ colorGreen : "\033[32m",
+ colorYellow : "\033[33m",
+ colorBlue : "\033[34m",
+ colorPurple : "\033[35m",
+ colorCyan : "\033[36m",
+ colorWhite : "\033[37m",
+}
diff --git a/gosrc/main.go b/gosrc/main.go
new file mode 100644
index 0000000..27cec39
--- /dev/null
+++ b/gosrc/main.go
@@ -0,0 +1,47 @@
+// SMITH ( // /
+// main ( )/ /
+// by salade )(/ /
+// ________________ ( /) /
+// ()__)____________))))) :^} /
+
+package main
+
+import (
+ "encoding/json"
+ "fmt"
+ "io/ioutil"
+ "log"
+)
+
+// #include "../csrc/smith.h"
+// #cgo LDFLAGS: -lsmith -L../
+import "C"
+
+type Config struct {
+ Public_key string
+ Secret_key string
+ Mirror string
+}
+
+func main() {
+ fmt.Println("Welcome, traveller, my name is " + Styles.colorGreen + C.GoString(C.mr_smith()) + Styles.colorReset +
+ "\nI will try to help you get the bag...")
+
+ config_path := "./config.json"
+ config_content, err := ioutil.ReadFile(config_path)
+ if err != nil {
+ log.Fatal("config file not found")
+ }
+
+ var config Config
+ err = json.Unmarshal(config_content, &config)
+
+ if err != nil {
+ log.Fatal("error during marshall() ", err)
+ }
+
+ fmt.Println("\n" +
+ Styles.colorBlue + "public_key: " + Styles.colorReset + config.Public_key + "\n" +
+ Styles.colorBlue + "secret_key: " + Styles.colorReset + config.Secret_key + "\n" +
+ Styles.colorBlue + "mirror: " + Styles.colorReset + config.Mirror)
+}