Update 2024-02-14 07:51 OpenBSD/amd64-x13

This commit is contained in:
c0dev0id
2024-02-14 07:54:31 +01:00
parent b55e6a3616
commit 9624895938
373 changed files with 19074 additions and 3045 deletions

45
.bin/OLD/codi-fetch Executable file
View File

@@ -0,0 +1,45 @@
#!/bin/sh
echo "Logging In..."
passdata="$(pass Internet/comdirect.com)"
client_id=$(echo "$passdata" | grep ^client_id | awk '{ print $2 }')
client_secret=$(echo "$passdata" | grep ^client_secret | awk '{ print $2 }')
username=$(echo "$passdata" | grep ^user | awk '{ print $2 }')
password=$(echo "$passdata" | head -1)
### FUNCTIONS
get_token() {
token=$(curl -s \
-X POST \
-H "Accept:application/json" \
-H "Content-Type:application/x-www-form-urlencoded" \
--data-urlencode "client_id=$client_id" \
--data-urlencode "client_secret=$client_secret" \
--data-urlencode "username=$username" \
--data-urlencode "password=$password" \
--data-urlencode "grant_type=password" \
https://api.comdirect.de/oauth/token \
| jq -r .access_token)
echo "$token"
}
# $1 token
get_session() {
transactions=$(curl -s \
-X POST \
-H "Accept:application/json" \
-H "Content-Type:application/x-www-form-urlencoded" \
--data-urlencode "client_id=$client_id" \
--data-urlencode "client_secret=$client_secret" \
--data-urlencode "username=$username" \
--data-urlencode "password=$password" \
--data-urlencode "grant_type=password" \
https://api.comdirect.de/ \
| jq -r .access_token)
echo "$transactions"
}
### MAIN PROGRAM
TOKEN=$(get_token)
echo "Got token: $TOKEN"