Commit 2d8c393f by Csók Tamás

bugfixes, +added custom url handler (Debian based systems)

parent 1dde927f
[Desktop Entry]
Version=0.1
Encoding=UTF-8
Version=0.2
Type=Application
Name=Cloud GUI
Comment=Tool to use IK Cloud
Exec=cloud2
Exec=cloud2 %u
Icon=/usr/share/icons/cloud.svg
Terminal=true
Type=Application
MimeType=x-scheme-handler/rdp;x-scheme-handler/nx;x-scheme-handler/ssh;
Categories=Utility;Application;
......@@ -30,6 +30,7 @@ class Struct:
def pars_arguments():
parser = argparse.ArgumentParser();
parser.add_argument("uri", type=str, help="Specific schema handler", nargs='?', default=None)
parser.add_argument("-u", "--username", type=str)
parser.add_argument("-p", "--password", type=str)
parser.add_argument("-d", "--driver", help="Select webdriver. Aside from Firefox, you have to install first the proper driver.", \
......@@ -106,16 +107,16 @@ class Browser:
vm = Struct()
driver = self.driver
driver.maximize_window()
driver.get("https://demo.cloud.bme.hu/")
driver.find_element_by_css_selector("a[href*='/login/']").click()
self.login()
driver.get("https://pc3.szgt.uni-miskolc.hu/")
#driver.find_element_by_css_selector("a[href*='/login/']").click()
#self.login()
vm.state, vm.protocol = "", "NONE"
try:
while vm.state.upper()[:3] not in ("FUT", "RUN"):
element = WebDriverWait(driver,7200).until(EC.presence_of_element_located((By.CSS_SELECTOR, "#vm-details-pw-eye.icon-eye-close")))
vm.state = driver.find_element_by_css_selector("#vm-details-state > span").text
#cl: connection string converted to list
cl = driver.find_element_by_css_selector("#vm-info-pane > input").get_attribute("value").split()
cl = driver.find_element_by_css_selector("#vm-details-connection-string").get_attribute("value").split()
if cl[0] == "sshpass":
vm.protocol = "SSH"
vm.user, vm.host = cl[6].split("@")
......@@ -140,6 +141,12 @@ class Browser:
def main():
args = pars_arguments()
if args.uri is not None:
vm = Struct()
vm.protocol, vm.user, vm.password, vm.host, vm.port = args.uri.split(':',4)
vm.protocol = vm.protocol.upper()
vm.state = "RUN"
else:
browser = Browser(args)
if args.old:
vm = browser.old_main()
......@@ -155,4 +162,3 @@ def main():
if __name__ == "__main__":
main()
#!/bin/bash
sudo apt-get install sshpass python-pip remmina-plugin-nx remmina-plugin-rdp
sudo apt-get install sshpass python-pip remmina-plugin-nx remmina-plugin-rdp xdg-user-dirs
sudo pip install selenium
if [ "$(uname -m)" == 'x86_64' ]; then
......@@ -8,6 +8,7 @@ if [ "$(uname -m)" == 'x86_64' ]; then
else
sudo cp remminapasswd32 /usr/local/bin/remminapasswd
fi
sudo chmod +x /usr/local/bin/remminapasswd
sudo cp cloud2 /usr/local/bin/
sudo chmod +x /usr/local/bin/cloud2
sudo cp cloud.py /usr/local/bin/
......@@ -15,7 +16,10 @@ sudo chmod +x /usr/local/bin/cloud.py
sudo cp cloud_connect_from_linux.py /usr/local/bin/
sudo chmod +x /usr/local/bin/cloud_connect_from_linux.py
sudo cp cloud.svg /usr/share/icons/
sudo cp cloud.desktop /usr/share/applications
sudo chmod +x /usr/share/applications/cloud.desktop
sudo update-desktop-database
cp cloud.desktop $(xdg-user-dir DESKTOP)
sudo chmod +x $(xdg-user-dir DESKTOP)/cloud.desktop
chmod +x $(xdg-user-dir DESKTOP)/cloud.desktop
remmina
\ No newline at end of file
......@@ -30,6 +30,7 @@ class Struct:
def pars_arguments():
parser = argparse.ArgumentParser();
parser.add_argument("uri", type=str, help="Specific schema handler", nargs='?', default=None)
parser.add_argument("-u", "--username", type=str)
parser.add_argument("-p", "--password", type=str)
parser.add_argument("-d", "--driver", help="Select webdriver. Aside from Firefox, you have to install first the proper driver.", \
......@@ -106,16 +107,16 @@ class Browser:
vm = Struct()
driver = self.driver
driver.maximize_window()
driver.get("https://demo.cloud.bme.hu/")
driver.find_element_by_css_selector("a[href*='/login/']").click()
self.login()
driver.get("https://pc3.szgt.uni-miskolc.hu/")
#driver.find_element_by_css_selector("a[href*='/login/']").click()
#self.login()
vm.state, vm.protocol = "", "NONE"
try:
while vm.state.upper()[:3] not in ("FUT", "RUN"):
element = WebDriverWait(driver,7200).until(EC.presence_of_element_located((By.CSS_SELECTOR, "#vm-details-pw-eye.icon-eye-close")))
vm.state = driver.find_element_by_css_selector("#vm-details-state > span").text
#cl: connection string converted to list
cl = driver.find_element_by_css_selector("#vm-info-pane > input").get_attribute("value").split()
cl = driver.find_element_by_css_selector("#vm-details-connection-string").get_attribute("value").split()
if cl[0] == "sshpass":
vm.protocol = "SSH"
vm.user, vm.host = cl[6].split("@")
......@@ -140,6 +141,12 @@ class Browser:
def main():
args = pars_arguments()
if args.uri is not None:
vm = Struct()
vm.protocol, vm.user, vm.password, vm.host, vm.port = args.uri.split(':',4)
vm.protocol = vm.protocol.upper()
vm.state = "RUN"
else:
browser = Browser(args)
if args.old:
vm = browser.old_main()
......@@ -155,4 +162,3 @@ def main():
if __name__ == "__main__":
main()
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 sign in to comment