TCP/IP Encoding
Hello Good Day !
I am working on Snort to add limit signatures for 3D Printers (such as using repetier-server G code commands are sent using TCP packets). Where I can find source , examples or code, to make me understand how G codes are translated or encoded for TCP packets... Or how can I decode repetier server TCP packets to analyze which command is being sent and what are X,Y, and Z positions for next move (So that I can generate alert if X is greater then Max limit ).
Hope you can understand my problem statement !!
Regards,
Mubeen
I am working on Snort to add limit signatures for 3D Printers (such as using repetier-server G code commands are sent using TCP packets). Where I can find source , examples or code, to make me understand how G codes are translated or encoded for TCP packets... Or how can I decode repetier server TCP packets to analyze which command is being sent and what are X,Y, and Z positions for next move (So that I can generate alert if X is greater then Max limit ).
Hope you can understand my problem statement !!
Regards,
Mubeen
Comments
So It means command like "G1 X10 F4800" will be transmitted over tcp as it is, after binary conversion only ???
----------------------------------
From Wire shark dump Bold and Italic is tcp packet sent from host to server, but its not readable as response from server is human readable...
...o
..b...Mk...e..U*...d..C...O(...k..Oq..b...Mz...~..M0...o..M&..O*...f...i...n..O'..ew.I{"callback_id":-1,"data":{},"session":"z%Uc4fcDQ9WY70QgHb^6non6T82LVnZU"}.~..{"callback_id":-1,"data":[{"data":{"O":51.76470565795898,"S":210.0,"T":207.5,"id":0,"t":1579151190563},"event":"temp","printer":"test"},{"data":{"O":0.0,"S":50.0,"T":51.70000076293945,"id":1000,"t":1579151190563},"event":"temp","printer":"test"},{"data":{"O":51.76470565795898,"S":210.0,"T":207.5,"id":0,"t":1579151190563},"event":"temp","printer":"test"},{"data":{"O":0.0,"S":50.0,"T":51.70000076293945,"id":1000,"t":1579151190563},"event":"temp","printer":"test"},{"data":{"O":51.76470565795898,"S":210.0,"T":207.5,"id":0,"t":1579151190567},"event":"temp","printer":"test"},{"data":{"O":0.0,"S":50.0,"T":51.70000076293945,"id":1000,"t":1579151190567},"event":"temp","printer":"test"},{"data":{"O":51.76470565795898,"S":210.0,"T":207.5,"id":0,"t":1579151190571},"event":"temp","printer":"test"},{"data":{"O":0.0,"S":50.0,"T":51.70000076293945,"id":1000,"t":1579151190571},"event":"temp","printer":"test"}],"eventList":true}.~..{"callback_id":-1,"data":[{"data":{"id":5167,"text":"ok","time":" 5:06:30.559","type":2},"event":"log","printer":"test"},{"data":{"id":5168,"text":"N2478 G0 F9000 X86.749 Y88.164","time":" 5:06:30.559","type":1},"event":"log","printer":"test"},{"data":{"id":5169,"text":"ok T:207.5 /210.0 B:51.7 /50.0 T0:207.5 /210.0 @:66 B@:0","time":" 5:06:30.563","type":2},"event":"log","printer":"test"},{"data":{"id":5170,"text":"ok T:207.5 /210.0 B:51.7 /50.0 T0:207.5 /210.0 @:66 B@:0","time":" 5:06:30.563","type":2},"event":"log","printer":"test"},{"data":{"id":5171,"text":"ok T:207.5 /210.0 B:51.7 /50.0 T0:207.5 /210.0 @:66 B@:0","time":" 5:06:30.567","type":2},"event":"log","printer":"test"},{"data":{"id":5172,"text":"N2479 G1 F1800 X116.353 Y117.767 E25.27117","time":" 5:06:30.567","type":1},"event":"log","printer":"test"},{"data":{"id":5173,"text":"ok T:207.5 /210.0 B:51.7 /50.0 T0:207.5 /210.0 @:66 B@:0","time":" 5:06:30.571","type":2},"event":"log","printer":"test"}],"eventList":true}.~..{"callback_id":-1,"data":[{"data":{"id":5174,"text":"N2480 M105","time":" 5:06:30.976","type"
https://www.repetier-server.com/manuals/programming/API/index.html
But this communication not necessarily contains what you want. After all server is sending gcode to printer and not host, so while printing best you could do is enable logging so you get a copy of everything that was send to printer.
But why do you need an alert if limits are exceeded? Firmware would ignore such moves, server and host will mark that print is not inside printable region and move buttons limit it also to allowed region. All left is sending explicitly wrong positions but these get catched by firmware as last barrier. It is also not that easy since you have to include offsets from G92 or tool offsets as well to limits.