def __init__(self, parent): super(BucketForm, self).__init__(parent) self.settings = sm.settingsManager() self.parent = parent self.setMinimumWidth(400) self.setWindowTitle("Bucket Connector") self.api_access = self.settings.getParam('aws_access_key_id') self.api_secret = self.settings.getParam('aws_secret_access_key') self.region = self.settings.getParam('region') self.user = self.settings.getParam("user") self.mainLayout = QVBoxLayout() self.session = self.settings.getSession() s3 = self.session.resource("s3") self.buckets = {x.name: x for x in list(s3.buckets.all())} self.combo_bucket = QComboBox() self.combo_bucket.addItems(list(self.buckets.keys())) self.connect = QPushButton("Connect") self.connect.clicked.connect(self.fm_connect) self.mainLayout.addWidget(self.combo_bucket) self.mainLayout.addWidget(self.connect) self.setLayout(self.mainLayout)
def __init__(self, parent): super(appsForm, self).__init__(parent) self.settings = sm.settingsManager() self.parent = parent self.setMinimumWidth(400) self.setWindowTitle("Apps") self.mainLayout = QVBoxLayout() avivable_apps = [ "git", "r.studio", "r.project", "dbeaver", "pycharm-community", "vscode", "bitvize-ssh-client", "x2go", "sourcetree", "obs-studio", "7zip", "python", "winscp", "awscli", "googlechrome", "miktex", "texstudio", "notepadplusplus" ] self.apps = [QCheckBox(a) for a in avivable_apps] self.install = QPushButton("Install Selected Apps") self.install.clicked.connect(self.fn_install) for a in self.apps: self.mainLayout.addWidget(a) self.mainLayout.addWidget(self.install) self.setLayout(self.mainLayout)
def __init__(self,parent): super(IdsForm,self).__init__(parent) self.settings = sm.settingsManager() self.parent = parent self.setMinimumWidth(400) self.setWindowTitle("AWS API Manager") self.api_access = QLineEdit(self.settings.getParam('aws_access_key_id')) self.api_secret = QLineEdit(self.settings.getParam('aws_secret_access_key')) self.api_secret.setEchoMode(QLineEdit.Password) region = self.settings.getParam('region') self.region = QLineEdit("us-east-2" if region == "" else region) self.pem = QPushButton("Select PEM Key File") self.pem.clicked.connect(self.fn_pem) self.mainLayout = QVBoxLayout() self.keys = QGridLayout() self.keys.addWidget(QLabel("Api Access"),0,0) self.keys.addWidget(self.api_access, 0, 1) self.keys.addWidget(QLabel("Api Secret"),1,0) self.keys.addWidget(self.api_secret, 1, 1) self.keys.addWidget(QLabel("Region"),2,0) self.keys.addWidget(self.region, 2, 1) self.save = QPushButton("Save") self.save.clicked.connect(self.save_to_file) self.mainLayout.addLayout(self.keys) self.mainLayout.addWidget(self.pem) self.mainLayout.addWidget(self.save) self.setLayout(self.mainLayout)
def setNxXML(ip): settings = SettingsManager.settingsManager() user = settings.getParam("user") home = expanduser("~") with open(resource_path(os.path.join('files', 'sessions')), 'r') as nx: nxs = nx.readlines() nxs = [re.sub('@ip@', ip, x) for x in nxs] nxs = [re.sub('@user@', user, x) for x in nxs] #nxs = [re.sub('@export@', home, x) for x in nxs] nx_path = os.path.join(home, '.sessions') with open(nx_path, 'w+') as nx: nx.writelines(nxs) return nx_path
def __init__(self, parent): super(userForm, self).__init__(parent) self.settings = sm.settingsManager() self.parent = parent self.setMinimumWidth(400) self.setWindowTitle("User Setup") self.mainLayout = QVBoxLayout() self.user = QLineEdit() self.save = QPushButton("save") self.save.clicked.connect(self.fn_save) self.mainLayout.addWidget(self.user) self.mainLayout.addWidget(self.save) self.setLayout(self.mainLayout)
def __init__(self, parent): super(PwdForm, self).__init__(parent) self.settings = sm.settingsManager() self.parent = parent self.setMinimumWidth(400) self.setWindowTitle("Password Setup") self.mainLayout = QVBoxLayout() self.pwd = QLineEdit() self.pwd.setEchoMode(QLineEdit.Password) self.save = QPushButton("save") self.save.clicked.connect(self.fn_save) self.mainLayout.addWidget(self.pwd) self.mainLayout.addWidget(self.save) self.setLayout(self.mainLayout)
def run_script(script): settings = SettingsManager.settingsManager() instance = settings.getInstance() if instance.state["Name"] == "running": print("Conectando") key_string = StringIO(settings.getParam("pem")) key = paramiko.RSAKey.from_private_key(key_string) ip = instance.network_interfaces_attribute[0]["Association"][ "PublicDnsName"] ssh = paramiko.SSHClient() ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh.connect(ip, username="******", pkey=key) print("Ejecutando") ssh_stdin, ssh_stdout, ssh_stderr = ssh.exec_command(script) print(ssh_stdout.readlines()) print(ssh_stderr.readlines()) msgBox = QMessageBox() msgBox.setText("Executed Correctly") else: msgBox = QMessageBox() msgBox.setText("Lab offline, nox excecuted") msgBox.exec_()
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Nov 1 23:33:56 2018 @author: dfischer """ from PySide2.QtWidgets import * from modules.functions import * import os import re from modules import SettingsManager settings = SettingsManager.settingsManager() home = os.path.expanduser("~") class IdsForm(QDialog): def __init__(self, parent): super(IdsForm, self).__init__(parent) self.parent = parent self.setMinimumWidth(400) self.setWindowTitle("AWS API Manager") self.id = QLineEdit(settings.getParam('id')) self.key = QLineEdit(settings.getParam('key')) self.key.setEchoMode(QLineEdit.Password) region = settings.getParam('region') self.region = QLineEdit("us-east-1" if region == "" else region)
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Nov 1 23:33:56 2018 @author: dfischer """ from modules.functions import * from modules import SettingsManager as sm, functions as fn import os home = os.path.expanduser("~") settings = sm.settingsManager() class idEc2Form(QDialog): def __init__(self, parent): super(idEc2Form, self).__init__(parent) self.parent = parent self.setMinimumWidth(400) self.setWindowTitle("AWS API Manager") try: con = settings.getSession() ec2 = con.resource("ec2") instances = list(ec2.instances.all()) except: pass dict = {fn.tagsToDict(i.tags)["Name"]: i.id for i in instances}