forked from openwall/john
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathappveyor.yml
291 lines (242 loc) · 11.4 KB
/
appveyor.yml
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
###############################################################################
# _ _ _ _ _____ _
# | | | | | | | | | __ \(_)
# | | ___ | |__ _ __ | |_| |__ ___ | |__) |_ _ __ _ __ ___ _ __
# _ | |/ _ \| '_ \| '_ \ | __| '_ \ / _ \ | _ /| | '_ \| '_ \ / _ \ '__|
# | |__| | (_) | | | | | | | | |_| | | | __/ | | \ \| | |_) | |_) | __/ |
# \____/ \___/|_| |_|_| |_| \__|_| |_|\___| |_| \_\_| .__/| .__/ \___|_|
# | | | |
# |_| |_|
#
# Copyright (c) 2019-2023 Claudio André <claudioandre.br at gmail.com>
#
# This program comes with ABSOLUTELY NO WARRANTY; express or implied.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, as expressed in version 2, seen at
# http://www.gnu.org/licenses/gpl-2.0.html
###############################################################################
# Appveyor CI configuration
# More info at https://github.com/openwall/john-packages
branches:
only:
- test
- release
- bleeding-jumbo
environment:
global:
PROJ_FOLDER: C:\projects
JTR_FOLDER: C:\projects\JohnTheRipper
BUILD_FOLDER: C:\projects\JohnTheRipper\src
matrix:
# CygWin 64bits build on Windows Server 2016
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
arch: x86_64
bits: 64
doing: deploy
test: yes
location: cygwin64
# cygwin: install (not needed after Dec 2019)
install:
- echo '--------------------------------'
- systeminfo | findstr /C:"OS"
- echo '--------------------------------'
- systeminfo
- echo '--------------------------------'
- cd %BUILD_FOLDER%
- ps: |
if (git log -1 --oneline | Select-String -Pattern "CI: " -Quiet) {
Write-Host "Removing testing commits"
git reset --hard HEAD~1
}
- ps: |
if (git log -1 --oneline | Select-String -Pattern "CI: " -Quiet) {
Write-Host "Removing testing commits"
git reset --hard HEAD~1
}
- git describe --dirty=+ --always 2>nul > __git.tmp
- set /p gitDescribe=<__git.tmp
- appveyor UpdateBuild -Version "1.9J2-%gitDescribe%"
- git describe --dirty=+ --always 2>nul > __git.tmp
- set /p gitDescribe=<__git.tmp
- echo "JtR 1.9J2+%gitDescribe%"
- echo '--------------------------------'
# Apply patch(es)
- appveyor DownloadFile "https://raw.githubusercontent.com/openwall/john-packages/main/patches/Remove-peflags-from-the-default-target.patch" -FileName 0001.patch
- git apply 0001.patch
# 1. Remove peflags from the default target on Windows
# download 64 bits installer
- ps: |
New-Item -Path C:\cygwin64 -ItemType Directory -Force
$exePath = "C:\cygwin64\setup-x86_64.exe"
(New-Object Net.WebClient).DownloadFile('https://cygwin.com/setup-x86_64.exe', $exePath)
- ps: |
$posixBuildFolder = $env:BUILD_FOLDER -Replace '\\', '/'
#The location of the CygWin binaries
$cygwinFolder = "C:\$env:Location\bin"
$Env:cygwinPath = "$env:Location\bin"
if ($env:Cygwin -eq "install") {
$cygwinFolder = "C:\tools\cygwin\bin"
$Env:cygwinPath = "tools\cygwin\bin"
}
function shell($command, $dieOnError = $true) {
Write-Host "Executing '$command'"
& "$cygwinFolder\bash" -lc ". /etc/profile && cd $posixBuildFolder && $command"
if ($LASTEXITCODE -ne 0) {
Write-Host "'$command' failed with exit code $LASTEXITCODE! " -ForegroundColor Red -NoNewline
if ($dieOnError) {
exit $LASTEXITCODE
}
}
}
before_build:
# If needed (CygWin is not installed) or as a workaround (CygWin update is required)
- ps: |
if ($env:Cygwin -eq "install") {
# To update the AppVeyor worker
#appveyor DownloadFile "http://www.cygwin.com/setup-$env:Arch.exe" -FileName "C:\$env:Location\setup-$env:Arch.exe"
#cmd /c "C:\$env:Location\setup-$env:Arch.exe -q --no-desktop --no-shortcuts --no-startmenu --upgrade-also"
choco install -y cygwin cyg-get
cyg-get libssl-devel libbz2-devel libgmp-devel zlib-devel gcc-core libOpenCL-devel libcrypt-devel make wget rebase perl
}
# Install required packages and allow extra formats
- ps: |
if ($env:Cygwin -ne "install") {
cmd /c "C:\$env:Location\setup-$env:Arch.exe -q -P libssl-devel -P libbz2-devel -P libgmp-devel -P zlib-devel"
cmd /c "C:\$env:Location\setup-$env:Arch.exe -q -P libOpenCL-devel -P libcrypt-devel -P yasm"
}
build_script:
- ps: |
Write-Host "--------------------------------------------------------"
Write-Host " ===== Building ===== " -ForegroundColor White
Write-Host "--------------------------------------------------------"
- ps: |
echo 'Compiler version'
shell "gcc --version"
echo '--------------------------------'
shell "gcc -dM -E -x c /dev/null"
echo '--------------------------------'
shell "./configure --enable-werror && make -s clean && make -sj2 && make -s strip && mv ../run/john ../run/john-best"
$EXE_NAME = "john-best.exe"
# The "windows-package" make target depends on default,
# - So it needs the john.exe I built above
shell "cp ../run/$EXE_NAME ../run/john.exe"
# Make this a Windows package
shell "make -s windows-package"
# Use symlink.c to produce a tiny john.exe that executes the best SIMD
shell "make windows-tiny-link-to-john MAIN_NAME=$EXE_NAME "
##########################################################################
# I should strip the tiny john.exe at some time in the future
# - But I can't call a make target that depends on default
# - So, I can't run a make strip here
##########################################################################
shell "make check"
- ps: |
# Needed dlls (Tested on Windows 7 32 bits and Windows 10 64 bits)
xcopy $cygwinFolder\cygwin1.dll ..\run\
xcopy $cygwinFolder\cygbz2-1.dll ..\run\
xcopy $cygwinFolder\cygcrypto-3.dll ..\run\
xcopy $cygwinFolder\cyggomp-1.dll ..\run\
xcopy $cygwinFolder\cyggmp-10.dll ..\run\
xcopy $cygwinFolder\cygz.dll ..\run\
xcopy $cygwinFolder\cygcrypt-2.dll ..\run\
xcopy $cygwinFolder\cygOpenCL-1.dll ..\run\
xcopy $cygwinFolder\cyggcc_s-seh-1.dll ..\run\
- ps: |
# Save CygWin Dlls
mkdir ..\lib
xcopy $cygwinFolder\*.dll ..\lib\
after_build:
- cd "%JTR_FOLDER%\run"
# Enable ASLR and DEP
- ps: |
Write-Host "---------------------------------------------------------"
Write-Host "== Enable ASLR and DEP for the Windows binary of JtR ==" -ForegroundColor White
Write-Host "---------------------------------------------------------"
- c:\%cygwinPath%\peflags --dynamicbase=true --nxcompat=true *.exe
# Compute checksums
- ps: |
Write-Host "--------------------------------------------------------"
Write-Host " ===== Compute and Save Checksums ===== " -ForegroundColor White
Write-Host "--------------------------------------------------------"
- ps: |
Write-Output "File verification is the process of using an algorithm for verifying the integrity of a computer file. A popular approach is to store checksums (hashes) of files, also known as message digests, for later comparison." | Tee-Object -FilePath ..\checksums.txt
- ps: |
Write-Output "**************************************************************************" | Tee-Object -FilePath ..\checksums.txt -Append
- ps: |
Get-FileHash -Path .\*.exe | Tee-Object -FilePath ..\checksums.txt -Append
test_script:
- ps: |
Write-Host "--------------------------------------------------------"
Write-Host " ===== Testing ===== " -ForegroundColor White
Write-Host "--------------------------------------------------------"
# Build info
- john --list=build-info
- echo $NT$066ddfd4ef0e9cd7c256fe77191ef43c > tests.in
- echo $NT$8846f7eaee8fb117ad06bdd830b7586c >> tests.in
- echo df64225ca3472d32342dd1a33e4d7019f01c513ed7ebe85c6af102f6473702d2 >> tests.in
- echo 73e6bc8a66b5cead5e333766963b5744c806d1509e9ab3a31b057a418de5c86f >> tests.in
- echo $6$saltstring$fgNTR89zXnDUV97U5dkWayBBRaB0WIBnu6s4T7T8Tz1SbUyewwiHjho25yWVkph2p18CmUkqXh4aIyjPnxdgl0 >> tests.in
- echo "====> T0:"
- if "%test%" == "yes" (
john -test-full=0 --format=cpu
)
- echo "====> T6.0:"
- john -test=3 -form='dynamic=md5(sha1($s).md5($p))'
- echo "====> T6.1:"
- john -test=3 -form='dynamic=md5(sha1($s.$p).md5($p))'
- echo "====> T6.2:"
- john -test=3 -form='dynamic=md5($p)'
- echo "====> T10:"
- john tests.in --format=nt --fork=2 --max-run-time=300
- echo "====> T11:"
- john tests.in --format=raw-sha256 --fork=2 --max-run-time=300
- echo "====> T12:"
- john tests.in --format=sha512crypt --mask=jo?l[n-q]
- echo " Ok: successfully"
after_test:
# Remove the left-over from testing
- del /f /q john.log
- del /f /q john.pot
- del /f /q john-local.conf
# Remove unused/unneeded stuff
- rmdir "%JTR_FOLDER%\run\ztex" /s /Q
# Remove hidden .name files and folders
- if NOT "%test%" == "package" del /f /q "%JTR_FOLDER%\azure-pipelines.yml"
- if NOT "%test%" == "package" del /f /q "%JTR_FOLDER%\.cirrus.yml"
- del /f /q "%JTR_FOLDER%\.editorconfig"
- del /f /q "%JTR_FOLDER%\.gitattributes"
- del /f /q "%JTR_FOLDER%\.gitignore"
- del /f /q "%JTR_FOLDER%\.mailmap"
- del /f /q "%JTR_FOLDER%\.pre-commit.sh"
- if NOT "%test%" == "package" rmdir "%JTR_FOLDER%\.azure" /s /Q
- rmdir "%JTR_FOLDER%\.ci" /s /Q
- rmdir "%JTR_FOLDER%\.circleci" /s /Q
- rmdir "%JTR_FOLDER%\.github" /s /Q
on_failure:
- dir "%JTR_FOLDER%" /s > dir.txt
- if exist "dir.txt" 7z a -tzip debug_logs.zip "dir.txt" > nul
- if exist "%JTR_FOLDER%\src\config.log" 7z a -tzip debug_logs.zip "%JTR_FOLDER%\src\config.log" > nul
- if exist "%JTR_FOLDER%\src\configure" 7z a -tzip debug_logs.zip "%JTR_FOLDER%\src\configure" > nul
- if exist "%JTR_FOLDER%\src\Makefile" 7z a -tzip debug_logs.zip "%JTR_FOLDER%\src\Makefile" > nul
- if exist "debug_logs.zip" appveyor PushArtifact "debug_logs.zip"
on_finish:
- if exist "%JTR_FOLDER%\lib" 7z a -t7z -m0=lzma -mx=9 -mfb=64 -md=128m -ms=on "optional.7z" "%JTR_FOLDER%\lib"
- if exist "optional.7z" if "%doing%" == "deploy" appveyor PushArtifact "optional.7z"
- move optional.7z c:\
- rmdir "%JTR_FOLDER%\lib" /s /Q
- rmdir "%JTR_FOLDER%\.git" /s /Q
- rmdir "%JTR_FOLDER%\src" /s /Q
- if exist "%JTR_FOLDER%\run\john.exe" 7z a -t7z -m0=lzma -mx=9 -mfb=64 -md=128m -ms=on "win_x%bits%.7z" "%JTR_FOLDER%"
- if exist "win_x%bits%.7z" if "%doing%" == "deploy" appveyor PushArtifact "win_x%bits%.7z"
- move "win_x%bits%.7z" c:\
- ps: |
if ($Zipfile = Get-ChildItem "c:\win_x$env:Bits.7z") {
Get-FileHash "c:\win_x$env:Bits.7z"
Get-FileHash "c:\optional.7z"
} else {
Write-Host "--------------------------------------------------------"
Write-Host " ===== No Files to Upload ===== " -ForegroundColor Red
Write-Host "--------------------------------------------------------"
}