2022-10-10

Linux traffic control

 sudo tc qdisc add dev eth0 root netem delay 200ms

sudo tc qdisc del dev eth0 root netem delay 200ms


sudo tc qdisc add dev eth0 root netem delay 1000ms

sudo tc qdisc del dev eth0 root netem delay 1000ms


sudo tc qdisc del dev eth0 root netem delay 2000ms


RC522 with raspberry pi

M1

S50

UID

UFUID

FUID

CUID


rc522

pn532


https://github.com/ikarus23/MifareClassicTool


https://github.com/ondryaso/pi-rc522


https://github.com/mxgxw/MFRC522-python


https://stackoverflow.com/questions/41326384/re-writing-uid-and-block-0-on-chinese-supposed-to-be-writable-mifare-1k-card-i


There are 2 types of UID writeble cards:


Block 0 writable cards: you can write block 0 at any moment

Backdoored cards

If writing block 0 does not work, you probably have a backdoored card: To enable the backdoor, you need to send the following sequence to the card: (everything in hexadecimal)


RC522 > Card: 50 00 57 cd (HLTA + CRC)

RC522 > Card: 40 (7 bits only)

Card > RC522: A (4 bits only)

RC522 > Card: 43

Card > RC522: A (4 bits only)

Then you can write to block 0 without authentication. If it still does not work, your card is probably not UID changeable.



芢聆湮苤: 褫夔岆 1024-byte 湮苤腔縐

楷冞:     50  00  57  cd  

楷冞:     40 (7 bits)

彶善: a (4 bits)

楷冞:     43  

彶善: 0a  




Name Pin # Pin name

SDA 24 GPIO8

SCK 23 GPIO11

MOSI 19 GPIO10

MISO 21 GPIO9

IRQ None None

GND Any Any Ground

RST 22 GPIO25

3.3V 1 3V3



sudo raspi-config

spi

remote-gpio



sudo apt-get update

sudo apt-get upgrade


sudo apt-get install python3-dev python3-pip


sudo apt-get install python-spidev python3-spidev


???

sudo pip3 install spidev

sudo pip3 install mfrc522


git clone https://github.com/lthiery/SPI-Py.git


cd SPI-Py/

git checkout 8cce26b9ee6e69eb041e9d5665944b88688fca68

git checkout 8cce26b9ee6e69eb041e9d5665944b88688fca68

git checkout -b 8cce26b9ee6e69eb041e9d5665944b88688fca68

sudo python setup.py install

sudo python3 setup.py install


git clone https://github.com/mxgxw/MFRC522-python.git

cd MFRC522-python

python Read.py




注意:0扇区不能随意乱写,0扇区写不符合算法规则的数据会导致卡片锁死。


byte0-byte3 为UID


byte4 为check byte 算法 byte4 = byte0 ^ byte1 ^ byte2 ^ byte3


byte5为0x08


byte6 为0x04,


byte7 为0x00,Byte5,Byte6和byte7是m1卡片类型不可随意更改。

https://www.gushiciku.cn/pl/pi9z/zh-tw


https://www.tspweb.com/key/%E6%89%8B%E6%9C%BAnfc%E6%9A%B4%E5%8A%9B%E7%A0%B4%E8%A7%A3ic%E5%8D%A1%E5%AF%86%E9%92%A5.html


X11 Forwarding


xauth list

xxx


echo $DISPLAY

YYY


another user:

xauth add "xxx"


export DISPLAY="YYY"

Linux disable touchpad mid-click

xinput list

 

xinput get-button-map 10

#   1 2 3 4 5 6 7 


xinput list --long 10

    Button labels: "Button Left" "Button Middle" "Button Right" "Button Wheel Up" "Button Wheel Down" "Button Horiz Wheel Left" "Button Horiz Wheel Right"

 

# disable mid-click

xinput set-button-map 10 1 0 3 4 5 6 7


# mid-click -> left

xinput set-button-map 10 1 1 3 4 5 6 7