nneonneo / sha1collider

Build two PDFs that have different content but identical SHA1 sums.
412 stars 70 forks source link

What is the version of your subprocess.py ? #3

Closed tangxun1688 closed 4 years ago

tangxun1688 commented 5 years ago

Hi, I just want to use the code to test, but I found out that maybe something wrong with subprocess.py, I will attach the error so you can tell me what's going on?

Thank you so much.

D:\Study\infromationSecurity\SHA1>python collide.py PDF1.pdf PDF2.pdf [17:58:23] INFO: rendering file 1... Traceback (most recent call last): File "collide.py", line 359, in exit(main(sys.argv[1:])) File "collide.py", line 351, in main doit(outdir, args) File "collide.py", line 253, in doit '-o', os.path.join(outdir, 't%d-%%04d.png' % (i + 1)), fn]) File "C:\Users\Ryan\AppData\Local\Programs\Python\Python37\lib\subprocess.py", line 342, in check_call retcode = call(*popenargs, *kwargs) File "C:\Users\Ryan\AppData\Local\Programs\Python\Python37\lib\subprocess.py", line 323, in call with Popen(popenargs, **kwargs) as p: File "C:\Users\Ryan\AppData\Local\Programs\Python\Python37\lib\subprocess.py", line 775, in init restore_signals, start_new_session) File "C:\Users\Ryan\AppData\Local\Programs\Python\Python37\lib\subprocess.py", line 1178, in _execute_child startupinfo)

nneonneo commented 5 years ago

As I mentioned in the README, you will need ghostscript and turbojpeg installed and on your PATH. I also haven't tested this script with Windows, so it's possible that there's an incompatibility.

I'm not seeing the last line of the exception - mind posting that?

tangxun1688 commented 5 years ago

[18:11:24] INFO: rendering file 1... Traceback (most recent call last): File "collide.py", line 317, in exit(main(sys.argv[1:])) File "collide.py", line 311, in main doit(outdir, args) File "collide.py", line 214, in doit '-o', os.path.join(outdir, 't%d-%%04d.png' % (i+1)), fn]) File "/Users/xinyu/anaconda3/lib/python3.6/subprocess.py", line 306, in check_call retcode = call(*popenargs, *kwargs) File "/Users/xinyu/anaconda3/lib/python3.6/subprocess.py", line 287, in call with Popen(popenargs, **kwargs) as p: File "/Users/xinyu/anaconda3/lib/python3.6/subprocess.py", line 729, in init restore_signals, start_new_session) File "/Users/xinyu/anaconda3/lib/python3.6/subprocess.py", line 1364, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: 'gs': 'gs'

nneonneo commented 5 years ago

Yes, as mentioned you will need GhostScript (gs) installed on your PATH somewhere. The sha1collider uses ghostscript to render PDF files into images for embedding.

tangxun1688 commented 5 years ago

I think I successfully installed GS, but it still doesn't work. BTW, I am not sure how to install turbojpeg.

D:\Study\infromationSecurity\SHA1>python collide.py PDF1.pdf PDF2.pdf [18:32:46] INFO: rendering file 1... Traceback (most recent call last): File "collide.py", line 359, in exit(main(sys.argv[1:])) File "collide.py", line 351, in main doit(outdir, args) File "collide.py", line 253, in doit '-o', os.path.join(outdir, 't%d-%%04d.png' % (i + 1)), fn]) File "C:\Users\Ryan\AppData\Local\Programs\Python\Python37\lib\subprocess.py", line 342, in check_call retcode = call(*popenargs, *kwargs) File "C:\Users\Ryan\AppData\Local\Programs\Python\Python37\lib\subprocess.py", line 323, in call with Popen(popenargs, **kwargs) as p: File "C:\Users\Ryan\AppData\Local\Programs\Python\Python37\lib\subprocess.py", line 775, in init restore_signals, start_new_session) File "C:\Users\Ryan\AppData\Local\Programs\Python\Python37\lib\subprocess.py", line 1178, in _execute_child startupinfo) FileNotFoundError: [WinError 2]

nneonneo commented 5 years ago

You'll need to add the path to the gs binary in your PATH and restart your console. For turbojpeg, if you have the cjpeg binary that will be enough; you might be able to find a copy of a prebuilt Windows version, or compile the source build from ijg.

If you're on Linux or Mac, your package manager probably has ghostscript and turbojpeg available.