joseamirandavelez
Posts: 3
Joined: Fri Apr 28, 2017 12:32 am

Post Processing commands added to gcode file

Sat Apr 29, 2017 5:11 pm

Hi,

I am using a command like this in the Post Processing script:

Code: Select all

curl -u username:password -k -H "X-Api-Key: 11223344556677889900" -F "select=false" -F "print=false" -F "file=@[output_filepath]" "http://myprintersadress/api/files/local"
to send the gcode file to OctoPrint. It works flawlesly. The only problem is that Simplify3D writes the whole line to the gcode file. This includes my username, password, api key and octopi server address... all sensitive information. Is there any way to prevent Simplify3D from echoing this to the gcode file? :?: :?:

brian442
Posts: 1243
Joined: Mon Nov 28, 2016 5:35 am

Re: Post Processing commands added to gcode file

Sun Apr 30, 2017 10:21 am

What operating system are you using? I tried this myself and it seems to work fine on my computer. Nothing extra is added to the gcode files.

upsm
Posts: 151
Joined: Sun Mar 12, 2017 5:37 am

Re: Post Processing commands added to gcode file

Sun Apr 30, 2017 2:50 pm

joseamirandavelez wrote: The only problem is that Simplify3D writes the whole line to the gcode file. This includes my username, password, api key and octopi server address... all sensitive information. Is there any way to prevent Simplify3D from echoing this to the gcode file? :?: :?:
G-Code files are not usually ones you "share" so that's why I assume they by default push everything in, and I personally like that. Now since they were sensible enough to assume you might not want everything in, there is option to strip data from G-Code. You can find most here
Below are the post-processing tools that also work in the post-processing box:

{REPLACE "E" "A"} - search and replace for the text within quotes, in this example every "E" character would be replaced with an "A" character
{PREPEND "G92 E0\n"} - prepends the specified text at the very beginning of the gcode file, note that the \n is converted into a true newline character, not two separate "\" and "n" characters
{APPEND "G28 X0 Y0\n"} - appends the specified text to the very end of the gcode file
{DELETE "M82\n"} - deletes every occurrence of the specified text from the gcode file, note that it will not automatically delete a line if it is suddenly empty after the deletion, so that is why you might want to include the \n at the end (so that the empty line is also removed)
{STRIP ";"} - completely deletes every line in the gcode file that begins with the specified text
{TOOL0REPLACE "E" "A"} and {TOOL1REPLACE "E" "B"} - these special TOOL#REPLACE commands will do a search and replace, very similar to the {REPLACE} command, however, the replace only occurs if the specified tool is active. For example, when using TOOL1REPLACE, the replacement will only occur if tool 1 was currently active at that line of the gcode file
To remove the data you want (postprocessing info) use this:

Code: Select all

{STRIP "; postProcessing"} 
Used cars search engine
  • TT UP Plus 2 / Smoothieware
  • M150 / Smoothieware
  • Custom (mendel) / Smoothieware
  • Custom (darwin) / Smoothieware
  • Custom (darwin) / Marlin
  • Custom (darwin) / Replicape

upsm
Posts: 151
Joined: Sun Mar 12, 2017 5:37 am

Re: Post Processing commands added to gcode file

Sun Apr 30, 2017 8:12 pm

mine "post processing field" content:

Code: Select all

curl -H "X-Api-Key: 123123123123123123123" -F "select=true" -F "print=true" -F "file=@[output_filepath]" "http://192.168.0.1/api/files/local"
{STRIP ";   postProcessing"} 
note that between ; and postProce... there are 3 spaces (not sure if something like " +" could be used or some other similar expression
Used cars search engine
  • TT UP Plus 2 / Smoothieware
  • M150 / Smoothieware
  • Custom (mendel) / Smoothieware
  • Custom (darwin) / Smoothieware
  • Custom (darwin) / Marlin
  • Custom (darwin) / Replicape

joseamirandavelez
Posts: 3
Joined: Fri Apr 28, 2017 12:32 am

Re: Post Processing commands added to gcode file

Mon May 01, 2017 1:00 am

brian442 wrote:What operating system are you using? I tried this myself and it seems to work fine on my computer. Nothing extra is added to the gcode files.
I checked the file, and it outputs the whole line.

Code: Select all

;   postProcessing,{REPLACE "; outer perimeter\n" "; outer perimeter\nM204 S600\n"},{REPLACE "; inner perimeter\n" "; inner perimeter\nM204 S1200\n"},{REPLACE "; solid layer\n" "; solid layer\nM204 S1500\n"},{REPLACE "; infill\n" "; infill\nM204 S2000\n"},curl -u username:password -k -H "X-Api-Key: APIKEYGOESHERE" -F "select=false" -F "print=false" -F "file=@[output_filepath]" "http://yoururl.com/api/files/local"

joseamirandavelez
Posts: 3
Joined: Fri Apr 28, 2017 12:32 am

Re: Post Processing commands added to gcode file

Mon May 01, 2017 1:17 am

upsm:

This worked. Thanks!

I dont usually share my gcode file, however, they are usually shared between people with the same printers. For example, my Prusa printer came with a lot of gcode files in the card, ready to use. Even with a whole RC airplane... Not a single stl file. But the main reason is that OctoPrint allows people to download gcode files. If the files contain the username, password and API key, they can do whatever they want with the server... So the only thing they need is to find a gcode file generated by me, either by using a vulnerability in any of the software used by OctoPi or simply stealing an sd card... If the information is not in the gcode file, its going to be harder for them. It's just an extra security measure.

Return to “General Discussion and Tips”