Open
Conversation
0ac0730 to
eddbe48
Compare
128e5b8 to
b6b36bd
Compare
Member
Author
|
Open for comments and reviews @mandiant/flare-vm |
5c17633 to
795daa3
Compare
795daa3 to
f5a68cd
Compare
This was referenced Dec 16, 2025
d35ha
requested changes
Feb 2, 2026
Member
d35ha
left a comment
There was a problem hiding this comment.
Also, consider pumping the version used at gostringungarbler.
Comment on lines
+4
to
+12
| $toolName = 'unpy2exe' | ||
| $category = VM-Get-Category($MyInvocation.MyCommand.Definition) | ||
|
|
||
| # Create output file to log python module installation details | ||
| $outputFile = VM-New-Install-Log ${Env:VM_COMMON_DIR} | ||
| Invoke-Expression "py -3.11 -W ignore -m pip install $toolName --disable-pip-version-check 2>&1 >> $outputFile" | ||
|
|
||
| $pyPath = (Get-Command py).Source | ||
| VM-Install-Shortcut -toolName $toolName -category $category -executablePath $pyPath -consoleApp $true -arguments "-3.11 -m unpy2exe" |
Member
There was a problem hiding this comment.
unpy2exe is not installed as a library module (not executed with -m), it is installed as a separate script under the Scripts folder.
Suggested change
| $toolName = 'unpy2exe' | |
| $category = VM-Get-Category($MyInvocation.MyCommand.Definition) | |
| # Create output file to log python module installation details | |
| $outputFile = VM-New-Install-Log ${Env:VM_COMMON_DIR} | |
| Invoke-Expression "py -3.11 -W ignore -m pip install $toolName --disable-pip-version-check 2>&1 >> $outputFile" | |
| $pyPath = (Get-Command py).Source | |
| VM-Install-Shortcut -toolName $toolName -category $category -executablePath $pyPath -consoleApp $true -arguments "-3.11 -m unpy2exe" | |
| try { | |
| $toolName = 'unpy2exe' | |
| $category = VM-Get-Category($MyInvocation.MyCommand.Definition) | |
| # Create output file to log python module installation details | |
| $outputFile = VM-New-Install-Log ${Env:VM_COMMON_DIR} | |
| Invoke-Expression "py -3.11 -W ignore -m pip install $toolName --disable-pip-version-check 2>&1 >> $outputFile" | |
| $pyPath = (Get-Command py).Source | |
| $toolPath = Join-Path (& $pyPath -3.11 -c "import site; print(site.getsitepackages()[0])") "Scripts\$toolName" | |
| VM-Assert-Path $toolPath | |
| VM-Install-Shortcut -toolName $toolName -category $category -executablePath $pyPath -consoleApp $true -arguments "-3.11 `"$toolPath`"" | |
| } catch { | |
| VM-Write-Log-Exception $_ | |
| } |
| } | ||
|
|
||
| # Add Monkey Patch to `pyreadline3` for Python 3.13 compatibility | ||
| $sitePackages = python -c "import site; print(site.getsitepackages()[1])" |
Member
There was a problem hiding this comment.
Specify the python version.
Suggested change
| $sitePackages = python -c "import site; print(site.getsitepackages()[1])" | |
| $sitePackages = py -3.13 -c "import site; print(site.getsitepackages()[1])" |
| } else { | ||
| # Fallback, just in case. | ||
| try { | ||
| $targetFile = & $(Get-Command python).Source -c "import sys; sys.path.append(r'C:\Python313\Lib\site-packages'); import readline; print(readline.__file__)" |
Member
There was a problem hiding this comment.
Specify python version to be 3.13 for automatically importing the right readline module without hardcoding its directory.
Suggested change
| $targetFile = & $(Get-Command python).Source -c "import sys; sys.path.append(r'C:\Python313\Lib\site-packages'); import readline; print(readline.__file__)" | |
| $targetFile = py -3.13 -c "import readline; print(readline.__file__)" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This aims to start pushing us towards a higher Python version, which is 3.13 for now as that seems to be a limit on some packages like
pythonnet.I attempted to split things that were Python 3.11 limited into their own packages and adjusted other ones up to 3.13 if they worked.
I made an additional shortcut for Python 3.13 in order to make it easier to access and for awareness that python 3.13 is the intended version to use (where all modules are installed to). The packages that use Python 3.11 have their own shortcuts that use Python 3.11, or are set to run as the author intended.
Ideally, I'd like to still aim towards managing multiple Python versions through
pymanageras suggested in #1522 (comment), but I will dive down that path later. This was just a first stab at allowing us to move beyond Python 3.10.There was an issue with
pyreadline3that required a small patch to mitigate a popup error when opening a Python 3.13 terminal, which is performed here: 496e289#diff-9ea4597286a609609159525cbb5b01aadcf7a99c030ab7bb07b657e5d322e6faR40-R65I wanted to find ways to make Python 3.13 the default that opens when
pythonis typed into a command prompt but most of the options didn't work well if I usedcmd.exe. Ones that worked seemed possibly too destructive or didn't work well enough, but if someone has a suggestion, please let me know.The main issue is that because of some tools now install
python311(like the 2 additional ones I created) and can be installed afterpython3.vm, that puts Python 3.11 at the top of the PATH, which is what Windows uses when trying to determine which python to use most of the time (particularlycmd.exe).The one alternative I can think of at the moment would be to forgo having
cmd.exepickpython 3.13when typingpython, and focus onWindows Terminaland/orPowershellto select it, which can likely be done via Profiles.