Closed mrmay-dev closed 1 year ago
Here's a quick-fix for the issue. I'll update the repo after checking for other bugs.
Make sure the .keys files are in a directory called keys
under the application folder. Like this:
owntags/
└── application/
└── keys/
├── prefix-1.keyfile
└── prefix-2.keyfile
Now, edit line 18.
REMOVE this line:
OUTPUT_FOLDER = configuration["owntag_options"]["output_folder"]
~REPLACE IT with this one:
OUTPUT_FOLDER = "keys/"
Let me know if the change works for you.
Thanks for progressing the project. I made the changes...
python3 request_reports.py
Traceback (most recent call last):
File "/Users/Downloads/OwnTracks/owntags-main/application/request_reports.py", line 13, in <module>
from apple_cryptography import *
File "/Users/Downloads/OwnTracks/owntags-main/application/apple_cryptography.py", line 19, in <module>
from OwnTags_plugin import get_configuration
File "/Users/Downloads/OwnTracks/owntags-main/application/OwnTags_plugin.py", line 7, in <module>
import paho.mqtt.publish as publish
ModuleNotFoundError: No module named 'paho'
python3 owntags.sh
File "/Users/Downloads/OwnTracks/owntags-main/owntags.sh", line 5
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
^
SyntaxError: invalid syntax
Hope this helps. You need a coffee cash register :-)
Thanks for progressing the project. I made the changes...
python3 request_reports.py Traceback (most recent call last): File "/Users/Downloads/OwnTracks/owntags-main/application/request_reports.py", line 13, in <module> from apple_cryptography import * File "/Users/Downloads/OwnTracks/owntags-main/application/apple_cryptography.py", line 19, in <module> from OwnTags_plugin import get_configuration File "/Users/Downloads/OwnTracks/owntags-main/application/OwnTags_plugin.py", line 7, in <module> import paho.mqtt.publish as publish ModuleNotFoundError: No module named 'paho'
You have to install Paho-mqtt.
pip3 install paho-mqtt
python3 owntags.sh File "/Users/Downloads/OwnTracks/owntags-main/owntags.sh", line 5 SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" ^ SyntaxError: invalid syntax
owntags.sh is a Shell file, not python, syntax is :
./owntags.sh
@Systm21 got it. I didn't pull it directly from your request... but (noob problem) didn't know how to just pull an item or two from the changes you proposed. I'm learning. :)
I made the changes...
python3 request_reports.py
2023 Sep 12 (Tue) 08:04:37
Using python3
Days: 0, Hrs: 0, Min: 60
Traceback (most recent call last):
File "/Users/Downloads/OwnTracks/owntags-main/application/request_reports.py", line 62, in <module>
iCloud_decryptionkey = args.key if args.key else retrieveICloudKey()
^^^^^^^^^^^^^^^^^^^
File "/Users/Downloads/OwnTracks/owntags-main/application/apple_cryptography.py", line 58, in retrieveICloudKey
db_key = unpad(decrypt(db_key_enc, algorithms.TripleDES(master_key), modes.CBC(db_key_IV)), algorithms.TripleDES.block_size)[:24]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/Downloads/OwnTracks/owntags-main/application/apple_cryptography.py", line 41, in unpad
return unpadder.update(paddedBinary) + unpadder.finalize()
^^^^^^^^^^^^^^^^^^^
File "/Users/Library/Python/3.11/lib/python/site-packages/cryptography/hazmat/primitives/padding.py", line 160, in finalize
result = _byte_unpadding_check(
^^^^^^^^^^^^^^^^^^^^^^
File "/Users/Library/Python/3.11/lib/python/site-packages/cryptography/hazmat/primitives/padding.py", line 102, in _byte_unpadding_check
raise ValueError("Invalid padding bytes.")
ValueError: Invalid padding bytes.
This error looks like what you get when the password is missing or wrong in the settings.toml
. Try the version just uploaded and create a new settings.toml
by copying the settings-template.toml
and filling in the details.
Check out the README.md
on the repo's front page for more instructions.
Also, update the Python libraries. The cryptography is super important.
pip install --upgrade pip
pip install pyobjc cryptography six paho-mqtt
...also please use updated files in repo, can have something todo with the old toml problem.
Found a mistake in mine: Oh man. The settings-template.toml also clearly states Password macOS/computer…. I had the iCloud password in there. 😕 Now comes:
./owntags.sh 24:00
2023 Sep 12 (Tue) 16:14:35
Using python3
Days: 0, Hrs: 24, Min: 0
500 Internal Server Error
HELP: This error is generally happens when something is wrong with the request.
Usually no keys were requested, meaning the keys folder is probably empty.
Traceback (most recent call last):
File "/Users/maquis/Downloads/owntags-main_12-09-2023_V2/application/request_reports.py", line 124, in <module>
raise Exception(response_status)
Exception: (500, 'Internal Server Error')
-- END SCRIPT --
I think the problem could be the keys.
I added the car1.keyfile and the private key B64 to the /owntags/application/keys/ folder. (OpenHaystack with right click on the tracker -> Copy private key B64)
The content of my car1.keyfile is one line: VcD4QkiUJeYVBZHmCNSROkXk9CjApDmU0WEq2w== (This is not the original private key B64 just an example)
Is the car1.keyfile correct?
My settings.toml :
[owntag_options] password = "XXXXXX" # macOS/computer password print_history = 1
# negative numbers (-1) will print all fetched locations,
# 0 will turn printing fetched locations off
status_msg = false # publish status and metadata
status_base = "status/owntags" # topic for status messages
[mqtt_secrets]
mqtt_broker = "192.168.1.86" # broker address mqtt_port = 1884 # 1883 if no TLS; 8883 if TLS mqtt_user = "USER" # Broker user mqtt_pass = "PWD" # Broker password
mqtt_tls = "None" # To use TLS comment out this line by putting a '#' in front of it.
# download HiveMQ certificate: https://community.hivemq.com/t/frequently-asked-questions/514
# create users at https://console.hivemq.com
[owntracks_options]
owntracks_device = "owntracks/phone" # user Topic Base of your phone or device with owntracks, used for waypoints
owntags_base = nan # topic base for tags. If nan
owntracks_device will be used.
false
turn off, if true
use confidence[tag_options.car1]
tag_name = "car1"
location = true
waypoint = false
timestamp = 1000000001
radius = false
[tag_options.car2]
tag_name = "car2"
location = true
waypoint = false
timestamp = 1000000002
radius = false
[tag_options.unicorn]
tag_name = "unicorn"
location = true
waypoint = false
timestamp = 1000000003
radius = false
[tag_options.dragon]
tag_name = "dragon"
location = true
waypoint = false
timestamp = 1000000004
radius = false
tag_image = nan # base 64 encoded, 200x200, PNG or JPEG image
mqtt_topic = nan # (not required) topic for this tag, if nan
owntags_base will be used
status_topic = false # (not required) if True
messages will be published to status_base
/prefix
The keys must be converted to the format, which is used in the headless-haystack project.
I can create new keys using headless-haystack (generate_keys.py)
The result would be: SROSOM_keyfile SROSOM_devices.json SROSOM.keys
Is the SROSOM.keys file the correct format? Then I would feed them my data.
.keys, yes
error first reported here
As a quick look, line 18:
This tells the script where to find the
.keyfiles
. I'm poking at this now and looking at what I'm using now to update/fix this.