#!/bin/bash
#Auteur: Korigan
#Testé sur: Backtrack5 et Debian7
echo "[+] Creation du repertoire de travail"
mkdir nfc
cd nfc
echo "[+] Telechargement des packages"
wget http://www.scm-pc-card.de/file/driver/Readers_Writers/scl3711_-_linux_64-bit_driver.gz
wget https://alioth.debian.org/frs/download.php/file/3862/pcsc-lite-1.8.8.tar.bz2
wget http://libnfc.googlecode.com/files/libnfc-1.7.0-rc7.tar.gz
wget https://mfoc.googlecode.com/files/mfoc-0.10.6.tar.gz
echo "[+] Décompression des archives"
tar -xvzf scl3711_-_linux_64-bit_driver.gz
tar -xjvf pcsc-lite-1.8.8.tar.bz2
tar -xvzf libnfc-1.7.0-rc7.tar.gz
tar -xvzf mfoc-0.10.6.tar.gz
echo "[+] Gestion des dépendances"
apt-get install libudev-dev pkg-config;
echo "[+] Installation de pcsc-lite 1.8.8"
cd pcsc-lite-1.8.8; ./configure && make && make install; cd ..
cd sclgeneric_2.09_linux_64bit/; ./install.sh
echo "[+] Installation de libnfc 1.7.0-rc7"
cd ../libnfc-1.7.0-rc7
sed -i 's/if (uiBlock == 0 \&\&/\/\/if (uiBlock == 0 \&\&/' utils/nfc-mfclassic.c
sed -i 's/continue/\/\/continue/g' utils/nfc-mfclassic.c
./configure && make && make install; cd ..
cat << EOF > /etc/modprobe.d/blacklist-libnfc.conf
echo "[+] Gestion des conflis"
blacklist pn533
blacklist nfc
EOF
echo "[+] Installation des utilitaires tiers: mfoc 0.10.6"
cd mfoc-0.10.6; ./configure && make && make install