Kaynağa Gözat

wip

* proxmark3 for RFID reading
* test lua script as an example script to read RFIDs
* test python script to read HID magstripe reader
clementinecomputing 5 yıl önce
ebeveyn
işleme
a761358f50

+ 71 - 0
busunit-PIU/scripts/capture-mag-hid

@@ -0,0 +1,71 @@
+#!/usr/bin/python3
+#
+# Copyright (c) 2019 Clementine Computing LLC.
+#
+# This file is part of PopuFare.
+#
+# PopuFare is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# PopuFare 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 Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with PopuFare.  If not, see <https://www.gnu.org/licenses/>.
+#
+
+import os, sys, evdev, asyncio, os.path
+from evdev import InputDevice, categorize, ecodes
+
+dev_init = False
+dev = { }
+
+HID_NAME = 'HID c216:0180'
+
+evfns_n = 13
+evfns_bd = "/dev/input/"
+evfns = [ ]
+
+for x in range(evfns_n):
+  fn = evfns_bd + "event" + str(x)
+  if (os.path.exists(fn)):
+    evfns.append(fn)
+
+for evfn in evfns:
+  _dev = evdev.InputDevice(evfn)
+  print("device:", _dev.name)
+  if _dev.name == HID_NAME:
+    dev_init = True
+    dev = _dev
+    break
+
+if not dev_init:
+  print("could not find device, exiting")
+  sys.exit(0)
+
+print(dev)
+print(dev.capabilities())
+print(dev.capabilities(verbose=True))
+
+dev.grab()
+
+for event in dev.read_loop():
+  if event.type == ecodes.EV_KEY:
+    print(categorize(event))
+
+sys.exit(0)
+
+
+async def print_events(device):
+  async for event in device.async_read_loop():
+    print(device.path, evdev.categorize(event, sep=':'))
+
+for device in dev:
+  asyncio.ensure_future(print_events(dev))
+
+
+print("...")

+ 47 - 0
busunit-PIU/scripts/proxmark3-lf-hid-read.lua

@@ -0,0 +1,47 @@
+--
+-- Copyright (c) 2019 Clementine Computing LLC.
+--
+-- This file is part of PopuFare.
+--
+-- PopuFare is free software: you can redistribute it and/or modify
+-- it under the terms of the GNU Affero General Public License as published by
+-- the Free Software Foundation, either version 3 of the License, or
+-- (at your option) any later version.
+--
+-- PopuFare 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 Affero General Public License for more details.
+--
+-- You should have received a copy of the GNU Affero General Public License
+-- along with PopuFare.  If not, see <https://www.gnu.org/licenses/>.
+--
+
+local cmds = require('commands')
+local getopt = require('getopt')
+local bin = require('bin')
+local utils = require('utils')
+local format=string.format
+local floor=math.floor
+local os = require("os")
+
+function sleep (a) 
+    local sec = tonumber(os.clock() + a); 
+    while (os.clock() < sec) do 
+    end 
+end
+
+local function main(args)
+  print( string.rep('--',30) )
+  print( string.rep('--',30) )
+
+  -- core.console will go async when waiting for the proxmark to return
+  -- so need to wait for a response (sleep)
+  core.console('lf hid read')
+  -- sleep(30) -- run for 30 seconds
+  os.execute("sleep 30")
+  
+  print( string.rep('--',30) )
+
+end
+main(args)

+ 84 - 0
busunit-PIU/scripts/setup-system

@@ -0,0 +1,84 @@
+#!/bin/bash
+#
+# Copyright (c) 2019 Clementine Computing LLC.
+#
+# This file is part of PopuFare.
+#
+# PopuFare is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# PopuFare 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 Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with PopuFare.  If not, see <https://www.gnu.org/licenses/>.
+#
+
+# Helper script to setup the PIU system.
+# Meant to be run as root.
+#
+
+# Remove bloat.
+# Note this is mainly a note as in the future,
+# the system will have these packages already
+# removed.
+#
+apt-get purge -y  wolfram-engine wolframscript \
+  scratch scratch2 \
+  libreoffice-core libreoffice-base-core
+
+
+# For development
+#
+apt-get install -y vim
+
+# For HID (magstripe)
+#
+apt-get install -y python3-evdev
+
+# proxmark3 install
+#
+apt-get install -y p7zip git build-essential \
+  libreadline5 libreadline-dev libusb-0.1-4 \
+  libusb-dev libqt4-dev perl pkg-config wget \
+  libncurses5-dev gcc-arm-none-eabi \
+  libstdc++-arm-none-eabi-newlib libpcsclite-dev pcscd
+
+useradd bus
+
+mkdir -p git
+
+pushd git
+
+  git clone https://github.com/proxmark/proxmark3.git
+  pushd proxmark3
+    git pull
+
+    sudo cp -rf driver/77-mm-usb-device-blacklist.rules /etc/udev/rules.d/77-mm-usb-device-blacklist.rules
+    sudo udevadm control --reload-rules
+
+    adduser pi dialout
+    adduser bus dialout
+
+    make clean && make all
+
+    # Flash most recent firmware onto proxmark.
+    # Assumes proxmark3 on /dev/ttyACM0 (`udevadm info /dev/ttyACM0` should show appropriate
+    # proxmark information)
+    #
+    client/flasher /dev/ttyACM0 -b bootrom/obj/bootrom.elf armsrc/obj/fullimage.elf
+
+  popd
+popd
+
+
+
+
+
+
+
+