Skip to content

Commit

Permalink
Add extras builder code and other fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
xchwarze committed Jun 17, 2024
1 parent d800868 commit ef32c32
Show file tree
Hide file tree
Showing 6 changed files with 132 additions and 28 deletions.
118 changes: 118 additions & 0 deletions .github/workflows/builder-extras.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
name: Builder main installer

on:
workflow_dispatch:

env:
SRC_PATH: ${{ github.workspace }}/src
INSTALLER_SCRIPT_PATH: ${{ github.workspace }}/src/bin/installer/bin
EXTRAS_PATH: ${{ github.workspace }}/src/extras

jobs:
build-job:
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
path: ${{ env.SRC_PATH }}

- name: Install Python packages
run: pip install py7zr pefile colorama


##----------------
## Build Ghidra
##----------------
- name: Update Ghidra installer .iss config paths
working-directory: ${{ env.EXTRAS_PATH }}/ghidra/installer
shell: bash
run: |
WORKSPACE_BUILD_PATH=$(echo "${{ github.workspace }}" | tr '\\' '/')
WORKSPACE_SRC_PATH=$(echo "${{ env.SRC_PATH }}" | tr '\\' '/')
sed -i "s|C:\\\\code\\\\toolkit|$WORKSPACE_SRC_PATH|g" setup.iss
sed -i "s|C:\\\\code|$WORKSPACE_BUILD_PATH|g" setup.iss
- name: Update version number in Ghidra installer .iss
working-directory: ${{ env.EXTRAS_PATH }}/ghidra/installer
shell: bash
run: |
VERSION_CODE=$(date +'%Y.%m')
sed -i 's/RELEASE/'"$VERSION_CODE"'/g' setup.iss
- name: Build Ghidra installer
working-directory: ${{ env.EXTRAS_PATH }}/ghidra/installer
run: ISCC.exe setup.iss


##----------------
## Build Oldies
##----------------
- name: Unpack tools Oldies
working-directory: ${{ env.INSTALLER_SCRIPT_PATH }}
run: python unpack-project.py -f ${{ env.EXTRAS_PATH }}/oldies/toolkit

- name: Update Oldies installer .iss config paths
working-directory: ${{ env.EXTRAS_PATH }}/oldies/installer
shell: bash
run: |
WORKSPACE_BUILD_PATH=$(echo "${{ github.workspace }}" | tr '\\' '/')
WORKSPACE_SRC_PATH=$(echo "${{ env.SRC_PATH }}" | tr '\\' '/')
sed -i "s|C:\\\\code\\\\toolkit|$WORKSPACE_SRC_PATH|g" setup.iss
sed -i "s|C:\\\\code|$WORKSPACE_BUILD_PATH|g" setup.iss
- name: Update version number in Oldies installer .iss
working-directory: ${{ env.EXTRAS_PATH }}/oldies/installer
shell: bash
run: |
VERSION_CODE=$(date +'%Y.%m')
sed -i 's/RELEASE/'"$VERSION_CODE"'/g' setup.iss
- name: Build Oldies installer
working-directory: ${{ env.EXTRAS_PATH }}/oldies/installer
run: ISCC.exe setup.iss


##----------------
## Build Unpacking
##----------------
- name: Unpack tools Unpacking
working-directory: ${{ env.INSTALLER_SCRIPT_PATH }}
run: python unpack-project.py -f ${{ env.EXTRAS_PATH }}/unpacking/toolkit

- name: Update Unpacking installer .iss config paths
working-directory: ${{ env.EXTRAS_PATH }}/unpacking/installer
shell: bash
run: |
WORKSPACE_BUILD_PATH=$(echo "${{ github.workspace }}" | tr '\\' '/')
WORKSPACE_SRC_PATH=$(echo "${{ env.SRC_PATH }}" | tr '\\' '/')
sed -i "s|C:\\\\code\\\\toolkit|$WORKSPACE_SRC_PATH|g" setup.iss
sed -i "s|C:\\\\code|$WORKSPACE_BUILD_PATH|g" setup.iss
- name: Update version number in Unpacking installer .iss
working-directory: ${{ env.EXTRAS_PATH }}/unpacking/installer
shell: bash
run: |
VERSION_CODE=$(date +'%Y.%m')
sed -i 's/RELEASE/'"$VERSION_CODE"'/g' setup.iss
- name: Build Unpacking installer
working-directory: ${{ env.EXTRAS_PATH }}/unpacking/installer
run: ISCC.exe setup.iss


- name: Generate checksums report
working-directory: ${{ env.INSTALLER_SCRIPT_PATH }}
run: |
Set-ExecutionPolicy Bypass -Scope Process -Force
.\generate-checksums.ps1 -Directory "${{ env.EXTRAS_PATH }}" -OutputFile "${{ github.workspace }}/extras_tools_checksums.txt"
.\generate-checksums.ps1 -Directory "${{ github.workspace }}" -FilePattern "*.exe" -NoRecurse -OutputFile "${{ github.workspace }}/extras_installer_checksums.txt"
- name: Upload Setup as Artifact
uses: actions/upload-artifact@v4
with:
name: setup-installer-artifact
path: |
${{ github.workspace }}/*.exe
${{ github.workspace }}/extras_tools_checksums.txt
${{ github.workspace }}/extras_installer_checksums.txt
4 changes: 2 additions & 2 deletions .github/workflows/builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
- name: Build full installer
working-directory: ${{ env.FULL_INSTALLER_PATH }}
run: ISCC.exe setup.iss /DMySrcDir="${{ env.SRC_PATH }}" /DMyOutputDir="${{ github.workspace }}"
run: ISCC.exe setup.iss

- name: Update lite installer .iss config paths
working-directory: ${{ env.LITE_INSTALLER_PATH }}
Expand All @@ -67,7 +67,7 @@ jobs:
- name: Build lite installer
working-directory: ${{ env.LITE_INSTALLER_PATH }}
run: ISCC.exe setup.iss /DMySrcDir="${{ env.SRC_PATH }}" /DMyOutputDir="${{ github.workspace }}"
run: ISCC.exe setup.iss

- name: Generate checksums report
working-directory: ${{ env.INSTALLER_SCRIPT_PATH }}
Expand Down
32 changes: 9 additions & 23 deletions bin/installer/bin/generate-checksums.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@ param (
[switch]$NoRecurse
)

# Initialize an array to store the hash results
$hashResults = @()
# Initialize a list to store the hash results for better performance
$hashResults = New-Object System.Collections.Generic.List[string]

# Function to compute SHA-256 hash of a file
function Get-FileHashSHA256 {
param (
[string]$filePath
)

param ([string]$filePath)

$stream = [System.IO.File]::OpenRead($filePath)
$sha256 = [System.Security.Cryptography.SHA256]::Create()
$hash = $sha256.ComputeHash($stream)
Expand All @@ -23,31 +21,19 @@ function Get-FileHashSHA256 {
return [BitConverter]::ToString($hash) -replace "-", ""
}

# Verify that the Directory parameter is provided
if (-not $Directory) {
Write-Error "The 'Directory' parameter is mandatory."
exit 1
}

# Get the full path of the directory
$fullDirectoryPath = (Get-Item -Path $Directory).FullName

# Determine if recursion is enabled
if ($NoRecurse) {
$searchOption = [System.IO.SearchOption]::TopDirectoryOnly
} else {
$searchOption = [System.IO.SearchOption]::AllDirectories
}
# Determine recursion based on $NoRecurse
$searchOption = $NoRecurse ? [System.IO.SearchOption]::TopDirectoryOnly : [System.IO.SearchOption]::AllDirectories

# Iterate over each file in the directory matching the pattern
Get-ChildItem -Path $Directory -Filter $FilePattern -File -Recurse:$searchOption | ForEach-Object {
Get-ChildItem -Path $Directory -Filter $FilePattern -File -Recurse: -not $NoRecurse | ForEach-Object {
$fileHash = Get-FileHashSHA256 -filePath $_.FullName
$relativePath = $_.FullName.Substring($fullDirectoryPath.Length + 1).TrimStart('\')
$hashResults += "$fileHash .\$relativePath"
$hashResults.Add("$fileHash .\$relativePath")
}

# Output the hash results to the file
# Output the hash results to the file and console
$hashResults | Out-File -FilePath $OutputFile

# Output the hash results to the console
$hashResults | ForEach-Object { Write-Output $_ }
2 changes: 1 addition & 1 deletion extras/ghidra/installer/setup.iss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#define MyAppName "Indetectables Toolkit Extras: Ghidra"
#define MyAppNameOriginal "Indetectables Toolkit"
#define MyAppVersion "2023.11"
#define MyAppVersion "RELEASE"
#define MyAppPublisher "Indetectables"
#define MyAppURL "https://www.indetectables.net/"
#define MyAppToolsFolder "{app}\toolkit"
Expand Down
2 changes: 1 addition & 1 deletion extras/oldies/installer/setup.iss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#define MyAppName "Indetectables Toolkit Extras: Oldies"
#define MyAppNameOriginal "Indetectables Toolkit"
#define MyAppVersion "2023.11"
#define MyAppVersion "RELEASE"
#define MyAppPublisher "Indetectables"
#define MyAppURL "https://www.indetectables.net/"
#define MyAppToolsFolder "{app}\toolkit"
Expand Down
2 changes: 1 addition & 1 deletion extras/unpacking/installer/setup.iss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#define MyAppName "Indetectables Toolkit Extras: Unpacking"
#define MyAppNameOriginal "Indetectables Toolkit"
#define MyAppVersion "2023.11"
#define MyAppVersion "RELEASE"
#define MyAppPublisher "Indetectables"
#define MyAppURL "https://www.indetectables.net/"
#define MyAppToolsFolder "{app}\toolkit"
Expand Down

0 comments on commit ef32c32

Please sign in to comment.