{"id":20268986,"url":"https://github.com/patatetom/libs9","last_synced_at":"2025-07-24T08:02:12.697Z","repository":{"id":256781115,"uuid":"405053572","full_name":"patatetom/libS9","owner":"patatetom","description":"Python library for IC Card Reader S9-BU-00-01 from Fongwah","archived":false,"fork":false,"pushed_at":"2021-09-10T14:10:32.000Z","size":879,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-14T05:28:29.456Z","etag":null,"topics":["nfc","nfc-reader","nfc-tag","nfc-writer","rfid","rfid-reader","tag"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/patatetom.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-09-10T11:13:57.000Z","updated_at":"2021-09-10T16:27:30.000Z","dependencies_parsed_at":"2024-09-13T02:51:47.467Z","dependency_job_id":"dcc1986c-2c7b-426f-89f2-278bdd13300f","html_url":"https://github.com/patatetom/libS9","commit_stats":null,"previous_names":["patatetom/libs9"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patatetom%2FlibS9","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patatetom%2FlibS9/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patatetom%2FlibS9/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patatetom%2FlibS9/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/patatetom","download_url":"https://codeload.github.com/patatetom/libS9/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241753144,"owners_count":20014252,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["nfc","nfc-reader","nfc-tag","nfc-writer","rfid","rfid-reader","tag"],"created_at":"2024-11-14T12:22:22.646Z","updated_at":"2025-03-03T23:05:32.066Z","avatar_url":"https://github.com/patatetom.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# libS9\nPython library for IC Card Reader S9-BU-00-01 from Fongwah\n\n\n## foreword\n\nthe library is intended to be used with `Python3` under `Linux`.\nit only implements some functions from `libS8.so` around `Mifare S50 tags` (classic 1k EV1).\nonly the `A key` is used.\nexcept `readUID`, all the proposed functions expect a `block number` as input.\n\n\n## usage\n\n```pycon\n\u003e\u003e\u003e from libS9 import Reader\n\u003e\u003e\u003e reader = Reader('/dev/usb/hiddev3')\n\n\u003e\u003e\u003e # get UID tag\n\u003e\u003e\u003e reader.readUID()\n'0BDA3FF0'\n\n\u003e\u003e\u003e # read first block \n\u003e\u003e\u003e reader.readBlock()\n'0BDA3FF0:0:F03FDA0B1E8804000000000000000000'\n\u003e\u003e\u003e reader.readBlock(0)\n'0BDA3FF0:0:F03FDA0B1E8804000000000000000000'\n\u003e\u003e\u003e reader.readBlock(0, 'FF'*6)\n'0BDA3FF0:0:F03FDA0B1E8804000000000000000000'\n\n\u003e\u003e\u003e # blocks 0, 1, 2 \u0026 3 are on the same sector 0 [012[3]][456[7]]...\n\u003e\u003e\u003e reader.readBlock(0)\n'0BDA3FF0:0:F03FDA0B1E8804000000000000000000'\n\u003e\u003e\u003e reader.readBlock(1)\n'0BDA3FF0:1:00000000000000000000000000000000'\n\u003e\u003e\u003e reader.readBlock(2)\n'0BDA3FF0:2:00000000000000000000000000000000'\n\u003e\u003e\u003e reader.readBlock(3)\n'0BDA3FF0:3:000000000000FF078000FFFFFFFFFFFF'\n\u003e\u003e\u003e reader.readSector(2)\n['0BDA3FF0:0:F03FDA0B1E8804000000000000000000', '0BDA3FF0:1:00000000000000000000000000000000', '0BDA3FF0:2:00000000000000000000000000000000', '0BDA3FF0:3:000000000000FF078000FFFFFFFFFFFF']\n\u003e\u003e\u003e reader.writeBlock(2, '1234567890ABCDEF'*2)\n'0BDA3FF0:2:1234567890ABCDEF1234567890ABCDEF'\n\u003e\u003e\u003e reader.readSector(1)\n['0BDA3FF0:0:F03FDA0B1E8804000000000000000000', '0BDA3FF0:1:00000000000000000000000000000000', '0BDA3FF0:2:1234567890ABCDEF1234567890ABCDEF', '0BDA3FF0:3:000000000000FF078000FFFFFFFFFFFF']\n\n\u003e\u003e\u003e # can't use writeBlock on access control block (trailer)\n\u003e\u003e\u003e # block 3 is the trailer block of sector 0 [012[3]][456[7]]...\n\u003e\u003e\u003e reader.writeBlock(1, '11'*16)\n'0BDA3FF0:1:11111111111111111111111111111111'\n\u003e\u003e\u003e reader.writeBlock(3, '4BAD'*4)\n\u003e\u003e\u003e print(reader.writeBlock(3, '4BAD'*4))\nNone\n\u003e\u003e\u003e # and of course on manufacturer block\n\u003e\u003e\u003e reader.writeBlock(0, '4BAD'*4)\n\u003e\u003e\u003e print(reader.writeBlock(0, '4BAD'*4))\nNone\n\n\n\u003e\u003e\u003e # change keyA on block 7 (trailer) of sector 1 [012[3]][456[7]]...\n\u003e\u003e\u003e # REMEMBER (WRITE DOWN) THE KEYS YOU INSTALL\n\u003e\u003e\u003e reader.changeKey(4, 'EE'*6)\n'0BDA3FF0:4:[EEEEEEEEEEEE]'\n\u003e\u003e\u003e reader.changeKey(5, 'AA'*6, 'EE'*6)\n'0BDA3FF0:5:[AAAAAAAAAAAA]'\n\u003e\u003e\u003e reader.resetKey(6, 'AA'*6)\n'0BDA3FF0:6:[FFFFFFFFFFFF]'\n\u003e\u003e\u003e reader.readBlock(7)\n'0BDA3FF0:7:000000000000FF078000FFFFFFFFFFFF'\n\n\u003e\u003e\u003e # key (6 bytes) can be passed as bytes, string or integer\n\u003e\u003e\u003e reader.readBlock(2, b'\\xff'*6)\n'0BDA3FF0:2:1234567890ABCDEF1234567890ABCDEF'\n\u003e\u003e\u003e reader.readBlock(2, 'ff'*6)\n'0BDA3FF0:2:1234567890ABCDEF1234567890ABCDEF'\n\u003e\u003e\u003e reader.readBlock(2, 0xFFFFFFFFFFFF)\n'0BDA3FF0:2:1234567890ABCDEF1234567890ABCDEF'\n\n\u003e\u003e\u003e # data (16 bytes) can be passed as bytes or string\n\u003e\u003e\u003e reader.writeBlock(60, b'\\x01'*16)\n'0BDA3FF0:60:01010101010101010101010101010101'\n\u003e\u003e\u003e reader.writeBlock(61, '10'*16)\n'0BDA3FF0:61:10101010101010101010101010101010'\n\u003e\u003e\u003e reader.readSector(60)\n['0BDA3FF0:60:01010101010101010101010101010101', '0BDA3FF0:61:10101010101010101010101010101010', '0BDA3FF0:62:00000000000000000000000000000000', '0BDA3FF0:63:000000000000FF078000FFFFFFFFFFFF']\n\n\u003e\u003e\u003e # \"protect\" sector 15 with new keyA\n\u003e\u003e\u003e # REMEMBER (WRITE DOWN) THE KEYS YOU INSTALL\n\u003e\u003e\u003e reader.changeKey(60, '102030'*2)\n'0BDA3FF0:60:[102030102030]'\n\u003e\u003e\u003e reader.readBlock(60)\nFalse\n\u003e\u003e\u003e reader.writeBlock(60, '88'*16)\nFalse\n\u003e\u003e\u003e reader.readSector(60)\n[False, False, False, False]\n\u003e\u003e\u003e reader.readSector(60, '102030102030')\n['0BDA3FF0:60:01010101010101010101010101010101', '0BDA3FF0:61:10101010101010101010101010101010', '0BDA3FF0:62:00000000000000000000000000000000', '0BDA3FF0:63:000000000000FF078000FFFFFFFFFFFF']\n\n\u003e\u003e\u003e # reset a sector\n\u003e\u003e\u003e reader.resetSector(60, '123456'*2)\nFalse\n\u003e\u003e\u003e reader.resetSector(60, '102030'*2)\n['0BDA3FF0:60:00000000000000000000000000000000', '0BDA3FF0:61:00000000000000000000000000000000', '0BDA3FF0:62:00000000000000000000000000000000', '0BDA3FF0:60:[FFFFFFFFFFFF]']\n\u003e\u003e\u003e # reset a block\n\u003e\u003e\u003e reader.readBlock(2)\n'0BDA3FF0:2:1234567890ABCDEF1234567890ABCDEF'\n\u003e\u003e\u003e reader.resetBlock(2)\n'0BDA3FF0:2:00000000000000000000000000000000'\n```\n\n\n## S9-BU-00-01\n\n![S9-BU-00-01](s9r.jpg)\n![S9-BU-00-01](s9v.jpg)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatatetom%2Flibs9","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpatatetom%2Flibs9","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatatetom%2Flibs9/lists"}