From 0a966150a0bf41466c3c3e0e39672892bf6bdd01 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Thu, 1 Jan 2015 14:07:42 +0100 Subject: [PATCH] Updated the README.txt CHG: added marshmellows last changes with rtrim, and minor fixes. DEL: code cleanup in usb_cdc.c --- README.txt | 134 +++++++++++++++++++---------------------------- client/cmddata.c | 14 ++++- client/cmddata.h | 1 + client/cmdlf.c | 12 +++-- common/cmd.c | 2 - common/usb_cdc.c | 66 +++++++++++------------ 6 files changed, 106 insertions(+), 123 deletions(-) diff --git a/README.txt b/README.txt index cb2c7f3c..62c29920 100644 --- a/README.txt +++ b/README.txt @@ -1,87 +1,63 @@ -NOTICE: -(2014-03-26) -This is now the official Proxmark repository! - -INTRODUCTION: - -The proxmark3 is a powerful general purpose RFID tool, the size of a deck -of cards, designed to snoop, listen and emulate everything from -Low Frequency (125kHz) to High Frequency (13.56MHz) tags. - -This repository contains enough software, logic (for the FPGA), and design -documentation for the hardware that you could, at least in theory, -do something useful with a proxmark3. - -RESOURCES: - - * This repository! - https://github.com/Proxmark/proxmark3 - - * The Wiki - https://github.com/Proxmark/proxmark3/wiki - - * The GitHub page - http://proxmark.github.io/proxmark3/ - - * The Forum - http://www.proxmark.org/forum - - * The IRC chanel - irc.freenode.org #proxmark3 - -or- - http://webchat.freenode.net/?channels=#proxmark3 - -DEVELOPMENT: - -The tools required to build or run the project will vary depending on -your operating system. Please refer to the Wiki for details. - - * https://github.com/Proxmark/proxmark3/wiki - -OBTAINING HARDWARE: - -The Proxmark 3 is available for purcahse (assembled and tested) from the -following locations: - - * http://proxmark3.com/ - * http://www.xfpga.com/ - -Most of the ultra-low-volume contract assemblers could put -something like this together with a reasonable yield. A run of around -a dozen units is probably cost-effective. The BOM includes (possibly- -outdated) component pricing, and everything is available from Digikey -and the usual distributors. - -If you've never assembled a modern circuit board by hand, then this is -not a good place to start. Some of the components (e.g. the crystals) -must not be assembled with a soldering iron, and require hot air. - -The schematics are included; the component values given are not -necessarily correct for all situations, but it should be possible to do -nearly anything you would want with appropriate population options. - -The printed circuit board artwork is also available, as Gerbers and an -Excellon drill file. +The iceman fork. +NOTICE: -LICENSING: +The official Proxmark repository is found here: https://github.com/Proxmark/proxmark3 -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. +NEWS: -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +Whats in this fork? I have scraped the web for different enhancements to the PM3 sourcecode and not all of them ever found their way to the master branch. +Among the stuff is + * jonor's hf 14a raw timing patch + * Piwi's updates. (usually gets into the master) + * Holimans iclass, (usually gets into the master) + * Marshmellows LF fixes (will go into the master) + * Midnitesnakes Ultralight, Ultralight-c enhancements + * My desfire, Ultralight extras, LF T55xx enhancements, bugs fixes (filelength, hf mf commands ), TNP3xxx lua scripts, Awid26, skidata scripts (will come) + * other osbscury patches like for the sammy-mode, (offline you know), tagidentifications, defaultkeys. + +Give me a hint, and I'll see if I can't merge in the stuff you have. + +PM3 GUI: +I do tend to rename and move stuff around, the official PM3-GUI from Gaucho will not work so good. *sorry* -Jonathan Westhues -user jwesthues, at host cq.cx + +DEVELOPMENT: -May 2007, Cambridge MA +This fork is adjusted to compile on windows/mingw environment with Qt5.3.1 & GCC 4.8 +For people with linux you will need to patch some sourcecode and some small change to one makefile. If you are lazy, you google the forum and find asper's or holimans makefile or you find your solution below. + +Common errors linux/macOS finds +Error: + * loclass/fileutils.c:15:2: warning: implicit declaration of function ‘_stat’ [-Wimplicit-function-declaration] +Solution: + * Remove the "unscore" sign. In linux you use without underscore, in windows you need a underscore. + +Error: + * \client\makefile the parameter -lgdi32 +Solution: + * Remove parameter. + +Error: + * Using older Qt4.6 gives compilation errors. +Solution + * Upgrade to Qt5.3.1 + OR + * Change these two line in \client\makefile + CXXFLAGS = -I$(QTDIR)/include -I$(QTDIR)/include/QtCore -I$(QTDIR)/include/QtGui -I$(QTDIR)/include/QtWidgets -I/mingw/include + QTLDLIBS = -L$(QTDIR)/lib -lQt5Core -lQt5Gui -lQt5Widgets + + TO + + CXXFLAGS = -I$(QTDIR)/include -I$(QTDIR)/include/QtCore -I$(QTDIR)/include/QtGui + QTLDLIBS = -L$(QTDIR)/lib -lQtCore4 -lQtGui4 + + +And old Qt4 version is found here: http://www.icesql.se/proxmark3/code/linuxmakefile.txt but this one doesn't have all new files in it. So I don't recommend it. + + + +January 2015, Sweden +iceman at host iuse.se \ No newline at end of file diff --git a/client/cmddata.c b/client/cmddata.c index 7aa8fcf4..de564a69 100644 --- a/client/cmddata.c +++ b/client/cmddata.c @@ -226,7 +226,7 @@ int Cmdaskmandemod(const char *Cmd) PrintAndLog("EM410x pattern found: "); printEM410x(lo); } - if (BitLen>16) return 1; + //if (BitLen>16) return 1; return 0; } @@ -976,6 +976,15 @@ int CmdLtrim(const char *Cmd) RepaintGraphWindow(); return 0; } +int CmdRtrim(const char *Cmd) +{ + int ds = atoi(Cmd); + + GraphTraceLen = ds; + + RepaintGraphWindow(); + return 0; +} /* * Manchester demodulate a bitstream. The bitstream needs to be already in @@ -1377,13 +1386,14 @@ static command_t CommandTable[] = {"fskdemod", CmdFSKdemod, 1, "Demodulate graph window as a HID FSK"}, {"fskhiddemod", CmdFSKdemodHID, 1, "Demodulate graph window as a HID FSK using raw"}, {"fskiodemod", CmdFSKdemodIO, 1, "Demodulate graph window as an IO Prox FSK using raw"}, - {"fskrawdemod", CmdFSKrawdemod, 1, "[clock rate] [invert] Demodulate graph window from FSK to binary (clock = 64 or 50)(invert = 1 or 0)"}, + {"fskrawdemod", CmdFSKrawdemod, 1, "[clock rate] [invert] [rchigh] [rclow] Demodulate graph window from FSK to binary (clock = 50)(invert = 1 or 0)(rchigh = 10)(rclow=8)"}, {"grid", CmdGrid, 1, " -- overlay grid on graph window, use zero value to turn off either"}, {"hexsamples", CmdHexsamples, 0, " [] -- Dump big buffer as hex bytes"}, {"hide", CmdHide, 1, "Hide graph window"}, {"hpf", CmdHpf, 1, "Remove DC offset from trace"}, {"load", CmdLoad, 1, " -- Load trace (to graph window"}, {"ltrim", CmdLtrim, 1, " -- Trim samples from left of trace"}, + {"rtrim", CmdRtrim, 1, " -- Trim samples from right of trace"}, {"mandemod", CmdManchesterDemod, 1, "[i] [clock rate] -- Manchester demodulate binary stream (option 'i' to invert output)"}, {"manrawdecode", Cmdmandecoderaw, 1, "Manchester decode binary stream already in graph buffer"}, {"manmod", CmdManchesterMod, 1, "[clock rate] -- Manchester modulate a binary stream"}, diff --git a/client/cmddata.h b/client/cmddata.h index 9b8f22ca..59ac43b9 100644 --- a/client/cmddata.h +++ b/client/cmddata.h @@ -36,6 +36,7 @@ int CmdHide(const char *Cmd); int CmdHpf(const char *Cmd); int CmdLoad(const char *Cmd); int CmdLtrim(const char *Cmd); +int CmdRtrim(const char *Cmd); int Cmdmandecoderaw(const char *Cmd); int CmdManchesterDemod(const char *Cmd); int CmdManchesterMod(const char *Cmd); diff --git a/client/cmdlf.c b/client/cmdlf.c index 14d8d215..8257a5b3 100644 --- a/client/cmdlf.c +++ b/client/cmdlf.c @@ -571,8 +571,9 @@ int CmdVchDemod(const char *Cmd) //by marshmellow int CmdLFfind(const char *Cmd) { + int ans = 0; char cmdp = param_getchar(Cmd, 0); - + if (strlen(Cmd) > 1 || cmdp == 'h' || cmdp == 'H') { PrintAndLog("Usage: lf search [use data from Graphbuffer]"); PrintAndLog(" [use data from Graphbuffer], if not set, try reading data from tag."); @@ -581,9 +582,8 @@ int CmdLFfind(const char *Cmd) PrintAndLog(" : lf search 1"); return 0; } - - int ans = 0; - if (!offline && cmdp != '1' ){ + + if (!offline || (cmdp != '1') ){ ans = CmdLFRead(""); } else if (GraphTraceLen<1000) { PrintAndLog("Data in Graphbuffer was too small."); @@ -607,7 +607,9 @@ int CmdLFfind(const char *Cmd) ans=CmdIndalaDemod("224"); PrintAndLog("Indala (224): %s", (ans)?"YES":"NO" ); - //PrintAndLog("No Known Tags Found!\n"); + if (!ans) + PrintAndLog("No Known Tags Found!\n"); + return 0; } diff --git a/common/cmd.c b/common/cmd.c index dae3a8da..66b93990 100644 --- a/common/cmd.c +++ b/common/cmd.c @@ -34,8 +34,6 @@ #include "string.h" #include "../include/proxmark3.h" -//static UsbCommand txcmd; - bool cmd_receive(UsbCommand* cmd) { // Check if there is a usb packet available diff --git a/common/usb_cdc.c b/common/usb_cdc.c index 097d9a4e..c8d5af1c 100644 --- a/common/usb_cdc.c +++ b/common/usb_cdc.c @@ -223,7 +223,6 @@ byte_t btReceiveBank = AT91C_UDP_RX_DATA_BK0; void usb_disable() { // Disconnect the USB device AT91C_BASE_PIOA->PIO_ODR = GPIO_USB_PU; -// SpinDelay(100); // Clear all lingering interrupts if(pUdp->UDP_ISR & AT91C_UDP_ENDBUSRES) { @@ -236,32 +235,31 @@ void usb_disable() { //* \brief This function Activates the USB device //*---------------------------------------------------------------------------- void usb_enable() { - // Set the PLL USB Divider - AT91C_BASE_CKGR->CKGR_PLLR |= AT91C_CKGR_USBDIV_1 ; - - // Specific Chip USB Initialisation - // Enables the 48MHz USB clock UDPCK and System Peripheral USB Clock - AT91C_BASE_PMC->PMC_SCER = AT91C_PMC_UDP; - AT91C_BASE_PMC->PMC_PCER = (1 << AT91C_ID_UDP); - - // Enable UDP PullUp (USB_DP_PUP) : enable & Clear of the corresponding PIO - // Set in PIO mode and Configure in Output - AT91C_BASE_PIOA->PIO_PER = GPIO_USB_PU; // Set in PIO mode + // Set the PLL USB Divider + AT91C_BASE_CKGR->CKGR_PLLR |= AT91C_CKGR_USBDIV_1 ; + + // Specific Chip USB Initialisation + // Enables the 48MHz USB clock UDPCK and System Peripheral USB Clock + AT91C_BASE_PMC->PMC_SCER = AT91C_PMC_UDP; + AT91C_BASE_PMC->PMC_PCER = (1 << AT91C_ID_UDP); + + // Enable UDP PullUp (USB_DP_PUP) : enable & Clear of the corresponding PIO + // Set in PIO mode and Configure in Output + AT91C_BASE_PIOA->PIO_PER = GPIO_USB_PU; // Set in PIO mode AT91C_BASE_PIOA->PIO_OER = GPIO_USB_PU; // Configure as Output - - // Clear for set the Pullup resistor + + // Clear for set the Pullup resistor AT91C_BASE_PIOA->PIO_CODR = GPIO_USB_PU; - - // Disconnect and reconnect USB controller for 100ms - usb_disable(); - - // Wait for a short while - for (volatile size_t i=0; i<0x100000; i++); -// SpinDelay(100); - // Reconnect USB reconnect - AT91C_BASE_PIOA->PIO_SODR = GPIO_USB_PU; - AT91C_BASE_PIOA->PIO_OER = GPIO_USB_PU; + // Disconnect and reconnect USB controller for 100ms + usb_disable(); + + // Wait for a short while + for (volatile size_t i=0; i<0x100000; i++); + + // Reconnect USB reconnect + AT91C_BASE_PIOA->PIO_SODR = GPIO_USB_PU; + AT91C_BASE_PIOA->PIO_OER = GPIO_USB_PU; } //*---------------------------------------------------------------------------- @@ -300,28 +298,26 @@ bool usb_poll() //* \brief Read available data from Endpoint OUT //*---------------------------------------------------------------------------- uint32_t usb_read(byte_t* data, size_t len) { - byte_t bank = btReceiveBank; + byte_t bank = btReceiveBank; uint32_t packetSize, nbBytesRcv = 0; - uint32_t time_out = 0; + uint32_t time_out = 0; - while (len) - { + while (len) { if (!usb_check()) break; if ( pUdp->UDP_CSR[AT91C_EP_OUT] & bank ) { packetSize = MIN(pUdp->UDP_CSR[AT91C_EP_OUT] >> 16, len); - len -= packetSize; + len -= packetSize; while(packetSize--) data[nbBytesRcv++] = pUdp->UDP_FDR[AT91C_EP_OUT]; pUdp->UDP_CSR[AT91C_EP_OUT] &= ~(bank); - if (bank == AT91C_UDP_RX_DATA_BK0) - { + if (bank == AT91C_UDP_RX_DATA_BK0) { bank = AT91C_UDP_RX_DATA_BK1; - } else { + } else { bank = AT91C_UDP_RX_DATA_BK0; - } + } } - if (time_out++ == 0x1fff) break; + if (time_out++ == 0x1fff) break; } btReceiveBank = bank; @@ -353,7 +349,7 @@ uint32_t usb_write(const byte_t* data, const size_t len) { // Wait for the the first bank to be sent while (!(pUdp->UDP_CSR[AT91C_EP_IN] & AT91C_UDP_TXCOMP)) { if (!usb_check()) return length; - } + } pUdp->UDP_CSR[AT91C_EP_IN] &= ~(AT91C_UDP_TXCOMP); while (pUdp->UDP_CSR[AT91C_EP_IN] & AT91C_UDP_TXCOMP); pUdp->UDP_CSR[AT91C_EP_IN] |= AT91C_UDP_TXPKTRDY; -- 2.39.5