{"id":206,"date":"2026-03-13T14:34:35","date_gmt":"2026-03-13T14:34:35","guid":{"rendered":"https:\/\/www.myuremote.com\/website\/?page_id=206"},"modified":"2026-03-13T14:37:09","modified_gmt":"2026-03-13T14:37:09","slug":"python-capture-tool","status":"publish","type":"page","link":"https:\/\/www.myuremote.com\/website\/docs\/technical\/python-capture-tool\/","title":{"rendered":"Python capture tool"},"content":{"rendered":"\n<section style=\"max-width:1000px;margin:0 auto;padding:26px 18px;line-height:1.6;\">\n\n  <header style=\"margin-bottom:18px;\">\n    <h1 style=\"font-size:clamp(26px,4vw,38px);line-height:1.15;margin:0;\">\n      Testing Device Commands with the MyURemote Python Capture Tool\n    <\/h1>\n\n    <p style=\"margin:10px 0 0 0;max-width:940px;\">\n      This page explains how to use the <strong>MyURemote Python capture tool<\/strong> to inspect\n      what a device integration actually sends over the network.\n      It is intended as a practical technical reference for integrators, advanced users,\n      and for internal debugging when creating or validating command-based device drivers.\n    <\/p>\n\n    <p style=\"margin:10px 0 0 0;max-width:940px;opacity:.85;\">\n      Key idea: <strong>before debugging device behaviour, first verify what MyURemote is really sending.<\/strong>\n    <\/p>\n  <\/header>\n\n  <hr style=\"opacity:.25;margin:18px 0;\" \/>\n\n  <!-- 1. PURPOSE -->\n  <section>\n    <h2>1. What this tool is for<\/h2>\n\n    <p>\n      In many integrations, the first question is not whether the target device is responding correctly,\n      but whether <strong>the correct bytes are leaving MyURemote in the first place<\/strong>.\n      When building or testing a driver, you often want to know:\n    <\/p>\n\n    <ul>\n      <li>is the command sent over <strong>TCP<\/strong> or <strong>UDP<\/strong>?<\/li>\n      <li>what is the exact byte payload?<\/li>\n      <li>is the payload plain ASCII text or binary data?<\/li>\n      <li>does the integration send one packet or multiple packets?<\/li>\n      <li>does the client expect any kind of response?<\/li>\n    <\/ul>\n\n    <p style=\"opacity:.85;\">\n      The Python capture tool provides a fake target device that listens on a chosen port and logs\n      whatever MyURemote sends to it.\n    <\/p>\n  <\/section>\n\n  <hr style=\"opacity:.25;margin:18px 0;\" \/>\n\n  <!-- 2. WHY IT MATTERS -->\n  <section>\n    <h2>2. Why this matters in real-world integrations<\/h2>\n\n    <p>\n      Many device protocols are poorly documented, inconsistent between firmware versions,\n      or only partially understood from packet captures and reverse engineering.\n      In practice, debugging becomes much easier when you can isolate one question:\n    <\/p>\n\n    <pre style=\"background:#f6f7f9;border:1px solid rgba(0,0,0,.08);padding:12px;border-radius:12px;overflow:auto;\"><code>What exactly is MyURemote sending to the network?<\/code><\/pre>\n\n    <p>\n      Once that is clear, you can compare the captured output against:\n    <\/p>\n\n    <ul>\n      <li>a known working vendor app<\/li>\n      <li>Wireshark traces<\/li>\n      <li>existing driver definitions<\/li>\n      <li>protocol documentation<\/li>\n      <li>expected ASCII \/ HEX command formats<\/li>\n    <\/ul>\n\n    <p style=\"opacity:.85;\">\n      This avoids \u201cguess debugging\u201d and gives a reproducible reference point during development.\n    <\/p>\n  <\/section>\n\n  <hr style=\"opacity:.25;margin:18px 0;\" \/>\n\n  <!-- 3. WHAT THE TOOL DOES -->\n  <section>\n    <h2>3. What the capture tool does<\/h2>\n\n    <p>\n      The Python script starts a small fake server that listens on a single configurable port for both:\n    <\/p>\n\n    <ul>\n      <li><strong>TCP traffic<\/strong><\/li>\n      <li><strong>UDP traffic<\/strong><\/li>\n    <\/ul>\n\n    <p>\n      For every received packet, it prints:\n    <\/p>\n\n    <ul>\n      <li>timestamp<\/li>\n      <li>protocol (TCP or UDP)<\/li>\n      <li>client IP and source port<\/li>\n      <li>packet length in bytes<\/li>\n      <li>HEX representation<\/li>\n      <li>ASCII representation<\/li>\n    <\/ul>\n\n    <p>\n      For TCP connections, the tool also returns a very small test response:\n    <\/p>\n\n    <pre style=\"background:#f6f7f9;border:1px solid rgba(0,0,0,.08);padding:12px;border-radius:12px;overflow:auto;\"><code>OK\\r\\n<\/code><\/pre>\n\n    <p style=\"opacity:.85;\">\n      That response is not meant to emulate a real device protocol.\n      It simply helps in cases where the sender expects some response and would otherwise block or disconnect differently.\n    <\/p>\n  <\/section>\n\n  <hr style=\"opacity:.25;margin:18px 0;\" \/>\n\n  <!-- 4. DOWNLOAD -->\n  <section>\n    <h2>4. Download<\/h2>\n\n    <p>\n      The capture tool can be downloaded directly here:\n    <\/p>\n\n    <p>\n      <a href=\"https:\/\/myuremote.com\/website\/downloads\/python\/capture_tool\/python tcp_sniffer.py\" target=\"_blank\" rel=\"noopener\">\n        myuremote.com\/website\/downloads\/python\/capture_tool\/python tcp_sniffer.py\n      <\/a>\n    <\/p>\n\n    <p style=\"opacity:.85;\">\n      Save the script locally and run it on a machine that is reachable from the device running MyURemote.\n      In most cases this will be a computer on the same local network.\n    <\/p>\n  <\/section>\n\n  <hr style=\"opacity:.25;margin:18px 0;\" \/>\n\n  <!-- 5. REQUIREMENTS -->\n  <section>\n    <h2>5. Requirements<\/h2>\n\n    <ul>\n      <li>a computer with <strong>Python 3<\/strong><\/li>\n      <li>the computer must be reachable on the same LAN as the MyURemote client<\/li>\n      <li>the chosen TCP\/UDP port must not be blocked by the firewall<\/li>\n      <li>MyURemote must be configured to send commands to that IP and port<\/li>\n    <\/ul>\n\n    <p style=\"opacity:.85;\">\n      In most setups, no extra Python packages are required because the script uses standard library modules only.\n    <\/p>\n  <\/section>\n\n  <hr style=\"opacity:.25;margin:18px 0;\" \/>\n\n  <!-- 6. HOW TO RUN -->\n  <section>\n    <h2>6. How to run the tool<\/h2>\n\n    <p>\n      Start the script from a terminal or command prompt:\n    <\/p>\n\n    <pre style=\"background:#f6f7f9;border:1px solid rgba(0,0,0,.08);padding:12px;border-radius:12px;overflow:auto;\"><code>python3 capture_tool<\/code><\/pre>\n\n    <p>\n      The tool will ask which port it should use, for example:\n    <\/p>\n\n    <pre style=\"background:#f6f7f9;border:1px solid rgba(0,0,0,.08);padding:12px;border-radius:12px;overflow:auto;\"><code>Welke poort moet ik gebruiken? (bv. 4998) : 4998<\/code><\/pre>\n\n    <p>\n      It then determines the local IP address of the machine and displays the values you should use in MyURemote.\n    <\/p>\n\n    <p>\n      Typical output looks like this:\n    <\/p>\n\n    <pre style=\"background:#f6f7f9;border:1px solid rgba(0,0,0,.08);padding:12px;border-radius:12px;overflow:auto;\"><code>=== Fake Device Server (TCP + UDP) ===\n\n\ud83d\udd0d Lokale server draait op IP: 192.168.0.120\n\u27a1 Stel in MyURemote IP = 192.168.0.120, poort = 4998\n\u27a1 Wireshark filter voorbeeld: host 192.168.0.120 and tcp.port == 4998\n\nTCP-server luistert op 0.0.0.0:4998\nUDP-server luistert op 0.0.0.0:4998\n\nWachten op verkeer... (Ctrl+C om te stoppen)<\/code><\/pre>\n  <\/section>\n\n  <hr style=\"opacity:.25;margin:18px 0;\" \/>\n\n  <!-- 7. HOW TO USE WITH MYUREMOTE -->\n  <section>\n    <h2>7. How to use it with MyURemote<\/h2>\n\n    <p>\n      The basic workflow is straightforward:\n    <\/p>\n\n    <ol style=\"margin-top:10px;\">\n      <li>Run the capture tool on a computer in the local network.<\/li>\n      <li>Note the IP address and chosen port shown by the script.<\/li>\n      <li>In MyURemote, configure the test device or command target to use that IP and port.<\/li>\n      <li>Trigger the command from MyURemote.<\/li>\n      <li>Inspect the output printed by the Python tool.<\/li>\n    <\/ol>\n\n    <p>\n      In other words:\n    <\/p>\n\n    <pre style=\"background:#f6f7f9;border:1px solid rgba(0,0,0,.08);padding:12px;border-radius:12px;overflow:auto;\"><code>MyURemote \u2192 your computer running capture_tool \u2192 terminal output<\/code><\/pre>\n\n    <p style=\"opacity:.85;\">\n      This lets you validate the actual command payload before involving the real target device.\n    <\/p>\n  <\/section>\n\n  <hr style=\"opacity:.25;margin:18px 0;\" \/>\n\n  <!-- 8. HOW TO READ OUTPUT -->\n  <section>\n    <h2>8. How to read the output<\/h2>\n\n    <p>\n      When MyURemote sends a command, the tool prints a packet log similar to:\n    <\/p>\n\n    <pre style=\"background:#f6f7f9;border:1px solid rgba(0,0,0,.08);padding:12px;border-radius:12px;overflow:auto;\"><code>[2026-03-13T14:23:10] TCP 192.168.0.45:53122 -> 8 bytes\n  HEX:   50 4F 57 45 52 4F 4E 0D\n  ASCII: POWERON.<\/code><\/pre>\n\n    <p>\n      This tells you:\n    <\/p>\n\n    <ul>\n      <li>the transport protocol used<\/li>\n      <li>which client sent it<\/li>\n      <li>how long the packet is<\/li>\n      <li>the raw bytes in hexadecimal<\/li>\n      <li>a readable ASCII view where possible<\/li>\n    <\/ul>\n\n    <p>\n      The ASCII line is especially helpful for text-based protocols.\n      The HEX line is essential for:\n    <\/p>\n\n    <ul>\n      <li>binary commands<\/li>\n      <li>non-printable delimiters<\/li>\n      <li>carriage return \/ line feed differences<\/li>\n      <li>null bytes or checksum bytes<\/li>\n      <li>comparing exact payloads against Wireshark captures<\/li>\n    <\/ul>\n  <\/section>\n\n  <hr style=\"opacity:.25;margin:18px 0;\" \/>\n\n  <!-- 9. PRACTICAL USE CASES -->\n  <section>\n    <h2>9. Practical use cases<\/h2>\n\n    <h3 style=\"margin-top:14px;\">9.1 Testing a new TCP driver<\/h3>\n    <p>\n      When defining a new IP-based driver, you can point the device temporarily to the capture tool\n      instead of the real target and verify that the outgoing command format is correct.\n    <\/p>\n\n    <h3 style=\"margin-top:14px;\">9.2 Verifying delimiter issues<\/h3>\n    <p>\n      Many protocols require exact terminators such as:\n    <\/p>\n    <ul>\n      <li><code>\\r<\/code><\/li>\n      <li><code>\\n<\/code><\/li>\n      <li><code>\\r\\n<\/code><\/li>\n      <li>no terminator at all<\/li>\n    <\/ul>\n    <p>\n      The HEX output makes these differences immediately visible.\n    <\/p>\n\n    <h3 style=\"margin-top:14px;\">9.3 Confirming UDP vs TCP behaviour<\/h3>\n    <p>\n      Some devices accept UDP discovery and TCP control, while others use UDP for actual commands.\n      This tool allows you to confirm what the integration is really doing.\n    <\/p>\n\n    <h3 style=\"margin-top:14px;\">9.4 Comparing against vendor-app traffic<\/h3>\n    <p>\n      You can compare captured MyURemote commands against traffic captured from an official app\n      to verify that the format, byte order and framing match expectations.\n    <\/p>\n\n    <h3 style=\"margin-top:14px;\">9.5 Debugging response expectations<\/h3>\n    <p>\n      If MyURemote behaves differently when the fake server returns <code>OK\\r\\n<\/code>,\n      that can be a clue that the integration expects a response phase after sending the command.\n    <\/p>\n  <\/section>\n\n  <hr style=\"opacity:.25;margin:18px 0;\" \/>\n\n  <!-- 10. WIRESHARK -->\n  <section>\n    <h2>10. Optional: combine it with Wireshark<\/h2>\n\n    <p>\n      The script already prints a suggested filter format. For example:\n    <\/p>\n\n    <pre style=\"background:#f6f7f9;border:1px solid rgba(0,0,0,.08);padding:12px;border-radius:12px;overflow:auto;\"><code>host 192.168.0.120 and tcp.port == 4998<\/code><\/pre>\n\n    <p>\n      Or for UDP:\n    <\/p>\n\n    <pre style=\"background:#f6f7f9;border:1px solid rgba(0,0,0,.08);padding:12px;border-radius:12px;overflow:auto;\"><code>host 192.168.0.120 and udp.port == 4998<\/code><\/pre>\n\n    <p>\n      Combining terminal logging with Wireshark is useful because:\n    <\/p>\n\n    <ul>\n      <li>the terminal gives an immediate readable summary<\/li>\n      <li>Wireshark shows session timing and packet structure in more detail<\/li>\n      <li>you can compare multiple clients and repeated command sequences<\/li>\n    <\/ul>\n\n    <p style=\"opacity:.85;\">\n      In many debugging sessions, the terminal output is enough.\n      Wireshark becomes most useful when timing, retries, retransmissions or multi-packet exchanges are involved.\n    <\/p>\n  <\/section>\n\n  <hr style=\"opacity:.25;margin:18px 0;\" \/>\n\n  <!-- 11. IMPORTANT LIMITATIONS -->\n  <section>\n    <h2>11. Important limitations<\/h2>\n\n    <p>\n      This tool is intentionally simple. It is a <strong>capture endpoint<\/strong>, not a protocol emulator.\n    <\/p>\n\n    <ul>\n      <li>it does <strong>not<\/strong> emulate a real device state machine<\/li>\n      <li>it does <strong>not<\/strong> perform authentication handshakes<\/li>\n      <li>it does <strong>not<\/strong> implement brand-specific responses<\/li>\n      <li>the TCP reply <code>OK\\r\\n<\/code> is generic and only meant as a minimal test response<\/li>\n      <li>it is mainly useful for raw command inspection, not full protocol validation<\/li>\n    <\/ul>\n\n    <p style=\"opacity:.85;\">\n      For complex protocols such as WebSocket, TLS-based sessions, challenge\/response flows,\n      or structured JSON exchanges, this capture tool is still useful as a first diagnostic step,\n      but it is not a complete simulator.\n    <\/p>\n  <\/section>\n\n  <hr style=\"opacity:.25;margin:18px 0;\" \/>\n\n  <!-- 12. WHEN TO USE IT -->\n  <section>\n    <h2>12. When this tool is the right first step<\/h2>\n\n    <p>\n      Use the capture tool first when:\n    <\/p>\n\n    <ul>\n      <li>a command appears not to work and you want to validate the exact outgoing payload<\/li>\n      <li>you are creating a new driver and want quick feedback<\/li>\n      <li>you suspect formatting issues in the command string<\/li>\n      <li>you want to know whether traffic is TCP or UDP<\/li>\n      <li>you need a fast local test target without involving the real device<\/li>\n    <\/ul>\n\n    <p>\n      This often turns an unclear integration problem into a very concrete technical question:\n    <\/p>\n\n    <pre style=\"background:#f6f7f9;border:1px solid rgba(0,0,0,.08);padding:12px;border-radius:12px;overflow:auto;\"><code>Is the wrong command being sent, or is the real device rejecting a correct command?<\/code><\/pre>\n  <\/section>\n\n  <hr style=\"opacity:.25;margin:18px 0;\" \/>\n\n  <!-- 13. SUMMARY -->\n  <section>\n    <h2>13. Summary<\/h2>\n\n    <ul>\n      <li>The Python capture tool acts as a fake network device for TCP and UDP command testing.<\/li>\n      <li>It helps verify exactly what MyURemote sends over the network.<\/li>\n      <li>It logs packet size, HEX data and ASCII data for quick inspection.<\/li>\n      <li>It is ideal for driver development, command validation and protocol debugging.<\/li>\n      <li>It is not a full emulator, but it is an excellent first diagnostic tool.<\/li>\n    <\/ul>\n\n    <p style=\"opacity:.85;margin-top:10px;\">\n      Bottom line: <strong>this tool helps separate command-generation problems from device-behaviour problems.<\/strong>\n    <\/p>\n  <\/section>\n\n<\/section>\n","protected":false},"excerpt":{"rendered":"<p>Testing Device Commands with the MyURemote Python Capture Tool This page explains how to use the MyURemote Python capture tool to inspect what a device integration actually sends over the network. It is intended as a practical technical reference for integrators, advanced users, and for internal debugging when creating or validating command-based device drivers. Key [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":144,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-206","page","type-page","status-publish","hentry"],"blocksy_meta":{"has_hero_section":"disabled","styles_descriptor":{"styles":{"desktop":"","tablet":"","mobile":""},"google_fonts":[],"version":6}},"_links":{"self":[{"href":"https:\/\/www.myuremote.com\/website\/wp-json\/wp\/v2\/pages\/206","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.myuremote.com\/website\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.myuremote.com\/website\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.myuremote.com\/website\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.myuremote.com\/website\/wp-json\/wp\/v2\/comments?post=206"}],"version-history":[{"count":2,"href":"https:\/\/www.myuremote.com\/website\/wp-json\/wp\/v2\/pages\/206\/revisions"}],"predecessor-version":[{"id":208,"href":"https:\/\/www.myuremote.com\/website\/wp-json\/wp\/v2\/pages\/206\/revisions\/208"}],"up":[{"embeddable":true,"href":"https:\/\/www.myuremote.com\/website\/wp-json\/wp\/v2\/pages\/144"}],"wp:attachment":[{"href":"https:\/\/www.myuremote.com\/website\/wp-json\/wp\/v2\/media?parent=206"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}