Friday, 22 July 2016

Execute windows commands from Raspberry Pi

On the Windows pc

on an elivated command prompt run:
reg add "HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\system" /v LocalAccountTokenFilterPolicy /t REG_DWORD /d 1 /f

on the Raspberry Pi

sudo apt-get update
sudo apt-get install git dh-autoreconf autoconf libc6 samba-dev libtalloc-dev libtevent-dev
gcc-mingw-w64
git clone git://git.code.sf.net/p/winexe/winexe-waf winexe-winexe-waf
cd ./winexe-winexe-waf/source
sudo ./waf configure
sudo ./waf
sudo mkdir /usr/winexe
sudo cp * /usr/winexe/
sudo /usr/winexe/winexe -U USERNAME%PASSWORD --runas=USERNAME%PASSWORD  //IP 'ipconfig'

 If succsessfull this will return the ip settings on your windows pc.

NB! add %% after each line if you make a handsoff script.



4 comments:

  1. Hi, When trying to run the configure command I am getting:
    pi@raspberrypi:~/winexe-winexe-waf/source $ sudo ./waf configure
    Setting top to : /home/pi/winexe-winexe-waf/source
    Setting out to : /home/pi/winexe-winexe-waf/source/build
    Checking for 'gcc' (c compiler) : /usr/bin/gcc
    Checking for program pkg-config : /usr/bin/pkg-config
    Checking for 'dcerpc' : yes
    Checking for 'talloc' : yes
    SAMBA_INCS set to : /usr/include/samba-4.0
    SAMBA_LIBS set to : /usr/lib/arm-linux-gnueabihf/samba
    Checking for samba_util.h : no
    Build of shared winexe : disabled
    Cannot continue! Please either install Samba shared libraries and re-run waf, or download the Samba source code and re-run waf with the "--samba-dir" option.
    (complete log in /home/pi/winexe-winexe-waf/source/build/config.log)


    it is failing on: Checking for samba_util.h , Any Suggestions?

    ReplyDelete
    Replies
    1. Same problem here. - No solution found yet.

      Delete
  2. I have found this for the job instead. https://github.com/CoreSecurity/impacket

    It works very well.

    I installed it like this:

    $ sudo apt-get install python-dev python-pip -y
    $ pip install --upgrade pip
    $ sudo pip install pycrypto pyasn1 pyOpenSSL ldapdomaindump
    #Please note that pycrypto will not install if you forget to install python-dev
    $ git clone https://github.com/CoreSecurity/impacket.git
    $ cd impacket
    $ sudo python setup.py install

    ReplyDelete
    Replies
    1. Good stuff!
      I made a little tool that execute localy on windows and controlled with mqtt. : https://github.com/KjetilSv/Win10As/ full source and downloadable

      Delete