Good morning, I need to create a lua script for cyclic programming of “n” mifare 1k cards.
Specifically I should enter the number of cards to be programmed and and execute the command “hf mf wrbl --blk 3 -k FFFFFFFFFF -d 998877665544FF078069FFFFFFFF . At each writing you will have to prompt to press enter.
I tried to create the script but it cannot find the hf command.
Can you please help me thank you.
-- Carica i Comandi
local getopt = require('getopt')
local lib14a = require('read14a')
local cmds = require('commands')
local utils = require('utils')
local ansicolors = require('ansicolors')
-- Funzione per eseguire un comando e simulare l'invio
function eseguiComando(comando)
io.popen(comando)
end
-- Chiedi all'utente quante carte programmare
print("Quante carte vuoi programmare?")
local numeroCarte = io.read("*n")
-- Ciclo per eseguire il comando per ogni carta
for i = 1, numeroCarte do
-- Costruisci il comando completo
local cmds = "hf mf wrbl --blk 3 -k FFFFFFFFFFFF -d 998877665544FF078069FFFFFFFFFFFF"
-- Esegui il comando
eseguiComando(cmds)
-- Simula l'invio (puoi adattare questa parte se necessario)
print("Premi invio per continuare...")
io.read()
end
I don’t think so. If I try to send the command from the command line it works perfectly.
I am using the latest version available for windows downloaded on proxmarklbuilds for pm3.
-- Carichiamo le librerie necessarie
local cmds = require('commands')
local utils = require('utils')
-- Funzione principale
local function main()
-- Chiediamo all'utente il numero di carte
print("Quante carte vuoi programmare?")
local numCarte = io.read("*n")
-- Verifichiamo che l'input sia un numero intero positivo
while not (numCarte and numCarte > 0) do
print("Inserisci un numero intero positivo:")
numCarte = io.read("*n")
end
io.read() -- Legge un'intera linea di input, quindi basta premere Invio
-- Cicliamo per ogni carta
for i = 1, numCarte do
print("Programmazione carta", i)
-- Scriviamo sul blocco 3
io.read() -- Legge un'intera linea di input, quindi basta premere Invio
core.console("hf mf wrbl --blk 3 -k FFFFFFFFFFFF -d 998877665544078069FFFFFFFFFFFF")
end
-- Messaggio di fine programmazione con il conteggio
print("Sono state programmate " .. numCarte .. " carte.")
end
-- Eseguiamo la funzione principale
main()
My next goal is to figure out how to add 2 counters, 1 for cards programmed correctly and 1 for cards with errors.
I can’t figure out how to get the reading result from the hf mf wrbl command.
So as to perform an if then else.