bvanheu / stratatools

Stratasys EEPROM tool
BSD 3-Clause "New" or "Revised" License
88 stars 40 forks source link

build.sh failing #1

Closed NeilvEs closed 10 years ago

NeilvEs commented 10 years ago

Hi,

I was trying to build your code via $ ./build.sh on Mac Osx, but it prompts an error: src/des.c:409:5: error: conflicting types for 'DESX_CBCUpdate' int DESX_CBCUpdate (DESX_CBC_CTX context, uint8_t output, uint8_t inp... ^ src/des.h:20:5: note: previous declaration is here int DESX_CBCUpdate(DESX_CBC_CTX , uint8_t , uint8_t , unsigned int);

I think this causes the build to fail (there is no file 'strata sys' in /bin). I am by no means a coding expert, but how can I resolve this?

Looking forward hearing from you!

Thanks, Neil

P.s.: it gives some error to, but I don't think they cause the build to fail:

src/stratasys.c:167:30: warning: format specifies type 'int' but the argument has type 'ssize_t' (aka 'long') [-Wformat] printf("%d bytes\n", bytes); ~~ ^~~~~ %zd src/stratasys.c:180:32: warning: format specifies type 'int' but the argument has type 'ssize_t' (aka 'long') [-Wformat] printf("\t%d bytes\n", bytes); ~~ ^~~~~ %zd src/stratasys.c:192:30: warning: format specifies type 'int' but the argument has type 'ssize_t' (aka 'long') [-Wformat] printf("%d bytes\n", bytes); ~~ ^~~~~ %zd src/stratasys.c:205:30: warning: format specifies type 'int' but the argument has type 'ssize_t' (aka 'long') [-Wformat] printf("%d bytes\n", bytes); ~~ ^~~~~ %zd 4 warnings generated.

HaveBlueXST commented 10 years ago

Hello! I'm not bvanheu, but if the issue you're running into is the one I'm thinking of, his quick fix is the following:

In the file src/des.h, line 20:

int DESX_CBCUpdate(DESX_CBC_CTX , uint8_t , uint8_t *, unsigned int)

replace this line ^ by this one v :

int DESX_CBCUpdate (DESX_CBC_CTX context, uint8_t output, uint8_t *input, size_t len)

so that src/des.h, line 20 is now:

int DESX_CBCUpdate (DESX_CBC_CTX context, uint8_t output, uint8_t *input, size_t len)

On 11/24/2013 10:10 AM, NeilvEs wrote:

Hi,

I was trying to build your code via $ ./build.sh on Mac Osx, but it prompts an error: src/des.c:409:5: error: conflicting types for 'DESX_CBCUpdate' int DESX_CBCUpdate (DESX_CBC_CTX context, uint8_t output, uint8_t inp... ^ src/des.h:20:5: note: previous declaration is here int DESX_CBCUpdate(DESX_CBC_CTX , uint8_t , uint8_t , unsigned int);

I think this causes the build to fail (there is no file 'strata sys' in /bin). I am by no means a coding expert, but how can I resolve this?

Looking forward hearing from you!

Thanks, Neil

P.s.: it gives some error to, but I don't think they cause the build to fail:

src/stratasys.c:167:30: warning: format specifies type 'int' but the argument has type 'ssize_t' (aka 'long') [-Wformat] printf("%d bytes\n", bytes); ~~ ^~~~~ %zd src/stratasys.c:180:32: warning: format specifies type 'int' but the argument has type 'ssize_t' (aka 'long') [-Wformat] printf("\t%d bytes\n", bytes); ~~ ^~~~~ %zd src/stratasys.c:192:30: warning: format specifies type 'int' but the argument has type 'ssize_t' (aka 'long') [-Wformat] printf("%d bytes\n", bytes); ~~ ^~~~~ %zd src/stratasys.c:205:30: warning: format specifies type 'int' but the argument has type 'ssize_t' (aka 'long') [-Wformat] printf("%d bytes\n", bytes); ~~ ^~~~~ %zd 4 warnings generated.

— Reply to this email directly or view it on GitHub https://github.com/bvanheu/stratasys/issues/1.

NeilvEs commented 10 years ago

Thanks, it builds now. However, it trows an error when running (Plain text CRC invalid):

$ ./bin/stratasys -d -m 5394D7657CED641D -u 23747906010000d0 -i ./test.bin -o ./decrypted_test.bin

Stratasys Cryptography Service

EEPROM UID: 23747906010000D0FF Machine number: 5394D7657CED641D [+] Reading ./test.bin ... 104 bytes [i] Validating key CRC ... valid. [i] Building key ... done. [i] Decrypting content ... done. [i] Decrypting current material qty ... done. [i] Validating current material qty crypted CRC ... valid. [i] Validating plain text CRC ... invalid. F932 != 6BCC Error ^

What could I do to resolve this?

Op 24 nov. 2013, om 21:09 heeft HaveBlueXST notifications@github.com het volgende geschreven:

Hello! I'm not bvanheu, but if the issue you're running into is the one I'm thinking of, his quick fix is the following:

In the file src/des.h, line 20:

int DESX_CBCUpdate(DESX_CBC_CTX , uint8_t , uint8_t *, unsigned int)

replace this line ^ by this one v :

int DESX_CBCUpdate (DESX_CBC_CTX context, uint8_t output, uint8_t *input, size_t len)

so that src/des.h, line 20 is now:

int DESX_CBCUpdate (DESX_CBC_CTX context, uint8_t output, uint8_t *input, size_t len)

On 11/24/2013 10:10 AM, NeilvEs wrote:

Hi,

I was trying to build your code via $ ./build.sh on Mac Osx, but it prompts an error: src/des.c:409:5: error: conflicting types for 'DESX_CBCUpdate' int DESX_CBCUpdate (DESX_CBC_CTX context, uint8_t output, uint8_t inp... ^ src/des.h:20:5: note: previous declaration is here int DESX_CBCUpdate(DESX_CBC_CTX , uint8_t , uint8_t , unsigned int);

I think this causes the build to fail (there is no file 'strata sys' in /bin). I am by no means a coding expert, but how can I resolve this?

Looking forward hearing from you!

Thanks, Neil

P.s.: it gives some error to, but I don't think they cause the build to fail:

src/stratasys.c:167:30: warning: format specifies type 'int' but the argument has type 'ssize_t' (aka 'long') [-Wformat] printf("%d bytes\n", bytes); ~~ ^~~~~ %zd src/stratasys.c:180:32: warning: format specifies type 'int' but the argument has type 'ssize_t' (aka 'long') [-Wformat] printf("\t%d bytes\n", bytes); ~~ ^~~~~ %zd src/stratasys.c:192:30: warning: format specifies type 'int' but the argument has type 'ssize_t' (aka 'long') [-Wformat] printf("%d bytes\n", bytes); ~~ ^~~~~ %zd src/stratasys.c:205:30: warning: format specifies type 'int' but the argument has type 'ssize_t' (aka 'long') [-Wformat] printf("%d bytes\n", bytes); ~~ ^~~~~ %zd 4 warnings generated.

— Reply to this email directly or view it on GitHub https://github.com/bvanheu/stratasys/issues/1.

— Reply to this email directly or view it on GitHub.

bvanheu commented 10 years ago

You can send me the file "test.bin", i can have a look to your file.

Can I suggest to try the next-gen code? You can find it in the "stratasys-ng" branch.

In the directory where you cloned this respository, simply run:

$ git checkout -b stratasys-ng origin/stratasys-ng

you will find a python2 script named "stratasys-cli.py". You will need to install pycrypto.

Then, simply run:

$ python2 ./stratasys-cli.py info --help
...
$ python2 ./stratasys-cli.py info -t prodigy -e 23747906010000d0 -i test.bin --human-output
NeilvEs commented 10 years ago

Hi,

I've made the changes in a Ubuntu VM to the new branch. Installed pycrypto and checked if python 2.7 was installed. Prompted the following error: $ ./stratasys-cli.py info -t prodigy -e 23747906010000d0 -i test.bin -u -r Traceback (most recent call last): File "./stratasys-cli.py", line 168, in app.run() File "./stratasys-cli.py", line 46, in run args.func(args) File "./stratasys-cli.py", line 133, in command_info cartridge = m.decode(machine_number, args.eeprom_uid, cartridge_crypted) File "/home/parallels/stratasys/stratasys/manager.py", line 76, in decode cartridge_packed = self.decrypt(machine_number, eeprom_uid, cartridge_crypted) File "/home/parallels/stratasys/stratasys/manager.py", line 220, in decrypt if self.checksum.checksum(cartridge_crypted[0x00:0x40]) != struct.unpack("<H", cartridge_crypted[0x46:0x48])[0]: struct.error: unpack requires a string argument of length 2

Please find the test.bin file here: https://dl.dropboxusercontent.com/u/416289/test.bin

bvanheu commented 10 years ago

Are you on x64 VM?

I have this error (on x86): Exception: invalid content checksum: should have 0x6bcc but have 0x3e0e

Also, would you mind telling me what printer model you are using? It looks like we don't provide the good printer-model (like 'prodigy' or 'fox').

NeilvEs commented 10 years ago

Indeed, it's a x64 VM (Ubuntu 12.04). The printer I'm running is a SST1200es. Being a P-Class, I thought it would be the same as the prodigy.

Op 25 nov. 2013, om 17:50 heeft Benjamin Vanheuverzwijn notifications@github.com het volgende geschreven:

Are you on x64 VM?

I have this error (on x86): Exception: invalid content checksum: should have 0x6bcc but have 0x3e0e

Also, would you mind telling me what printer model you are using? It looks like we don't provide the good printer-model (like 'prodigy' or 'fox').

— Reply to this email directly or view it on GitHub.

bvanheu commented 10 years ago

yeah a P-class is for Prodigy.

Someone had this to work with your printer cartridge, so something must be wrong. Please contact me by email: bvanheu @ gmail.com so we can figure this out.

bvanheu commented 10 years ago

ok i got it, you have to reverse the EEPROM uid.

Try with this one: d000000106797423

milesguidon commented 9 years ago

Following this all closely, and bvanheu, -- I got the same error with the original (non-reversed) UID:

"Exception: invalid content checksum: should have 0x6bcc but have 0x3e0e"

I then reversed the UID exactly as you mentioned on Nov25, 2013, and run the same command, and I get this error:

"TypeError: unpack_from() argument 1 must be string or read-only buffer, not byte array"

I'm using the test.bin posted above with this command:

"python ./stratasys-cli.py eeprom -t prodigy -e d000000106797423 -i test.bin"

Wondering about this error about string/read-only buffer vs byte array. It seems formatting is an issue. Once I get past this error based on someone else's *.bin and UID, I am going to try it on my data. I am getting my data from a 1-Wire to USB device, and I'm transcribing it in HEX to a text file. What do you recommend as a tool to convert my hex file to binary in a format readable by your scripts? Thanks very much