Esempio n. 1
0
def handle(req):
    req.content_type = req.headers_out['Content-Type'] = 'text/html'
    cfg = config.Config('/data/pypi/config.ini')
    request = RequestWrapper(cfg, req)
    pseudoenv = {}
    pseudoenv['CONTENT_TYPE'] = req.headers_in.get('content-type', '')
    pseudoenv['REMOTE_ADDR'] = req.get_remote_host(apache.REMOTE_NOLOOKUP)
    pseudoenv['HTTP_USER_AGENT'] = req.headers_in.get('user-agent', '')
    pseudoenv['QUERY_STRING'] = req.args
    pseudoenv['HTTP_CGI_AUTHORIZATION'] = req.headers_in.get('authorization',
        '')
    pseudoenv['REQUEST_METHOD'] = req.method
    path_info = req.path_info
    pseudoenv['PATH_INFO'] = path_info
    try:
        handler = WebUI(request, pseudoenv)
        handler.run()
    except:
        s = StringIO.StringIO()
        traceback.print_exc(None, s)
        req.write("<pre>")
        req.write(cgi.escape(s.getvalue()))
        req.write("</pre>")
        req.headers_out['Content-Type'] = 'text/html'
    req.content_type = req.headers_out['Content-Type']
    return apache.OK
Esempio n. 2
0
class CLOUD(object):
    # TODO:
    # - based on reply from qa team, the access url should be full qualified
    # name or ip address base on auth conf. since the web server might not be
    # resolved in testing environment or against certain conf which may cause
    # problem when verifying traffic pass-through successfully or not. pre_url
    # is temporary solution which is used to trigger the auth process. for
    # example, pre_url in full qualified name to trigger auth process while
    # url in ip address to verify traffic.
    def __init__(self, url, title, pre_url=None):
        self.url = url
        self.title = title
        self.pre_url = pre_url if pre_url else url

        self.w = WebUI()
        self.mode = None
        self.popup = None

    def check_cloud_on(self, locator, displayed):
        for i in range(4):
            try:
                self.w.wait_until_element_displayed(displayed)
                break
            except Exception, e:
                self.w.warn('Fail to find element %s, before check %s, will try again' \
                          %(str(displayed), str(locator)), True)
        if i == 3:
            raise WebUIException('Fail to find element %s, before check %s' \
                %(str(displayed), str(locator)))

        check_element = self.w.find_element(locator)
        if not check_element.is_selected():
            check_element.click()
Esempio n. 3
0
def new_policy():
    wui=WebUI()
    hm=HM()
    if wui.session_id is None:
        hm.login(wui.d("login.server"),
                 wui.d("login.username"),
                 wui.d("login.password"))
    hm.new_policy(wui.d("policy.name"))
def policy_config():
    wui=WebUI()
    hm=HM()
    if wui.session_id is None:
        hm.login_by_vhm(wui.d("login.server"),
                        wui.d("login.username"),
                        wui.d("login.password"))
    hm.config_ssid_express(wui.d("policy.name"))
Esempio n. 5
0
def update():
    wui=WebUI()
    hm=HM()
    if wui.session_id is None:
        hm.login(wui.d("login.server"),
                 wui.d("login.username"),
                 wui.d("login.password"))
    hm.update_hm_service(wui.d("service.name"))
Esempio n. 6
0
def main():
    wui = WebUI()
    hm = HM()
    if wui.session_id is None:
        hm.login(wui.d("login.server"),
                 wui.d("login.username"),
                 wui.d("login.password"))
    hm.test()             
Esempio n. 7
0
def upload_and_activate_configuration():
    wui = WebUI()
    hm = HM()
    hm.login(wui.d("login.server"),
    		 wui.d("login.username"),
             wui.d("login.password"))
    hm.to_hiveaps_table()
    hm.upload_and_activate_configuration(wui.d("ap.mgt0_ip"))
def update():
    wui=WebUI()
    hm=HM()
    if wui.session_id is None:
        hm.login(wui.d("login.server"),
                 wui.d("login.username"),
                 wui.d("login.password"))
    hm.to_hiveaps_table()
    hm.update_country_code(wui.d("ap.mgt0_ip"))
Esempio n. 9
0
def modify():
    wui=WebUI()
    hm=HM()
    if wui.session_id is None:
        hm.login(wui.d("login.server"),
                 wui.d("login.username"),
                 wui.d("login.password"))
    hm.to_hiveaps_table()                 
    hm.modify(wui.d("modify.mgt0_ip"), wui.d("modify.name"))
def update():
    wui = WebUI()
    hm = HM()
    if wui.session_id is None:
        hm.login(wui.d("login.server"),
                 wui.d("login.username"),
                 wui.d("login.password"))
    hm.to_hiveaps_table()
    hm.update_bootstrap(wui.d("ap.mgt0_ip"))
    hm.check_update_result(wui.d("ap.mgt0_ip"))
def policy_config():
    wui=WebUI()
    hm=HM()
    configer = Configuration()
    if wui.session_id is None:
        hm.login(wui.d("login.server"),
                 wui.d("login.username"),
                 wui.d("login.password"))
    for config_object in wui.d("policy.name").split(): 
    	configer.create_config(config_object)
def create_device_sn():
    wui = WebUI()
    d = Devices(wui.d("visit.url"), wui.d("visit.title"))
    if wui.session_id:
        d.to_url_home()
        d.to_menu(wui.d('devices.menu_name'))
        d.wait_until_to_menu_success(wui.d("devices.menu_name"))
        if d.check_sn_exist(wui.d('devices.sn_number')):
            wui.info('this is serial number is exist, do remove it.', True)
            d.remove_devices_by_serial_numbers(wui.d('devices.sn_number'))
        d.add_devices_by_serial_numbers(wui.d('devices.sn_number'))
    else:
        d.logout()
Esempio n. 13
0
def login_hm():
    wui = WebUI()
    
    import platform
    if platform.system() == 'Windows':
        server = 'https://10.155.40.100/'
    else:
        server = wui.d('hm_server')
    admin = wui.d('user_admin.name')
    admin_pwd = wui.d('user_admin.passwd')
    
    hm = HM()
    hm.login(server, admin, admin_pwd)
Esempio n. 14
0
def create_network_policy():
    wui = WebUI()
    cloud = CLOUD(wui.d("visit.url"), wui.d("visit.title"))

    if wui.session_id:
        cloud.to_url_home()
        cloud.to_menu(wui.d("policy.menu_name"))
        cloud.wait_until_to_menu_success(wui.d("policy.menu_name"))
        cloud.to_page_before_policy()
        cloud.create_network_policy(wui.d("policy.name"), wui.d("policy.Description"))
        cloud.wait_until_create_policy_result(wui.d("policy.success_msg"), check_success=wui.d("policy.check_success"))

        # cloud.to_page_before_deployed_ssid()
        # cloud.create_SSID(wui.d("ssid.name"), wui.d("ssid.name"))
        # cloud.wait_until_create_ssid_result(wui.d("ssid.success_msg"), check_success=wui.d("ssid.check_success"))
        #
        # cloud.to_page_device_templates()
        # cloud.to_page_additional_settings()
        #
        # cloud.to_page_deploy_policy()
        # cloud.wait_until_to_deploy_policy_page(wui.d("deploy_policy.menu_title"))
        # cloud.select_checkbox_deploy_policy(wui.d("deploy_policy.check_mac"), wui.d("deploy_policy.dut_number"))
        # cloud.wait_until_to_deploy_policy_success(wui.d("deploy_policy.success_msg"), check_success=wui.d("deploy_policy.check_success"))


        # cloud.wait_until_login_success(popup=wui.d("login.popup_timer"), success_page=wui.d("login.success_page"))
        # if wui.d("login.success_page") == 'false':
        #     return
        # else:
        #     cloud.to_url_after_login(redirect=wui.d("visit.auto_redirect"))
    else:
        cloud.policy_mode()
        cloud.logout()
def cwp_register_negative():
    wui = WebUI()
    cwp = CWP(wui.d("visit.url"), wui.d("visit.title"), wui.d("visit.pre_url"))
    cwp.to_url_before_login()
    cwp.register(wui.d("register.first_name"),
                 wui.d("register.last_name"),
                 wui.d("register.email"),
                 wui.d("register.phone"),
                 wui.d("register.visiting"),
                 wui.d("register.reason"))
    cwp.wait_until_login_fail()
def cwp_login_negative_amigopod():
    wui = WebUI()
    cwp = CWP(wui.d("visit.url"), wui.d("visit.title"), wui.d("visit.pre_url"))
    if wui.session_id is None:    
        cwp.to_url_before_login(location='CWP_custom_loginpage_amigopod')
        cwp.login_amigopod(wui.d("login.username"),
                           wui.d("login.password"))
        cwp.wait_until_login_fail(failed_page=wui.d("login.failed_page"), redirect_page_name=wui.d("redirect.page_name"))
    elif wui.session_id and wui.d("visit.login_page_exist") == "true":
        cwp.login_amigopod(wui.d("login.username"),
                           wui.d("login.password"))
        cwp.wait_until_login_fail(failed_page=wui.d("login.failed_page"), redirect_page_name=wui.d("redirect.page_name"))
def cwp_register_negative():
    wui = WebUI()
    cwp = CWP(wui.d("visit.url"), wui.d("visit.title"), wui.d("visit.pre_url"))
    cwp.to_url_before_login()
    cwp.register123(wui.d("register.first_name"),
                    wui.d("register.last_name"),
                    wui.d("register.email"),
                    wui.d("register.visiting"))
    cwp.wait_until_login_fail(redirect_page_name='registration123')
Esempio n. 18
0
    def __init__(self, url, title, pre_url=None):
        self.url = url
        self.title = title
        self.pre_url = pre_url if pre_url else url

        self.w = WebUI()
        self.mode = None
        self.popup = None
Esempio n. 19
0
def main():
    wui = WebUI()
    hm = HM()
    if wui.session_id is None:
        hm.login(wui.d("login.server"),
                 wui.d("login.username"),
                 wui.d("login.password"))
    hm.to_hiveaps_table(type='rogue')
    wui.unregister_cleanup(hm.logout)    
    hm.mitigation(wui.d("ap.ssid"), wui.d("ap.mac"), wui.d("ap.reporting_hostname"))             
def new_network_policy():
    wui = WebUI()
    cloud = CLOUD(wui.d("visit.url"), wui.d("visit.title"))
    if wui.session_id:
        cloud.to_url_home()
        cloud.unit_click_configure()
        cloud.unit_new_netpolicy()
        cloud.unit_config_netpolicy(wui.d("policy.name"))
        cloud.unit_new_ssid()
        cloud.unit_config_basicssid(wui.d("ssid.name"), wui.d("ssid.security"), wui.d("ssid.key"))
        #cloud.unit_select_all_ssid()
        cloud.unit_select_ssid(wui.d("ssid.name"))
        cloud.unit_click_devicetemplate()
        cloud.unit_click_additional()
        cloud.unit_uploadconfig(wui.d("device.mac"))
Esempio n. 21
0
def webop():
    wui = WebUI()
    cwp = CWP(wui.d("visit.url"), wui.d("visit.title"))
    cwp.to_url_before_login()
    cwp.register(wui.d("register.first_name"),
                 wui.d("register.last_name"),
                 wui.d("register.email"),
                 wui.d("register.phone"),
                 wui.d("register.visiting"),
                 wui.d("register.reason"))
    cwp.to_url_after_login()
    cwp.logout()
def cwp_register_positive():
    wui = WebUI()
    cwp = CWP(wui.d("visit.url"), wui.d("visit.title"), wui.d("visit.pre_url"))
    if wui.session_id is None:
        cwp.to_url_before_login()
        cwp.register(wui.d("register.first_name"),
                     wui.d("register.last_name"),
                     wui.d("register.email"),
                     wui.d("register.phone"),
                     wui.d("register.visiting"),
                     wui.d("register.reason"))
        cwp.wait_until_login_success()
        cwp.to_url_after_login()
    else:
        cwp.register_mode()
        cwp.logout()
def upload():
    wui = WebUI()
    hm = HM()
    if wui.session_id is None:
        hm.login(wui.d("login.server"),
                 wui.d("login.username"),
                 wui.d("login.password"))
    hm.config_update_device_new(wui.d("upload.policy"), wui.d("ap.mgt0_ip"), type=wui.d("upload.type"))
    hm.check_update_result(wui.d("ap.mgt0_ip"), result_page='config')
def cwp_login_positive_npd():
    wui = WebUI()
    cwp = CWP(wui.d("visit.url"), wui.d("visit.title"), wui.d("visit.pre_url"))
    if wui.session_id is None:
        cwp.to_url_before_login(location='npd_login')
        cwp.login_npd(wui.d("login.username"),
                      wui.d("login.password"))
        cwp.wait_until_login_success(popup=wui.d("login.popup_timer"))
        cwp.to_url_after_login()
    elif wui.session_id and wui.d("visit.login_page_exist") == "true":
        cwp.login_npd(wui.d("login.username"),
                      wui.d("login.password"))
        cwp.wait_until_login_success(popup=wui.d("login.popup_timer"))
        cwp.to_url_after_login()   
    else:
        cwp.login_mode()
        cwp.logout()
def create_network_policy():
    wui = WebUI()
    config = Configuration(wui.d("visit.url"), wui.d("visit.title"))

    if wui.session_id:
        config.to_url_home()
        config.to_menu(wui.d("policy.menu_name"))
        config.wait_until_to_menu_success(wui.d("policy.menu_name"))
        config.to_page_before_policy()
        config.create_network_policy(wui.d("policy.name"), wui.d("policy.Description"))
        config.wait_until_create_policy_result(wui.d("policy.success_msg"), check_success=wui.d("policy.check_success"))

    else:
        config.policy_mode()
        config.logout()
Esempio n. 26
0
def update():
    wui = WebUI()
    hm = HM()
    hm.login(wui.d("login.server"),
             wui.d("login.username"),
             wui.d("login.password"))
    if wui.d("update.function") == "upload_config":
        hm.to_hiveaps_table()
        hm.set_image_to_boot(wui.d("ap.mgt0_ip"))
        hm.upload_and_activate_configuration(wui.d("ap.mgt0_ip"), type='compare_running_ap_config')
        hm.upload_and_activate_configuration(wui.d("ap.mgt0_ip"), type='complete')
        hm.get_tech_data(wui.d("ap.mgt0_ip"))
def cloud_login_positive():
    wui = WebUI()
    login = Login(wui.d("visit.url"), wui.d("visit.title"), wui.d("visit.pre_url"))
    if wui.session_id is None:
        login.to_url_before_login()
        login.login(wui.d("login.username"),
                  wui.d("login.password"))
        login.wait_until_login_success(wui.d("login.username"))

    else:
        login.login_mode()
        login.logout()
def upload():
    wui = WebUI()
    hm = HM()
    if wui.session_id is None:
        hm.login(wui.d("login.server"),
                 wui.d("login.username"),
                 wui.d("login.password"))
    hm.to_hiveaps_table()
    hm.upload_and_activate_configuration(wui.d("ap.mgt0_ip"), type=wui.d("upload.type"))
    hm.check_update_result(wui.d("ap.mgt0_ip"))
def create_device_sn():
    wui = WebUI()
    d = Devices(wui.d("visit.url"), wui.d("visit.title"))
    if wui.session_id:
        d.to_url_home()
        d.to_menu(wui.d('devices.menu_name'))
        d.wait_until_to_menu_success(wui.d("devices.menu_name"))
        d.remove_devices_by_serial_numbers(wui.d('devices.sn_number'))
    else:
        d.c.policy_mode()
        d.c.logout()
Esempio n. 30
0
def login_vhm():
    wui = WebUI()
    
    import platform
    if platform.system() == 'Windows':
        server = 'https://10.155.40.100/'
    else:
        server = wui.d('hm_server')
    vhm_admin = wui.d('vhm_account.admin_name')
    vhm_admin_pwd = wui.d('vhm_account.admin_passwd')

    hm = HM()
    hm.login_by_vhm(server, vhm_admin, vhm_admin_pwd, 
                    wui.d('vhm_welcome.hive_name'), 
                    wui.d('vhm_welcome.hive_mgt_passwd'), 
                    wui.d('vhm_welcome.quick_ssid_passwd'))
    
    hm.logout()
Esempio n. 31
0
from flask import Flask, render_template, request
from webui import WebUI
import requests, json, time
import MainLoop, FetchFromTwitch, FetchDataIngame, json

app = Flask(__name__)
ui = WebUI(app, debug=True)


@app.route('/')
def index():
    return render_template("index.html")


@app.route('/stop')
def stop():
    print("Stopping...")
    MainLoop.flag = False
    return ""


@app.route('/background_process')
def background_process():
    MainLoop.runMain()
    MainLoop.flag = True
    return ""


@app.route("/get_game/<name>")
def get_game(name):
    FetchFromTwitch.set_current_game(name)
Esempio n. 32
0
from flask import Flask
from flask import request
from webui import WebUI

app = Flask(__name__,
            static_url_path='/static',
            static_folder='',
            template_folder='')

ui = WebUI(app, debug=True, app_name="Salut")


@app.route('/post_form', methods=['POST'])
def return_form():
    info = request.data
    return f"Got {request.data}"


@app.route("/")
def home():
    return app.send_static_file('static/index.html'), 200


if __name__ == "__main__":
    ui.run()
Esempio n. 33
0
from flask import Flask
from webui import WebUI
import PyQt5.QtGui as gui
import sys, os

import config

icon_path = os.path.join(
    os.path.dirname(os.path.abspath(sys.modules['__main__'].__file__)),
    config.ICON_RELATIVE_PATH)

if getattr(sys, 'frozen', False):
    base_dir = os.path.join(sys._MEIPASS)
    app = Flask(__name__,
                static_folder=os.path.join(base_dir, 'static'),
                template_folder=os.path.join(base_dir, 'templates'))
else:
    app = Flask(__name__)

ui = WebUI(app, icon_path=icon_path, app_name=config.WINDOW_TITLE)
app.config.from_object('config')

from . import views