mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2026-05-12 11:18:11 -07:00
SWIG experiments
This commit is contained in:
@@ -318,7 +318,7 @@ if (NOT SKIPPYTHON EQUAL 1)
|
||||
add_definitions(-DHAVE_PYTHON)
|
||||
set(ADDITIONAL_DIRS ${PYTHON3_INCLUDE_DIRS} ${ADDITIONAL_DIRS})
|
||||
set(ADDITIONAL_LNK ${PYTHON3_LIBRARIES} ${ADDITIONAL_LNK})
|
||||
set(ADDITIONAL_LNKDIRS ${PYTHON3_LIBRARY_DIRS} ${ADDITIONAL_LNKDIRS})
|
||||
set(ADDITIONAL_LNKDIRS ${PYTHON3_LIBRARY_DIRS} ${ADDITIONAL_LNKDIRS})
|
||||
endif (PYTHON3EMBED_FOUND)
|
||||
endif (NOT SKIPPYTHON EQUAL 1)
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ static bool OpenPm3(void) {
|
||||
return true;
|
||||
}
|
||||
// Open with LocalSocket. Not a tcp connection!
|
||||
bool ret = OpenProxmark("socket:"PM3_LOCAL_SOCKET_SERVER, false, 1000, false, 115200);
|
||||
bool ret = OpenProxmark(session.current_device, "socket:"PM3_LOCAL_SOCKET_SERVER, false, 1000, false, 115200);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
build/
|
||||
Executable
+4
@@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
|
||||
swig -lua -o ../src/pm3_luawrap.c ../include/pm3.h
|
||||
swig -python -o ../src/pm3_pywrap.c ../include/pm3.h
|
||||
Executable
+10
@@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
rm -rf build
|
||||
mkdir build
|
||||
(
|
||||
cd build
|
||||
cmake ..
|
||||
make -j
|
||||
)
|
||||
|
||||
Executable
+3
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
build/proxmark3 /dev/ttyACM0 -c "script run testembedded.lua"
|
||||
Executable
+7
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
#/usr/local/lib/python3/dist-packages/pm3.py
|
||||
#/usr/lib/python3/dist-packages/pm3.py
|
||||
|
||||
# need access to pm3.py
|
||||
PYTHONPATH=../src build/proxmark3 /dev/ttyACM0 -c "script run testembedded.py"
|
||||
@@ -0,0 +1,498 @@
|
||||
# MINGW:
|
||||
# On ProxSpace 3.4:
|
||||
# cmake -G"MSYS Makefiles" ..
|
||||
# On Proxspace 3.3 or less, you need to install cmake:
|
||||
# pacman -S mingw-w64-x86_64-cmake
|
||||
# /mingw64/bin/cmake -G"MSYS Makefiles" ..
|
||||
#
|
||||
# Android cross-compilation:
|
||||
# cmake \
|
||||
# -DCMAKE_TOOLCHAIN_FILE=<path-to-your-android-ndk>/build/cmake/android.toolchain.cmake \
|
||||
# -DANDROID_ABI=armeabi-v7a \
|
||||
# -DANDROID_NATIVE_API_LEVEL=android-19 \
|
||||
# -DSKIPBT=1 -DSKIPPYTHON=1 -DSKIPPTHREAD=1 ..
|
||||
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
project(proxmark3)
|
||||
SET (PM3_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../..)
|
||||
|
||||
if(CMAKE_VERSION VERSION_LESS "3.7.0")
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
endif()
|
||||
|
||||
if (NOT SKIPQT EQUAL 1)
|
||||
if(APPLE AND EXISTS /usr/local/opt/qt5)
|
||||
# Homebrew installs Qt5 (up to at least 5.11.0) in
|
||||
# /usr/local/qt5. Ensure that it can be found by CMake
|
||||
# since it is not in the default /usr/local prefix.
|
||||
# Add it to PATHS so that it doesn't override the
|
||||
# CMAKE_PREFIX_PATH environment variable.
|
||||
# QT_FIND_PACKAGE_OPTIONS should be passed to find_package,
|
||||
# e.g. find_package(Qt5Core ${QT_FIND_PACKAGE_OPTIONS})
|
||||
list(APPEND QT_FIND_PACKAGE_OPTIONS PATHS /usr/local/opt/qt5)
|
||||
endif(APPLE AND EXISTS /usr/local/opt/qt5)
|
||||
set(QT_PACKAGELIST
|
||||
Qt5Core
|
||||
Qt5Widgets
|
||||
Qt5Gui
|
||||
)
|
||||
set(Qt5_FOUND ON)
|
||||
foreach(_qt_package IN LISTS QT_PACKAGELIST)
|
||||
find_package(${_qt_package} QUIET ${QT_FIND_PACKAGE_OPTIONS})
|
||||
set(Qt5_LIBRARIES ${${_qt_package}_LIBRARIES} ${Qt5_LIBRARIES})
|
||||
if(NOT ${_qt_package}_FOUND)
|
||||
set(Qt5_FOUND OFF)
|
||||
endif(NOT ${_qt_package}_FOUND)
|
||||
endforeach()
|
||||
endif (NOT SKIPQT EQUAL 1)
|
||||
|
||||
find_package(PkgConfig)
|
||||
if (NOT SKIPBT EQUAL 1)
|
||||
pkg_search_module(BLUEZ QUIET bluez)
|
||||
endif (NOT SKIPBT EQUAL 1)
|
||||
|
||||
if (NOT SKIPPYTHON EQUAL 1)
|
||||
pkg_search_module(PYTHON3 QUIET python3)
|
||||
pkg_search_module(PYTHON3EMBED QUIET python3-embed)
|
||||
endif (NOT SKIPPYTHON EQUAL 1)
|
||||
|
||||
# If build on android cross, we need to init source and build.
|
||||
if (ANDROID)
|
||||
set(CFLAGS_EXTERNAL_LIB CFLAGS=--target=${CMAKE_C_COMPILER_TARGET})
|
||||
include(ExternalProject)
|
||||
endif (ANDROID)
|
||||
|
||||
if (NOT SKIPREADLINE EQUAL 1)
|
||||
if (APPLE)
|
||||
find_path(READLINE_INCLUDE_DIRS readline/readline.h /usr/local/opt/readline/include /opt/local/include /opt/include /usr/local/include /usr/include NO_DEFAULT_PATH)
|
||||
find_library(READLINE_LIBRARIES readline /usr/local/opt/readline/lib /opt/local/lib /opt/lib /usr/local/lib /usr/lib NO_DEFAULT_PATH)
|
||||
endif (APPLE)
|
||||
if (ANDROID)
|
||||
ExternalProject_Add(ncurses
|
||||
URL http://ftp.gnu.org/pub/gnu/ncurses/ncurses-6.0.tar.gz
|
||||
PREFIX deps/ncurses
|
||||
DOWNLOAD_DIR ${CMAKE_CURRENT_SOURCE_DIR}/deps/ncurses
|
||||
CONFIGURE_COMMAND ./configure CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER} LD=${CMAKE_C_COMPILER} AR=${CMAKE_AR} RANLIB=${CMAKE_RANLIB} ${CFLAGS_EXTERNAL_LIB} --host=arm
|
||||
BUILD_IN_SOURCE ON
|
||||
BUILD_COMMAND make -j2 libs
|
||||
INSTALL_COMMAND ""
|
||||
LOG_DOWNLOAD ON
|
||||
)
|
||||
ExternalProject_Add_StepTargets(ncurses configure build install)
|
||||
|
||||
ExternalProject_Add(readline
|
||||
URL ftp://ftp.gnu.org/gnu/readline/readline-7.0.tar.gz
|
||||
PREFIX deps/readline
|
||||
DOWNLOAD_DIR ${CMAKE_CURRENT_SOURCE_DIR}/deps/readline
|
||||
CONFIGURE_COMMAND ./configure CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER} LD=${CMAKE_C_COMPILER} AR=${CMAKE_AR} RANLIB=${CMAKE_RANLIB} ${CFLAGS_EXTERNAL_LIB} --host=arm --enable-static
|
||||
BUILD_IN_SOURCE ON
|
||||
BUILD_COMMAND make -j2
|
||||
INSTALL_COMMAND ""
|
||||
LOG_DOWNLOAD ON
|
||||
)
|
||||
ExternalProject_Add_StepTargets(readline configure build install)
|
||||
set(READLINE_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR}/deps/readline/src/)
|
||||
set(READLINE_LIBRARIES ${CMAKE_CURRENT_BINARY_DIR}/deps/readline/src/readline/libreadline.a ${CMAKE_CURRENT_BINARY_DIR}/deps/ncurses/src/ncurses/lib/libncurses.a)
|
||||
else (ANDROID)
|
||||
find_path(READLINE_INCLUDE_DIRS readline/readline.h)
|
||||
find_library(READLINE_LIBRARIES readline)
|
||||
endif (ANDROID)
|
||||
if (READLINE_INCLUDE_DIRS AND READLINE_LIBRARIES)
|
||||
set(READLINE_FOUND ON)
|
||||
endif (READLINE_INCLUDE_DIRS AND READLINE_LIBRARIES)
|
||||
endif (NOT SKIPREADLINE EQUAL 1)
|
||||
|
||||
if(ANDROID)
|
||||
set(BZIP2_BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}/deps/bzip2/src/bzip2)
|
||||
ExternalProject_Add(bzip2
|
||||
GIT_REPOSITORY https://android.googlesource.com/platform/external/bzip2
|
||||
GIT_TAG platform-tools-30.0.2
|
||||
PREFIX deps/bzip2
|
||||
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/deps/bzip2
|
||||
CONFIGURE_COMMAND mkdir -p ${BZIP2_BUILD_DIR} && git archive --format tar HEAD | tar -C ${BZIP2_BUILD_DIR} -x
|
||||
BUILD_IN_SOURCE ON
|
||||
BUILD_COMMAND make -C ${BZIP2_BUILD_DIR} -j4 CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER} LD=${CMAKE_C_COMPILER} AR=${CMAKE_AR} RANLIB=${CMAKE_RANLIB} ${CFLAGS_EXTERNAL_LIB} libbz2.a
|
||||
INSTALL_COMMAND ""
|
||||
LOG_DOWNLOAD ON
|
||||
)
|
||||
ExternalProject_Add_StepTargets(bzip2 configure build install)
|
||||
set(BZIP2_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR}/deps/bzip2/src/bzip2)
|
||||
set(BZIP2_LIBRARIES ${CMAKE_CURRENT_BINARY_DIR}/deps/bzip2/src/bzip2/libbz2.a)
|
||||
else()
|
||||
set(BZIP2_LIBRARIES bz2)
|
||||
endif(ANDROID)
|
||||
if (BZIP2_LIBRARIES)
|
||||
set(BZIP2_FOUND ON)
|
||||
endif (BZIP2_LIBRARIES)
|
||||
|
||||
add_subdirectory(${PM3_ROOT}/client/deps deps)
|
||||
|
||||
set (TARGET_SOURCES
|
||||
${PM3_ROOT}/common/commonutil.c
|
||||
${PM3_ROOT}/common/util_posix.c
|
||||
${PM3_ROOT}/common/parity.c
|
||||
${PM3_ROOT}/common/bucketsort.c
|
||||
${PM3_ROOT}/common/crapto1/crapto1.c
|
||||
${PM3_ROOT}/common/crapto1/crypto1.c
|
||||
${PM3_ROOT}/common/crc.c
|
||||
${PM3_ROOT}/common/crc16.c
|
||||
${PM3_ROOT}/common/crc32.c
|
||||
${PM3_ROOT}/common/crc64.c
|
||||
${PM3_ROOT}/common/lfdemod.c
|
||||
${PM3_ROOT}/common/legic_prng.c
|
||||
${PM3_ROOT}/common/iso15693tools.c
|
||||
${PM3_ROOT}/common/cardhelper.c
|
||||
${PM3_ROOT}/common/generator.c
|
||||
${PM3_ROOT}/client/src/crypto/asn1dump.c
|
||||
${PM3_ROOT}/client/src/crypto/asn1utils.c
|
||||
${PM3_ROOT}/client/src/crypto/libpcrypto.c
|
||||
${PM3_ROOT}/client/src/emv/test/cda_test.c
|
||||
${PM3_ROOT}/client/src/emv/test/crypto_test.c
|
||||
${PM3_ROOT}/client/src/emv/test/cryptotest.c
|
||||
${PM3_ROOT}/client/src/emv/test/dda_test.c
|
||||
${PM3_ROOT}/client/src/emv/test/sda_test.c
|
||||
${PM3_ROOT}/client/src/emv/apduinfo.c
|
||||
${PM3_ROOT}/client/src/emv/cmdemv.c
|
||||
${PM3_ROOT}/client/src/emv/crypto.c
|
||||
${PM3_ROOT}/client/src/emv/crypto_polarssl.c
|
||||
${PM3_ROOT}/client/src/emv/dol.c
|
||||
${PM3_ROOT}/client/src/emv/dump.c
|
||||
${PM3_ROOT}/client/src/emv/emv_pk.c
|
||||
${PM3_ROOT}/client/src/emv/emv_pki.c
|
||||
${PM3_ROOT}/client/src/emv/emv_pki_priv.c
|
||||
${PM3_ROOT}/client/src/emv/emv_roca.c
|
||||
${PM3_ROOT}/client/src/emv/emv_tags.c
|
||||
${PM3_ROOT}/client/src/emv/emvcore.c
|
||||
${PM3_ROOT}/client/src/emv/emvjson.c
|
||||
${PM3_ROOT}/client/src/emv/tlv.c
|
||||
${PM3_ROOT}/client/src/fido/additional_ca.c
|
||||
${PM3_ROOT}/client/src/fido/cbortools.c
|
||||
${PM3_ROOT}/client/src/fido/cose.c
|
||||
${PM3_ROOT}/client/src/fido/fidocore.c
|
||||
${PM3_ROOT}/client/src/loclass/cipher.c
|
||||
${PM3_ROOT}/client/src/loclass/cipherutils.c
|
||||
${PM3_ROOT}/client/src/loclass/elite_crack.c
|
||||
${PM3_ROOT}/client/src/loclass/hash1_brute.c
|
||||
${PM3_ROOT}/client/src/loclass/ikeys.c
|
||||
${PM3_ROOT}/client/src/mifare/mad.c
|
||||
${PM3_ROOT}/client/src/mifare/mfkey.c
|
||||
${PM3_ROOT}/client/src/mifare/mifare4.c
|
||||
${PM3_ROOT}/client/src/mifare/mifaredefault.c
|
||||
${PM3_ROOT}/client/src/mifare/mifarehost.c
|
||||
${PM3_ROOT}/client/src/mifare/ndef.c
|
||||
${PM3_ROOT}/client/src/mifare/desfire_crypto.c
|
||||
${PM3_ROOT}/client/src/uart/uart_posix.c
|
||||
${PM3_ROOT}/client/src/uart/uart_win32.c
|
||||
${PM3_ROOT}/client/src/ui/overlays.ui
|
||||
${PM3_ROOT}/client/src/aidsearch.c
|
||||
${PM3_ROOT}/client/src/cmdanalyse.c
|
||||
${PM3_ROOT}/client/src/cmdcrc.c
|
||||
${PM3_ROOT}/client/src/cmddata.c
|
||||
${PM3_ROOT}/client/src/cmdflashmem.c
|
||||
${PM3_ROOT}/client/src/cmdflashmemspiffs.c
|
||||
${PM3_ROOT}/client/src/cmdhf.c
|
||||
${PM3_ROOT}/client/src/cmdhf14a.c
|
||||
${PM3_ROOT}/client/src/cmdhf14b.c
|
||||
${PM3_ROOT}/client/src/cmdhf15.c
|
||||
${PM3_ROOT}/client/src/cmdhfcryptorf.c
|
||||
${PM3_ROOT}/client/src/cmdhfepa.c
|
||||
${PM3_ROOT}/client/src/cmdhffelica.c
|
||||
${PM3_ROOT}/client/src/cmdhffido.c
|
||||
${PM3_ROOT}/client/src/cmdhficlass.c
|
||||
${PM3_ROOT}/client/src/cmdhflegic.c
|
||||
${PM3_ROOT}/client/src/cmdhflist.c
|
||||
${PM3_ROOT}/client/src/cmdhflto.c
|
||||
${PM3_ROOT}/client/src/cmdhfmf.c
|
||||
${PM3_ROOT}/client/src/cmdhfmfdes.c
|
||||
${PM3_ROOT}/client/src/cmdhfmfhard.c
|
||||
${PM3_ROOT}/client/src/cmdhfmfp.c
|
||||
${PM3_ROOT}/client/src/cmdhfmfu.c
|
||||
${PM3_ROOT}/client/src/cmdhfthinfilm.c
|
||||
${PM3_ROOT}/client/src/cmdhftopaz.c
|
||||
${PM3_ROOT}/client/src/cmdhw.c
|
||||
${PM3_ROOT}/client/src/cmdlf.c
|
||||
${PM3_ROOT}/client/src/cmdlfawid.c
|
||||
${PM3_ROOT}/client/src/cmdlfcotag.c
|
||||
${PM3_ROOT}/client/src/cmdlfem4x.c
|
||||
${PM3_ROOT}/client/src/cmdlffdx.c
|
||||
${PM3_ROOT}/client/src/cmdlfgallagher.c
|
||||
${PM3_ROOT}/client/src/cmdlfguard.c
|
||||
${PM3_ROOT}/client/src/cmdlfhid.c
|
||||
${PM3_ROOT}/client/src/cmdlfhitag.c
|
||||
${PM3_ROOT}/client/src/cmdlfindala.c
|
||||
${PM3_ROOT}/client/src/cmdlfio.c
|
||||
${PM3_ROOT}/client/src/cmdlfjablotron.c
|
||||
${PM3_ROOT}/client/src/cmdlfkeri.c
|
||||
${PM3_ROOT}/client/src/cmdlfmotorola.c
|
||||
${PM3_ROOT}/client/src/cmdlfnedap.c
|
||||
${PM3_ROOT}/client/src/cmdlfnexwatch.c
|
||||
${PM3_ROOT}/client/src/cmdlfnoralsy.c
|
||||
${PM3_ROOT}/client/src/cmdlfpac.c
|
||||
${PM3_ROOT}/client/src/cmdlfparadox.c
|
||||
${PM3_ROOT}/client/src/cmdlfpcf7931.c
|
||||
${PM3_ROOT}/client/src/cmdlfpresco.c
|
||||
${PM3_ROOT}/client/src/cmdlfpyramid.c
|
||||
${PM3_ROOT}/client/src/cmdlfsecurakey.c
|
||||
${PM3_ROOT}/client/src/cmdlft55xx.c
|
||||
${PM3_ROOT}/client/src/cmdlfti.c
|
||||
${PM3_ROOT}/client/src/cmdlfverichip.c
|
||||
${PM3_ROOT}/client/src/cmdlfviking.c
|
||||
${PM3_ROOT}/client/src/cmdlfvisa2000.c
|
||||
${PM3_ROOT}/client/src/cmdmain.c
|
||||
${PM3_ROOT}/client/src/cmdparser.c
|
||||
${PM3_ROOT}/client/src/cmdscript.c
|
||||
${PM3_ROOT}/client/src/cmdsmartcard.c
|
||||
${PM3_ROOT}/client/src/cmdtrace.c
|
||||
${PM3_ROOT}/client/src/cmdusart.c
|
||||
${PM3_ROOT}/client/src/cmdwiegand.c
|
||||
${PM3_ROOT}/client/src/comms.c
|
||||
${PM3_ROOT}/client/src/fileutils.c
|
||||
${PM3_ROOT}/client/src/flash.c
|
||||
${PM3_ROOT}/client/src/graph.c
|
||||
${PM3_ROOT}/client/src/jansson_path.c
|
||||
${PM3_ROOT}/client/src/preferences.c
|
||||
${PM3_ROOT}/client/src/pm3_binlib.c
|
||||
${PM3_ROOT}/client/src/pm3_bitlib.c
|
||||
${PM3_ROOT}/client/src/prng.c
|
||||
${PM3_ROOT}/client/src/scandir.c
|
||||
${PM3_ROOT}/client/src/scripting.c
|
||||
${PM3_ROOT}/client/src/tea.c
|
||||
${PM3_ROOT}/client/src/ui.c
|
||||
${PM3_ROOT}/client/src/util.c
|
||||
${PM3_ROOT}/client/src/wiegand_formats.c
|
||||
${PM3_ROOT}/client/src/wiegand_formatutils.c
|
||||
${CMAKE_BINARY_DIR}/version.c
|
||||
)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${CMAKE_BINARY_DIR}/version.c
|
||||
COMMAND sh ${PM3_ROOT}/tools/mkversion.sh > ${CMAKE_BINARY_DIR}/version.c || perl ${PM3_ROOT}/tools/mkversion.pl > ${CMAKE_BINARY_DIR}/version.c || ${CMAKE_COMMAND} -E copy ${PM3_ROOT}/common/default_version.c ${CMAKE_BINARY_DIR}/version.c
|
||||
DEPENDS ${PM3_ROOT}/common/default_version.c
|
||||
)
|
||||
|
||||
set(ADDITIONAL_SRC "")
|
||||
set(ADDITIONAL_LNK "")
|
||||
set(ADDITIONAL_DIRS "")
|
||||
set(ADDITIONAL_LNKDIRS "")
|
||||
set(X86_CPUS x86 x86_64 i686)
|
||||
|
||||
message(STATUS "CMAKE_SYSTEM_PROCESSOR := ${CMAKE_SYSTEM_PROCESSOR}")
|
||||
|
||||
if (APPLE)
|
||||
message("Apple device detected.")
|
||||
set(ADDITIONAL_SRC ${PM3_ROOT}/client/src/util_darwin.h ${PM3_ROOT}/client/src/util_darwin.m ${ADDITIONAL_SRC})
|
||||
set(ADDITIONAL_LNK "-framework Foundation" "-framework AppKit")
|
||||
endif (APPLE)
|
||||
|
||||
if ((NOT SKIPQT EQUAL 1) AND (Qt5_FOUND))
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
set (TARGET_SOURCES
|
||||
${PM3_ROOT}/client/src/proxgui.cpp
|
||||
${PM3_ROOT}/client/src/proxguiqt.cpp
|
||||
${TARGET_SOURCES})
|
||||
|
||||
add_definitions("-DHAVE_GUI")
|
||||
set(ADDITIONAL_LNK ${Qt5_LIBRARIES} ${ADDITIONAL_LNK})
|
||||
else ((NOT SKIPQT EQUAL 1) AND (Qt5_FOUND))
|
||||
set(TARGET_SOURCES
|
||||
${PM3_ROOT}/client/src/guidummy.cpp
|
||||
${TARGET_SOURCES})
|
||||
endif ((NOT SKIPQT EQUAL 1) AND (Qt5_FOUND))
|
||||
|
||||
if (NOT SKIPBT EQUAL 1)
|
||||
if (BLUEZ_FOUND)
|
||||
add_definitions("-DHAVE_BLUEZ")
|
||||
set(ADDITIONAL_LNK ${BLUEZ_LIBRARIES} ${ADDITIONAL_LNK})
|
||||
endif (BLUEZ_FOUND)
|
||||
endif(NOT SKIPBT EQUAL 1)
|
||||
|
||||
if (NOT SKIPPYTHON EQUAL 1)
|
||||
if (PYTHON3EMBED_FOUND)
|
||||
add_definitions(-DHAVE_PYTHON)
|
||||
set(ADDITIONAL_DIRS ${PYTHON3EMBED_INCLUDE_DIRS} ${ADDITIONAL_DIRS})
|
||||
set(ADDITIONAL_LNK ${PYTHON3EMBED_LIBRARIES} ${ADDITIONAL_LNK})
|
||||
set(ADDITIONAL_LNKDIRS ${PYTHON3EMBED_LIBRARY_DIRS} ${ADDITIONAL_LNKDIRS})
|
||||
elseif (PYTHON3_FOUND)
|
||||
add_definitions(-DHAVE_PYTHON)
|
||||
set(ADDITIONAL_DIRS ${PYTHON3_INCLUDE_DIRS} ${ADDITIONAL_DIRS})
|
||||
set(ADDITIONAL_LNK ${PYTHON3_LIBRARIES} ${ADDITIONAL_LNK})
|
||||
set(ADDITIONAL_LNKDIRS ${PYTHON3_LIBRARY_DIRS} ${ADDITIONAL_LNKDIRS})
|
||||
endif (PYTHON3EMBED_FOUND)
|
||||
endif (NOT SKIPPYTHON EQUAL 1)
|
||||
|
||||
if (NOT SKIPREADLINE EQUAL 1)
|
||||
if (READLINE_FOUND)
|
||||
add_definitions("-DHAVE_READLINE")
|
||||
set(ADDITIONAL_DIRS ${READLINE_INCLUDE_DIRS} ${ADDITIONAL_DIRS})
|
||||
set(ADDITIONAL_LNK ${READLINE_LIBRARIES} ${ADDITIONAL_LNK})
|
||||
endif (READLINE_FOUND)
|
||||
endif(NOT SKIPREADLINE EQUAL 1)
|
||||
if (BZIP2_FOUND)
|
||||
set(ADDITIONAL_DIRS ${BZIP2_INCLUDE_DIRS} ${ADDITIONAL_DIRS})
|
||||
set(ADDITIONAL_LNK ${BZIP2_LIBRARIES} ${ADDITIONAL_LNK})
|
||||
else (BZIP2_FOUND)
|
||||
message(FATAL_ERROR "Bzip2 not found")
|
||||
endif (BZIP2_FOUND)
|
||||
|
||||
message("===================================================================")
|
||||
if (SKIPQT EQUAL 1)
|
||||
message("GUI support: skipped")
|
||||
else (SKIPQT EQUAL 1)
|
||||
if (Qt5_FOUND)
|
||||
message("GUI support: QT5 found, enabled")
|
||||
else (Qt5_FOUND)
|
||||
message("GUI support: QT5 not found, disabled")
|
||||
endif (Qt5_FOUND)
|
||||
endif (SKIPQT EQUAL 1)
|
||||
|
||||
if (SKIPBT EQUAL 1)
|
||||
message("native BT support: skipped")
|
||||
else (SKIPBT EQUAL 1)
|
||||
if (BLUEZ_FOUND)
|
||||
message("native BT support: Bluez found, enabled")
|
||||
else (BLUEZ_FOUND)
|
||||
message("native BT support: Bluez not found, disabled")
|
||||
endif (BLUEZ_FOUND)
|
||||
endif(SKIPBT EQUAL 1)
|
||||
|
||||
if (SKIPPYTHON EQUAL 1)
|
||||
message("Python3 library: skipped")
|
||||
else (SKIPPYTHON EQUAL 1)
|
||||
if (PYTHON3EMBED_FOUND)
|
||||
message("Python3 library: Python3 embed found, enabled")
|
||||
elseif (PYTHON_FOUND)
|
||||
message("Python3 library: Python3 found, enabled")
|
||||
else (PYTHON3EMBED_FOUND)
|
||||
message("Python3 library: Python3 not found, disabled")
|
||||
endif (PYTHON3EMBED_FOUND)
|
||||
endif(SKIPPYTHON EQUAL 1)
|
||||
|
||||
if (SKIPREADLINE EQUAL 1)
|
||||
message("Readline library: skipped")
|
||||
else (SKIPREADLINE EQUAL 1)
|
||||
if (READLINE_FOUND)
|
||||
message("Readline library: enabled")
|
||||
else (READLINE_FOUND)
|
||||
message("Readline library: Readline not found, disabled")
|
||||
endif (READLINE_FOUND)
|
||||
endif(SKIPREADLINE EQUAL 1)
|
||||
message("===================================================================")
|
||||
|
||||
# Lua SWIG
|
||||
if (EXISTS ${PM3_ROOT}/client/src/pm3_luawrap.c)
|
||||
set (TARGET_SOURCES
|
||||
${PM3_ROOT}/client/src/pm3_luawrap.c
|
||||
${TARGET_SOURCES})
|
||||
add_definitions(-DHAVE_LUA_SWIG)
|
||||
message("Lua SWIG wrapper found")
|
||||
endif (EXISTS ${PM3_ROOT}/client/src/pm3_luawrap.c)
|
||||
|
||||
# Python SWIG
|
||||
if (NOT SKIPPYTHON EQUAL 1)
|
||||
if (PYTHON3EMBED_FOUND OR PYTHON3_FOUND)
|
||||
if (EXISTS ${PM3_ROOT}/client/src/pm3_pywrap.c)
|
||||
set (TARGET_SOURCES
|
||||
${PM3_ROOT}/client/src/pm3_pywrap.c
|
||||
${TARGET_SOURCES})
|
||||
add_definitions(-DHAVE_PYTHON_SWIG)
|
||||
message("Python SWIG wrapper found")
|
||||
endif (EXISTS ${PM3_ROOT}/client/src/pm3_pywrap.c)
|
||||
endif (PYTHON3EMBED_FOUND OR PYTHON3_FOUND)
|
||||
endif (NOT SKIPPYTHON EQUAL 1)
|
||||
|
||||
add_executable(proxmark3
|
||||
${PM3_ROOT}/client/src/proxmark3.c
|
||||
${TARGET_SOURCES}
|
||||
${ADDITIONAL_SRC}
|
||||
)
|
||||
|
||||
target_compile_options(proxmark3 PUBLIC -Wall -Werror -O3)
|
||||
if (ANDROID)
|
||||
if (NOT SKIPREADLINE EQUAL 1)
|
||||
add_dependencies(proxmark3 ncurses readline)
|
||||
endif (NOT SKIPREADLINE EQUAL 1)
|
||||
add_dependencies(proxmark3 bzip2)
|
||||
endif (ANDROID)
|
||||
|
||||
if (MINGW)
|
||||
# Mingw uses by default Microsoft printf, we want the GNU printf (e.g. for %z)
|
||||
# and setting _ISOC99_SOURCE sets internally __USE_MINGW_ANSI_STDIO=1
|
||||
# FTR __USE_MINGW_ANSI_STDIO seems deprecated in Mingw32
|
||||
# but not Mingw64 https://fr.osdn.net/projects/mingw/lists/archive/users/2019-January/000199.html
|
||||
target_compile_definitions(proxmark3 PRIVATE _ISOC99_SOURCE)
|
||||
|
||||
set(CMAKE_C_FLAGS "-mno-ms-bitfields -fexec-charset=cp850 ${CMAKE_C_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS "-mno-ms-bitfields -fexec-charset=cp850 ${CMAKE_CXX_FLAGS}")
|
||||
endif (MINGW)
|
||||
|
||||
target_include_directories(proxmark3 PRIVATE
|
||||
${PM3_ROOT}/common
|
||||
${PM3_ROOT}/common_fpga
|
||||
${PM3_ROOT}/include
|
||||
${PM3_ROOT}/client/src
|
||||
${PM3_ROOT}/client/include
|
||||
${ADDITIONAL_DIRS}
|
||||
)
|
||||
|
||||
if (NOT APPLE)
|
||||
# required for Raspberry Pi, but breaks with clang (OSX). Need to be at the end of the linker line.
|
||||
set(ADDITIONAL_LNK ${ADDITIONAL_LNK} -Wl,--as-needed -latomic -Wl,--no-as-needed)
|
||||
endif (NOT APPLE)
|
||||
|
||||
|
||||
find_library(pm3rrg_rdv4_cliparser REQUIRED)
|
||||
find_library(pm3rrg_rdv4_jansson REQUIRED)
|
||||
find_library(pm3rrg_rdv4_tinycbor REQUIRED)
|
||||
find_library(pm3rrg_rdv4_lua REQUIRED)
|
||||
find_library(pm3rrg_rdv4_mbedtls REQUIRED)
|
||||
find_library(pm3rrg_rdv4_reveng REQUIRED)
|
||||
find_library(pm3rrg_rdv4_hardnested REQUIRED)
|
||||
find_library(pm3rrg_rdv4_whereami REQUIRED)
|
||||
|
||||
target_link_libraries(proxmark3 PRIVATE
|
||||
m
|
||||
pm3rrg_rdv4_mbedtls
|
||||
pm3rrg_rdv4_cliparser
|
||||
pm3rrg_rdv4_jansson
|
||||
pm3rrg_rdv4_lua
|
||||
pm3rrg_rdv4_tinycbor
|
||||
pm3rrg_rdv4_amiibo
|
||||
pm3rrg_rdv4_reveng
|
||||
pm3rrg_rdv4_hardnested
|
||||
pm3rrg_rdv4_whereami
|
||||
${ADDITIONAL_LNK})
|
||||
|
||||
if (NOT SKIPPTHREAD EQUAL 1)
|
||||
target_link_libraries(proxmark3 PRIVATE pthread)
|
||||
endif (NOT SKIPPTHREAD EQUAL 1)
|
||||
|
||||
if (NOT SKIPPYTHON EQUAL 1)
|
||||
# OSX have a hard time compiling python3 dependency with older cmake.
|
||||
if (PYTHON3EMBED_FOUND OR PYTHON3_FOUND)
|
||||
if (NOT CMAKE_VERSION VERSION_LESS 3.13)
|
||||
target_link_directories(proxmark3 PRIVATE ${ADDITIONAL_LNKDIRS})
|
||||
elseif (APPLE)
|
||||
message( SEND_ERROR "Your CMAKE version is too old for Apple platform, please update to a version >=3.13" )
|
||||
endif (NOT CMAKE_VERSION VERSION_LESS 3.13)
|
||||
endif (PYTHON3EMBED_FOUND OR PYTHON3_FOUND)
|
||||
endif (NOT SKIPPYTHON EQUAL 1)
|
||||
|
||||
install(TARGETS proxmark3 DESTINATION "bin")
|
||||
install(DIRECTORY cmdscripts lualibs luascripts pyscripts resources dictionaries DESTINATION "share/proxmark3")
|
||||
|
||||
add_custom_command(OUTPUT lualibs/pm3_cmd.lua
|
||||
COMMAND "awk -f pm3_cmd_h2lua.awk ../include/pm3_cmd.h > lualibs/pm3_cmd.lua"
|
||||
COMMENT "Creating lualibs/pm3_cmd.lua"
|
||||
)
|
||||
|
||||
add_custom_command(OUTPUT lualibs/mfc_default_keys.lua
|
||||
COMMAND "awk -f default_keys_dic2lua.awk mfc_default_keys.dic > lualibs/mfc_default_keys.lua"
|
||||
COMMENT "Creating lualibs/mfc_default_keys.lua"
|
||||
)
|
||||
|
||||
#"make package" will trigger this
|
||||
SET(CPACK_GENERATOR "DEB")
|
||||
SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "Iceman")
|
||||
INCLUDE(CPack)
|
||||
Executable
+3
@@ -0,0 +1,3 @@
|
||||
local pm3 = require("pm3")
|
||||
p=pm3.get_current_dev()
|
||||
pm3.console(p, "hw status")
|
||||
Executable
+12
@@ -0,0 +1,12 @@
|
||||
import sys
|
||||
import pm3
|
||||
|
||||
def main():
|
||||
print('Hello world')
|
||||
#p=pm3.open("/dev/ttyACM0")
|
||||
p=pm3.get_current_dev()
|
||||
pm3.console(p, "hw status")
|
||||
#pm3.close(p)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,23 @@
|
||||
#ifndef LIBPM3_H
|
||||
#define LIBPM3_H
|
||||
|
||||
#ifdef SWIG
|
||||
%module pm3
|
||||
%{
|
||||
/* Include the header in the wrapper code */
|
||||
#include "pm3.h"
|
||||
%}
|
||||
|
||||
/* Strip "pm3_" from API functions for SWIG */
|
||||
%rename("%(strip:[pm3_])s") "";
|
||||
%feature("immutable","1") pm3_current_dev;
|
||||
|
||||
/* Parse the header file to generate wrappers */
|
||||
#endif
|
||||
|
||||
typedef struct pm3_device pm3_device;
|
||||
pm3_device* pm3_open(char *port);
|
||||
int pm3_console(pm3_device* dev, char *cmd);
|
||||
void pm3_close(pm3_device* dev);
|
||||
pm3_device* pm3_get_current_dev(void);
|
||||
#endif
|
||||
@@ -0,0 +1 @@
|
||||
build/
|
||||
Executable
+10
@@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
rm -rf build
|
||||
mkdir build
|
||||
(
|
||||
cd build
|
||||
cmake ..
|
||||
make -j
|
||||
)
|
||||
|
||||
@@ -0,0 +1,481 @@
|
||||
# MINGW:
|
||||
# On ProxSpace 3.4:
|
||||
# cmake -G"MSYS Makefiles" ..
|
||||
# On Proxspace 3.3 or less, you need to install cmake:
|
||||
# pacman -S mingw-w64-x86_64-cmake
|
||||
# /mingw64/bin/cmake -G"MSYS Makefiles" ..
|
||||
#
|
||||
# Android cross-compilation:
|
||||
# cmake \
|
||||
# -DCMAKE_TOOLCHAIN_FILE=<path-to-your-android-ndk>/build/cmake/android.toolchain.cmake \
|
||||
# -DANDROID_ABI=armeabi-v7a \
|
||||
# -DANDROID_NATIVE_API_LEVEL=android-19 \
|
||||
# -DSKIPBT=1 -DSKIPPYTHON=1 -DSKIPPTHREAD=1 ..
|
||||
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
project(proxmark3)
|
||||
SET (PM3_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../..)
|
||||
|
||||
if(CMAKE_VERSION VERSION_LESS "3.7.0")
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
endif()
|
||||
|
||||
if (NOT SKIPQT EQUAL 1)
|
||||
if(APPLE AND EXISTS /usr/local/opt/qt5)
|
||||
# Homebrew installs Qt5 (up to at least 5.11.0) in
|
||||
# /usr/local/qt5. Ensure that it can be found by CMake
|
||||
# since it is not in the default /usr/local prefix.
|
||||
# Add it to PATHS so that it doesn't override the
|
||||
# CMAKE_PREFIX_PATH environment variable.
|
||||
# QT_FIND_PACKAGE_OPTIONS should be passed to find_package,
|
||||
# e.g. find_package(Qt5Core ${QT_FIND_PACKAGE_OPTIONS})
|
||||
list(APPEND QT_FIND_PACKAGE_OPTIONS PATHS /usr/local/opt/qt5)
|
||||
endif(APPLE AND EXISTS /usr/local/opt/qt5)
|
||||
set(QT_PACKAGELIST
|
||||
Qt5Core
|
||||
Qt5Widgets
|
||||
Qt5Gui
|
||||
)
|
||||
set(Qt5_FOUND ON)
|
||||
foreach(_qt_package IN LISTS QT_PACKAGELIST)
|
||||
find_package(${_qt_package} QUIET ${QT_FIND_PACKAGE_OPTIONS})
|
||||
set(Qt5_LIBRARIES ${${_qt_package}_LIBRARIES} ${Qt5_LIBRARIES})
|
||||
if(NOT ${_qt_package}_FOUND)
|
||||
set(Qt5_FOUND OFF)
|
||||
endif(NOT ${_qt_package}_FOUND)
|
||||
endforeach()
|
||||
endif (NOT SKIPQT EQUAL 1)
|
||||
|
||||
find_package(PkgConfig)
|
||||
if (NOT SKIPBT EQUAL 1)
|
||||
pkg_search_module(BLUEZ QUIET bluez)
|
||||
endif (NOT SKIPBT EQUAL 1)
|
||||
|
||||
if (NOT SKIPPYTHON EQUAL 1)
|
||||
pkg_search_module(PYTHON3 QUIET python3)
|
||||
pkg_search_module(PYTHON3EMBED QUIET python3-embed)
|
||||
endif (NOT SKIPPYTHON EQUAL 1)
|
||||
|
||||
# If build on android cross, we need to init source and build.
|
||||
if (ANDROID)
|
||||
set(CFLAGS_EXTERNAL_LIB CFLAGS=--target=${CMAKE_C_COMPILER_TARGET})
|
||||
include(ExternalProject)
|
||||
endif (ANDROID)
|
||||
|
||||
if (NOT SKIPREADLINE EQUAL 1)
|
||||
if (APPLE)
|
||||
find_path(READLINE_INCLUDE_DIRS readline/readline.h /usr/local/opt/readline/include /opt/local/include /opt/include /usr/local/include /usr/include NO_DEFAULT_PATH)
|
||||
find_library(READLINE_LIBRARIES readline /usr/local/opt/readline/lib /opt/local/lib /opt/lib /usr/local/lib /usr/lib NO_DEFAULT_PATH)
|
||||
endif (APPLE)
|
||||
if (ANDROID)
|
||||
ExternalProject_Add(ncurses
|
||||
URL http://ftp.gnu.org/pub/gnu/ncurses/ncurses-6.0.tar.gz
|
||||
PREFIX deps/ncurses
|
||||
DOWNLOAD_DIR ${CMAKE_CURRENT_SOURCE_DIR}/deps/ncurses
|
||||
CONFIGURE_COMMAND ./configure CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER} LD=${CMAKE_C_COMPILER} AR=${CMAKE_AR} RANLIB=${CMAKE_RANLIB} ${CFLAGS_EXTERNAL_LIB} --host=arm
|
||||
BUILD_IN_SOURCE ON
|
||||
BUILD_COMMAND make -j2 libs
|
||||
INSTALL_COMMAND ""
|
||||
LOG_DOWNLOAD ON
|
||||
)
|
||||
ExternalProject_Add_StepTargets(ncurses configure build install)
|
||||
|
||||
ExternalProject_Add(readline
|
||||
URL ftp://ftp.gnu.org/gnu/readline/readline-7.0.tar.gz
|
||||
PREFIX deps/readline
|
||||
DOWNLOAD_DIR ${CMAKE_CURRENT_SOURCE_DIR}/deps/readline
|
||||
CONFIGURE_COMMAND ./configure CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER} LD=${CMAKE_C_COMPILER} AR=${CMAKE_AR} RANLIB=${CMAKE_RANLIB} ${CFLAGS_EXTERNAL_LIB} --host=arm --enable-static
|
||||
BUILD_IN_SOURCE ON
|
||||
BUILD_COMMAND make -j2
|
||||
INSTALL_COMMAND ""
|
||||
LOG_DOWNLOAD ON
|
||||
)
|
||||
ExternalProject_Add_StepTargets(readline configure build install)
|
||||
set(READLINE_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR}/deps/readline/src/)
|
||||
set(READLINE_LIBRARIES ${CMAKE_CURRENT_BINARY_DIR}/deps/readline/src/readline/libreadline.a ${CMAKE_CURRENT_BINARY_DIR}/deps/ncurses/src/ncurses/lib/libncurses.a)
|
||||
else (ANDROID)
|
||||
find_path(READLINE_INCLUDE_DIRS readline/readline.h)
|
||||
find_library(READLINE_LIBRARIES readline)
|
||||
endif (ANDROID)
|
||||
if (READLINE_INCLUDE_DIRS AND READLINE_LIBRARIES)
|
||||
set(READLINE_FOUND ON)
|
||||
endif (READLINE_INCLUDE_DIRS AND READLINE_LIBRARIES)
|
||||
endif (NOT SKIPREADLINE EQUAL 1)
|
||||
|
||||
if(ANDROID)
|
||||
set(BZIP2_BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}/deps/bzip2/src/bzip2)
|
||||
ExternalProject_Add(bzip2
|
||||
GIT_REPOSITORY https://android.googlesource.com/platform/external/bzip2
|
||||
GIT_TAG platform-tools-30.0.2
|
||||
PREFIX deps/bzip2
|
||||
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/deps/bzip2
|
||||
CONFIGURE_COMMAND mkdir -p ${BZIP2_BUILD_DIR} && git archive --format tar HEAD | tar -C ${BZIP2_BUILD_DIR} -x
|
||||
BUILD_IN_SOURCE ON
|
||||
BUILD_COMMAND make -C ${BZIP2_BUILD_DIR} -j4 CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER} LD=${CMAKE_C_COMPILER} AR=${CMAKE_AR} RANLIB=${CMAKE_RANLIB} ${CFLAGS_EXTERNAL_LIB} libbz2.a
|
||||
INSTALL_COMMAND ""
|
||||
LOG_DOWNLOAD ON
|
||||
)
|
||||
ExternalProject_Add_StepTargets(bzip2 configure build install)
|
||||
set(BZIP2_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR}/deps/bzip2/src/bzip2)
|
||||
set(BZIP2_LIBRARIES ${CMAKE_CURRENT_BINARY_DIR}/deps/bzip2/src/bzip2/libbz2.a)
|
||||
else()
|
||||
set(BZIP2_LIBRARIES bz2)
|
||||
endif(ANDROID)
|
||||
if (BZIP2_LIBRARIES)
|
||||
set(BZIP2_FOUND ON)
|
||||
endif (BZIP2_LIBRARIES)
|
||||
|
||||
add_subdirectory(${PM3_ROOT}/client/deps deps)
|
||||
|
||||
set (TARGET_SOURCES
|
||||
${PM3_ROOT}/common/commonutil.c
|
||||
${PM3_ROOT}/common/util_posix.c
|
||||
${PM3_ROOT}/common/parity.c
|
||||
${PM3_ROOT}/common/bucketsort.c
|
||||
${PM3_ROOT}/common/crapto1/crapto1.c
|
||||
${PM3_ROOT}/common/crapto1/crypto1.c
|
||||
${PM3_ROOT}/common/crc.c
|
||||
${PM3_ROOT}/common/crc16.c
|
||||
${PM3_ROOT}/common/crc32.c
|
||||
${PM3_ROOT}/common/crc64.c
|
||||
${PM3_ROOT}/common/lfdemod.c
|
||||
${PM3_ROOT}/common/legic_prng.c
|
||||
${PM3_ROOT}/common/iso15693tools.c
|
||||
${PM3_ROOT}/common/cardhelper.c
|
||||
${PM3_ROOT}/common/generator.c
|
||||
${PM3_ROOT}/client/src/crypto/asn1dump.c
|
||||
${PM3_ROOT}/client/src/crypto/asn1utils.c
|
||||
${PM3_ROOT}/client/src/crypto/libpcrypto.c
|
||||
${PM3_ROOT}/client/src/emv/test/cda_test.c
|
||||
${PM3_ROOT}/client/src/emv/test/crypto_test.c
|
||||
${PM3_ROOT}/client/src/emv/test/cryptotest.c
|
||||
${PM3_ROOT}/client/src/emv/test/dda_test.c
|
||||
${PM3_ROOT}/client/src/emv/test/sda_test.c
|
||||
${PM3_ROOT}/client/src/emv/apduinfo.c
|
||||
${PM3_ROOT}/client/src/emv/cmdemv.c
|
||||
${PM3_ROOT}/client/src/emv/crypto.c
|
||||
${PM3_ROOT}/client/src/emv/crypto_polarssl.c
|
||||
${PM3_ROOT}/client/src/emv/dol.c
|
||||
${PM3_ROOT}/client/src/emv/dump.c
|
||||
${PM3_ROOT}/client/src/emv/emv_pk.c
|
||||
${PM3_ROOT}/client/src/emv/emv_pki.c
|
||||
${PM3_ROOT}/client/src/emv/emv_pki_priv.c
|
||||
${PM3_ROOT}/client/src/emv/emv_roca.c
|
||||
${PM3_ROOT}/client/src/emv/emv_tags.c
|
||||
${PM3_ROOT}/client/src/emv/emvcore.c
|
||||
${PM3_ROOT}/client/src/emv/emvjson.c
|
||||
${PM3_ROOT}/client/src/emv/tlv.c
|
||||
${PM3_ROOT}/client/src/fido/additional_ca.c
|
||||
${PM3_ROOT}/client/src/fido/cbortools.c
|
||||
${PM3_ROOT}/client/src/fido/cose.c
|
||||
${PM3_ROOT}/client/src/fido/fidocore.c
|
||||
${PM3_ROOT}/client/src/loclass/cipher.c
|
||||
${PM3_ROOT}/client/src/loclass/cipherutils.c
|
||||
${PM3_ROOT}/client/src/loclass/elite_crack.c
|
||||
${PM3_ROOT}/client/src/loclass/hash1_brute.c
|
||||
${PM3_ROOT}/client/src/loclass/ikeys.c
|
||||
${PM3_ROOT}/client/src/mifare/mad.c
|
||||
${PM3_ROOT}/client/src/mifare/mfkey.c
|
||||
${PM3_ROOT}/client/src/mifare/mifare4.c
|
||||
${PM3_ROOT}/client/src/mifare/mifaredefault.c
|
||||
${PM3_ROOT}/client/src/mifare/mifarehost.c
|
||||
${PM3_ROOT}/client/src/mifare/ndef.c
|
||||
${PM3_ROOT}/client/src/mifare/desfire_crypto.c
|
||||
${PM3_ROOT}/client/src/uart/uart_posix.c
|
||||
${PM3_ROOT}/client/src/uart/uart_win32.c
|
||||
${PM3_ROOT}/client/src/ui/overlays.ui
|
||||
${PM3_ROOT}/client/src/aidsearch.c
|
||||
${PM3_ROOT}/client/src/cmdanalyse.c
|
||||
${PM3_ROOT}/client/src/cmdcrc.c
|
||||
${PM3_ROOT}/client/src/cmddata.c
|
||||
${PM3_ROOT}/client/src/cmdflashmem.c
|
||||
${PM3_ROOT}/client/src/cmdflashmemspiffs.c
|
||||
${PM3_ROOT}/client/src/cmdhf.c
|
||||
${PM3_ROOT}/client/src/cmdhf14a.c
|
||||
${PM3_ROOT}/client/src/cmdhf14b.c
|
||||
${PM3_ROOT}/client/src/cmdhf15.c
|
||||
${PM3_ROOT}/client/src/cmdhfcryptorf.c
|
||||
${PM3_ROOT}/client/src/cmdhfepa.c
|
||||
${PM3_ROOT}/client/src/cmdhffelica.c
|
||||
${PM3_ROOT}/client/src/cmdhffido.c
|
||||
${PM3_ROOT}/client/src/cmdhficlass.c
|
||||
${PM3_ROOT}/client/src/cmdhflegic.c
|
||||
${PM3_ROOT}/client/src/cmdhflist.c
|
||||
${PM3_ROOT}/client/src/cmdhflto.c
|
||||
${PM3_ROOT}/client/src/cmdhfmf.c
|
||||
${PM3_ROOT}/client/src/cmdhfmfdes.c
|
||||
${PM3_ROOT}/client/src/cmdhfmfhard.c
|
||||
${PM3_ROOT}/client/src/cmdhfmfp.c
|
||||
${PM3_ROOT}/client/src/cmdhfmfu.c
|
||||
${PM3_ROOT}/client/src/cmdhfthinfilm.c
|
||||
${PM3_ROOT}/client/src/cmdhftopaz.c
|
||||
${PM3_ROOT}/client/src/cmdhw.c
|
||||
${PM3_ROOT}/client/src/cmdlf.c
|
||||
${PM3_ROOT}/client/src/cmdlfawid.c
|
||||
${PM3_ROOT}/client/src/cmdlfcotag.c
|
||||
${PM3_ROOT}/client/src/cmdlfem4x.c
|
||||
${PM3_ROOT}/client/src/cmdlffdx.c
|
||||
${PM3_ROOT}/client/src/cmdlfgallagher.c
|
||||
${PM3_ROOT}/client/src/cmdlfguard.c
|
||||
${PM3_ROOT}/client/src/cmdlfhid.c
|
||||
${PM3_ROOT}/client/src/cmdlfhitag.c
|
||||
${PM3_ROOT}/client/src/cmdlfindala.c
|
||||
${PM3_ROOT}/client/src/cmdlfio.c
|
||||
${PM3_ROOT}/client/src/cmdlfjablotron.c
|
||||
${PM3_ROOT}/client/src/cmdlfkeri.c
|
||||
${PM3_ROOT}/client/src/cmdlfmotorola.c
|
||||
${PM3_ROOT}/client/src/cmdlfnedap.c
|
||||
${PM3_ROOT}/client/src/cmdlfnexwatch.c
|
||||
${PM3_ROOT}/client/src/cmdlfnoralsy.c
|
||||
${PM3_ROOT}/client/src/cmdlfpac.c
|
||||
${PM3_ROOT}/client/src/cmdlfparadox.c
|
||||
${PM3_ROOT}/client/src/cmdlfpcf7931.c
|
||||
${PM3_ROOT}/client/src/cmdlfpresco.c
|
||||
${PM3_ROOT}/client/src/cmdlfpyramid.c
|
||||
${PM3_ROOT}/client/src/cmdlfsecurakey.c
|
||||
${PM3_ROOT}/client/src/cmdlft55xx.c
|
||||
${PM3_ROOT}/client/src/cmdlfti.c
|
||||
${PM3_ROOT}/client/src/cmdlfverichip.c
|
||||
${PM3_ROOT}/client/src/cmdlfviking.c
|
||||
${PM3_ROOT}/client/src/cmdlfvisa2000.c
|
||||
${PM3_ROOT}/client/src/cmdmain.c
|
||||
${PM3_ROOT}/client/src/cmdparser.c
|
||||
${PM3_ROOT}/client/src/cmdscript.c
|
||||
${PM3_ROOT}/client/src/cmdsmartcard.c
|
||||
${PM3_ROOT}/client/src/cmdtrace.c
|
||||
${PM3_ROOT}/client/src/cmdusart.c
|
||||
${PM3_ROOT}/client/src/cmdwiegand.c
|
||||
${PM3_ROOT}/client/src/comms.c
|
||||
${PM3_ROOT}/client/src/fileutils.c
|
||||
${PM3_ROOT}/client/src/flash.c
|
||||
${PM3_ROOT}/client/src/graph.c
|
||||
${PM3_ROOT}/client/src/jansson_path.c
|
||||
${PM3_ROOT}/client/src/preferences.c
|
||||
${PM3_ROOT}/client/src/pm3_binlib.c
|
||||
${PM3_ROOT}/client/src/pm3_bitlib.c
|
||||
${PM3_ROOT}/client/src/prng.c
|
||||
${PM3_ROOT}/client/src/scandir.c
|
||||
${PM3_ROOT}/client/src/scripting.c
|
||||
${PM3_ROOT}/client/src/tea.c
|
||||
${PM3_ROOT}/client/src/ui.c
|
||||
${PM3_ROOT}/client/src/util.c
|
||||
${PM3_ROOT}/client/src/wiegand_formats.c
|
||||
${PM3_ROOT}/client/src/wiegand_formatutils.c
|
||||
${CMAKE_BINARY_DIR}/version.c
|
||||
)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${CMAKE_BINARY_DIR}/version.c
|
||||
COMMAND sh ${PM3_ROOT}/tools/mkversion.sh > ${CMAKE_BINARY_DIR}/version.c || perl ${PM3_ROOT}/tools/mkversion.pl > ${CMAKE_BINARY_DIR}/version.c || ${CMAKE_COMMAND} -E copy ${PM3_ROOT}/common/default_version.c ${CMAKE_BINARY_DIR}/version.c
|
||||
DEPENDS ${PM3_ROOT}/common/default_version.c
|
||||
)
|
||||
|
||||
set(ADDITIONAL_SRC "")
|
||||
set(ADDITIONAL_LNK "")
|
||||
set(ADDITIONAL_DIRS "")
|
||||
set(ADDITIONAL_LNKDIRS "")
|
||||
set(X86_CPUS x86 x86_64 i686)
|
||||
|
||||
message(STATUS "CMAKE_SYSTEM_PROCESSOR := ${CMAKE_SYSTEM_PROCESSOR}")
|
||||
|
||||
if (APPLE)
|
||||
message("Apple device detected.")
|
||||
set(ADDITIONAL_SRC ${PM3_ROOT}/client/src/util_darwin.h ${PM3_ROOT}/client/src/util_darwin.m ${ADDITIONAL_SRC})
|
||||
set(ADDITIONAL_LNK "-framework Foundation" "-framework AppKit")
|
||||
endif (APPLE)
|
||||
|
||||
if ((NOT SKIPQT EQUAL 1) AND (Qt5_FOUND))
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
set (TARGET_SOURCES
|
||||
${PM3_ROOT}/client/src/proxgui.cpp
|
||||
${PM3_ROOT}/client/src/proxguiqt.cpp
|
||||
${TARGET_SOURCES})
|
||||
|
||||
add_definitions("-DHAVE_GUI")
|
||||
set(ADDITIONAL_LNK ${Qt5_LIBRARIES} ${ADDITIONAL_LNK})
|
||||
else ((NOT SKIPQT EQUAL 1) AND (Qt5_FOUND))
|
||||
set(TARGET_SOURCES
|
||||
${PM3_ROOT}/client/src/guidummy.cpp
|
||||
${TARGET_SOURCES})
|
||||
endif ((NOT SKIPQT EQUAL 1) AND (Qt5_FOUND))
|
||||
|
||||
if (NOT SKIPBT EQUAL 1)
|
||||
if (BLUEZ_FOUND)
|
||||
add_definitions("-DHAVE_BLUEZ")
|
||||
set(ADDITIONAL_LNK ${BLUEZ_LIBRARIES} ${ADDITIONAL_LNK})
|
||||
endif (BLUEZ_FOUND)
|
||||
endif(NOT SKIPBT EQUAL 1)
|
||||
|
||||
if (NOT SKIPPYTHON EQUAL 1)
|
||||
if (PYTHON3EMBED_FOUND)
|
||||
add_definitions(-DHAVE_PYTHON)
|
||||
set(ADDITIONAL_DIRS ${PYTHON3EMBED_INCLUDE_DIRS} ${ADDITIONAL_DIRS})
|
||||
set(ADDITIONAL_LNK ${PYTHON3EMBED_LIBRARIES} ${ADDITIONAL_LNK})
|
||||
set(ADDITIONAL_LNKDIRS ${PYTHON3EMBED_LIBRARY_DIRS} ${ADDITIONAL_LNKDIRS})
|
||||
elseif (PYTHON3_FOUND)
|
||||
add_definitions(-DHAVE_PYTHON)
|
||||
set(ADDITIONAL_DIRS ${PYTHON3_INCLUDE_DIRS} ${ADDITIONAL_DIRS})
|
||||
set(ADDITIONAL_LNK ${PYTHON3_LIBRARIES} ${ADDITIONAL_LNK})
|
||||
set(ADDITIONAL_LNKDIRS ${PYTHON3_LIBRARY_DIRS} ${ADDITIONAL_LNKDIRS})
|
||||
endif (PYTHON3EMBED_FOUND)
|
||||
endif (NOT SKIPPYTHON EQUAL 1)
|
||||
|
||||
if (NOT SKIPREADLINE EQUAL 1)
|
||||
if (READLINE_FOUND)
|
||||
add_definitions("-DHAVE_READLINE")
|
||||
set(ADDITIONAL_DIRS ${READLINE_INCLUDE_DIRS} ${ADDITIONAL_DIRS})
|
||||
set(ADDITIONAL_LNK ${READLINE_LIBRARIES} ${ADDITIONAL_LNK})
|
||||
endif (READLINE_FOUND)
|
||||
endif(NOT SKIPREADLINE EQUAL 1)
|
||||
if (BZIP2_FOUND)
|
||||
set(ADDITIONAL_DIRS ${BZIP2_INCLUDE_DIRS} ${ADDITIONAL_DIRS})
|
||||
set(ADDITIONAL_LNK ${BZIP2_LIBRARIES} ${ADDITIONAL_LNK})
|
||||
else (BZIP2_FOUND)
|
||||
message(FATAL_ERROR "Bzip2 not found")
|
||||
endif (BZIP2_FOUND)
|
||||
|
||||
message("===================================================================")
|
||||
if (SKIPQT EQUAL 1)
|
||||
message("GUI support: skipped")
|
||||
else (SKIPQT EQUAL 1)
|
||||
if (Qt5_FOUND)
|
||||
message("GUI support: QT5 found, enabled")
|
||||
else (Qt5_FOUND)
|
||||
message("GUI support: QT5 not found, disabled")
|
||||
endif (Qt5_FOUND)
|
||||
endif (SKIPQT EQUAL 1)
|
||||
|
||||
if (SKIPBT EQUAL 1)
|
||||
message("native BT support: skipped")
|
||||
else (SKIPBT EQUAL 1)
|
||||
if (BLUEZ_FOUND)
|
||||
message("native BT support: Bluez found, enabled")
|
||||
else (BLUEZ_FOUND)
|
||||
message("native BT support: Bluez not found, disabled")
|
||||
endif (BLUEZ_FOUND)
|
||||
endif(SKIPBT EQUAL 1)
|
||||
|
||||
if (SKIPPYTHON EQUAL 1)
|
||||
message("Python3 library: skipped")
|
||||
else (SKIPPYTHON EQUAL 1)
|
||||
if (PYTHON3EMBED_FOUND)
|
||||
message("Python3 library: Python3 embed found, enabled")
|
||||
elseif (PYTHON_FOUND)
|
||||
message("Python3 library: Python3 found, enabled")
|
||||
else (PYTHON3EMBED_FOUND)
|
||||
message("Python3 library: Python3 not found, disabled")
|
||||
endif (PYTHON3EMBED_FOUND)
|
||||
endif(SKIPPYTHON EQUAL 1)
|
||||
|
||||
if (SKIPREADLINE EQUAL 1)
|
||||
message("Readline library: skipped")
|
||||
else (SKIPREADLINE EQUAL 1)
|
||||
if (READLINE_FOUND)
|
||||
message("Readline library: enabled")
|
||||
else (READLINE_FOUND)
|
||||
message("Readline library: Readline not found, disabled")
|
||||
endif (READLINE_FOUND)
|
||||
endif(SKIPREADLINE EQUAL 1)
|
||||
message("===================================================================")
|
||||
|
||||
# Lua SWIG
|
||||
if (EXISTS ${PM3_ROOT}/client/src/pm3_luawrap.c)
|
||||
set (TARGET_SOURCES
|
||||
${PM3_ROOT}/client/src/pm3_luawrap.c
|
||||
${TARGET_SOURCES})
|
||||
add_definitions(-DHAVE_LUA_SWIG)
|
||||
message("Lua SWIG wrapper found")
|
||||
endif (EXISTS ${PM3_ROOT}/client/src/pm3_luawrap.c)
|
||||
|
||||
# Python SWIG
|
||||
if (NOT SKIPPYTHON EQUAL 1)
|
||||
if (PYTHON3EMBED_FOUND OR PYTHON3_FOUND)
|
||||
if (EXISTS ${PM3_ROOT}/client/src/pm3_pywrap.c)
|
||||
set (TARGET_SOURCES
|
||||
${PM3_ROOT}/client/src/pm3_pywrap.c
|
||||
${TARGET_SOURCES})
|
||||
add_definitions(-DHAVE_PYTHON_SWIG)
|
||||
message("Python SWIG wrapper found")
|
||||
endif (EXISTS ${PM3_ROOT}/client/src/pm3_pywrap.c)
|
||||
endif (PYTHON3EMBED_FOUND OR PYTHON3_FOUND)
|
||||
endif (NOT SKIPPYTHON EQUAL 1)
|
||||
|
||||
add_library(pm3rrg_rdv4 SHARED
|
||||
${PM3_ROOT}/client/src/proxmark3.c
|
||||
${TARGET_SOURCES}
|
||||
${ADDITIONAL_SRC}
|
||||
)
|
||||
target_compile_definitions(pm3rrg_rdv4 PRIVATE LIBPM3)
|
||||
|
||||
target_compile_options(pm3rrg_rdv4 PUBLIC -Wall -Werror -O3)
|
||||
if (ANDROID)
|
||||
if (NOT SKIPREADLINE EQUAL 1)
|
||||
add_dependencies(pm3rrg_rdv4 ncurses readline)
|
||||
endif (NOT SKIPREADLINE EQUAL 1)
|
||||
add_dependencies(pm3rrg_rdv4 bzip2)
|
||||
endif (ANDROID)
|
||||
|
||||
if (MINGW)
|
||||
# Mingw uses by default Microsoft printf, we want the GNU printf (e.g. for %z)
|
||||
# and setting _ISOC99_SOURCE sets internally __USE_MINGW_ANSI_STDIO=1
|
||||
# FTR __USE_MINGW_ANSI_STDIO seems deprecated in Mingw32
|
||||
# but not Mingw64 https://fr.osdn.net/projects/mingw/lists/archive/users/2019-January/000199.html
|
||||
target_compile_definitions(pm3rrg_rdv4 PRIVATE _ISOC99_SOURCE)
|
||||
|
||||
set(CMAKE_C_FLAGS "-mno-ms-bitfields -fexec-charset=cp850 ${CMAKE_C_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS "-mno-ms-bitfields -fexec-charset=cp850 ${CMAKE_CXX_FLAGS}")
|
||||
endif (MINGW)
|
||||
|
||||
target_include_directories(pm3rrg_rdv4 PRIVATE
|
||||
${PM3_ROOT}/common
|
||||
${PM3_ROOT}/common_fpga
|
||||
${PM3_ROOT}/include
|
||||
${PM3_ROOT}/client/src
|
||||
${PM3_ROOT}/client/include
|
||||
${ADDITIONAL_DIRS}
|
||||
)
|
||||
|
||||
if (NOT APPLE)
|
||||
# required for Raspberry Pi, but breaks with clang (OSX). Need to be at the end of the linker line.
|
||||
set(ADDITIONAL_LNK ${ADDITIONAL_LNK} -Wl,--as-needed -latomic -Wl,--no-as-needed)
|
||||
endif (NOT APPLE)
|
||||
|
||||
|
||||
find_library(pm3rrg_rdv4_cliparser REQUIRED)
|
||||
find_library(pm3rrg_rdv4_jansson REQUIRED)
|
||||
find_library(pm3rrg_rdv4_tinycbor REQUIRED)
|
||||
find_library(pm3rrg_rdv4_lua REQUIRED)
|
||||
find_library(pm3rrg_rdv4_mbedtls REQUIRED)
|
||||
find_library(pm3rrg_rdv4_reveng REQUIRED)
|
||||
find_library(pm3rrg_rdv4_hardnested REQUIRED)
|
||||
find_library(pm3rrg_rdv4_whereami REQUIRED)
|
||||
|
||||
target_link_libraries(pm3rrg_rdv4 PRIVATE
|
||||
m
|
||||
pm3rrg_rdv4_mbedtls
|
||||
pm3rrg_rdv4_cliparser
|
||||
pm3rrg_rdv4_jansson
|
||||
pm3rrg_rdv4_lua
|
||||
pm3rrg_rdv4_tinycbor
|
||||
pm3rrg_rdv4_amiibo
|
||||
pm3rrg_rdv4_reveng
|
||||
pm3rrg_rdv4_hardnested
|
||||
pm3rrg_rdv4_whereami
|
||||
${ADDITIONAL_LNK})
|
||||
|
||||
if (NOT SKIPPTHREAD EQUAL 1)
|
||||
target_link_libraries(pm3rrg_rdv4 PRIVATE pthread)
|
||||
endif (NOT SKIPPTHREAD EQUAL 1)
|
||||
|
||||
if (NOT SKIPPYTHON EQUAL 1)
|
||||
# OSX have a hard time compiling python3 dependency with older cmake.
|
||||
if (PYTHON3EMBED_FOUND OR PYTHON3_FOUND)
|
||||
if (NOT CMAKE_VERSION VERSION_LESS 3.13)
|
||||
target_link_directories(pm3rrg_rdv4 PRIVATE ${ADDITIONAL_LNKDIRS})
|
||||
elseif (APPLE)
|
||||
message( SEND_ERROR "Your CMAKE version is too old for Apple platform, please update to a version >=3.13" )
|
||||
endif (NOT CMAKE_VERSION VERSION_LESS 3.13)
|
||||
endif (PYTHON3EMBED_FOUND OR PYTHON3_FOUND)
|
||||
endif (NOT SKIPPYTHON EQUAL 1)
|
||||
Executable
+3
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
gcc -o test test.c -I../../include -lpm3rrg_rdv4 -L../build -lpthread
|
||||
Executable
+3
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
LD_LIBRARY_PATH=../build ./test
|
||||
@@ -0,0 +1,8 @@
|
||||
#include "pm3.h"
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
pm3_device *p;
|
||||
p = pm3_open("/dev/ttyACM0");
|
||||
pm3_console(p, "hw status");
|
||||
pm3_close(p);
|
||||
}
|
||||
Executable
+3
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
ln -fs ../build/libpm3rrg_rdv4.so pm3.so
|
||||
Executable
+8
@@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
# pm3.so somewhere in default LUA_CPATH :
|
||||
# /usr/local/lib/lua/5.2/pm3.so
|
||||
# /usr/lib/lua/5.2/pm3.so
|
||||
# ./pm3.so
|
||||
|
||||
lua test.lua
|
||||
Executable
+4
@@ -0,0 +1,4 @@
|
||||
local pm3 = require("pm3")
|
||||
p=pm3.open("/dev/ttyACM0")
|
||||
pm3.console(p, "hw status")
|
||||
pm3.close(p)
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user