Git Product home page Git Product logo

Comments (4)

hamarituc avatar hamarituc commented on June 17, 2024

It should work with DESFire as it is the application this tool was designed for. Which Lua version do you have installed? Do you have multiple versions of Lua installed in parallel? During build a file named luainit.inc is created. Can you please post the content of this file here.

from desfsh.

artzaik avatar artzaik commented on June 17, 2024
$ lua

Lua 5.4.2  Copyright (C) 1994-2020 Lua.org, PUC-Rio
$ cat luainit.inc 

  0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x41, 0x45, 0x53,

  0x28, 0x6b, 0x2c, 0x20, 0x76, 0x29, 0x0a, 0x20, 0x20, 0x69, 0x66, 0x20,

  0x6e, 0x6f, 0x74, 0x20, 0x6b, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x20, 0x6b,

  0x20, 0x3d, 0x20, 0x22, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,

  0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,

  0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,

  0x22, 0x20, 0x65, 0x6e, 0x64, 0x0a, 0x20, 0x20, 0x69, 0x66, 0x20, 0x6e,

  0x6f, 0x74, 0x20, 0x76, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x20, 0x76, 0x20,

  0x3d, 0x20, 0x30, 0x20, 0x65, 0x6e, 0x64, 0x0a, 0x20, 0x20, 0x72, 0x65,

  0x74, 0x75, 0x72, 0x6e, 0x20, 0x7b, 0x20, 0x74, 0x20, 0x3d, 0x20, 0x22,

  0x41, 0x45, 0x53, 0x22, 0x2c, 0x20, 0x6b, 0x20, 0x3d, 0x20, 0x6b, 0x2c,

  0x20, 0x76, 0x20, 0x3d, 0x20, 0x76, 0x20, 0x7d, 0x0a, 0x65, 0x6e, 0x64,

  0x0a, 0x0a, 0x0a, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20,

  0x5f, 0x33, 0x4b, 0x33, 0x44, 0x45, 0x53, 0x28, 0x6b, 0x2c, 0x20, 0x76,

  0x29, 0x0a, 0x20, 0x20, 0x69, 0x66, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x6b,

  0x20, 0x74, 0x68, 0x65, 0x6e, 0x20, 0x6b, 0x20, 0x3d, 0x20, 0x22, 0x30,

  0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,

  0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,

  0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,

  0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x22,

  0x20, 0x65, 0x6e, 0x64, 0x0a, 0x20, 0x20, 0x69, 0x66, 0x20, 0x6e, 0x6f,

  0x74, 0x20, 0x76, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x20, 0x76, 0x20, 0x3d,

  0x20, 0x30, 0x20, 0x65, 0x6e, 0x64, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74,

  0x75, 0x72, 0x6e, 0x20, 0x7b, 0x20, 0x74, 0x20, 0x3d, 0x20, 0x22, 0x33,

  0x4b, 0x33, 0x44, 0x45, 0x53, 0x22, 0x2c, 0x20, 0x6b, 0x20, 0x3d, 0x20,

  0x6b, 0x2c, 0x20, 0x76, 0x20, 0x3d, 0x20, 0x76, 0x20, 0x7d, 0x0a, 0x65,

  0x6e, 0x64, 0x0a, 0x0a, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e,

  0x20, 0x5f, 0x33, 0x44, 0x45, 0x53, 0x28, 0x6b, 0x2c, 0x20, 0x76, 0x29,

  0x0a, 0x20, 0x20, 0x69, 0x66, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x6b, 0x20,

  0x74, 0x68, 0x65, 0x6e, 0x20, 0x6b, 0x20, 0x3d, 0x20, 0x22, 0x30, 0x30,

  0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,

  0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,

  0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x22, 0x20, 0x65, 0x6e, 0x64, 0x0a,

  0x20, 0x20, 0x69, 0x66, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x76, 0x20, 0x74,

  0x68, 0x65, 0x6e, 0x20, 0x76, 0x20, 0x3d, 0x20, 0x30, 0x20, 0x65, 0x6e,

  0x64, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x7b,

  0x20, 0x74, 0x20, 0x3d, 0x20, 0x22, 0x33, 0x44, 0x45, 0x53, 0x22, 0x2c,

  0x20, 0x6b, 0x20, 0x3d, 0x20, 0x6b, 0x2c, 0x20, 0x76, 0x20, 0x3d, 0x20,

  0x76, 0x20, 0x7d, 0x0a, 0x65, 0x6e, 0x64, 0x0a, 0x0a, 0x66, 0x75, 0x6e,

  0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x44, 0x45, 0x53, 0x28, 0x6b, 0x2c,

  0x20, 0x76, 0x29, 0x0a, 0x20, 0x20, 0x69, 0x66, 0x20, 0x6e, 0x6f, 0x74,

  0x20, 0x6b, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x20, 0x6b, 0x20, 0x3d, 0x20,

  0x22, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,

  0x30, 0x30, 0x30, 0x30, 0x30, 0x22, 0x20, 0x65, 0x6e, 0x64, 0x0a, 0x20,

  0x20, 0x69, 0x66, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x76, 0x20, 0x74, 0x68,

  0x65, 0x6e, 0x20, 0x76, 0x20, 0x3d, 0x20, 0x30, 0x20, 0x65, 0x6e, 0x64,

  0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x7b, 0x20,

  0x74, 0x20, 0x3d, 0x20, 0x22, 0x44, 0x45, 0x53, 0x22, 0x2c, 0x20, 0x6b,

  0x20, 0x3d, 0x20, 0x6b, 0x2c, 0x20, 0x76, 0x20, 0x3d, 0x20, 0x76, 0x20,

  0x7d, 0x0a, 0x65, 0x6e, 0x64, 0x0a, 0x2d, 0x65, 0x20, 0x00
$ make clean all

rm -f *.o *.inc

rm -f desfsh

gcc -Wall -Wextra -g -I/usr/include/lua5.4 -c -o buffer.o buffer.c

gcc -Wall -Wextra -g -I/usr/include/lua5.4 -c -o cmd_app.o cmd_app.c

gcc -Wall -Wextra -g -I/usr/include/lua5.4 -c -o cmd_data.o cmd_data.c

gcc -Wall -Wextra -g -I/usr/include/lua5.4 -c -o cmd_picc.o cmd_picc.c

gcc -Wall -Wextra -g -I/usr/include/lua5.4 -c -o cmd_sec.o cmd_sec.c

gcc -Wall -Wextra -g -I/usr/include/lua5.4 -c -o crc.o crc.c

gcc -Wall -Wextra -g -I/usr/include/lua5.4 -c -o crypto.o crypto.c

gcc -Wall -Wextra -g -I/usr/include/lua5.4 -c -o debug.o debug.c

gcc -Wall -Wextra -g -I/usr/include/lua5.4 -c -o desflua.o desflua.c

gcc -Wall -Wextra -g -I/usr/include/lua5.4 -c -o desfsh.o desfsh.c

echo -n -e "\0" | cat luainit.lua - | xxd -i > luainit.inc

gcc -Wall -Wextra -g -I/usr/include/lua5.4 -c -o fn.o fn.c

gcc -Wall -Wextra -g -I/usr/include/lua5.4 -c -o help.o help.c

gcc -Wall -Wextra -g -I/usr/include/lua5.4 -c -o hexdump.o hexdump.c

gcc -Wall -Wextra -g -I/usr/include/lua5.4 -c -o key.o key.c

gcc -Wall -Wextra -g -I/usr/include/lua5.4 -c -o shell.o shell.c

gcc -Wall -Wextra -g -I/usr/include/lua5.4 -c -o show.o show.c

gcc -Wall -Wextra -g -I/usr/include/lua5.4 -o desfsh buffer.o cmd_app.o cmd_data.o cmd_picc.o cmd_sec.o crc.o crypto.o debug.o desflua.o desfsh.o fn.o help.o hexdump.o key.o shell.o show.o -lnfc -lfreefare -lreadline -llua5.4 -lcrypto -lz

from desfsh.

hamarituc avatar hamarituc commented on June 17, 2024

From luainit.inc it seems the -e parameter of echo is directly piped into xxd instead of enable parsing the escape sequences. It would be better to store the Lua code directly in the C source files.

from desfsh.

artzaik avatar artzaik commented on June 17, 2024

Great, thank you!

from desfsh.

Related Issues (1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.