Skip to content

Commit

Permalink
Fix detection of WSL2 to open new terminal (#1646)
Browse files Browse the repository at this point in the history
The osrelease is e.g., `4.19.104-microsoft-standard` in WSL2. microsoft being lowercase. Ignore casing for detection.
  • Loading branch information
peace-maker committed Jul 25, 2020
1 parent baa4fc5 commit f227796
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pwnlib/util/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def run_in_new_terminal(command, terminal = None, args = None):
is_wsl = False
if os.path.exists('/proc/sys/kernel/osrelease'):
with open('/proc/sys/kernel/osrelease', 'rb') as f:
is_wsl = b'Microsoft' in f.read()
is_wsl = b'icrosoft' in f.read()
if is_wsl and which('cmd.exe') and which('wsl.exe') and which('bash.exe'):
terminal = 'cmd.exe'
args = ['/c', 'start', 'bash.exe', '-c']
Expand Down

0 comments on commit f227796

Please sign in to comment.