G1SMS 97%
This commit is contained in:
parent
a8c1ee320b
commit
3a57378c00
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
##################################################################
|
||||
# Author: Fred (support@qo-op.com)
|
||||
# Version: 0.1
|
||||
# Version: 1.0
|
||||
# License: GPL (http://www.google.com/search?q=GPL)
|
||||
##################################################################
|
||||
# Commande SMS: sms_ABO.sh
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
################################################################################
|
||||
# Author: Fred (support@qo-op.com)
|
||||
# Version: 0.1
|
||||
# Version: 1.0
|
||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||
################################################################################
|
||||
# Accessible seulement pour ADMINPHONE.
|
||||
|
@ -21,10 +21,10 @@ case "$CMD" in
|
|||
# Get it from first MESSAGE message word...
|
||||
towoo=$(echo $MESSAGE | cut -d ' ' -f 1)
|
||||
|
||||
SEARCH=$(grep -Rwl "$towoo" ~/.zen/g1sms_wallets_swarm/*/*.uidna* | tail -n 1 | cut -f 3 -d '/')
|
||||
SEARCH=$(grep -Rwl "$towoo" ~/.zen/ipfs_swarm/*/_uidna* | tail -n 1 | cut -f 6 -d '/')
|
||||
if [[ "$SEARCH" != "" ]]; then
|
||||
REMOTENODE=$(cat ~/.zen/g1sms_wallets_swarm/$SEARCH/MASTERPHONE.sms)
|
||||
DESTRIB=$(cat ~/.zen/g1sms_wallets_swarm/$SEARCH/$SEARCH.pub)
|
||||
REMOTENODE=$(cat ~/.zen/ipfs_swarm/$SEARCH/MASTERPHONE.sms)
|
||||
DESTRIB=$(cat ~/.zen/ipfs_swarm/$SEARCH/_pub)
|
||||
DESTPHONE=$SEARCH
|
||||
log "__SUB:sms_ADMIN.sh: FOUND $towoo on NODE ($REMOTENODE) G1sms+ wallet: $DESTRIB : $DESTPHONE)"
|
||||
|
||||
|
@ -37,9 +37,9 @@ case "$CMD" in
|
|||
|
||||
MEM)
|
||||
log "__SUB:sms_ADMIN.sh: Send $MESSAGE message to All NODE members"
|
||||
for f in ~/.zen/g1sms_wallets/*/*.uidname; do
|
||||
for f in ~/.zen/g1sms_wallets/*/_uidname; do
|
||||
uid=$(cat $f);
|
||||
num=$(echo $f | cut -d '/' -f3);
|
||||
num=$(echo $f | cut -d '/' -f 6);
|
||||
if [[ "$num" == "$ADMINPHONE" || "$num" == "$MASTERPHONE" ]]; then continue; fi
|
||||
log "__SUB:sms_ADMIN.sh: Send SMS to $num: $uid"
|
||||
sms_SEND "$num" "$uid, $MESSAGE"
|
||||
|
@ -51,7 +51,7 @@ case "$CMD" in
|
|||
ALL)
|
||||
log "__SUB:sms_ADMIN.sh: Send $MESSAGE message to All NODE G1sms wallets"
|
||||
for f in ~/.zen/g1sms_wallets/*; do
|
||||
num=$(echo $f | cut -d '/' -f3);
|
||||
num=$(echo $f | cut -d '/' -f 6);
|
||||
if [[ "$num" == "$ADMINPHONE" || "$num" == "$MASTERPHONE" ]]; then continue; fi
|
||||
log "__SUB:sms_ADMIN.sh: Send SMS to $num"
|
||||
sms_SEND "$num" "$MESSAGE"
|
||||
|
@ -60,18 +60,6 @@ case "$CMD" in
|
|||
sms_SEND "$ADMINPHONE" "ADMIN! Message envoyé aux $(ls ~/.zen/g1sms_wallets/ | cut -d '/' -f3 | wc -l) possesseur de G1sms Wallets de ce NODE"
|
||||
;;
|
||||
|
||||
SWARM)
|
||||
log "__SUB:sms_ADMIN.sh: Send $MESSAGE message to All SWARM G1sms wallets"
|
||||
for f in ~/.zen/g1sms_wallets_swarm/+33*; do
|
||||
num=$(echo $f | cut -d '/' -f3);
|
||||
if [[ "$num" == "$ADMINPHONE" || "$num" == "$MASTERPHONE" ]]; then continue; fi
|
||||
log "__SUB:sms_ADMIN.sh: Send SMS to $num"
|
||||
sms_SEND "$num" "$MESSAGE"
|
||||
sleep 5
|
||||
done
|
||||
sms_SEND "$ADMINPHONE" "ADMIN! Message: $MESSAGE envoyé aux $(ls ~/.zen/g1sms_wallets_swarm/ | cut -d '/' -f3 | wc -l) PHONE G1sms Wallets du SWARM"
|
||||
;;
|
||||
|
||||
*)
|
||||
log "__SUB:sms_ADMIN.sh: Send back ERRORs message to Admin"
|
||||
if [ -f "/tmp/ERROR.CRON" ]; then
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
################################################################################
|
||||
# Author: Fred (support@qo-op.com)
|
||||
# Version: 0.1
|
||||
# Version: 1.0
|
||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||
################################################################################
|
||||
source ./init.sh
|
||||
|
|
|
@ -85,25 +85,24 @@ then
|
|||
|
||||
boucle=$(bc -l <<< "$boucle + 1")
|
||||
|
||||
log "__SUB:sms_BILLET.sh: ->BILLET:$PHONE:$NUMBER:$VALbillet:$UNIT"
|
||||
log "__SUB:sms_BILLET.sh: ->BILLET:$PHONE:$NUMBER:$VALbillet:$UNIT"
|
||||
# CREATE "NUMBER SECRET" ACCOUNT for G1 transfert
|
||||
TRANSAC=$(bc -l <<< "scale=2; $VIR / $NBbillets")
|
||||
|
||||
BILLETPUBKEY=$(python3 ./tools/key_create_dunikey.py "$NUMBER" "$SECRET"
|
||||
mv /tmp/secret.dunikey ~/.zen/g1billets/$bpath/
|
||||
BILLETPUBKEY=$(./silkaj/silkaj generate_auth_file --auth-scrypt -salt="$NUMBER" -password="$SECRET")
|
||||
BILLETPUBKEY=$(python3 ./tools/key_create_dunikey.py "$NUMBER" "$SECRET")
|
||||
# COPY authfile for Usage in 6 month...
|
||||
log "__SUB:sms_BILLET.sh: authfile KEY : ~/.zen/g1billets/$bpath/note.authfile.IPFSPrivKey.gpg"
|
||||
log "__SUB:sms_BILLET.sh: authfile KEY : ~/.zen/g1billets/$bpath/note.dunikey.IPFSPrivKey.gpg"
|
||||
mkdir -p "~/.zen/g1billets/$bpath"
|
||||
echo "${IPFSPrivKey}" | gpg -q --output "~/.zen/g1billets/$bpath/note.authfile.IPFSPrivKey.gpg" --yes --pinentry-mode loopback --symmetric --passphrase-fd 0 "./authfile"
|
||||
./natools.py encrypt -p $NODE_G1PUBKEY -i "./authfile" -o "~/.zen/g1billets/$bpath/note.authfile.$NODE_UIDNA.crypt"
|
||||
rm -f "./authfile"
|
||||
echo "${IPFSPrivKey}" | gpg -q --output "~/.zen/g1billets/$bpath/note.dunikey.IPFSPrivKey.gpg" --yes --pinentry-mode loopback --symmetric --passphrase-fd 0 "/tmp/secret.dunikey"
|
||||
./natools.py encrypt -p $NODE_G1PUBKEY -i "/tmp/secret.dunikey" -o "~/.zen/g1billets/$bpath/note.dunikey.$NODE_UIDNA.crypt"
|
||||
rm -f /tmp/secret.dunikey
|
||||
|
||||
log_history $PHONE "G1BILLET, $TRANSAC, $BILLETPUBKEY"
|
||||
sleep 3
|
||||
# Fill BILLET with TRANSAC amount
|
||||
PAY=$(./silkaj/silkaj transaction --auth-scrypt -salt="$PHONE" -password="$PIN" --amount="$TRANSAC" --output="$BILLETPUBKEY" --comment="G1Billet $NUMBER" -y)
|
||||
if [[ "$(echo $PAY | cut -d '|' -f 1)" != "KO" ]]; then
|
||||
duniter_server=$(./tools/duniter_getnode.sh)
|
||||
PAY=$(silkaj -p "$duniter_server" -af --file ~/.zen/g1sms_wallets/$PHONE/secret.dunikey tx --output "$BILLETPUBKEY" --amount "$TRANSAC" --comment "[G1sms+] G1Billet $NUMBER" -y)
|
||||
if [[ "$(echo $PAY | grep 'successful')" != "" && "$PAY" != "" ]]; then
|
||||
# NOTES ARE FILES STORED IN DICEWARE COMPOSED SUBDIR
|
||||
echo "$(date +%Y%m%d)" > "~/.zen/g1billets/$bpath/note.creationdate"
|
||||
echo "$MEMBER" > "~/.zen/g1billets/$bpath/note.creator"
|
||||
|
@ -136,7 +135,7 @@ then
|
|||
|
||||
# + G1SMS Commission
|
||||
sleep 2
|
||||
COM=$(./silkaj/silkaj transaction --auth-scrypt -salt="$PHONE" -password="$PIN" --amount="$BILLCOM" --output="$NODE_G1PUBKEY" --comment="[G1sms+] Achat G1Billets" -y)
|
||||
COM=$(silkaj -p "$duniter_server" -af --file ~/.zen/g1sms_wallets/$PHONE/secret.dunikey tx --output "$NODE_G1PUBKEY" --amount "$BILLCOM" --comment "[G1sms+] Achat G1Billets" -y)
|
||||
|
||||
# POUR IMPRIMER LES BILLETS! Brancher votre imprimante, configurer cups, activer code lp ;)
|
||||
num=$(date +%Y%m%d)
|
||||
|
@ -164,7 +163,7 @@ Support: $ADMINPSEUDO ($ADMINPHONE)
|
|||
sms_SEND "$phone" "$mess"
|
||||
# ADMIN ALERT SMS + TODO Add ADMINEMAIL parameter in "install.sh"
|
||||
sms_SEND "$ADMINPHONE" "$MEMBER vient de créer $NBbillets G1Billets de $VALbillet $UNIT ($TRANSAC G1): $MAIL"
|
||||
cat ./email.txt | sed s/EMAIL/frenault@linkeo.com/g | sed s/SUBJECT/Creation_G1Billets/g | sed s/MESSAGE/"$MEMBER ($PHONE) vient de creer $NBbillets G1Billets de $VALbillet $UNIT ($TRANSAC G1) vers $MAIL"/g | ssmtp "frenault@linkeo.com"
|
||||
cat ./email.txt | sed s/EMAIL/support@qo-op.com/g | sed s/SUBJECT/Creation_G1Billets/g | sed s/MESSAGE/"$MEMBER ($PHONE) vient de creer $NBbillets G1Billets de $VALbillet $UNIT ($TRANSAC G1) vers $MAIL"/g | ssmtp "frenault@linkeo.com"
|
||||
|
||||
#####################################
|
||||
# Amount too High, solde insuffisant
|
||||
|
|
|
@ -26,7 +26,13 @@ then
|
|||
UNIT=$(cat "~/.zen/g1billets/$bpath/note.unit")
|
||||
BILLETPUBKEY=$(cat "~/.zen/g1billets/$bpath/note.pubkey")
|
||||
|
||||
AMOUNTG1=$(./silkaj/silkaj amount "$BILLETPUBKEY")
|
||||
# Check account amount
|
||||
declare -a accounting
|
||||
accounting=($(check_account))
|
||||
log "$(declare -p accounting)"
|
||||
AMOUNTG1=${accounting[0]}
|
||||
AMOUNT=${accounting[1]}
|
||||
UNIT=${accounting[2]}
|
||||
log "Billet: $AMOUNTG1 ($VALbillet $UNIT): $BILLETPUBKEY"
|
||||
|
||||
# NO GOOD SECRET
|
||||
|
@ -46,10 +52,12 @@ https://www.g1sms.fr/contact"
|
|||
# Account creation
|
||||
sms_INIT_ACCOUNT "$PHONE"
|
||||
fi
|
||||
log "./silkaj/silkaj transaction --auth-scrypt -salt=\"$CODE\" -password=\"$SEC$SALT\" --amount=\"$AMOUNTG1\" --output=\"$PUBKEY\" --comment=\"THIRD_PARTY_MANAGER:$NODE_G1PUBKEY:G1SMS:ENCAISSEMENT:$CODE\" -y"
|
||||
PAY=$(./silkaj/silkaj transaction --auth-scrypt -salt="$CODE" -password="$SEC$SALT" --amount="$AMOUNTG1" --output="$PUBKEY" --comment="THIRD_PARTY_MANAGER:$NODE_G1PUBKEY:ENCAISSEMENT:$CODE" -y)
|
||||
|
||||
if [[ "$(echo $PAY | cut -d '|' -f 1)" != "KO" ]]; then
|
||||
echo "${IPFSPrivKey}" | gpg -d -q --output "/tmp/note.dunikey" --yes --pinentry-mode loopback --passphrase-fd 0 "~/.zen/g1billets/$bpath/note.dunikey.IPFSPrivKey.gpg"
|
||||
|
||||
duniter_server=$(./tools/duniter_getnode.sh)
|
||||
PAY=$(silkaj -p "$duniter_server" -af --file /tmp/note.dunikey tx --output "$PUBKEY" --amount "$AMOUNTG1" --comment "[G1sms+] $NODE_G1PUBKEY:RAZ:$CODE" -y)
|
||||
if [[ "$(echo $PAY | grep 'successful')" != "" && "$PAY" != "" ]]; then
|
||||
# DESTROY BILLET
|
||||
rm -Rf ~/.zen/g1billets/$bpath
|
||||
# DESTROY PUBLIC CACHE in /tmp
|
||||
|
@ -57,7 +65,7 @@ https://www.g1sms.fr/contact"
|
|||
rm -Rf /tmp/billets_valides/$bpath
|
||||
fi
|
||||
|
||||
SOLDE=$(./silkaj/silkaj amount "$PUBKEY")
|
||||
SOLDE=$(silkaj_balance $PUBKEY)
|
||||
|
||||
mess="[G1SMS]
|
||||
ENCAISSEMENT de $VALbillet $UNIT ($AMOUNTG1 G1)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
################################################################################
|
||||
# Author: Fred (support@qo-op.com) & poka
|
||||
# Version: 0.1
|
||||
# Version: 1.0
|
||||
# License: AGPL (http://www.google.com/search?q=AGPL)
|
||||
################################################################################
|
||||
|
||||
|
@ -13,8 +13,8 @@ MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
|||
|
||||
export YOU=$(ps aux --sort=+utime | grep ipfs | tail -n 1 | cut -d " " -f 1)
|
||||
cd $MY_PATH
|
||||
source init.sh
|
||||
source functions.sh
|
||||
source ./init.sh
|
||||
source ./functions.sh
|
||||
|
||||
security
|
||||
|
||||
|
@ -30,7 +30,8 @@ CMD=$(echo "$TEXT" | awk '{print toupper($1)}')
|
|||
##################################################################
|
||||
if [[ ! -f "~/.zen/g1sms_wallets/$PHONE/MASTERPHONE.sms" && "$CMD" != "ADMIN" ]]
|
||||
then
|
||||
NODEPHONE=$(cat "~/.zen/g1sms_wallets_swarm/$PHONE/MASTERPHONE.sms")
|
||||
HPHONE=$(echo -n $PHONE | sha256sum | cut -d ' ' -f 1)
|
||||
NODEPHONE=$(cat ~/.zen/ipfs_swarm/G1SMS/$HPHONE@*/MASTERPHONE.sms)
|
||||
if [[ "$NODEPHONE" != "$MASTERPHONE" && "$NODEPHONE" != "" ]]; then
|
||||
sms_SEND "$PHONE" "[G1sms+] Vous avez déjà un compte portefeuille sur $NODEPHONE (Envoyez lui RAZ si vous voulez fermer votre compte)"
|
||||
log "ALERT!! $PHONE compte existant sur le NODE G1sms+ ($NODEPHONE)"
|
||||
|
@ -50,11 +51,10 @@ case "$CMD" in
|
|||
MEMBERUID=$(echo "$TEXT" | awk '{print $2}' | grep -E "([A-Za-z0-9\-\_]+$)")
|
||||
./sms_DESTROY.sh "$PHONE" "$MEMBERUID"&
|
||||
;;
|
||||
A|AIDE)
|
||||
A|AIDE|HELP)
|
||||
./sms_AIDE.sh "$PHONE" &
|
||||
;;
|
||||
N|D)
|
||||
# SEND DESTROY Member or DESTROY DON to empty you PHONE wallet and remove it
|
||||
MEMBERUID=$(echo "$TEXT" | awk '{print $2}' | grep -E "([A-Za-z0-9\-\_]+$)")
|
||||
./sms_NEW.sh "$PHONE" "$MEMBERUID" &
|
||||
;;
|
||||
|
|
|
@ -23,6 +23,5 @@ path = "/tmp/secret.dunikey"
|
|||
key = SigningKey.from_credentials(argv[1], argv[2], None)
|
||||
key.save_pubsec_file(path)
|
||||
print(
|
||||
"",
|
||||
key.pubkey,
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue