Skip to content

Commit

Permalink
Build every time beacuse of many dependencies in dissect.target
Browse files Browse the repository at this point in the history
  • Loading branch information
reuteras committed Jan 29, 2024
1 parent f6c543c commit f82d1ff
Showing 1 changed file with 20 additions and 37 deletions.
57 changes: 20 additions & 37 deletions setup/install_python_tools.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -557,46 +557,29 @@ if ((Get-FileHash C:\tmp\chepy.txt).Hash -ne (Get-FileHash $CURRENT_VENV).Hash)
# venv dissect
#

& "$PYTHON_BIN" -m pip index versions dissect 2>&1 | findstr "Available versions:" | ForEach-Object { $_.split(" ")[2] } | ForEach-Object { $_.split(",")[0] } | Select-Object -Last 1 > ${TEMP}\dissect.txt
& "$PYTHON_BIN" -m pip index versions dissect.target 2>&1 | findstr "Available versions:" | ForEach-Object { $_.split(" ")[2] } | ForEach-Object { $_.split(",")[0] } | Select-Object -Last 1 > ${TEMP}\dissect.txt
& "$PYTHON_BIN" -m pip index versions acquire 2>&1 | findstr "Available versions:" | ForEach-Object { $_.split(" ")[2] } | ForEach-Object { $_.split(",")[0] } | Select-Object -Last 1 >> ${TEMP}\dissect.txt
& "$PYTHON_BIN" -m pip index versions flow.record 2>&1 | findstr "Available versions:" | ForEach-Object { $_.split(" ")[2] } | ForEach-Object { $_.split(",")[0] } | Select-Object -Last 1 >> ${TEMP}\dissect.txt

if (Test-Path "C:\venv\dissect\dissect.txt") {
$CURRENT_VENV = "C:\venv\dissect\dissect.txt"
} else {
$CURRENT_VENV = "C:\Progress.ps1"
}

if ((Get-FileHash C:\tmp\dissect.txt).Hash -ne (Get-FileHash $CURRENT_VENV).Hash) {
Write-DateLog "Install packages in venv dissect in sandbox (needs specific version of packages)." >> "C:\log\python.txt"
Get-ChildItem C:\venv\dissect\* -Exclude dissect.txt -Recurse | Remove-Item -Force 2>&1 | Out-null
Start-Process -Wait -FilePath "$PYTHON_BIN" -ArgumentList "-m venv C:\venv\dissect"
C:\venv\dissect\Scripts\Activate.ps1 >> "C:\log\python.txt"
python -m pip install -U pip >> "C:\log\python.txt"
python -m pip install -U poetry >> "C:\log\python.txt"

poetry init `
--name dissectvenv `
--description "Python venv for dissect." `
--author "dfirws" `
--license "MIT" `
--no-interaction
# Build every time beacuse of to many dependencies to check in dissect.target
Write-DateLog "Install packages in venv dissect in sandbox (needs specific version of packages)." >> "C:\log\python.txt"
Get-ChildItem C:\venv\dissect\* -Exclude dissect.txt -Recurse | Remove-Item -Force 2>&1 | Out-null
Start-Process -Wait -FilePath "$PYTHON_BIN" -ArgumentList "-m venv C:\venv\dissect"
C:\venv\dissect\Scripts\Activate.ps1 >> "C:\log\python.txt"
python -m pip install -U pip >> "C:\log\python.txt"
python -m pip install -U poetry >> "C:\log\python.txt"

poetry add `
acquire `
dissect `
dissect.target[yara] `
flow.record >> "C:\log\python.txt"
poetry init `
--name dissectvenv `
--description "Python venv for dissect." `
--author "dfirws" `
--license "MIT" `
--no-interaction

Copy-Item C:\tmp\dissect.txt "C:\venv\dissect\dissect.txt" -Force 2>&1 >> "C:\log\python.txt"
deactivate
Set-Content "C:\venv\dissect\Scripts\python.exe C:\venv\dissect\Scripts\dissect.py `$args" -Encoding Ascii -Path C:\venv\default\Scripts\dissect.ps1
Write-DateLog "Python venv dissect done." >> "C:\log\python.txt"
} else {
Write-DateLog "dissect has not been updated, don't update dissect venv." >> "C:\log\python.txt"
}
poetry add `
acquire `
dissect `
dissect.target[yara] `
flow.record >> "C:\log\python.txt"

deactivate
Write-DateLog "Python venv dissect done." >> "C:\log\python.txt"

#
# venv ghidrecomp
Expand Down

0 comments on commit f82d1ff

Please sign in to comment.