0

I've done some searching and found references to a neat little tool called winexe (which is great, since psexec is exactly what I was looking to emulate), but it's not QUITE working the way I'd like...

What I'm trying to do is automate my memory dumping process (which I typically do manually on my windows machine) by scripting it in bash.I copy a Redline folder over to the target, connect with psexec, and then run the .bat script. Works great. Tried it from my Linux machine, and it works if I connect winexe with cmd.exe and run the .bat manually...

The problem, is that if I try to do something like:

winexe -U=username%password //hostname 'cmd.exe /c C:\Temp\Redline\RunRedlineAudit.bat'

- or -

winexe -U=username%password //hostname C:/Temp/Redline/RunRedlineAudit.bat

It kicks back:

Failure Encountered:
Privilege Escalation Script and/or Helper Script not found.

Any thoughts on what the problem could be and how to fix it? So far I'm thinking I may just script all the way up to the cmd.exe connect, and then do that very last step manually, but that's no fun ;)

The batch script:

@ECHO off
SETLOCAL enableextensions enabledelayedexpansion
SET elevate=.\elevate.cmd
SET helper\.\Helper.bat
SET args=%1

IF NOT EXIST "%elevate%" goto :failed
IF NOT EXIST "%helper%" goto :failed

For /f "tokens=2 delims=[]" %%G in ('ver') Do (set _version=%%G)
For /f "tokens=2,3,4 delims=. " %%G in ('echo %_version%') Do (set _major=%%G& set _minor=%%H& set _build=%%I)

if "%_major%"=="5" goto sub5
if "%_major%"=="6" goto sub6
Echo unsupported OS version
goto:eof
:sub5
call %helper% %args%
GOTO :end
:sub6
ECHO Requesting Elevation
call %elevate% %helper% %args%
GOTO :end

:failed
:ECHO.
:ECHO.
ECHO Failure Encountered:
ECHO Privilege Escalation Script and/or Helper Script not found.
GOTO :end

:end
ENDLOCAL
@ECHO on
Arvandor
  • 181
  • 1
  • 5
  • 15

2 Answers2

0

Can you please post your .bat file content?

Meanwhile, try run winexe with --system flag

Samuel
  • 3,631
  • 5
  • 37
  • 71
0

The problem is with path to elevate.cmd and Helper.bat.

When you executing cmd /c C:\Temp\Redline\RunRedlineAudit.bat,

cmd shell will execute RunRedlineAudit.bat at user's folder, and it will

search for a needed files there.

To solve that issue, you should replace relative path with absolute in following variables:

SET elevate=.\elevate.cmd

SET helper=.\Helper.bat

Samuel
  • 3,631
  • 5
  • 37
  • 71