Skip to content

Commit

Permalink
19.3 (#71)
Browse files Browse the repository at this point in the history
* Fix to prevent setup.py from import theonionbox; addressing PEP#517.

* Housekeeping: Removed some artefacts.

* Dashboard: Session 'prepared' after successful login was not accepted as valid. Fixed.

* Dashboard: Truncate __HashedControlSessionPassword (alike HashedControlPassword). No need to show this in full length.

* 19.3
  • Loading branch information
ralphwetzel authored Dec 29, 2019
1 parent 5b1baf0 commit aab150c
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 15 deletions.
24 changes: 18 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,22 @@
import setuptools.command.build_ext
import setuptools.command.sdist
import setuptools.command.install
import theonionbox.stamp as stamp

from distutils.extension import Extension

# This code replaces ...
# import theonionbox.stamp as stamp
# used here up to TOB 19.2
# but failing meanwhile with pip > 18 due to PEP#517 trouble
# ref: https://github.com/pypa/pip/issues/6163
# ref: https://packaging.python.org/guides/single-sourcing-package-version/:

stamp = {}
with open("theonionbox/stamp.py") as fp:
exec(fp.read(), stamp)

# later on we use: stamp['__version__']

# Custom command to compile the latest README.html
# BTW: grip is quite cool!
def CompileREADME():
Expand Down Expand Up @@ -72,7 +84,7 @@ def file_as_blockiter(afile, blocksize=65536):

if (old_md_hash != current_md_hash) or (old_html_hash != current_html_hash):
from grip import export
export(path='README.md', out_filename='readme/README.html', title=f'{stamp.__title__} v{stamp.__version__}')
export(path='README.md', out_filename='readme/README.html', title=f"{stamp['__title__']} v{stamp['__version__']}")
hash_changed = True
else:
print('Skiping generation of README.html; files unchanged!')
Expand Down Expand Up @@ -302,11 +314,11 @@ def generate_data_files(data_files):

package_data_exclude = {
'theonionbox': ['sections/controlcenter/*',
'sections/cc/*',
]
}

data_files = [
# ('', ['pyproject.toml']),
('docs', ['docs/*.*']),
('', ['readme/README.html']),
('config', ['theonionbox/config/*.*']),
Expand Down Expand Up @@ -368,7 +380,7 @@ def generate_data_files(data_files):
cmdclass={'sdist': sdist,
},
name='theonionbox',
version=stamp.__version__,
version=stamp['__version__'],
# py_modules=['theonionbox.py'],
packages=packages,
package_dir=package_dir,
Expand All @@ -381,7 +393,7 @@ def generate_data_files(data_files):
license='MIT',
author='Ralph Wetzel',
author_email='[email protected]',
description=f'{stamp.__title__}: {stamp.__description__}',
description=f"{stamp['__title__']}: {stamp['__description__']}",
long_description=open('docs/description.rst', 'rb').read().decode('utf-8'),
entry_points={
'console_scripts': [
Expand All @@ -394,7 +406,7 @@ def generate_data_files(data_files):
'requests>=2.21',
'PySocks>=1.6.7',
'bottle>=0.12.16',
'stem>=1.7.0',
'stem4tob>=1.7.1.post3',
'tzlocal>=1.5',
# 'futures>=3.2; python_version<"3.0"',
'urllib3>=1.22',
Expand Down
2 changes: 1 addition & 1 deletion theonionbox/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def main():

if __name__ == '__main__':

args = sys.argv[1:]
# args = sys.argv[1:]
main()


8 changes: 4 additions & 4 deletions theonionbox/sections/config/config.html
Original file line number Diff line number Diff line change
Expand Up @@ -86,20 +86,20 @@
if len(out):
out += ' '
end
if hcp == 1 and cmd[:3] == '16:':
if (hcp % 2 > 0) and cmd[:3] == '16:':
cmd = cmd[:12] + '...' # no need to transmit this completely!
hcp += 1
end
if cmd == "HashedControlPassword":
hcp = 1
if "HashedControlPassword" in cmd or "HashedControlSessionPassword" in cmd:
hcp += 1
end
out += cmd
end
%>
{{out}}
% if hcp > 1:
<div style="font-size: 70%; color: lightgray; display: block;">
The HashedControlPassword was truncated for safety reasons.
The HashedControl(Session)Password was truncated for safety reasons.
</div>
% end
</div>
Expand Down
4 changes: 2 additions & 2 deletions theonionbox/stamp.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__title__ = 'The Onion Box'
__description__ = 'Dashboard to monitor Tor node operations.'
__version__ = '19.2'
__stamp__ = '20191202|224123'
__version__ = '19.3'
__stamp__ = '20191229|232641'
4 changes: 2 additions & 2 deletions theonionbox/theonionbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,8 @@ def proxy(ctx, control, host, port, socket, proxy):
}}


if __name__ == '__main__':
# if __name__ == '__main__':
# main(box_debug)
main()
# main()

# __all__ = ['main']
2 changes: 2 additions & 0 deletions theonionbox/tob/apps/dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ def __init__(self
callback=self.get_logout,
**config)

config['valid_status'] = ['ok', 'auto', 'prepared']

self.app.route('/<session>/index.html',
method='GET',
callback=self.get_index,
Expand Down

0 comments on commit aab150c

Please sign in to comment.