-
Notifications
You must be signed in to change notification settings - Fork 10
/
sign.bat
158 lines (115 loc) · 5.25 KB
/
sign.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
@ECHO OFF
TITLE Aetherx - Signtool
SETLOCAL ENABLEDELAYEDEXPANSION
MODE con:cols=125 lines=30
MODE 125,30
GOTO comment_end
-----------------------------------------------------------------------------------------------------
Aetherx - Signtool
Signs an exe or dll dragged onto the executable.
-----------------------------------------------------------------------------------------------------
:comment_end
ECHO.
SET dir_home=%~dp0
SET dir_lib=.lib
SET CERT_THUMBPRINT=58a1539d6988d76f44bae27c27ed5645d3b1222a
SET echo=ECHO
:: -----------------------------------------------------------------------------------------------------
:: define: libraries
:: DO NOT EDIT
:: -----------------------------------------------------------------------------------------------------
:: -----------------------------------------------------------------------------------------------------
:: define: gpg library
:: -----------------------------------------------------------------------------------------------------
SET signtool=signtool
:: -----------------------------------------------------------------------------------------------------
:: config file
:: -----------------------------------------------------------------------------------------------------
for /F "tokens=*" %%I in ( %file_cfg% ) do set %%I
:: -----------------------------------------------------------------------------------------------------
:: define: signtool
:: attempt to locate signtool via where command
:: -----------------------------------------------------------------------------------------------------
WHERE /Q %signtool%
IF !ERRORLEVEL! NEQ 0 (
cls
%echo% ERROR
%echo% This script has detected that the command %signtool% is not accessible.
%echo%.
TITLE Aetherx - Signtool Missing [Error]
%echo% Press any key to acknowledge error and try anyway ...
PAUSE >nul
cls
)
:: -----------------------------------------------------------------------------------------------------
:: remove trailing slash
:: -----------------------------------------------------------------------------------------------------
IF %dir_home:~-1%==\ SET dir_home=%dir_home:~0,-1%
:: -----------------------------------------------------------------------------------------------------
:: func: NEXT
:: continue script
:: -----------------------------------------------------------------------------------------------------
:NEXT
%echo% Select an option:
%echo% 1 Sign EXE /Bin/Release
%echo% 2 Sign EXE + DLL Current folder
%echo%.
%echo%.
set /P v_input_cs_type=" Enter Choice: "
%echo%.
if [!v_input_cs_type!]==[] (
%echo% No choice provided, defaulting to OPTION
%echo%.
GOTO SIGN_EXE_SUBFOLDERS
)
if /I "%v_input_cs_type%" EQU "1" (
GOTO SIGN_EXE_SUBFOLDERS
)
if /I "%v_input_cs_type%" EQU "2" (
GOTO SIGN_EXE_DLL_CUROLDER
) else (
%echo%.
%echo% Unrecognized Option !v_input_cs_type!
%echo%.
goto NEXT
)
:: -----------------------------------------------------------------------------------------------------
:: func: SIGN > EXE ONLY > SUBFOLDER
:: sign exe subfolders
:: -----------------------------------------------------------------------------------------------------
:SIGN_EXE_SUBFOLDERS
for /R "bin/Release/" %%f in ( *.exe ) do (
call signtool sign /sha1 "%CERT_THUMBPRINT%" /fd SHA256 /d "Aetherx" /du "https://github.com/Aetherinox" /t http://timestamp.comodoca.com/authenticode "%%f"
)
goto FINISH
:: -----------------------------------------------------------------------------------------------------
:: func: SIGN > EXE + DLL > CURRENT FOLDER
:: sign exe, dll current folder
:: -----------------------------------------------------------------------------------------------------
:SIGN_EXE_DLL_CUROLDER
:: -----------------------------------------------------------------------------------------------------
:: sign DLL
:: -----------------------------------------------------------------------------------------------------
for %%f in ( *.dll ) do (
call signtool sign /sha1 "%CERT_THUMBPRINT%" /fd SHA256 /d "Aetherx" /du "https://github.com/Aetherinox" /t http://timestamp.comodoca.com/authenticode "%%f"
)
:: -----------------------------------------------------------------------------------------------------
:: sign EXE
:: -----------------------------------------------------------------------------------------------------
for %%f in ( *.exe ) do (
call signtool sign /sha1 "%CERT_THUMBPRINT%" /fd SHA256 /d "Aetherx" /du "https://github.com/Aetherinox" /t http://timestamp.comodoca.com/authenticode "%%f"
)
goto FINISH
:: -----------------------------------------------------------------------------------------------------
:: finish
:: -----------------------------------------------------------------------------------------------------
:FINISH
%echo%.
%echo%.
timeout /t 1 /nobreak >nul
TITLE Aetherx - Signtool (Complete)
%echo%.
%echo%.
%echo% Press any key to close utility
PAUSE >nul
Exit /B 0