Commit ff4ebbfa authored by zicmama's avatar zicmama

Supp 1

parent 2f38f205
deny from all
DirectoryIndex 404.html
...@@ -24,15 +24,6 @@ connection = at19200 ...@@ -24,15 +24,6 @@ connection = at19200
synchronizetime = yes synchronizetime = yes
gammucoding = utf8 gammucoding = utf8
#logformat = textall #logformat = textall
PIN = 0000
[gammu1]
device = /dev/ttyUSB1
name = Phone on USB serial port HUAWEI_Technology HUAWEI_Mobile
connection = at19200
synchronizetime = yes
gammucoding = utf8
# SMSD configuration, see gammu-smsdrc(5) # SMSD configuration, see gammu-smsdrc(5)
[smsd] [smsd]
...@@ -91,24 +82,3 @@ Traduire et changer ce code dans init.sh pour un autre pays!! ...@@ -91,24 +82,3 @@ Traduire et changer ce code dans init.sh pour un autre pays!!
* Synchronise phone accounts with multiple G1SMS servers. * Synchronise phone accounts with multiple G1SMS servers.
* ... * ...
ERROR USB DONGLE !!!! NEED HARD RESET??
https://askubuntu.com/questions/882278/how-do-i-set-ttyusb-boot-time-defaults
vi /etc/udev/rules.d/10-ttyUSB.rules
ACTION=="add", SUBSYSTEMS="usb", ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1003", ATTRS{serial}=="3f980000.usb", SYMLINK+="mydongle", RUN+="/bin/stty -F /dev/%k -crtscts"
un 2018/11/18 10:17:08 gammu-smsd[887]: Starting phone communication...
Sun 2018/11/18 10:17:08 gammu-smsd[887]: Error at init connection: Error opening device, it doesn't exist. (DEVICENOTEXIST[4])
Sun 2018/11/18 10:17:08 gammu-smsd[887]: Going to 30 seconds sleep because of too many connection errors
Sun 2018/11/18 10:33:11 gammu-smsd[887]: Starting phone communication...
Sun 2018/11/18 10:33:15 gammu-smsd[887]: Soft reset return code: No error. (NONE[1])
Sun 2018/11/18 10:33:20 gammu-smsd[887]: Error getting SMS status: Error writing to the device. (DEVICEWRITEERROR[11])
CheckSecurity = 0
ResetFrequency = 0
HardResetFrequency = 0
CommTimeout = 5
SendTimeout = 30
ReceiveFrequency = 15
#!/bin/bash
source /root/G1SMS/shell/init.sh
source /root/G1SMS/shell/functions.sh
if [ -d "/root/G1SMS" ]
then
cd "/root/G1SMS"
else
exit
fi
TOTAL=0
TOTALG1=0
NB=0
for f in $(ls ./wallets/ -t); do
PHONE="$f"
PIN=$(cat /root/G1SMS/wallets/$PHONE/$PHONE.pin|xargs)
PUBKEY=$(cat /root/G1SMS/wallets/$PHONE/$PHONE.pub|xargs)
AMOUNTG1=$(./silkaj/silkaj amount --auth-scrypt -salt="$PHONE" -password="$PIN")
echo $PHONE / $PUBKEY
echo "Solde ($PHONE) : $AMOUNTG1 G1"
NB=$(bc <<< "$NB + 1")
TOTALG1=$(bc -l <<< "$AMOUNTG1 + $TOTALG1")
AMOUNTLOVE=$(bc <<< "$AMOUNTG1 * 100 / $DUFACTOR")
TOTAL=$(bc -l <<< "$AMOUNTLOVE + $TOTAL")
# Use G1SMS with phone
# export SMS_1_NUMBER="$PHONE"
# export SMS_1_TEXT="N"
# $(/root/G1SMS/sms_received.sh)
# SEND SMS TO phone
#dest="$PHONE"
#mess="[G1SMS] bonjour, vous avez un porte-monnaie Libre ($AMOUNTLOVE LOVE). Envoyez N pour le conserver. 1l0v3. https://qo-op.com"
#gammu-smsd-inject TEXT "$dest" -text "$mess"
#sleep 30
done
echo "Solde TOTAL : $TOTAL LOVE"
#!/bin/bash
source /root/G1SMS/shell/init.sh
source /root/G1SMS/shell/functions.sh
if [ -d "/root/G1SMS" ]
then
cd "/root/G1SMS"
else
exit
fi
TOTAL=0
for f in $(ls ./wallets/ -t); do
PHONE="$f"
PIN=$(cat /root/G1SMS/wallets/$PHONE/$PHONE.pin|xargs)
PUBKEY=$(cat /root/G1SMS/keys/$PHONE/$PHONE.pub|xargs)
AMOUNTG1=$(./silkaj/silkaj amount --auth-scrypt -salt="$PHONE" -password="$PIN")
echo $PHONE / $PUBKEY
echo "Solde ($PHONE) : $AMOUNTG1 G1"
if [[ "$AMOUNTG1" == "0.0" ]]; then echo "REMOVE"; rm -f /root/G1SMS/keys/$PHONE.pub; rm -f /root/G1SMS/keys/$PHONE.pin; fi
TOTAL=$(bc -l <<< "$AMOUNTG1 + $TOTAL")
AMOUNTLOVE=$(bc <<< "$AMOUNTG1 * 100 / $DUFACTOR")
# Use G1SMS with phone
# export SMS_1_NUMBER="$PHONE"
# export SMS_1_TEXT="N"
# $(/root/G1SMS/sms_received.sh)
# SEND SMS TO phone
dest="$PHONE"
mess="[G1SMS] bonjour, vous avez un porte-monnaie Libre ($AMOUNTLOVE LOVE). Envoyez N pour le conserver. 1l0v3. https://qo-op.com"
gammu-smsd-inject TEXT "$dest" -text "$mess"
sleep 30
done
echo "Solde TOTAL : $TOTAL G1"
#!/bin/bash
# Handle commands
case "$1" in
amount)
echo 1000
;;
transaction)
echo "OK"
;;
generate_auth_file)
echo "CLEF0PUBLIQUE1DU2PORTE3MONNAIE4LIBRE5"
;;
*)
echo "KO"
;;
esac
echo "RUN ./silkaj/silkaj $*" >> /tmp/g1sms.log
\ No newline at end of file
REPLACE WITH G1SMS PROVIDER WALLET PRIVATE KEY (authfile créé par 'silkaj generate_auth_file --auth-scrypt -salt="$LOGIN" -password="$PASSWD"')!!! Adjust "g1sms.pub.key" accordingly!!!
#!/bin/bash
################################################################################
# Author: Fred (support@qo-op.com)
# Version: 0.1
# License: GPL (http://www.google.com/search?q=GPL)
################################################################################
source /root/G1SMS/shell/init.sh
source /root/G1SMS/shell/functions.sh
log "X sms_SETUNIT.sh ($1=phone, $2=unit)"
phone="$1"
unit="$2"
UNITFILE="./wallets/$phone/$phone.unit"
# Initialise PHONE, PIN, PUBKEY, UNIT, HIST
sms_INIT_ACCOUNT "$phone" "NOSMS"
if [[ $result == "unknown" ]]; then
$(sms_ERROR "$phone" "Porte-monnaie inconnu. Envoyez N pour le créer.")
exit
fi
# No unit received
if [[ $unit == "U" ]]; then
if [[ -f "$UNITFILE" ]]; then
unit=$(cat "$UNITFILE")
else
unit="LOVE";
fi
fi
echo "$unit" > "$UNITFILE"
mess="[G1SMS]
Unité de votre porte-monnaie Libre: $unit"
sms_SEND "$phone" "$mess"
exit
#!/bin/bash
################################################################################
# Author: Fred (support@qo-op.com)
# Version: 0.1
# License: GPL (http://www.google.com/search?q=GPL)
################################################################################
source /root/G1SMS/shell/init.sh
source /root/G1SMS/shell/functions.sh
#SECURITY
security
# Get global variables from gammu-smsd
PHONE="$SMS_1_NUMBER"
TEXT="$SMS_1_TEXT"
log "##################################"
log "$(date)"
log "SMS received $PHONE $TEXT"
# No Reply to MySelf (or enjoy SMS LOOP of the death)
if [ "$PHONE" == "$MASTERPHONE" ]; then exit; fi
# Extract Received Command (if new update sms_AIDE.sh)
CMD=$(echo "$TEXT" | cut -d ' ' -f 1)
log "COMMAND $CMD"
# Handle commands
case "$CMD" in
A)
./shell/sms_AIDE.sh "$PHONE" &
;;
N|D)
./shell/sms_NEW.sh "$PHONE" &
;;
P)
DEST=$(echo "$TEXT" | cut -d ' ' -f 2)
LOVE=$(echo "$TEXT" | cut -d ' ' -f 3)
checkdest=$(echo "$DEST" | grep -E "^\-?[0-9]+$") # Test if number
checklove=$(echo "$LOVE" | grep -E "^\-?[0-9]+$") # Test number
if [[ ${#DEST} == 10 && "$checkdest" != '' && "$checklove" != '' ]]; then
./shell/sms_PAY.sh "$PHONE" "$DEST" "$LOVE" &
else
./shell/sms_ERROR.sh "$PHONE" "$TEXT" &
fi
;;
C)
./shell/sms_COUNT.sh "$PHONE" &
;;
RIB)
NAME=$(echo "$TEXT" | cut -d ' ' -f 2)
./shell/sms_SETRIB.sh "$PHONE" "$NAME" &
;;
U)
UNIT=$(echo "$TEXT" | cut -d ' ' -f 2)
./shell/sms_SETUNIT.sh "$PHONE" "$UNIT" &
;;
Delivered|Pending)
# If delivered/pending notification come back (gammu/phone config)
exit
;;
*)
./shell/sms_ERROR.sh "$PHONE" "$TEXT" &
;;
esac
exit
#!/bin/bash
echo "Trash Testeur des Scripts G1SMS ('./sms_test.sh help' => Aide)"
echo "##############################################################"
if [[ $1 == "help" ]]; then
echo "'help'
Ce testeur permet de tester les scripts G1SMS sans déclencher l'envoi de SMS ni d'interactions avec la blockchain Duniter Ḡ1"
echo "####################################################"
echo "Surveiller l’exécution : 'tail -f /tmp/g1sms.log'"
echo "####################################################"
echo "IMPORTANT! Après utilisation, ne pas oublier de :
1. Restaurer lien Silkaj en répondant NON, ou manuellement:
rm ./silkaj/silkaj && ln -s src/silkaj.py ./silkaj/silkaj
2. Restaurer l'envoi de SMS en commentant la fonction 'gammu-smsd-inject' dans './shell/functions.sh'
3. Adapter les valeurs de './shell/init.sh' pour passer en production
export SMS_1_NUMBER='+33600000000'
export SMS_1_TEXT='N'
./sms_received.sh
HAPPY G1SMS"
exit
fi
echo "Désactiver Silkaj?? O (O/N)"
read oui
if [[ $oui == "N" ]]; then $(rm ./silkaj/silkaj && ln -s src/silkaj.py ./silkaj/silkaj);
else $(rm ./silkaj/silkaj && ln -s ../fake_silkaj.sh ./silkaj/silkaj); fi
# Define default numbers, randomly choosen
arr[0]="+33600000000"
arr[1]="+33612345678"
rand=$[$RANDOM % ${#arr[@]}]
num=${arr[$rand]}
rand2=$[$RANDOM % ${#arr[@]}]
num2=${arr[$rand2]}
num2="0${num2:3:10}"
# Ask for phone number
echo "Numero ( $num ) ? "
read SMS_1_NUMBER
if [[ $SMS_1_NUMBER == "" ]]; then SMS_1_NUMBER="$num"; fi
export SMS_1_NUMBER
# Ask for SMS text
echo "SMS ( A - N - C - U G1 - P $num2 100 ... )? A"
read SMS_1_TEXT
if [[ $SMS_1_TEXT == "" ]]; then SMS_1_TEXT="A"; fi
export SMS_1_TEXT
$(./sms_received.sh)
#!/bin/bash
echo "RSYNC code to smspi"
rsync -avz --progress --cvs-exclude --exclude "*.key" --exclude "wallets" --exclude "__pycache__" ~/workspace/G1SMS/ -e ssh root@smspi:/root/G1SMS/
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment