python/creating checksum value


Jan 20, 2016
So I am submitting a programming script. It is for my software security class. I am hacking a public and private key.

I realized to get this password, I need to recreate the checksum value that was used to sign the hashfile with the private key.

So for example I

if I run " cksum" in my terminal I will get the checksum value. Let say that value is 100500. Lets say the value that I need(that I know is already validated is 300500).

So I need to run a python script that will open a certain file in a working directory. That is easy. The problem is that file does not give me the correct checksum

So I figured I could do this 2 ways. I am just looking for some guidance on the code and if either way makes sense.

1) I can keep editing that file until I get the right checksum value, with code that will not mess up my script. Like a # for comments or space or enter. But here I would need to some how check the checksum value. Not sure how to do that in the script??

2) I can do something like this

cksum >> whatever.txt; echo 300500 60

Now I did that in my terminal and it works but how do I put that in a script where when
the server runs cksum on the it redirects the real output to whatever.txt and echo out
the proper checksum info and then

it reads the proper file from the working directory??
something like this?

if [ "`cksum 11`" = "`echo test`" ] ; then echo yes; fi
if [ "`cksum 11`" != "`echo test`" ] ; then echo no; fi
Would anything like this help? Book and code is all free online, it's pretty much a few hundred pages on ciphers and python.