{"id":24001704,"url":"https://github.com/therealdreg/pico-ps2-sniffer","last_synced_at":"2025-11-19T12:03:16.509Z","repository":{"id":271266580,"uuid":"912903049","full_name":"therealdreg/pico-ps2-sniffer","owner":"therealdreg","description":"A simple PS2 sniffer based on Raspberry PI PICO RP2040 (pico-sdk)","archived":false,"fork":false,"pushed_at":"2025-08-19T19:42:14.000Z","size":2749,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-19T21:28:40.836Z","etag":null,"topics":["hacking","hacking-tool","hardware-hacking","hardware-hacking-tools","keylogger","pico-sdk","pio","ps2","ps2-keyboard","ps2-sniffer","ps2-sniffing","raspberry-pi","raspberry-pi-pico","rp2040"],"latest_commit_sha":null,"homepage":"https://rootkit.es/","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/therealdreg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","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,"zenodo":null},"funding":{"github":["therealdreg"],"patreon":"dreg","custom":["https://www.paypal.me/therealdreg","https://www.paypal.me/therealdreg"]}},"created_at":"2025-01-06T16:20:27.000Z","updated_at":"2025-08-19T19:42:17.000Z","dependencies_parsed_at":"2025-01-06T17:28:36.425Z","dependency_job_id":"f4dead50-8ed9-4c84-b15c-42972ecefb69","html_url":"https://github.com/therealdreg/pico-ps2-sniffer","commit_stats":null,"previous_names":["therealdreg/pico-ps2-sniffer"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/therealdreg/pico-ps2-sniffer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/therealdreg%2Fpico-ps2-sniffer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/therealdreg%2Fpico-ps2-sniffer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/therealdreg%2Fpico-ps2-sniffer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/therealdreg%2Fpico-ps2-sniffer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/therealdreg","download_url":"https://codeload.github.com/therealdreg/pico-ps2-sniffer/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/therealdreg%2Fpico-ps2-sniffer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":285240542,"owners_count":27137943,"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","status":"online","status_checked_at":"2025-11-19T02:00:05.673Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["hacking","hacking-tool","hardware-hacking","hardware-hacking-tools","keylogger","pico-sdk","pio","ps2","ps2-keyboard","ps2-sniffer","ps2-sniffing","raspberry-pi","raspberry-pi-pico","rp2040"],"created_at":"2025-01-08T00:37:33.967Z","updated_at":"2025-11-19T12:03:16.498Z","avatar_url":"https://github.com/therealdreg.png","language":"C","funding_links":["https://github.com/sponsors/therealdreg","https://patreon.com/dreg","https://www.paypal.me/therealdreg"],"categories":[],"sub_categories":[],"readme":"# USB sniffer for RASPBERRY PI PICO RP2040\n\nThis is a simple PS2 sniffer based on a Raspberry Pi PICO RP2040 (pico-sdk).\n\n![](stuff/fullsetup.jpg)\n\nI created this project to ensure that all the effort I put into my okhi project (Open Keylogger Hardware Implant - USB \u0026 PS2 Keyboards) can benefit more people: https://github.com/therealdreg/okhi\n\n![](stuff/withcables.jpg)\n\n# Reporting issues\n\nIf you have a PS2-USB adapter that doesn't work with the sniffer, please send me some captures of the device using a logic analyzer or the pico-ps2-diagnostic-tool. This tool is designed to capture and replay signals on a PS/2 interface, specifically targeting the DATA and CLOCK lines:\n\nhttps://github.com/therealdreg/pico-ps2-diagnostic-tool\n\n![](stuff/originalvsre.png)\n\n A short pulse was captured on the original CLOCK signal, and the replayed signal successfully reproduced it.\n\n# Download last firmware\n\nDownload the latest firmware from the releases section:\n\nhttps://github.com/therealdreg/pico-ps2-sniffer/releases/latest\n\n# Flashing the firmware\n\nTo flash the firmware, you need to put the Raspberry Pi Pico in bootloader mode. To do this, press and hold the button while connecting the USB cable to the PC. The Pico will appear as a USB mass storage device. Drag and drop the \"pico_ps2_sniffer.uf2\" firmware file to the Pico.\n\n# Physical PS2 keylogger using a Raspberry Pi Pico\n\nFirst of all, **PS2 signals are 5V**, and the Raspberry Pi Pico is 3.3V. To avoid damaging the Pico, we need to use a level shifter! Never connect PS2 signals directly to the Pico!\n\n## Materials\n\n**TWO** Ps/2 Adapter Ps/2 Ps2 Keyboard Keypad Module For Arduino:\n\n![](stuff/twops2mod.jpg)\n\nhttps://www.aliexpress.com/i/32802677672.html\n\nUSB Converter Cable for Keyboard Mouse USB Male to PS2 Female Converter adapter Cable:\n\nhttps://www.aliexpress.com/item/32850416717.html\n\n![](stuff/ps2usbcable.jpg)\n\n\nI2C Logic Level Converter **PRE-SOLDERED** Bi-Directional 3.3V-5V 4 Channels\n\nhttps://www.amazon.com/-/es/Convertidor-pre-soldado-bidireccional-compatibles-microcontroladores/dp/B0CL2PFHMW?th=1\n\n![](stuff/voltconv.jpg)\n\nPS2 Male to PS2 Male cable:\n\nhttps://www.aliexpress.com/item/32833081345.html\n\n![](stuff/ps2maletops2male.jpg)\n\nLenovo PS2 Keyboard:\n\nhttps://aliexpress.com/i/1005006032883103.html\n\n![](stuff/lenovo.jpg)\n\n-------\n\nI assume you have a breadboard, a set of Dupont cables (male-to-male, female-to-male, female-to-female), and a Raspberry Pi Pico.\n\n## Connect everything\n\n1. Connect the Lenovo PS2 Keyboard to the PS2-pin board:\n\n![](stuff/ps2boardclose.jpg)\n\nConnect PS2-pin board with the dupont cables to breadboard:\n\n- Yellow: Clock\n- Orange: Data\n- Red: VCC\n- Brown: GND\n\nEach cable to one row of the breadboard.\n\n![](stuff/adaptercbcolor.jpg)\n\nConnect USB to PS2 adapter cable to the PS2 MALE CABLE and The USB PS2 Male cable to the other PS2-pin board.\n\n![](stuff/ps2adaptercabledip.jpg)\n\nConnect PS2-pin board with the dupont cables to breadboard, to join the PS2 signals of the two PS2-pin boards:\n\n![](stuff/jointwops2.jpg)\n\nConnect the USB to PS2 adapter to the PC. If the keyboard is working well done, if not, check the connections.\n\nDisconnect the USB to PS2 adapter from the PC.\n\nNow connect the I2C Logic Level Converter to the breadboard:\n\n![](stuff/levelshift.jpg)\n\n- HV1: YELLOW\n- HV2: ORANGE\n- HV: RED\n- GND: BROWN\n\n![](stuff/shifterbread.jpg)\n\nIts easy, same colours go to the same breadboard row. ALWAYS CHECK THE CONNECTIONS!\n\nNow connect the Raspberry Pi Pico to the breadboard:\n\n![](stuff/raspcabl.jpg)\n\n- PIN36 (3V3 OUT): WHITE\n- PIN27 (GPIO21, SNIFF CLOCK): PURPLE\n- PIN26 (GPIO20, SNIFF DAT): BLUE\n\nConnect two brown cable to two ground pins of the Pico, and connect one to the breadboard (brown row) and other to the I2C Logic Level Converter (GND).\n\nConnect from the I2C Logic Level Converter to the Raspberry Pi Pico:\n\n- WHITE: LV\n- PURPLE: LV1\n- BLUE: LV2\n(GND is already connected to PICO)\n\n![](stuff/shiff3.jpg)\n\nAt this point all 5v signals are converted to 3.3v signals. And our Raspberry Pi Pico is safe!\n\nAll we have done is to bring all the signals together and make them accessible using the breadboard, then convert them to 3.3V to prevent damaging the Pico.\n\nFinally, connect everything to the PC, and you're done! (Raspberry Pi Pico \u0026 USB to PS2 adapter).\n\n**WARNING**: some USB Hubs can cause problems with this setup. If you have problems, try connecting ALL directly to the PC.\n\n**WARNING**: Use short cables to avoid signal degradation (USB \u0026 Dupont). Avoid stack adapters, etc.\n\n## Inspecting PS2 traffic\n\nConnect to serial PORT (COM PORT) with a terminal program (like Putty, Tera Term, etc.), port conf:\n- 9600 bauds\n- data 8 bits\n- parity none\n- stop bits 1\n- flow control none\n\nTo view available COM ports on Windows, open Device Manager and look for the \"Ports (COM \u0026 LPT)\" section.\n\n**The COM port becomes available approximately 4 seconds after connection** (the firmware includes a delay before it starts).\n\nNow, jus type on the PS2 keyboard and see the magic!\n\n```\npico-ps2-sniffer started! v3 Build Date Aug 19 2025 21:37:38\nhttps://github.com/therealdreg/pico-ps2-sniffer\nhttps://github.com/therealdreg/okhi\nMIT License David Reguera Garcia aka Dreg\nX @therealdreg dreg@rootkit.es\n---------------------------------------------------------------\nDAT_GPIO: 20\nCLK_GPIO: 21\nAUX_D2H_JMP_GPIO: 22\nAUX_H2D_JMP_GPIO: 19\nokhi led GPIO: 26\nokhi USSEL GPIO: 8\nokhi USOE GPIO: 9\n\n[0x0000] t:0x0000469C H:0xED\n[0x0001] t:0x0000469D D:0xFA\n[0x0002] t:0x0000469F H:0x02\n[0x0003] t:0x000046A1 D:0xFA\n[0x0004] t:0x0000580B D:0x23\nMAKE_D --\u003e d\n-----------\n[0x0005] t:0x00005887 D:0xF0\n[0x0006] t:0x0000588B D:0x23\nBREAK_D --\u003e d\n**********\nkey break tracker (limit 0x13F bytes): d\n**********\n-----------\n[0x0007] t:0x00005DA9 D:0x2D\nMAKE_R --\u003e r\n-----------\n[0x0008] t:0x00005E2C D:0xF0\n[0x0009] t:0x00005E30 D:0x2D\nBREAK_R --\u003e r\n**********\nkey break tracker (limit 0x13F bytes): dr\n**********\n-----------\n[0x000A] t:0x000060C6 D:0x24\nMAKE_E --\u003e e\n-----------\n[0x000B] t:0x00006132 D:0xF0\n[0x000C] t:0x00006136 D:0x24\nBREAK_E --\u003e e\n**********\nkey break tracker (limit 0x13F bytes): dre\n**********\n-----------\n[0x000D] t:0x00006663 D:0x34\nMAKE_G --\u003e g\n-----------\n[0x000E] t:0x000066C8 D:0xF0\n[0x000F] t:0x000066CC D:0x34\nBREAK_G --\u003e g\n**********\nkey break tracker (limit 0x13F bytes): dreg\n**********\n----------\n```\n\n# Compatible adapters\n\nCheck the list of compatible adapters here:\n\nhttps://github.com/therealdreg/okhi?tab=readme-ov-file#ps2-usb-adapters-working-with-okhi\n\n# Adapter from hell\n\nCreating a real-world keylogger has been challenging and is still in beta. Take a look at some adapters on Amazon: they produce a peculiar long CLOCK signal each time, along with short pulses before the actual packet.\n\nThe PIO code must be compatible with these kinds of signals. Although the protocol should follow the standard and theoretically shouldn’t matter, unexpected behaviors occur in real-world scenarios.\n\nAdditionally, I found adapters that intermittently emit short pulses of various types, featuring fast rise and fall edges.\n\nSupporting the \"Adapter from hell\" was a pain, check this:\n\nhttps://github.com/therealdreg/okhi?tab=readme-ov-file#idle-behavior-adapter-from-hell\n\n![](stuff/togglit.jpg)\n\nAnother PS2 to USB Adapter from Aliexpress with a fast 1.8us low pulse (CLOCK LINE):\n\n![](stuff/lowpulse1p8us.jpg)\n\nNote: These types of \"glitches\" do not affect the functionality of the PS2 keyboard and the adapter in any way, but they are a problem when creating a generic sniffer.\n\n# GPIO used by the sniffer\n\n| PICO PIN | GPIO    | Function | USB Cable Color |\n|:--------:|:-------:|:----------------:|:-----:|\n| GND      | GND     | Ground           | N/A   |\n| 26       | GPIO20  | PS2 DAT          | N/A   |\n| 27       | GPIO21  | PS2 CLK          | N/A   |\n| 29       | GPIO22  | PIO (internal)   | N/A   |\n| 25       | GPIO19  | PIO (internal)   | N/A   |\n| 11       | GPIO8   | okhi (internal)  | N/A   |\n| 12       | GPIO9   | okhi (internal)  | N/A   |\n| 31       | GPIO26  | okhi led         | N/A   |\n\n\n# Learn resources\n\n- https://github.com/therealdreg/okhi\n- https://forums.raspberrypi.com/\n- https://datasheets.raspberrypi.com/pico/getting-started-with-pico.pdf\n- https://datasheets.raspberrypi.com/pico/raspberry-pi-pico-c-sdk.pdf\n- https://datasheets.raspberrypi.com/rp2040/rp2040-datasheet.pdf\n- https://github.com/therealdreg/okhi/blob/main/stuff/PS2_Keyboard.pdf\n\n# Related\n\n- https://github.com/therealdreg/pico-usb-sniffer-lite\n- https://github.com/therealdreg/pico-ps2-diagnostic-tool\n\n# Developers\n\nInstructions for building \u0026 debugging the firmware step-by-step can be found in the okhi repository:\n\nhttps://github.com/therealdreg/okhi?tab=readme-ov-file#developers-setup\n\n\n# CHANGELOG\n\n## v3 2025-08-19\n\n- okhi support: led, usb switch, button press...\n- better DOC\n- minor \u0026 cosmetic changes\n\n## v1 2025-01-21\n\n- Initial version from okhi project","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftherealdreg%2Fpico-ps2-sniffer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftherealdreg%2Fpico-ps2-sniffer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftherealdreg%2Fpico-ps2-sniffer/lists"}