mirror of
https://github.com/EDCD/EDDN.git
synced 2025-04-19 18:17:37 +03:00
Merge branch 'master' into live
This commit is contained in:
commit
17f98121a9
@ -87,7 +87,8 @@ do
|
||||
log " Archiving ${service}.log ..."
|
||||
# We have no means to tell the service to close and re-open output, it's
|
||||
# to stdout/err anyway. So we copy it.
|
||||
COMPRESSED_NAME="${service}.log.$(date --iso-8601=seconds)"
|
||||
TIMESTAMP="$(date --iso-8601=seconds)"
|
||||
COMPRESSED_NAME="${service}.log.${TIMESTAMP}"
|
||||
cp ${service}.log "${COMPRESSED_NAME}"
|
||||
if [ $? -ne 0 ];
|
||||
then
|
||||
@ -97,6 +98,11 @@ do
|
||||
fi
|
||||
# Truncate the live file.
|
||||
:> ${service}.log
|
||||
|
||||
# Produce a report on the just-rotated log
|
||||
${HOME}/.local/bin/eddn-report-log-errors "${COMPRESSED_NAME}" > \
|
||||
"${HOME}/reports/eddn-errors/by-log-rotation/eddn-errors-${TIMESTMAP}.txt"
|
||||
|
||||
# Now compress the newly archived log
|
||||
gzip -9v "${COMPRESSED_NAME}"
|
||||
log " DONE"
|
||||
|
@ -117,9 +117,6 @@ def process_file(input_file: str) -> None:
|
||||
print(matches.group('err_msg'))
|
||||
print(line)
|
||||
|
||||
else:
|
||||
print(line)
|
||||
|
||||
elif matches.group('software_name') == 'EDSM':
|
||||
# It's in-browser, no public source/releases
|
||||
if matches.group('software_version') == '1.0.1':
|
||||
@ -174,7 +171,37 @@ def process_file(input_file: str) -> None:
|
||||
else:
|
||||
print(line)
|
||||
|
||||
###################################################################
|
||||
elif matches.group('software_name') == 'EliteLogAgent':
|
||||
# <https://github.com/DarkWanderer/Elite-Log-Agent>
|
||||
if matches.group('software_version') == '2.0.0.660':
|
||||
print(line)
|
||||
|
||||
# <https://edcodex.info/?m=tools&entry=440>
|
||||
# <https://bitbucket.org/JuustoKakku/moonlight/src/master/>
|
||||
elif matches.group('software_name') == 'Moonlight':
|
||||
if matches.group('software_version') == '1.3.4':
|
||||
if matches.group('schema_ref') == 'https://eddn.edcd.io/schemas/journal/1':
|
||||
if matches.group('journal_event') == 'Scan':
|
||||
# Ref: <https://bitbucket.org/JuustoKakku/moonlight/issues/5/bad-scan-events-being-sent-to-eddn>
|
||||
if not matches.group('err_msg').startswith(
|
||||
'Failed Validation "[<ValidationError: "{\'type\': [\'array\', \'boolean\', \'integer\', \'number\', \'null\', \'object\', \'string\']} is not allowed for \''
|
||||
):
|
||||
print(matches.group('err_msg'))
|
||||
print(line)
|
||||
|
||||
else:
|
||||
print(line)
|
||||
|
||||
else:
|
||||
print(line)
|
||||
|
||||
# Abandoned/unmaintained project
|
||||
# <https://forums.frontier.co.uk/threads/release-eva-elite-virtual-assistant-for-iphone-ipad-no-longer-working-jan-2020.245900/page-18>
|
||||
# <https://apps.apple.com/gb/app/eva/id1098763533>
|
||||
elif matches.group('software_name') == 'EVA [iPhone]':
|
||||
pass
|
||||
|
||||
####################################################################
|
||||
# Issues we know about, but haven't yet alerted developers to
|
||||
###################################################################
|
||||
###################################################################
|
||||
|
@ -1,38 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# 2022-01-10: THIS SCRIPT DOES NOT PERFORM THE INTENDED PURPOSE
|
||||
# BECAUSE IT SEEMS THAT `requests` (or underlying modules) IS TOO CLEVER
|
||||
# AND APPLIES COMPRESSION WHEN WE SET THE `Content-Encoding: gzip`
|
||||
# HEADER
|
||||
|
||||
import json
|
||||
import requests
|
||||
import sys
|
||||
|
||||
print('''
|
||||
DO NOT USE THIS SCRIPT, IT DOES NOT PERFORM THE INTENDED PURPOSE.
|
||||
|
||||
USE THE `test-bad-gzip.sh` SCRIPT INSTEAD.
|
||||
|
||||
''')
|
||||
sys.exit(-1)
|
||||
|
||||
if len(sys.argv) != 2:
|
||||
print('test-sender.py <filename>')
|
||||
sys.exit(-1)
|
||||
|
||||
with open(sys.argv[1], 'r') as f:
|
||||
msg = f.read()
|
||||
|
||||
s = requests.Session()
|
||||
|
||||
# This apparently causes compression to actually happen
|
||||
s.headers['Content-Encoding'] = 'gzip'
|
||||
r = s.post(
|
||||
'https://dev.eddn.edcd.io:4432/upload/',
|
||||
data=msg,
|
||||
)
|
||||
|
||||
print(f'Response: {r!r}')
|
||||
print(f'Body: {r.content.decode()}')
|
||||
|
@ -1,6 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# python `requests` appears to perform compression when you set the
|
||||
# 'Content-Encoding: gzip' header, so do this with curl.
|
||||
|
||||
curl --verbose -d 'wegiuweuygtfawgep9aqe8fpq2387lfbr;iufvypq38764tpgf' -H 'Content-Encoding: gzip' 'https://dev.eddn.edcd.io:4432/upload/'
|
@ -1,37 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import json
|
||||
import requests
|
||||
import sys
|
||||
import urllib3
|
||||
import zlib
|
||||
|
||||
if len(sys.argv) != 2:
|
||||
print('test-sender.py <filename>')
|
||||
sys.exit(-1)
|
||||
|
||||
with open(sys.argv[1], 'r') as f:
|
||||
# Read from provided file
|
||||
msg = f.read()
|
||||
|
||||
# Fake form-encode it
|
||||
msg = 'wibble=' + msg
|
||||
|
||||
# Compress it
|
||||
msg_gzip = zlib.compress(msg.encode('utf-8'))
|
||||
|
||||
http = urllib3.PoolManager()
|
||||
|
||||
# Send that compressed data as a POST body
|
||||
r = http.request(
|
||||
'POST',
|
||||
'https://dev.eddn.edcd.io:4432/upload/',
|
||||
headers={
|
||||
'Content-Encoding': 'gzip'
|
||||
},
|
||||
body=msg_gzip
|
||||
)
|
||||
|
||||
print(f'Response: {r.status!r}')
|
||||
print(f'Body:\n{r.data.decode()}\n')
|
||||
|
@ -1,37 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import json
|
||||
import requests
|
||||
import sys
|
||||
import urllib3
|
||||
import zlib
|
||||
|
||||
if len(sys.argv) != 2:
|
||||
print('test-sender.py <filename>')
|
||||
sys.exit(-1)
|
||||
|
||||
with open(sys.argv[1], 'r') as f:
|
||||
# Read from provided file
|
||||
msg = f.read()
|
||||
|
||||
# Fake form-encode it
|
||||
msg = 'data=' + msg
|
||||
|
||||
# Compress it
|
||||
msg_gzip = zlib.compress(msg.encode('utf-8'))
|
||||
|
||||
http = urllib3.PoolManager()
|
||||
|
||||
# Send that compressed data as a POST body
|
||||
r = http.request(
|
||||
'POST',
|
||||
'https://dev.eddn.edcd.io:4432/upload/',
|
||||
headers={
|
||||
'Content-Encoding': 'gzip'
|
||||
},
|
||||
body=msg_gzip
|
||||
)
|
||||
|
||||
print(f'Response: {r.status!r}')
|
||||
print(f'Body:\n{r.data.decode()}\n')
|
||||
|
@ -1,34 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import json
|
||||
import requests
|
||||
import sys
|
||||
import urllib3
|
||||
import zlib
|
||||
|
||||
if len(sys.argv) != 2:
|
||||
print('test-sender.py <filename>')
|
||||
sys.exit(-1)
|
||||
|
||||
with open(sys.argv[1], 'r') as f:
|
||||
# Read from provided file
|
||||
msg = f.read()
|
||||
|
||||
# Compress it
|
||||
msg_gzip = zlib.compress(msg.encode('utf-8'))
|
||||
|
||||
http = urllib3.PoolManager()
|
||||
|
||||
# Send that compressed data as a POST body
|
||||
r = http.request(
|
||||
'POST',
|
||||
'https://dev.eddn.edcd.io:4432/upload/',
|
||||
headers={
|
||||
'Content-Encoding': 'gzip'
|
||||
},
|
||||
body=msg_gzip
|
||||
)
|
||||
|
||||
print(f'Response: {r.status!r}')
|
||||
print(f'Body:\n{r.data.decode()}\n')
|
||||
|
@ -1,29 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import json
|
||||
import sys
|
||||
import urllib3
|
||||
|
||||
if len(sys.argv) != 2:
|
||||
print('test-sender.py <filename>')
|
||||
sys.exit(-1)
|
||||
|
||||
with open(sys.argv[1], 'r') as f:
|
||||
# Read from provided file
|
||||
msg = f.read()
|
||||
|
||||
# Fake form-encode it
|
||||
msg = 'wibble=' + msg
|
||||
|
||||
http = urllib3.PoolManager()
|
||||
|
||||
# Send that data as a POST body
|
||||
r = http.request(
|
||||
'POST',
|
||||
'https://dev.eddn.edcd.io:4432/upload/',
|
||||
body=msg
|
||||
)
|
||||
|
||||
print(f'Response: {r.status!r}')
|
||||
print(f'Body:\n{r.data.decode()}\n')
|
||||
|
@ -1,29 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import json
|
||||
import sys
|
||||
import urllib3
|
||||
|
||||
if len(sys.argv) != 2:
|
||||
print('test-sender.py <filename>')
|
||||
sys.exit(-1)
|
||||
|
||||
with open(sys.argv[1], 'r') as f:
|
||||
# Read from provided file
|
||||
msg = f.read()
|
||||
|
||||
# Fake form-encode it
|
||||
msg = 'data=' + msg
|
||||
|
||||
http = urllib3.PoolManager()
|
||||
|
||||
# Send that data as a POST body
|
||||
r = http.request(
|
||||
'POST',
|
||||
'https://dev.eddn.edcd.io:4432/upload/',
|
||||
body=msg
|
||||
)
|
||||
|
||||
print(f'Response: {r.status!r}')
|
||||
print(f'Body:\n{r.data.decode()}\n')
|
||||
|
@ -1,20 +1,86 @@
|
||||
#!/usr/bin/env python3
|
||||
# vim: tabstop=4 shiftwidth=4 expandtab smarttab textwidth=0 wrapmargin=0
|
||||
|
||||
import json
|
||||
import argparse
|
||||
import requests
|
||||
import sys
|
||||
import zlib
|
||||
|
||||
if len(sys.argv) != 2:
|
||||
print('test-sender.py <filename>')
|
||||
sys.exit(-1)
|
||||
upload_url = 'https://dev.eddn.edcd.io:4432/upload/'
|
||||
|
||||
with open(sys.argv[1], 'r') as f:
|
||||
msg = f.read()
|
||||
def send_message(url, args):
|
||||
print(f'''
|
||||
send_message:
|
||||
URL: {url}
|
||||
input file: "{args.messagefile}"
|
||||
''')
|
||||
|
||||
s = requests.Session()
|
||||
with open(args.messagefile, 'r') as f:
|
||||
msg = f.read()
|
||||
|
||||
r = s.post('https://dev.eddn.edcd.io:4432/upload/', data=msg)
|
||||
if args.formdata:
|
||||
if args.formdata == 'good':
|
||||
msg = 'data=' + msg
|
||||
|
||||
print(f'Response: {r!r}')
|
||||
print(f'Body: {r.content.decode()}')
|
||||
elif args.formdata == 'bad':
|
||||
msg = 'BADLYENCODED=' + msg
|
||||
|
||||
s = requests.Session()
|
||||
|
||||
if args.gzip:
|
||||
# We assume that the argparse setup is enforcing the value being
|
||||
# valid, i.e. `'good'` if it's not `'bad'`.
|
||||
msg = zlib.compress(msg.encode('utf-8'))
|
||||
s.headers['Content-Encoding'] = 'gzip'
|
||||
|
||||
if args.gzip == 'bad':
|
||||
# Prepend a character so it's not a valid gzip header
|
||||
msg = b'w' + msg
|
||||
|
||||
r = s.post(upload_url, data=msg)
|
||||
|
||||
print(f'Response: {r!r}')
|
||||
print(f'Body: {r.content.decode()}')
|
||||
|
||||
if __name__ == "__main__":
|
||||
__parser = argparse.ArgumentParser(
|
||||
description='Send test messages to an EDDN /upload/ endpoint',
|
||||
)
|
||||
|
||||
__parser.add_argument(
|
||||
'--url',
|
||||
metavar='<full URL of /upload/ endpoint>',
|
||||
help='The full URL of an EDDN /upload/ endpoint',
|
||||
)
|
||||
|
||||
__parser.add_argument(
|
||||
'--formdata',
|
||||
choices=('good', 'bad'),
|
||||
help='Specify to form-encode the request body',
|
||||
)
|
||||
|
||||
__parser.add_argument(
|
||||
'--gzip',
|
||||
choices=('good', 'bad'),
|
||||
help='Specify to gzip-compress the request body',
|
||||
)
|
||||
|
||||
__parser.add_argument(
|
||||
'messagefile',
|
||||
metavar='<input file name>',
|
||||
help='Name of a file containing the body of the EDDN message to be sent',
|
||||
)
|
||||
|
||||
args = __parser.parse_args()
|
||||
|
||||
if args.url:
|
||||
# Allow for some short aliases, but NOT!!! for live !!!
|
||||
if args.url == 'beta':
|
||||
upload_url = 'https://beta.eddn.edcd.io:4431/upload/'
|
||||
|
||||
elif args.url == 'dev':
|
||||
upload_url = 'https://dev.eddn.edcd.io:4432/upload/'
|
||||
|
||||
else:
|
||||
upload_url = args.url
|
||||
|
||||
send_message(upload_url, args)
|
||||
|
Loading…
x
Reference in New Issue
Block a user