Example #1
0
def LoginDUT():
    os.system('taskkill /im IEXPLORE.EXE')
    sleep(1)
    ie = PAMIE( )
    sleep(0.1)
    ie.navigate(IP)
    sleep(0.5)
    ie.listBoxSelect('username',username)
    ie.textBoxSet('password',password)
    ie.buttonClick("OK")
    sleep(0.5)
Example #2
0
win32api.keybd_event(105,0,win32con.KEYEVENTF_KEYUP,0)
win32api.keybd_event(110,0,0,0)#n
win32api.keybd_event(110,0,win32con.KEYEVENTF_KEYUP,0)
sleep(10)

user4=wga.findControl(credential,wantedClass='Edit')
wga.setEditText(user4,password)
'''
#login
OKButton = wga.findControl(login, wantedClass="Button",wantedText="OK")
wga.clickButton(OKButton)


#set 11b,11g,11bg
ie.navigate("http://"+IP+"/admin.cgi?action=radio")
ie.listBoxSelect('radioInterface','2')
ie.listBoxSelect('radio.wlan0.mode','IEEE 802.11g')
sleep(1)

##set channel
channel='11'
ie.listBoxSelect('radio.wlan1.channel',channel)

##set Beacon Interval 
beacon_interval='100'
ie.textBoxSet('update.device.radio[wlan1].beacon-interval',beacon_interval)

##set DTIM Period 
dtim='2'
ie.textBoxSet('update.device.bss(radio=wlan1).dtim-period',dtim)
Example #3
0
def G54S(config):
    ie = PAMIE()
    wga = winGuiAuto
    mp = cModalPopUp
    ie.navigate("http://" + IP + "/advance/advance-lan-wireless.htm")
    login = wga.findTopWindow(wantedText="Connect to " + IP)
    credential = wga.findControl(login, wantedClass="SysCredential")
    user1 = wga.findControl(credential, wantedClass="ComboBoxEx32")
    user2 = wga.findControl(user1, wantedClass="ComboBox")
    user3 = wga.findControl(user2, wantedClass="Edit")
    wga.setEditText(user3, username)

    ## If password is not null,enter password by win32api.keybd_event
    ## First enter Alt+p
    win32api.keybd_event(18, 0, 0, 0)
    win32api.keybd_event(80, 0, 0, 0)
    win32api.keybd_event(18, 0, win32con.KEYEVENTF_KEYUP, 0)
    win32api.keybd_event(80, 0, win32con.KEYEVENTF_KEYUP, 0)

    ##Then enter password
    """win32api.keybd_event(82,0,0,0)
    win32api.keybd_event(82,0,win32con.KEYEVENTF_KEYUP,0)
    win32api.keybd_event(79,0,0,0)
    win32api.keybd_event(79,0,win32con.KEYEVENTF_KEYUP,0)
    win32api.keybd_event(79,0,0,0)
    win32api.keybd_event(79,0,win32con.KEYEVENTF_KEYUP,0)
    win32api.keybd_event(84,0,0,0)
    win32api.keybd_event(84,0,win32con.KEYEVENTF_KEYUP,0)
    time.sleep(10)"""

    OKButton = wga.findControl(login, wantedClass="Button", wantedText="OK")
    wga.clickButton(OKButton)

    ie.navigate("http://" + IP + "/advance/ad-lan-wireless_g.htm")
    ie.radioButtonSet("wl_radio", "1", checked=True)
    if config["wirelessmode"] == "802.11b only":
        wirelessmode = "11b-Only"
    elif config["wirelessmode"] == "802.11g only":
        wirelessmode = "11g-Only"
    elif config["wirelessmode"] == "802.11b/g":
        wirelessmode = "Mixed"
    ie.listBoxSelect("wl_gmode", wirelessmode)

    SSID = config["SSID"]
    ie.textBoxSet("wl_ssid_input", SSID)

    if config["autochannel"] == "Disable":
        ie.checkBoxSet("wl_channel_auto", 0)
    else:
        ie.checkBoxSet("wl_channel_auto", 1)

    channel = config["channel"]
    ie.listBoxSelect("wl_channel", "Channel " + channel)
    ie.buttonClick("Apply")
    time.sleep(10)
    ie.navigate("http://" + IP + "/advance/ad-lan-wireless_sec_g.htm")
    ie.radioButtonSet("wl_closed", "0", checked=True)

    encryption = config["encryption"]
    if encryption == "None":
        ie.radioButtonSet("wl_wep", "off", checked=True)
    elif encryption == "WEP":
        ie.radioButtonSet("wl_wep", "restricted", checked=True)
        keyindex = config["keyindex"]
        keytype = config["keytype"]
        wepkey = config["wepkey"]
        ie.radioButtonSet("wl_key", keyindex, checked=True)
        ie.listBoxSelect("wep_ascii_select" + keyindex, keytype)
        ie.textBoxSet("wl_key" + keyindex, wepkey)
    elif encryption == "TKIP":
        ie.radioButtonSet("wl_wep", "tkip", checked=True)
        ie.textBoxSet("wl_wpa_psk", config["passphrase"])
    elif encryption == "AES":
        ie.radioButtonSet("wl_wep", "aes", checked=True)
        ie.textBoxSet("wl_wpa_psk", config["passphrase"])

    ie.buttonClick("Apply")
    time.sleep(10)
Example #4
0
def Dlink_DWL_8500AP(config):
    ie = PAMIE()
    wga = winGuiAuto
    # ie.navigate("http://"+IP+"/admin.cgi?action=basic_settings")
    ie.navigate("http://" + IP)
    login = wga.findTopWindow(wantedText="Connect to " + IP)
    credential = wga.findControl(login, wantedClass="SysCredential")  # find by spi
    user1 = wga.findControl(credential, wantedClass="ComboBoxEx32")  # combin combo and edit
    user2 = wga.findControl(credential, wantedClass="ComboBox")
    user3 = wga.findControl(credential, wantedClass="Edit")
    wga.setEditText(user3, username)

    """
    ## First enter Alt+p
    win32api.keybd_event(18,0,0,0)
    win32api.keybd_event(80,0,0,0)
    win32api.keybd_event(18,0,win32con.KEYEVENTF_KEYUP,0)
    win32api.keybd_event(80,0,win32con.KEYEVENTF_KEYUP,0)

    ##Then enter password  admin
    win32api.keybd_event(97,0,0,0) #a
    win32api.keybd_event(97,0,win32con.KEYEVENTF_KEYUP,0)
    win32api.keybd_event(100,0,0,0) #d
    win32api.keybd_event(100,0,win32con.KEYEVENTF_KEYUP,0)
    win32api.keybd_event(109,0,0,0)#m
    win32api.keybd_event(109,0,win32con.KEYEVENTF_KEYUP,0)
    win32api.keybd_event(105,0,0,0)#i
    win32api.keybd_event(105,0,win32con.KEYEVENTF_KEYUP,0)
    win32api.keybd_event(110,0,0,0)#n
    win32api.keybd_event(110,0,win32con.KEYEVENTF_KEYUP,0)
    sleep(10)
    """
    # user4=wga.findControl(credential,wantedClass='Edit')
    # wga.setEditText(user4,password)

    # click login buttion
    OKButton = wga.findControl(login, wantedClass="Button", wantedText="OK")
    wga.clickButton(OKButton)

    ##set channel
    channel = config["channel"]
    ie.listBoxSelect("radio.wlan1.channel", channel)

    # select 11bg mode
    ie.navigate("http://" + IP + "/admin.cgi?action=radio")
    ie.listBoxSelect("radioInterface", "2")
    ie.listBoxSelect("radio.wlan0.mode", "IEEE 802.11g")
    sleep(1)
    if config["wirelessmode"] == "802.11b only":
        ie.checkBoxSet("supported-rate.wlan1.0", 0)
        ie.checkBoxSet("supported-rate.wlan1.1", 0)
        ie.checkBoxSet("supported-rate.wlan1.2", 0)
        ie.checkBoxSet("supported-rate.wlan1.3", 0)
        ie.checkBoxSet("supported-rate.wlan1.4", 0)
        ie.checkBoxSet("supported-rate.wlan1.5", 0)
        ie.checkBoxSet("supported-rate.wlan1.6", 1)
        ie.checkBoxSet("supported-rate.wlan1.7", 0)
        ie.checkBoxSet("supported-rate.wlan1.8", 0)
        ie.checkBoxSet("supported-rate.wlan1.9", 1)
        ie.checkBoxSet("supported-rate.wlan1.10", 1)
        ie.checkBoxSet("supported-rate.wlan1.11", 1)
        ie.checkBoxSet("basic-rate.wlan1.0", 0)
        ie.checkBoxSet("basic-rate.wlan1.1", 0)
        ie.checkBoxSet("basic-rate.wlan1.2", 0)
        ie.checkBoxSet("basic-rate.wlan1.3", 0)
        ie.checkBoxSet("basic-rate.wlan1.4", 0)
        ie.checkBoxSet("basic-rate.wlan1.5", 0)
        ie.checkBoxSet("basic-rate.wlan1.6", 0)
        ie.checkBoxSet("basic-rate.wlan1.7", 0)
        ie.checkBoxSet("basic-rate.wlan1.8", 0)
        ie.checkBoxSet("basic-rate.wlan1.9", 0)
        ie.checkBoxSet("basic-rate.wlan1.10", 1)
        ie.checkBoxSet("basic-rate.wlan1.11", 1)
    elif config["wirelessmode"] == "802.11g only":
        ie.checkBoxSet("supported-rate.wlan1.0", 1)
        ie.checkBoxSet("supported-rate.wlan1.1", 1)
        ie.checkBoxSet("supported-rate.wlan1.2", 1)
        ie.checkBoxSet("supported-rate.wlan1.3", 1)
        ie.checkBoxSet("supported-rate.wlan1.4", 1)
        ie.checkBoxSet("supported-rate.wlan1.5", 1)
        ie.checkBoxSet("supported-rate.wlan1.6", 0)
        ie.checkBoxSet("supported-rate.wlan1.7", 1)
        ie.checkBoxSet("supported-rate.wlan1.8", 1)
        ie.checkBoxSet("supported-rate.wlan1.9", 0)
        ie.checkBoxSet("supported-rate.wlan1.10", 0)
        ie.checkBoxSet("supported-rate.wlan1.11", 0)
        ie.checkBoxSet("basic-rate.wlan1.0", 0)
        ie.checkBoxSet("basic-rate.wlan1.1", 0)
        ie.checkBoxSet("basic-rate.wlan1.2", 0)
        ie.checkBoxSet("basic-rate.wlan1.3", 1)
        ie.checkBoxSet("basic-rate.wlan1.4", 0)
        ie.checkBoxSet("basic-rate.wlan1.5", 1)
        ie.checkBoxSet("basic-rate.wlan1.6", 0)
        ie.checkBoxSet("basic-rate.wlan1.7", 0)
        ie.checkBoxSet("basic-rate.wlan1.8", 1)
        ie.checkBoxSet("basic-rate.wlan1.9", 0)
        ie.checkBoxSet("basic-rate.wlan1.10", 0)
        ie.checkBoxSet("basic-rate.wlan1.11", 0)
    elif config["wirelessmode"] == "802.11b/g":
        ie.checkBoxSet("supported-rate.wlan1.0", 1)
        ie.checkBoxSet("supported-rate.wlan1.1", 1)
        ie.checkBoxSet("supported-rate.wlan1.2", 1)
        ie.checkBoxSet("supported-rate.wlan1.3", 1)
        ie.checkBoxSet("supported-rate.wlan1.4", 1)
        ie.checkBoxSet("supported-rate.wlan1.5", 1)
        ie.checkBoxSet("supported-rate.wlan1.6", 1)
        ie.checkBoxSet("supported-rate.wlan1.7", 1)
        ie.checkBoxSet("supported-rate.wlan1.8", 1)
        ie.checkBoxSet("supported-rate.wlan1.9", 1)
        ie.checkBoxSet("supported-rate.wlan1.10", 1)
        ie.checkBoxSet("supported-rate.wlan1.11", 1)
        ie.checkBoxSet("basic-rate.wlan1.0", 0)
        ie.checkBoxSet("basic-rate.wlan1.1", 0)
        ie.checkBoxSet("basic-rate.wlan1.2", 0)
        ie.checkBoxSet("basic-rate.wlan1.3", 0)
        ie.checkBoxSet("basic-rate.wlan1.4", 0)
        ie.checkBoxSet("basic-rate.wlan1.5", 0)
        ie.checkBoxSet("basic-rate.wlan1.6", 1)
        ie.checkBoxSet("basic-rate.wlan1.7", 0)
        ie.checkBoxSet("basic-rate.wlan1.8", 0)
        ie.checkBoxSet("basic-rate.wlan1.9", 1)
        ie.checkBoxSet("basic-rate.wlan1.10", 1)
        ie.checkBoxSet("basic-rate.wlan1.11", 1)

    thread.start_new_thread(click_ok, (1,))
    ie.buttonClick("Update")