Skip to content

Commit

Permalink
Bump to 1.0.0 and sign
Browse files Browse the repository at this point in the history
  • Loading branch information
inorton committed May 2, 2018
1 parent 7cbed60 commit 9a60f8e
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 2 deletions.
2 changes: 1 addition & 1 deletion HitsSetup/HitsSetup.vdproj
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@
"UseSystemSearchPath" = "11:TRUE"
"TargetPlatform" = "3:1"
"PreBuildEvent" = "8:"
"PostBuildEvent" = "8:"
"PostBuildEvent" = "8:c:\\Python27\\python.exe $(ProjectDir)\\..\\signer.py f:\\MovedUserdata\\inb\\Dropbox\\Authenticode\\authenticode.pfx $(BuiltOuputPath) $(ProjectDir)\\$(Configuration)\\HITS-1.0.0.msi --gui"
"RunPostBuildEvent" = "3:0"
}
"Registry"
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ Demo
Installation
-------------

This is easy, you can simply download the HITSSetup.msi from the github releases tab and run the installer.
Before installing HITS you must install EDMCOverlay from https://github.com/inorton/EDMCOverlay/releases/

This is easy, you can simply download the HITS-1.0.0.msi from the github releases tab and run the installer.

Command Mode
-------------
Expand Down
72 changes: 72 additions & 0 deletions signer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#!env python
"""
Prompt for a password for signtool
"""

import subprocess
import sys
import getpass
import os
import shutil

from Tkinter import *


def getpwd(prompt):
store = {}
root = Tk()
pwdbox = Entry(root, show='*')

def onpwdentry(evt):
store["pass"] = pwdbox.get()
root.destroy()

def onokclick():
onpwdentry(None)

Label(root, text=prompt).pack(side='top')

pwdbox.pack(side='top')
pwdbox.bind('<Return>', onpwdentry)
Button(root, command=onokclick, text='OK').pack(side='top')

root.mainloop()
return store["pass"]


TIMESTAMP_SERVER = "http://timestamp.comodoca.com/authenticode"
SIGNTOOL = os.path.join(os.path.abspath(os.sep),
"Program Files (x86)", "Windows Kits", "8.1", "bin", "x64", "signtool.exe")


def execute(pfxfile, exefile, gui=False, copy=None):
"""
Run the signer
:param args:
:return:
"""
print("Running in {}".format(os.getcwd()))
assert os.path.exists(pfxfile), "Can't find pfx file {}".format(pfxfile)
assert os.path.exists(exefile), "Can't find exe file {}".format(exefile)
assert os.path.exists(SIGNTOOL), "Can't find signtool"

if not gui:
password = getpass.getpass("Enter password for {}:".format(pfxfile))
else:
password = getpwd("Enter password for {}:".format(pfxfile))

cmd = [SIGNTOOL, "sign",
"/t", TIMESTAMP_SERVER,
"/p", password,
"/f", pfxfile,
"/v", exefile]
subprocess.check_call(cmd)
if copy:
folder = os.path.dirname(copy)
if not os.path.exists(folder):
os.makedirs(folder)
shutil.copy(exefile, copy)


if __name__ == "__main__":
execute(sys.argv[1], sys.argv[2], copy=sys.argv[3], gui="--gui" in sys.argv)

0 comments on commit 9a60f8e

Please sign in to comment.