hello gbanque!

This commit is contained in:
poka 2020-07-18 02:59:31 +02:00
parent 2e8f977719
commit c93b5bc661
7 changed files with 7918 additions and 34 deletions

File diff suppressed because it is too large Load Diff

34
src/dunikey/diceware.sh Executable file
View File

@ -0,0 +1,34 @@
#!/bin/bash
########################################################################
# Author: Fred (support@qo-op.com)
# Version: 2020.03.18
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
########################################################################
MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
########################################################################
# \\///
# qo-op
#############
##########################
#######################################
####################################################
########################################################################
MOTS=$(echo "$1" | grep -E "^\-?[0-9]+$")
# Default is 6 words passphrase
if [[ "$MOTS" == "" ]]; then MOTS=6; fi
WORDCOUNT=${1-$MOTS}
# Download the wordlist
# wget -nc -O ~/.diceware-wordlist http://world.std.com/%7Ereinhold/diceware.wordlist.asc 2> /dev/null
# print a list of the diceware words
cat $MY_PATH/diceware-wordlist.txt | \
awk '/[1-6][1-6][1-6][1-6][1-6]/{ print $2 }' | \
# randomize the list order
shuf --random-source=/dev/urandom | \
# pick the first n words
head -n ${WORDCOUNT} | \
# pretty print
tr '\n' ' ' | \
# Remove last space
rev | cut -c2- | rev

View File

@ -0,0 +1,30 @@
#!/usr/bin/env python3
# This Python script gets Duniter creddentials as arguments, and writes a PubSec file that should be compatible with Cesium and Silkaj(DuniterPy) clients.
# launch with :
# python3 key_create_dnuikey.py <id> <mdp>
# depends on duniterpy 0.56
### Licence - WTFPL
# This script was written my Matograine, in the hope that it will be helpful.
# Do What The Fuck you like with it. There is :
# * no guarantee that this will work
# * no support of any kind
#
# If this is helpful, please consider making a donation to the developper's pubkey : 78ZwwgpgdH5uLZLbThUQH7LKwPgjMunYfLiCfUCySkM8
# Have fun
from sys import argv
from duniterpy.key import SigningKey
#import pathlib
#MY_PATH = pathlib.Path(__file__).parent.absolute()
# path to save to
path = "/tmp/secret.dunikey"
#path = "{}/../shell/secret.dunikey".format(MY_PATH)
key = SigningKey.from_credentials(argv[1], argv[2], None)
key.save_pubsec_file(path)
print(
key.pubkey,
)

View File

@ -13,7 +13,6 @@ bot.global.text({
cmd = b.message.text
process.env.hb_cmd = cmd
// b.messageRoom("poka", "taratata")
gbanque = exec("src/shell/gbanque.sh ~~~$hb_cmd~~~$hb_username~~~$hb_room", function(err, stdout, stderr) {
if (err) {
b.respond("Une erreur est survenu: " + err)

View File

@ -6,16 +6,73 @@ MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
[[ -n $MY_PATH/.env ]] && source $MY_PATH/.env || (echo "Please create $MY_PATH/.env as $MY_PATH/.env.example" && exit 1)
sendmsg() {
chan="$1"
msg="${@:2}"
chan="$1"
msg="${@:2}"
[[ ! $chan || ! $msg ]] && echo "Please select user and message." && exit 1
[[ ! $chan || ! $msg ]] && echo "Please select user and message." && exit 0
curl -s -H "X-Auth-Token: $API_TOKEN" \
-H "X-User-Id: $API_ID" \
-H "Content-type:application/json" \
http://192.168.9.6:10140/api/v1/chat.postMessage \
-d "{ \"channel\": \"$chan\", \"text\": \"$msg\" }" > /dev/null 2>&1
curl -s -H "X-Auth-Token: $API_TOKEN" \
-H "X-User-Id: $API_ID" \
-H "Content-type:application/json" \
$API_URL/api/v1/chat.postMessage \
-d "{ \"channel\": \"$chan\", \"text\": \"$msg\" }" > /dev/null 2>&1
}
info_account() {
chan="$1"
[[ ! $chan ]] && echo "Please select user." && exit 0
homedir="$HOME/.bog/ids/axiomchat/$chan"
if [[ -d $homedir ]]; then
source $homedir/db
echo "Voici les identifiants de connexion de votre ḠCompte:"
echo -e "Login: **$salt**\nMot de passe: **$pepper**\nClé publique: **$pubkey**"
else
echo "Vous n'avez pas de compte chez nous."
fi
}
init_account() {
chan="$1"
[[ ! $chan ]] && echo "Please select user." && exit 0
homedir="$HOME/.bog/ids/axiomchat/$chan"
if [[ -f $homedir/secret.dunikey ]]; then
pubkey=$(cat $homedir/secret.dunikey| grep "pub: " | awk '{ print $2 }')
echo "Vous disposez déjà d'un portefeuille Ḡ1: **$pubkey**"
exit 0
fi
# LOGIN (=SALT)
salt="$($MY_PATH/../dunikey/diceware.sh 6)"
# PASS (=PEPPER)
pepper="$($MY_PATH/../dunikey/diceware.sh 4)"
# The pubkey for this salt/papper peer
pubkey=$(python3 $MY_PATH/../dunikey/key_create_dunikey.py "$salt" "$pepper")
[[ ! -f /tmp/secret.dunikey ]] && echo "Arf, problem happens making your secret.dunikey" && exit 0
[[ ! -d $homedir ]] && mkdir -p $homedir
[[ -f /tmp/secret.dunikey ]] && rm -f $homedir/secret.dunikey && mv /tmp/secret.dunikey $homedir/secret.dunikey
echo -e "salt=\"$salt\"\npepper=\"$pepper\"\npubkey=\"$pubkey\"" > $homedir/db
info_account $chan
# echo "Pubkey: **$pubkey**"
}
rm_account() {
chan="$1"
[[ ! $chan ]] && echo "Please select user." && exit 0
homedir="$HOME/.bog/ids/axiomchat/$chan"
if [[ -d $homedir ]]; then
source $homedir/db
echo "Suppression des données de votre portefeuille de votre ḠBanque."
echo -e "Login: **$salt**\nMot de passe: **$pepper**\nClé publique: **$pubkey**"
rm -r $homedir
echo "Suppression terminé, nous ne disposons plus d'aucune donnée vous concernant."
else
echo "Vous n'avez pas de compte chez nous."
fi
}
#[[ $(type $@ | grep "est une fonction") ]] && $@ || echo "Veuillez préciser votre commande"

View File

@ -7,6 +7,7 @@ source $MY_PATH/functions.sh
#args=$(echo "$@" | tr ' ' '\n' | grep -vEwi 'gbanque|gb|biz' | tr '\n' ' ')
args=$(echo "$@" | awk -F '~~~' '{ print $2 }' | tr ' ' '\n' | grep -vEwi 'gbanque|gb|biz' | tr '\n' ' ')
cmd=$(echo $args | awk '{ print $1 }')
user=$(echo $@ | awk -F '~~~' '{ print $3 }')
room=$(echo $@ | awk -F '~~~' '{ print $4 }')
@ -24,11 +25,20 @@ init() {
sendmsg $dest "Création de votre portefeuille..."
# echo "Cette conversation continue en privé @$user - @biz"
#TODO: Définir le workflow g1sms
echo "Work in progress ..."
## TODO: Définir le workflow g1sms
init_account $dest
}
[[ $(type $args | grep "est une fonction") ]] && $args || echo "Veuillez préciser votre commande"
remove() {
rm_account $dest
}
info() {
info_account $dest
}
[[ "$cmd" =~ ^(init|remove|info)$ ]] && $cmd || echo "Veuillez indiquer une commande valide"
#[[ $(type $cmd | grep "est une fonction") ]] && $cmd || echo "Veuillez préciser votre commande"
exit 0

View File

@ -1,22 +0,0 @@
2019-05-03 Rémi Colomb - gepi@riseup.net
2019-05-13 Chrystel MAGENC - chrystel.magenc@gmail.com
2019-05-17 Cédric Dumond - cedric.dumond@free.fr
2019-05-17 lisette MARCAHOSSE - monnaielibre66@gmail.com
2019-05-18 ELOIS SANCHEZ - elois@ifee.fr
2019-05-30 Rémi Colomb - gepi@riseup.net
2019-06-12 Genevieve GARCIA - g1.genevieve@lilo.org
2019-09-04 Pi nguyen - contact@axiom-team.fr
2019-09-10 Jean-Yves Toumit - saiolar-c@yahoo.fr
2019-09-13 Nicolas Chenu - scanlegentil@hotmail.com
2019-09-22 Jules EMERY - j.emeryan@outlook.com
2019-09-25 Etienne BOUCHE - poka@p2p.legal
2019-09-27 vincent dardel - ehvince@mailz.org
2019-10-30 Arnaud Langlois - ar.langlois@gmail.com
2019-11-04 Nicolas Chenu - scanlegentil@hotmail.com
2019-11-22 ELOIS SANCHEZ - c@elo.tf
2020-01-07 daniel leporini - daniel.leporini@gmail.com
2020-01-15 Emmanuel Salomon - emmanuel.salomon@gmail.com
2020-01-17 Fanch DAUBORD - fanchdaub@gmail.com
2020-01-30 Damien Leroy - damienleroy77@gmail.com
2019-10-04 Nicolas Chenu - scanlegentil@hotmail.com