Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
SATUNIX authored Nov 21, 2023
1 parent bac5605 commit 4426ffb
Show file tree
Hide file tree
Showing 14 changed files with 222 additions and 41 deletions.
Binary file modified IPFSS_IPFS-Secure
Binary file not shown.
13 changes: 13 additions & 0 deletions art_link/apexflexflexsecure.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
····································································
:_______ _______________ _________:
:___ |________________ __ ___ ____/__ /________ __ ______/_/:
:__ /| |__ __ \ _ \_ |/_/ __ /_ __ /_ _ \_ |/_/ ____/_/ :
:_ ___ |_ /_/ / __/_> < _ __/ _ / / __/_> < __/_/ :
:/_/ |_| .___/\___//_/|_| /_/ /_/ \___//_/|_| /_/ :
: /_/ :
:_______________ ________ :
:___ ____/__ /________ ___ ___/______________ _____________ :
:__ /_ __ /_ _ \_ |/_/____ \_ _ \ ___/ / / /_ ___/ _ \ :
:_ __/ _ / / __/_> < ____/ // __/ /__ / /_/ /_ / / __/ :
:/_/ /_/ \___//_/|_| /____/ \___/\___/ \__,_/ /_/ \___/ :
····································································
31 changes: 31 additions & 0 deletions art_link/art_link.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package art_link

import (
"bufio"
"fmt"
"strings"
"time"
"embed"
)
//go:embed *.txt
var artFiles embed.FS


func PrintFileSlowly(fileName string) error {
fileData, err := artFiles.ReadFile(fileName)
if err != nil {
return err
}

scanner := bufio.NewScanner(strings.NewReader(string(fileData)))
for scanner.Scan() {
line := scanner.Text()
for _, char := range line {
fmt.Print(string(char))
time.Sleep(3 * time.Millisecond) // Adjust the delay here to mimic the baud rate
}
fmt.Println()
}

return scanner.Err()
}
25 changes: 25 additions & 0 deletions art_link/decrypting.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
..,uod8BBBBBBBBBBBBBBBBRPFT?l!i:.
,=m8BBBBBBBBBBBBBBBRPFT?!||||||||||||||
!...:!TVBBBRPFT||||||||||!!^^""' ||||
!.......:!?|||||!!^^""' ||||
!.........|||| ||||
!.........|||| ## ||||
!.........|||| DECRYPTING FILES ||||
!.........|||| ||||
!.........|||| ||||
!.........|||| DECRYPTING FILES ||||
`.........|||| ,||||
.;.......|||| _.-!!|||||
.,uodWBBBBb.....|||| _.-!!|||||||||!:'
!YBBBBBBBBBBBBBBb..!|||:..-!!|||||||!iof68BBBBBb....
!..YBBBBBBBBBBBBBBb!!||||||||!iof68BBBBBBRPFT?!:: `.
!....YBBBBBBBBBBBBBBbaaitf68BBBBBBRPFT?!::::::::: `.
!......YBBBBBBBBBBBBBBBBBBBRPFT?!::::::;:!^"`;::: `.
!........YBBBBBBBBBBRPFT?!::::::::::^''...::::::; iBBbo.
`..........YBRPFT?!::::::::::::::::::::::::;iof68bo. WBBBBbo.
`..........:::::::::::::::::::::::;iof688888888888b. `YBBBP^'
`........::::::::::::::::;iof688888888888888888888b. `
`......:::::::::;iof688888888888888888888888888888b.
`....:::;iof688888888888888888888888888888888899fT!
`..::!8888888888888888888888888888888899fT|!^"'
`' !!988888888888888888888888899fT|!^"'
25 changes: 25 additions & 0 deletions art_link/encrypting.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
..,uod8BBBBBBBBBBBBBBBBRPFT?l!i:.
,=m8BBBBBBBBBBBBBBBRPFT?!||||||||||||||
!...:!TVBBBRPFT||||||||||!!^^""' ||||
!.......:!?|||||!!^^""' ||||
!.........|||| ||||
!.........|||| ## ||||
!.........|||| ENCRYPTING FILES ||||
!.........|||| ||||
!.........|||| ||||
!.........|||| ENCRYPTING FILES ||||
`.........|||| ,||||
.;.......|||| _.-!!|||||
.,uodWBBBBb.....|||| _.-!!|||||||||!:'
!YBBBBBBBBBBBBBBb..!|||:..-!!|||||||!iof68BBBBBb....
!..YBBBBBBBBBBBBBBb!!||||||||!iof68BBBBBBRPFT?!:: `.
!....YBBBBBBBBBBBBBBbaaitf68BBBBBBRPFT?!::::::::: `.
!......YBBBBBBBBBBBBBBBBBBBRPFT?!::::::;:!^"`;::: `.
!........YBBBBBBBBBBRPFT?!::::::::::^''...::::::; iBBbo.
`..........YBRPFT?!::::::::::::::::::::::::;iof68bo. WBBBBbo.
`..........:::::::::::::::::::::::;iof688888888888b. `YBBBP^'
`........::::::::::::::::;iof688888888888888888888b. `
`......:::::::::;iof688888888888888888888888888888b.
`....:::;iof688888888888888888888888888888888899fT!
`..::!8888888888888888888888888888888899fT|!^"'
`' !!988888888888888888888888899fT|!^"'
29 changes: 29 additions & 0 deletions art_link/flex_implant.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

...:::
:.. .::.
.:: .. .:.
:: .::: .:
.:. :::: .:
.: .::: :.
.:. :::: ::
:: ::: ::
.:: .:
.. =+++=::.
..-=++****=:
..-+*#####*::
.:+######*=:.
..-**###*#*:.
.:+***###*=:.
..:+***++++::.
..-==++== ::
.. :=: .:.
.. .: ::
.: .:::. ::
.. .::: ::
.. .:::. :.
::. :::: ..
:: ::: .
.:. ..
::: ..
.::::...

13 changes: 13 additions & 0 deletions art_link/ipfs.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.===:
:==-::::-=:
:=-:::::::::::-=:
==-:::::::::::::::-==. *#= :########: %#######: :#######*
=====-:::::::::-==--=. *#= :## ##: ##. .##: =#*
=----====-=-===--:::=. *#= :## *#- %#. .##+:
==------=====:::::-:=. *#= :##+++*##= %#######. -+#####=
=--------===::-:-:::=. *#= :##:::. ##. =##
==-------==-::::::-:=. *#= :## ##. :##: -##
==-------==-:-:-::-==. *#= :## %#. .#######*.
:==----==-:::-==:
:===-=--==:
.===.
11 changes: 11 additions & 0 deletions art_link/ipfs_small.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
-==.
.-=:::::-=:
:=-:::::::::::-=: :=: -====- :======: -=++=
===-:::::::::-===: :#- +# :## -#: :## :#=
=---===:-:-==-::=: :#- +# +#:-#: :##
=------===-:::-:=: :#- +#+++##= -######: .=####*.
=-------=-:-::::=: :#- +# -#: . ##
=-------=-:::-::=: :#- +# -#: :##. :##
:==-----=-:-::-=: :=: -= :=. :++++
.==--=-:-=:
===.
5 changes: 5 additions & 0 deletions art_link/scannow.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
____
/ ___| ___ __ _ _ __ _ __ _____ __
\___ \ / __/ _` | '_ \ | '_ \ / _ \ \ /\ / /
___) | (_| (_| | | | | | | | | (_) \ V V /
|____/ \___\__,_|_| |_| |_| |_|\___/ \_/\_/
12 changes: 0 additions & 12 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
module IPFSS_IPFS-Secure

go 1.21.4

require github.com/status-im/keycard-go v0.3.2

require (
github.com/btcsuite/btcd/btcec/v2 v2.2.0 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect
github.com/ethereum/go-ethereum v1.10.26 // indirect
github.com/go-stack/stack v1.8.1 // indirect
golang.org/x/crypto v0.1.0 // indirect
golang.org/x/sys v0.2.0 // indirect
golang.org/x/text v0.4.0 // indirect
)
Binary file added keycard-linux-amd64
Binary file not shown.
1 change: 1 addition & 0 deletions log_CID.log
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
QmQSv6fXvzeBG7ZRA3eAUs1LbZzperrTz1E71aXX68UDgf
94 changes: 65 additions & 29 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"crypto/sha256"
"strings"
"IPFSS_IPFS-Secure/keycard_link"
"IPFSS_IPFS-Secure/art_link"
"IPFSS_IPFS-Secure/ipfs_link"
)

Expand All @@ -32,43 +33,65 @@ func main() {
}
// Example: Parsing command-line arguments
// You might want to use a more robust way for parsing arguments (like the `flag` package)
if len(os.Args) < 2 {
fmt.Println("Usage: main.go [command]")
os.Exit(1)
}

command := os.Args[1]

switch command {
case "encrypt":
if len(os.Args) != 3 {
fmt.Println("Usage: main.go encrypt [filename]")
os.Exit(1)
}
filename := os.Args[2]
err := encryptFile(filename)
for {
choice, err := menu()
if err != nil {
fmt.Printf("Error encrypting file: %s\n", err)
os.Exit(1)
fmt.Println("Error:", err)
continue
}

case "decrypt":
if len(os.Args) != 3 {
fmt.Println("Usage: main.go decrypt [filename]")
os.Exit(1)
}
filename := os.Args[2]
err := decryptFile(filename)
if err != nil {
fmt.Printf("Error decrypting file: %s\n", err)
os.Exit(1)
switch choice {
case "1":
filename, err := generalAskUser("Enter the filename to decrypt ('Save file as'): ")
if err != nil {
fmt.Println("Error:", err)
continue
}
if err := decryptFile(filename); err != nil {
fmt.Println("Error:", err)
}

case "2":
filename, err := generalAskUser("Enter the filename to encrypt: ")
if err != nil {
fmt.Println("Error:", err)
continue
}
if err := encryptFile(filename); err != nil {
fmt.Println("Error:", err)
}

case "3":
err := art_link.PrintFileSlowly("apexflexflexsecure.txt")
if err != nil {
fmt.Println("Error displaying ASCII art:", err)
}

fmt.Println("Exiting...")
os.Exit(0)

default:
fmt.Println("Invalid option, please try again.")
}
}
}

default:
fmt.Println("Invalid command")
os.Exit(1)
func menu() (string, error) {
err := art_link.PrintFileSlowly("ipfs.txt")
if err != nil {
fmt.Println("Error displaying ASCII art:", err)
}

fmt.Println("=============================================")
fmt.Println("What would you like to do? Select 1, 2, or 3")
fmt.Println("1. Decrypt / pull file with CID.")
fmt.Println("2. Encrypt / upload sensitive data to IPFS.")
fmt.Println("3. Exit.")
fmt.Println("=============================================")
return generalAskUser("Enter your choice: ")
}

func downloadKeycardBinary() error {
url := "https://github.com/status-im/keycard-cli/releases/download/0.7.0/keycard-linux-amd64"
response, err := http.Get(url)
Expand Down Expand Up @@ -130,6 +153,10 @@ func askUserYN(question string) bool {
}

func encryptFile(filename string) error {
// Get the Keycard public key
art_link.PrintFileSlowly("scannow.txt")
art_link.PrintFileSlowly("flex_implant.txt")

publicKey, err := keycard_link.GetKeycardPublicKey()
if err != nil {
return fmt.Errorf("error getting Keycard public key: %w", err)
Expand All @@ -139,13 +166,17 @@ func encryptFile(filename string) error {
if err != nil {
return fmt.Errorf("error reading passphrase: %w", err)
}
fmt.Print("Generating the seed for KDF ... ")

seedKDF := publicKey + passphrase
fmt.Println("SeedKDF:", seedKDF)
fmt.Print("Generating the symmetric key... \n")

// Derive a key using a KDF (e.g., SHA-256)
kdfKey := sha256.Sum256([]byte(seedKDF))
encryptedKey := fmt.Sprintf("%x", kdfKey)
art_link.PrintFileSlowly("encrypting.txt")


// Encrypt the file using GPG and the derived key
cmd := exec.Command("gpg", "--symmetric", "--batch", "--passphrase", encryptedKey, filename)
Expand Down Expand Up @@ -217,6 +248,9 @@ func decryptFile(filename string) error {
}

// Get the Keycard public key
art_link.PrintFileSlowly("scannow.txt")
art_link.PrintFileSlowly("flex_implant.txt")

publicKey, err := keycard_link.GetKeycardPublicKey()
if err != nil {
return fmt.Errorf("error getting Keycard public key: %w", err)
Expand All @@ -228,9 +262,11 @@ func decryptFile(filename string) error {
return fmt.Errorf("error reading passphrase: %w", err)
}
// Generate the symmetric key
fmt.Print("Generating the symmetric key... \n")
seedKDF := publicKey + passphrase
kdfKey := sha256.Sum256([]byte(seedKDF))
decryptedKey := fmt.Sprintf("%x", kdfKey)
art_link.PrintFileSlowly("decrypting.txt")

// Decrypt the file using GPG
decryptedFilePath := "decrypted_" + filename // This is the path where the decrypted file will be saved
Expand Down
4 changes: 4 additions & 0 deletions test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
+++++++++++++++++++++++++++++++
TEST TEST TEST
OF THE IPFS KEYCARD SYSTEM
+++++++++++++++++++++++++++++++

0 comments on commit 4426ffb

Please sign in to comment.