Enumerating the If... Then: Scripts

Friday, February 20, 2009

batch: remote command prompt with the quickness

Tested.
In use at work.


tini.exe, from ntsecurity.nu, is a telnet server that is a remote command prompt.

Embedded in this script is starting and stopping a process remotely using wmic.


@echo off

:BOF
cls
set /p targethost=Target host:

if [%targethost%] == [] GOTO YOUSTUPID
pause

copy tini.exe \\%targethost%\c$\windows\system32\
WMIC /node:"%targethost%" PROCESS CALL Create "c:\windows\system32\tini.exe"

echo.
echo.

echo In new window, hit enter.
echo.

start "Tiny interactive network telnet" telnet %targethost% 7777

echo To kill remote command prompt...
pause

WMIC /node:"%targethost%" PROCESS where name="tini.exe" CALL Terminate 0

goto EOF


:YOUSTUPID

echo.
echo You must enter a target host
pause
goto BOF

0 Comments:

Post a Comment

<< Home