Commit bc89dcc2 authored by Thomas Nadovich's avatar Thomas Nadovich 🌸
Browse files

started to build out smb download tools

parent 73498e42
......@@ -37,6 +37,7 @@ msgpack-python = ">=0.5.6"
py = ">=1.6.0"
pycryptodome = ">=3.6.6"
pyshark = ">=0.4.2.9"
pysmb = "*"
python-can = ">=2.2.1"
python-dateutil = ">=2.7.3"
python-gitlab = ">=2.5.0"
......
This diff is collapsed.
......@@ -16,6 +16,7 @@ from .elbow import *
from .p3 import *
from .can import *
from .other import *
from .smb import *
from .flashloader import flashloader
from .flashloader import flash as flashloader_flash
from .legacy import legacy
......@@ -186,6 +187,7 @@ def setup_cli():
cli.add_command(elbow)
cli.add_command(p3)
cli.add_command(jtag)
cli.add_command(setup_jlink)
if permissions >= PERMISSIONS_ENGINEER:
cli.add_command(sdo_upload)
......
import click
import getpass
import urllib
import smb
from smb.SMBHandler import SMBHandler
@click.command()
@click.pass_context
def setup_jlink(ctx):
user = input("Username:")
passwd = getpass.getpass("Password for " + user + ":")
try:
smb_download('scarif.local/web/temp/test.txt', user, passwd)
except(urllib.error.URLError, smb.base.NotReadyError):
click.echo('Error: Unable to authenticate with server')
def smb_download(url, username, password):
opener = urllib.request.build_opener(SMBHandler)
with opener.open('smb://{0}:{1}@{2}'.format(username, password, url)) as fh:
data = fh.read()
click.echo(data)
......@@ -121,6 +121,10 @@ p319 = "p3"
p335 = "p3"
p386 = "p3"
odg = "objdict-generate"
[smb]
url = "scarif.local"
""".format(__version__))
def config_get(config, *keys):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment