checking in ssh stuff (unfinished), and some updates to clientinfo

This commit is contained in:
brent s 2018-12-29 09:35:16 -05:00
parent 676a2be088
commit 86875ff09f
5 changed files with 99 additions and 3 deletions

View File

@ -27,7 +27,7 @@
</div>
{% block body %}{% endblock %}
<footer class="footer">
<p><sub>The code for this page is released under the <a href="https://www.gnu.org/licenses/gpl-3.0.en.html#content">GPL 3.0 License</a>. It can be found <a href="https://git.square-r00t.net/OpTools/tree/net">here</a>.</sub></p>
<p><sub>The code for this page is released under the <a href="https://www.gnu.org/licenses/gpl-3.0.en.html#content">GPL 3.0 License</a>. It can be found <a href="https://git.square-r00t.net/OpTools/tree/net/addr/">here</a>.</sub></p>
</footer>
</div>
<!-- /container -->

View File

@ -8,12 +8,17 @@ def index():
# First we define interactive browsers
_intbrowsers = {'camino': ['http://caminobrowser.org/', 'Camino'],
'chrome': ['https://www.google.com/chrome/', 'Google Chrome'],
'edge': ['https://www.microsoft.com/en-us/windows/microsoft-edge',
'Microsoft Edge'],
'firefox': ['https://www.mozilla.org/firefox/', 'Mozilla Firefox'],
'galeon': ['http://galeon.sourceforge.net/', 'Galeon'],
'kmeleon': ['http://kmeleonbrowser.org/', 'K-Meleon'],
'konqueror': ['https://konqueror.org/', 'Konqueror'],
'links': ['http://links.twibright.com/', 'Links'],
'lynx': ['http://lynx.browser.org/', 'Lynx']}
'msie': ['https://en.wikipedia.org/wiki/Internet_Explorer',
'Microsoft Internet Explorer'],
'lynx': ['http://lynx.browser.org/', 'Lynx'],
'safari': ['https://www.apple.com/safari/', 'Apple Safari']}
_os = {'aix': ['https://www.ibm.com/power/operating-systems/aix', 'AIX'],
'amiga': ['http://www.amiga.org/', 'Amiga'],
'android': ['https://www.android.com/', 'Android'],
@ -30,6 +35,7 @@ def index():
'wii': ['http://wii.com/', 'Wii'],
'windows': ['https://www.microsoft.com/windows/', 'Windows']}
_alts = {'amiga': ' (have you tried <a href="http://aros.sourceforge.net/">AROS</a> yet?)',
'android': ' (have you tried <a href="https://lineageos.org/">LineageOS</a> yet?)',
'macos': ' (have you tried <a href="https://elementary.io/">ElementaryOS</a> yet?)',
'sgi': ' (have you tried <a href="http://www.maxxinteractive.com">MaXX</a> yet?)',
'windows': ' (have you tried <a href="https://https://reactos.org/">ReactOS</a> yet?)'}
@ -92,4 +98,4 @@ def about():

@app.route('/usage', methods = ['GET'])
def usage():
return(render_template('usage.html'))
return(render_template('usage.html'))

View File

@ -0,0 +1,7 @@
#!/usr/bin/env python3

# Generate a struct for generating keys.

class constructor(object):
def __init__(self, keyblob, encrypted = False):
self.keyblob = keyblob

View File

@ -0,0 +1,59 @@
#!/usr/bin/env python3

# Parse existing keys

class constructor(object):
# These are various struct formats for the "new"-style OpenSSH private keys.
# REF1: https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/ssh/PROTOCOL.key?annotate=1.1
# REF2: https://github.com/openssh/openssh-portable/blob/94bc1e7ffba3cbdea8c7dcdab8376bf29283128f/sshkey.c
def __init__(self, ssh_keyblob):
# "keyblob" is the raw binary of an extracted (i.e. "---...---"-removed) and un-base64'd private key.
self.keyblob = ssh_keyblob
# 'encrypted' if it's encrypted, 'none' if plaintext. This is determined via processing.
self.enctype = 'none'
# This is the header. It is used by both encrypted and unencrypted keys.
self.header = ''.join((
'14cx', # "openssh-key-v1" and null byte (6f70656e7373682d6b65792d7631 00) ("magic bytes")
'i' # separator, always 00000004
))
# Only two cipher types that I know of that are used.
self.ciphertype = {
'none': '4c', # 6e6f6e65
'aes256-cbc': '10c'} # 6165733235362d636263 ("aes256-cbc")
# This separator is present in both.
self.sep1 = 'i'
# The name of the key encryption, if encrypted. These are the only two I know of that are used.
self.kdfname = {
'none': '4c', # 6e6f6e65 ("none")
'bcrypt': '6c'} # 626372797074 ("bcrypt")
########################################### ENCRYPTED KEYS ONLY ################################################
# KDF options
self.kdfopts = {
'none': '0i', # zero-length
'encrypted': '24i'} # 24-length int
# The length of the salt. Default is 16 (REF2:67)
self.saltlen = {
'none': '0i', # TODO: do unencrypted still have salts?
'encrypted': '4i'} # 16 bytes length?
# The key needs to be parsed incrementally to have these lengths adjusted.
self.salt = {
'none': '0c',
'encrypted': '4c'} # This value may change based on self.saltlen['encrypted']'s value.
# The number of rounds for the key; default is 16 (REF2:69).
self.rounds = {
'none': '0i', # TODO: do unencrypted still have rounds?
'encrypted': '16i'}
################################################################################################################
# Number of public keys.
self.numpub = 'i'
# That's all we can populate now. The rest is handled below via functions.
self._chkencrypt()

def _chkencrypt(self):
pass


class legacy_constructor(object):
# These are various struct formats for the "old"-style OpenSSH private keys.
def __init__(self, keyblob):
self.keyblob = keyblob

24
net/ssh/puttyconv.py Normal file
View File

@ -0,0 +1,24 @@
#!/usr/bin/env python3

## INCOMPLETE ##
# TODO

import argparse

def parseArgs():
args = argparse.ArgumentParser(description = 'Convert private and public SSH keys between PuTTY/OpenSSH format')
args.add_argument('-l', '--legacy',
dest = 'legacy_ssh',
action = 'store_true',
help = ('If specified, try to handle the OpenSSH key as the legacy format ("") rather than the '
'newer '
'more compact format ("")'))
ktype = args.add_mutually_exclusive_group()
ktype.add_argument('-s', '--ssh',
dest = 'ktype',
const = 'openssh',
help = ('Force the conversion to OpenSSH format'))
ktype.add_argument('-p', '--putty',
dest = 'ktype',
const = 'putty',
help = ('Force the conversion to PuTTY format'))