Esempio n. 1
0
def check(req, page_info):
    """
    1. the unique format
    2. hashmap without index(no order,keyword unique)

    page_info['pagename'] = ""
    page_info['handler'] = None
    page_info['result'] = None
    page_info['message'] = "checking"

    """
    # check POST data
    q = req['body']
    if q and len(q):
        seq, h = utils.str2hash(q)
        #
        form_hashmap = form_fmt["wep_active"]["hash"]
        (rc, kall, ko1, ko2) = utils.diff_form_hashmap_keys(form_hashmap, h)
        page_info['message'] = ""
        if not rc:
            page_info['result'] = "SAME"
            page_info['message'] = ""
        else:
            page_info['result'] = "DIFF"
            page_info['message'] += (page_info['pagename'] + ":\n")
            page_info['message'] += ("Lost Keys : " + str(ko1) + "\n" )
            page_info['message'] += ("New  Keys : " + str(ko2) + "\n" )
    return
Esempio n. 2
0
def replace(req):
    """
    """
    changed = True
    q = req['body']
    if q and len(q):
        seq, h = utils.str2hash(q)
        new_h = form_repl(h)
        if new_h == h:
            changed = False
        else:
            q = utils.hash2str(new_h, seq)
            req['body'] = q
    else:
        changed = False
    return (req, changed)
Esempio n. 3
0
def check(req, page_info):
    """
    1. the unique format
    2. hashmap without index(no order,keyword unique)

    page_info['pagename'] = ""
    page_info['handler'] = None
    page_info['result'] = None
    page_info['message'] = "checking"

    """
    # check POST data
    q = req['body']
    if q and len(q):
        seq, h = utils.str2hash(q)
        #
        form_hashmap = None
        if "wireless_advanced_wep.cgi" == page_info['pagename']:
            form_hashmap = form_fmt['wep']['hash']
        elif "wireless_advanced_wpa.cgi" == page_info['pagename']:
            form_hashmap = form_fmt['wpa']['hash']
        (rc, kall, ko1, ko2) = utils.diff_form_hashmap_keys(form_hashmap, h)
        #print "==",form_hashmap
        #print "==",h
        page_info['message'] = ""
        if not rc:
            page_info['result'] = "SAME"
            page_info['message'] = ""
        else:
            page_info['result'] = "DIFF"
            page_info['message'] += (page_info['pagename'] + ":\n")
            if len(ko1):
                page_info['message'] += ("Lost Keys : " + str(ko1) + "\n" )
            if len(ko2):
                page_info['message'] += ("New  Keys : " + str(ko2) + "\n" )
    return