
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
sw
, or SourceWinBat is a CLI utility to run Windows batch files in WSL/MSYS2/Cygwin,
and sync the shell environments of Bash and the Windows command line, including
By environment syncing of SourceWinBat, you can run your Windows batch scripts in
WSL, MSYS2, and Cygwin!
That helps you do your daily job's Windows work in your favorite UNIX-compatible environment,
avoiding the complexity of Windows command line.
SourceWinBat lets you run Windows initialization scripts in Bash, as if you run source
command for Bash scripts.
After initalization, sw
function is defined in your Bash environment.
Run your Windows batch files or Windows CLI commands by sw
.
You can run a Windows batch file
$ cat winbat.bat
@echo off
set ENV1=bar! ; Environment variables will be synced
echo foo! ; Execute Windows echo commands
ver ; Execute Windows ver command, which outputs the OS version
$ sw winbat.bat # winbat.bat is executed
foo!
Microsoft Windows [Version 10.0.17763.195]
$ echo $ENV1 # ENV1 is synced!
bar!
You can also run a Windows command directly.
$ sw ver
Microsoft Windows [Version 10.0.17763.195]
SourceWinBat syncs environment variables, doskeys, and working directories of the Bash environment with those of the Windows cmd environment where a batch file is executed.
A batch file can see the exported environment variables of Bash.
Conversely, Bash has the environment variables defined by the batch file and Windows system
after the batch file is executed. PATH
is properly converted.
$ export UNIXENV="An UNIX environment variable is imported!"
$ cat syncenv.bat
echo %UNIXENV%
set WINENV=A Windows environment variable is imported!
set PATH=C:\any\path;%PATH%
$ sw syncenv.bat # syncenv sees the value of $UNIXENV, which we defined in Bash!
An UNIX environment variable is imported!
$ echo $WINENV # Now we can see $WINENV, which is set in synenv.bat!!
A Windows environment variable is imported!
$ echo $PATH # PATH is converted to the path of WSL
/mnt/c/any/path:/usr/bin/:/bin:(other paths go on...)
SourceWinBat enables Bash to import doskeys from Windows Batch files as Bash functions.
$ cat syncdoskey.bat
doskey echo1stparam=echo $1
doskey echoallparams=echo $*
doskey verver=ver
$ sw syncdoskey.bat
$ echo1stparam 1st 2nd 3rd # echo1stparam is imported!
1st
$ echo1stparam %OS% # "echo $1" is executed by cmd.exe, so %OS% is expanded
Windows_NT
$ echoallparams 1st 2nd 3rd
1st 2nd 3rd
$ verver
Microsoft Windows [Version 10.0.17763.195]
As source
of built-in Bash command syncs working directories, SourceWinBat also syncs them.
$ cd ~
$ cat syncwd.bat
pushd C:\Windows
pushd C:\Windows\system32
cd C:\Windows\system32\drivers
$ sw syncwd.bat
$ pwd # The current directory of Bash is changed
/mnt/c/Windows/System32/drivers
$ dirs # The directory stack is synced with that of the batch file
/mnt/c/Windows/System32/ /mnt/c/Windows /home/nullpo
SourceWinBat is written in Ruby. You can install it by Gem.
# gem install source_win_bat
Execute the line below to add the initialization in your .bashrc
.
$ echo 'eval "$(init_sw)"' >> ~/.bashrc
After restarting Bash, you will be able to use sw
in your shell.
Currently, SourceWinBat supports only Bash as a shell.
October update or later is required. SourceWinBat requires ConPTY API.
If you use MSYS2 and Cygwin with SourceWinBat, winpty
command is required.
Clone it from its GitHub repository and build it from the source. The repository is https://github.com/rprichard/winpty .
For MSYS2 users, DO NOT install winpty
via pacman
. As of 2019/01/03, Pacman installs the latest released version, 0.4.3-1, but this version does not work anymore.
FAQs
Unknown package
We found that source_win_bat demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.