| 1 | <!DOCTYPE html> |
| 2 | <html xmlns="http://www.w3.org/1999/xhtml" lang="" xml:lang=""> |
| 3 | <head> |
| 4 | <meta charset="utf-8" /> |
| 5 | <meta name="generator" content="pandoc" /> |
| 6 | <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" /> |
| 7 | <title>HACKING</title> |
| 8 | <style> |
| 9 | html { |
| 10 | color: #1a1a1a; |
| 11 | background-color: #fdfdfd; |
| 12 | } |
| 13 | body { |
| 14 | margin: 0 auto; |
| 15 | max-width: 36em; |
| 16 | padding-left: 50px; |
| 17 | padding-right: 50px; |
| 18 | padding-top: 50px; |
| 19 | padding-bottom: 50px; |
| 20 | hyphens: auto; |
| 21 | overflow-wrap: break-word; |
| 22 | text-rendering: optimizeLegibility; |
| 23 | font-kerning: normal; |
| 24 | } |
| 25 | @media (max-width: 600px) { |
| 26 | body { |
| 27 | font-size: 0.9em; |
| 28 | padding: 12px; |
| 29 | } |
| 30 | h1 { |
| 31 | font-size: 1.8em; |
| 32 | } |
| 33 | } |
| 34 | @media print { |
| 35 | html { |
| 36 | background-color: white; |
| 37 | } |
| 38 | body { |
| 39 | background-color: transparent; |
| 40 | color: black; |
| 41 | font-size: 12pt; |
| 42 | } |
| 43 | p, h2, h3 { |
| 44 | orphans: 3; |
| 45 | widows: 3; |
| 46 | } |
| 47 | h2, h3, h4 { |
| 48 | page-break-after: avoid; |
| 49 | } |
| 50 | } |
| 51 | p { |
| 52 | margin: 1em 0; |
| 53 | } |
| 54 | a { |
| 55 | color: #1a1a1a; |
| 56 | } |
| 57 | a:visited { |
| 58 | color: #1a1a1a; |
| 59 | } |
| 60 | img { |
| 61 | max-width: 100%; |
| 62 | } |
| 63 | svg { |
| 64 | height: auto; |
| 65 | max-width: 100%; |
| 66 | } |
| 67 | h1, h2, h3, h4, h5, h6 { |
| 68 | margin-top: 1.4em; |
| 69 | } |
| 70 | h5, h6 { |
| 71 | font-size: 1em; |
| 72 | font-style: italic; |
| 73 | } |
| 74 | h6 { |
| 75 | font-weight: normal; |
| 76 | } |
| 77 | ol, ul { |
| 78 | padding-left: 1.7em; |
| 79 | margin-top: 1em; |
| 80 | } |
| 81 | li > ol, li > ul { |
| 82 | margin-top: 0; |
| 83 | } |
| 84 | blockquote { |
| 85 | margin: 1em 0 1em 1.7em; |
| 86 | padding-left: 1em; |
| 87 | border-left: 2px solid #e6e6e6; |
| 88 | color: #606060; |
| 89 | } |
| 90 | code { |
| 91 | font-family: Menlo, Monaco, Consolas, 'Lucida Console', monospace; |
| 92 | font-size: 85%; |
| 93 | margin: 0; |
| 94 | hyphens: manual; |
| 95 | } |
| 96 | pre { |
| 97 | margin: 1em 0; |
| 98 | overflow: auto; |
| 99 | } |
| 100 | pre code { |
| 101 | padding: 0; |
| 102 | overflow: visible; |
| 103 | overflow-wrap: normal; |
| 104 | } |
| 105 | .sourceCode { |
| 106 | background-color: transparent; |
| 107 | overflow: visible; |
| 108 | } |
| 109 | hr { |
| 110 | background-color: #1a1a1a; |
| 111 | border: none; |
| 112 | height: 1px; |
| 113 | margin: 1em 0; |
| 114 | } |
| 115 | table { |
| 116 | margin: 1em 0; |
| 117 | border-collapse: collapse; |
| 118 | width: 100%; |
| 119 | overflow-x: auto; |
| 120 | display: block; |
| 121 | font-variant-numeric: lining-nums tabular-nums; |
| 122 | } |
| 123 | table caption { |
| 124 | margin-bottom: 0.75em; |
| 125 | } |
| 126 | tbody { |
| 127 | margin-top: 0.5em; |
| 128 | border-top: 1px solid #1a1a1a; |
| 129 | border-bottom: 1px solid #1a1a1a; |
| 130 | } |
| 131 | th { |
| 132 | border-top: 1px solid #1a1a1a; |
| 133 | padding: 0.25em 0.5em 0.25em 0.5em; |
| 134 | } |
| 135 | td { |
| 136 | padding: 0.125em 0.5em 0.25em 0.5em; |
| 137 | } |
| 138 | header { |
| 139 | margin-bottom: 4em; |
| 140 | text-align: center; |
| 141 | } |
| 142 | #TOC li { |
| 143 | list-style: none; |
| 144 | } |
| 145 | #TOC ul { |
| 146 | padding-left: 1.3em; |
| 147 | } |
| 148 | #TOC > ul { |
| 149 | padding-left: 0; |
| 150 | } |
| 151 | #TOC a:not(:hover) { |
| 152 | text-decoration: none; |
| 153 | } |
| 154 | code{white-space: pre-wrap;} |
| 155 | span.smallcaps{font-variant: small-caps;} |
| 156 | div.columns{display: flex; gap: min(4vw, 1.5em);} |
| 157 | div.column{flex: auto; overflow-x: auto;} |
| 158 | div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;} |
| 159 | /* The extra [class] is a hack that increases specificity enough to |
| 160 | override a similar rule in reveal.js */ |
| 161 | ul.task-list[class]{list-style: none;} |
| 162 | ul.task-list li input[type="checkbox"] { |
| 163 | font-size: inherit; |
| 164 | width: 0.8em; |
| 165 | margin: 0 0.8em 0.2em -1.6em; |
| 166 | vertical-align: middle; |
| 167 | } |
| 168 | .display.math{display: block; text-align: center; margin: 0.5rem auto;} |
| 169 | </style> |
| 170 | </head> |
| 171 | <body> |
| 172 | <header id="title-block-header"> |
| 173 | <h1 class="title">HACKING</h1> |
| 174 | </header> |
| 175 | <h1 id="razercfg---sniffing-the-usb-protocol">Razercfg - Sniffing the |
| 176 | USB protocol</h1> |
| 177 | <p>When adding support for a new mouse, or when debugging issues, it can |
| 178 | be usefull to capture the original protocol with Razer official |
| 179 | configuration software.</p> |
| 180 | <h2 id="requirements">Requirements</h2> |
| 181 | <p>No matter the method, the basic requirements are:</p> |
| 182 | <ul> |
| 183 | <li>a Windows machine with <a |
| 184 | href="http://www.razerzone.com/synapse/">Razer Synapse</a> installed |
| 185 | (note: you’ll need to register)</li> |
| 186 | <li>another mouse: to reduce protocol chatter by avoiding moving the |
| 187 | mouse spied on</li> |
| 188 | </ul> |
| 189 | <h2 id="using-usbpcap-or-wireshark">Using USBPcap or Wireshark</h2> |
| 190 | <p>You can sniff the USB protocol on Windows using <a |
| 191 | href="http://desowin.org/usbpcap/index.html">USBPcap</a>. Take a look at |
| 192 | the <a href="http://desowin.org/usbpcap/tour.html">illustrated tour</a> |
| 193 | for more information. Altenatively you can use <a |
| 194 | href="https://www.wireshark.org/">Wireshark</a>.</p> |
| 195 | <h2 id="using-a-guest-virtualbox-vm-and-usbmon-or-qemu-and-usbmon">Using |
| 196 | a guest VirtualBox VM and usbmon or QEMU and usbmon</h2> |
| 197 | <ol type="1"> |
| 198 | <li><p>Install Windows: you can get an evaluation copy (usable for 90 |
| 199 | days) of <a |
| 200 | href="https://www.microsoft.com/en-us/evalcenter/evaluate-windows-8-1-enterprise">Windows |
| 201 | 8/8.1/10</a> (note: you’ll need to register)</p></li> |
| 202 | <li><p>Find your mouse USB bus and device numbers:</p></li> |
| 203 | </ol> |
| 204 | <pre> |
| 205 | $ lsusb | grep 'ID 1532' |
| 206 | Bus 005 Device 010: ID 1532:0040 Razer USA, Ltd |
| 207 | $ bus=5 dev=10 |
| 208 | </pre> |
| 209 | <ol start="3" type="1"> |
| 210 | <li><p>configure VM access to the host USB: see the relevant <a |
| 211 | href="http://www.virtualbox.org/manual/ch03.html#idp54668304">USB |
| 212 | support</a> section in the <a |
| 213 | href="https://www.virtualbox.org/manual">VirtualBox manual</a></p></li> |
| 214 | <li><p>load the usbmon module:</p></li> |
| 215 | </ol> |
| 216 | <pre> |
| 217 | sudo modprobe usbmon |
| 218 | </pre> |
| 219 | <ol start="5" type="1"> |
| 220 | <li>monitor the bus, filtering for device specific messages:</li> |
| 221 | </ol> |
| 222 | <pre> |
| 223 | sudo cat /sys/kernel/debug/usb/usbmon/${bus}u | awk "{ if (\$4 ~ /:0*${bus}:0*${dev}:[0-9]+$/) print \$0 }" |
| 224 | </pre> |
| 225 | <p>See the <a |
| 226 | href="https://www.kernel.org/doc/Documentation/usb/usbmon.txt">usbmon |
| 227 | documentation</a> for the details of the output format.</p> |
| 228 | <p>Alternatively to VirtualBox VM, you may use <a |
| 229 | href="http://wiki.qemu.org/Main_Page">QEMU</a>.</p> |
| 230 | </body> |
| 231 | </html> |