Ejemplo n.º 1
0
def clear_mem():
    if (programmingState is not STATE_ACTIVE):
        GUI.showWarning('NOOO! Connection is not active!')
        return
    start = h2i(GUI.getSelected('Start Address'))
    end = h2i(GUI.getSelected('End Address'))
    wisps = GUI.getSelectedWispIDs()
    # safety checks
    if (start <= 0x4400 and end >= 0x6400):
        GUI.showWarning(
            "NOOO!! Don't clear the bootloader section, that will wirelessly brick the tag!"
        )
        return
    if (end <= start):
        GUI.showWarning('End Address (' + i2h(start) +
                        ') is smaller than or equal to Start Address!(' +
                        i2h(end) + ')')
        return
    if (start == 0x1800 and len(wisps) > 1):
        GUI.showWarning(
            "NOOO!! You don't want to delete the random numbers of multiple wisps at the same time!\nIf you do, they will talk like coffee-chickens"
        )
        return

    GUI.updatetxt('Clearing memory from ' + i2h(start) + 'to ' + i2h(end) +
                  ' to wisps: ' + ' and '.join(wisps))
    for wispID in GUI.getSelectedWispIDs():
        active_modules.append(
            WiClear(ASF(wispID=wispID, accessSpecID=ASF.nextASID(), fac=fac),
                    ID4hex=wispID,
                    start_address=start,
                    end_address=end))
        active_modules[-1].start(finished_callback=clear_mem_finished)
Ejemplo n.º 2
0
def readData(return_metadata=None):
    if (programmingState is not STATE_ACTIVE):
        GUI.showWarning('NOOO! Connection is not active!')
        return
    start = h2i(GUI.getSelected('Start Address'))
    end = h2i(GUI.getSelected('End Address'))
    wisps = GUI.getSelectedWispIDs()
    # safety checks
    if (not wisps):
        GUI.showWarning('Reading from ' + i2h(start) + 'to ' + i2h(end) +
                        ' to wisps: \n MAKE A SELECTION FIRST!')
        return
    if (end <= start):
        GUI.showWarning('End Address (' + i2h(start) +
                        ') is smaller than or equal to Start Address!(' +
                        i2h(end) + ')')
        return

    GUI.updatetxt('Reading from ' + i2h(start) + ' to ' + i2h(end) +
                  ' from the wisp(s): ' + ' and '.join(wisps))

    for wispID in wisps:
        active_modules.append(
            WiRead(ASF(wispID=wispID, accessSpecID=ASF.nextASID(), fac=fac),
                   ID4hex=wispID,
                   start_address=start,
                   end_address=end,
                   metadata=return_metadata))
        active_modules[-1].start(finished_callback=readData_finished)
Ejemplo n.º 3
0
def refreshRandomNumbers():
    if (programmingState is not STATE_ACTIVE):
        GUI.showWarning('NOOO! Connection is not active!')
        return
    wisps = GUI.getSelectedWispIDs()
    GUI.updatetxt('Reload Random numbers to the wisps: ' + ' and '.join(wisps))
    for wispID in wisps:
        active_modules.append(
            WiRandom(ASF(wispID=wispID, accessSpecID=ASF.nextASID(), fac=fac),
                     ID4hex=wispID))
        active_modules[-1].start(
            finished_callback=refreshRandomNumbers_finished)
Ejemplo n.º 4
0
def gotobios():
    if (programmingState is not STATE_ACTIVE):
        GUI.showWarning('NOOO! Connection is not active!')
        return
    wisps = GUI.getSelectedWispIDs()
    GUI.updatetxt('sending gotobios to wisps: ' + ' and '.join(wisps))
    for wispID in wisps:
        active_modules.append(
            Messenger(ASF(wispID=wispID, accessSpecID=ASF.nextASID(), fac=fac),
                      ID4hex=wispID,
                      message="b105",
                      readThis='b105'))
        active_modules[-1].start(finished_callback=gotobios_finished)
Ejemplo n.º 5
0
def reprogram():
    if (programmingState is not STATE_ACTIVE):
        GUI.showWarning('NOOO! Connection is not active!')
        return
    filename = GUI.getSelected('File')
    wisps = GUI.getSelectedWispIDs()
    nr_of_wisps = len(wisps)
    if (nr_of_wisps == 0):
        GUI.showWarning('Select a wisp first!')
        return
    bios_and_boot = (GUI.getSelected('BIOS and BOOT') == 'Enabled')
    if (bios_and_boot and filename == 'random'):
        GUI.showWarning("NOOO!! You don't want to boot into random data!")
        return
    hexlines = get_hex_lines()
    if not hexlines:
        return

    BWPAS = GUI.getSelected('OpSpecsPerAS')
    BWPAS = 4 if BWPAS == 'default (4)' else int(BWPAS)
    CT = GUI.getSelected('BWPayload')
    CT = None if CT == 'throttle' else int(CT)
    UO = GUI.getSelected('Updata Only') == 'True'
    COMPR = GUI.getSelected('Compression') == 'Enabled'
    M = GUI.getSelected('Reprogramming Mode')
    M       = WRepper.MODE_ONEBYONE_AND_SNIFFING if M =='Broadcast' else \
              (WRepper.MODE_ONEBYONE if M == 'Sequential' else \
              WRepper.MODE_PARALEL)
    DWAX = GUI.getSelected('Destroy Windows')
    DWAX = None if DWAX == 'never' else int(DWAX.split()[0][1:])
    GUI.updatetxt('Reprogramming data from "' + filename + '" to wisps: ' +
                  ' and '.join(wisps))
    active_modules.append(
        WRepper([
            ASF(wispID=wisps[i], accessSpecID=ASF.nextASID(), fac=fac)
            for i in range(nr_of_wisps)
        ],
                IDs4hex=wisps,
                hexlines=hexlines,
                update_only=UO,
                compressed_data=COMPR,
                constant_throttle=CT,
                memline_parallel=BWPAS,
                bios_and_boot=bios_and_boot,
                pro_mode=M,
                destroy_windows_after_Xsec_when_finished=DWAX))
    active_modules[-1].start(finished_callback=reprogram_finished)
Ejemplo n.º 6
0
def send_this(message=None, readThis=None, readAndReport_NrOfWords=None):
    if (programmingState is not STATE_ACTIVE):
        GUI.showWarning('NOOO! Connection is not active!')
        return
    wisps = GUI.getSelectedWispIDs()
    GUI.updatetxt(
        'sending command[' + (message if message else '-') + '] to wisps: ' +
        ' and '.join(wisps) + ' and expecting a result [' +
        (readThis if readThis else '-') + '] or ' +
        (readAndReport_NrOfWords if readAndReport_NrOfWords else '-') +
        ' words')
    for wispID in wisps:
        active_modules.append(
            Messenger(ASF(wispID=wispID, accessSpecID=ASF.nextASID(), fac=fac),
                      ID4hex=wispID,
                      message=message,
                      readThis=readThis,
                      readAndReport_NrOfWords=readAndReport_NrOfWords))
        active_modules[-1].start(finished_callback=send_this_finished)
Ejemplo n.º 7
0
def memCheck():
    if (programmingState is not STATE_ACTIVE):
        GUI.showWarning('NOOO! Connection is not active!')
        return

    wisps = GUI.getSelectedWispIDs()
    hexlines = get_hex_lines()
    if not hexlines:
        return
    DWAX = GUI.getSelected('Destroy Windows')
    DWAX = None if DWAX == 'never' else int(DWAX.split()[0][1:])
    GUI.updatetxt('Doing a memcheck to wisps: ' + ' and '.join(wisps))
    for wispID in GUI.getSelectedWispIDs():
        active_modules.append(
            PerfectWispMemory(send_util=ASF(wispID=wispID,
                                            accessSpecID=ASF.nextASID(),
                                            fac=fac),
                              ID4hex=wispID,
                              hexlines=hexlines))
        active_modules[-1].start(finished_callback=memCheck_finished,
                                 destroy_windows_after_Xsec_when_finished=DWAX)
Ejemplo n.º 8
0
def sendData():
    if (programmingState is not STATE_ACTIVE):
        GUI.showWarning('NOOO! Connection is not active!')
        return
    filename = GUI.getSelected('File')
    wisps = GUI.getSelectedWispIDs()
    if (len(wisps) == 0):
        wisps = GUI.tagWidget.getGoodTags(.5)
    if len(wisps) == 0:
        GUI.showWarning('NOOO! Where is WISP?')

    hexlines = get_hex_lines(old_random=False)
    if not hexlines:
        return
    BWPAS = GUI.getSelected('OpSpecsPerAS')
    BWPAS = 4 if BWPAS == 'default (4)' else int(BWPAS)
    CT = GUI.getSelected('BWPayload')
    CT = None if CT == 'throttle' else int(CT)
    DWAX = GUI.getSelected('Destroy Windows')
    DWAX = None if DWAX == 'never' else int(DWAX.split()[0][1:])

    GUI.updatetxt('Sending data from "' + filename + '" to wisps: ' +
                  ' and '.join(wisps))
    for wispID in wisps:
        active_modules.append(
            Stork(
                send_util=ASF(wispID=wispID,
                              accessSpecID=ASF.nextASID(),
                              fac=fac),
                ID4hex=wispID,
                hexlines=hexlines,
                blockWritesPerAccessSpec=BWPAS,
                constant_throttle=CT,
            ))
        active_modules[-1].start(finished_callback=sendData_finished,
                                 destroy_windows_after_Xsec_when_finished=DWAX)