


Server = SSHTunnelForwarder((ip, puerto), ssh_username=usuario, ssh_private_key=ssh_path, remote_bind_address=('127.0.0.1', 631)) Sudo('sed -i."old" "/Require user /etc/cups/nf sed -i."old2" "/AuthType Default/d" /etc/cups/nf /etc/init.d/cups reload') With settings(host_string=ip, port=puerto, password=password, user=usuario): #Borra en el archivo nf la autentificacion Sys.exit(app.Def on_Btn_cups_clicked(self, widget, ip, usuario, password, puerto, notebook, spinner, estado): (result) # Return the result of the processing ((exctype, value, traceback.format_exc())) # Retrieve args/kwargs here and fire processing using them

Initialise the runner function with passed args, kwargs. # Store constructor arguments (re-used for processing)
PYTHON 3 CREATE SSH TUNNEL TO SOCKET CODE
Return FalseThreading framework: the part of the code below was taken with some cosmetic modification from Self.engine = ORM.create_engine(nn_string)ĭef connection_check(self, callback_progress, callback_data): nn_string = self.driver, ername, self.password, self.host, self.port, self.database) Return "unknown"Database connection framework: Ssh_transport = _transport()įorwardServer(("", int(self.local_port_forward)), SubHandler).serve_forever() Self.pkey_rsa = _private_key_file(ĭef tunnel_create(self, callback_progress, callback_data):Ĭhain_port = int(self.remote_port_forward) Print("An exception of type ".format(self.key_username, "_rsa")) Self.SSHConnection = Worker(self.ssh_forwarder.tunnel_create) (QtGui.QFont("Microsoft Sans Serif", 11)) Self.btnWindowClose = QtWidgets.QPushButton(self)

(QtGui.QFont("Microsoft Sans Serif", 10)) Self.btnLogin = QtWidgets.QPushButton(self) (QtGui.QFont("Microsoft Sans Serif", 10, weight = )) Self.lblConnection = QtWidgets.QLabel(self) Self.ledUserPass = QtWidgets.QLineEdit(self) Self.lblUserPass = QtWidgets.QLabel(self) Self.ledUserName = QtWidgets.QLineEdit(self) Self.lblUserName = QtWidgets.QLabel(self) Self.WorkerPool = QtCore.QThreadPool(self) # Initialize imported variables and objects When I run just the ssh connection and port forwarding part I can easily work with database browser just like when using putty with port forwarding option. I have checked that with database browser (a separate application). App works when it only connects to remote host and sets up the port forwarding.
PYTHON 3 CREATE SSH TUNNEL TO SOCKET PASSWORD
provides framework for database connectionįirst part defines simple window to provide username and password to load rsa key and then connect to remote host via ssh and finally to establish port forwarding. defines the GUI (in QT5) and assigns actions to slotsĢ. I am trying to incorporate into the application the modules that connect via SSH with remote host, establish port forwarding (forward the remote port on which SQL Server is listening) and then establish connection to SQL Server instance.īelow are the extracted parts of the code which:ġ. To begin with I have to say I was not sure where to put the question but it seems to be after all problem with QT Threading.
