Showing posts with label Hack Window Vista With Metasploit. Show all posts
Showing posts with label Hack Window Vista With Metasploit. Show all posts

Sunday, August 21, 2011

Hack Windows Vista with Metasploit

Write:

if it works in cmd.exe , you can remotely execute on multiple servers.This script invokes whatever command you can use in cmd.exe on one or more computers you input the command you'd like to run as a screen input when you run the script you can use all cmd.exe command like [del,ipconfig /flushdns,ipconfig /registerdns,gpupdate /force ,notepad.exe,defrag c:, wuauclt /detectnow , powercfg, net start ,net stop,copy,arp,wscript.exe ....] this script requires powershell Version 2.0 , because the cmdlet Invoke-WmiMethod is introduced in powershell V 2


PowerShell

# ==============================================================================================
#  
# Script Name : Run Remote cmd.exe Commands

# AUTHOR: Mohamed Garrana 
# DATE  : 4/12/2010

# COMMENT: 
# this script invokes whatever command you can use in cmd.exe on one or more computers
#you input the command name as a screen input when you run the script
#you can use all cmd.exe command like [del,ipconfig /flushdns,ipconfig /registerdns,gpupdate /force ,notepad.exe,defrag c:, ...
#..wuauclt /detectnow,powercfg,net start ,net stop,copy,arp,wscript.exe ....]
#if you can do it from cmd.exe you can do it here on multiple computers at the same time
# ==============================================================================================


function Run-RemoteCMD {

    param(
    [Parameter(Mandatory=$true,valuefrompipeline=$true)]
    [string]$compname)
    begin {
        $command = Read-Host " Enter command to run"
        [string]$cmd = "CMD.EXE /C " +$command
                        }
    process {
        $newproc = Invoke-WmiMethod -class Win32_process -name Create -ArgumentList ($cmd) -ComputerName $compname
        if ($newproc.ReturnValue -eq 0 )
                { Write-Output " Command $($command) invoked Sucessfully on $($compname)" }
                # if command is sucessfully invoked it doesn't mean that it did what its supposed to do
                #it means that the command only sucessfully ran on the cmd.exe of the server
                #syntax errors can occur due to user input 
    
    
    
    
    }
    End{Write-Output "Script ...END"}
                 }
    

#----------------
#you can use this script to run any command that can be run on CMD.EXE
#the following is only to give you an idea how can you use it
#-----------------
#for copying files from many remote computers to a single
# get-content c:\servers.txt | Run-Remotecommand
#Enter command to run: copy c:\log\log.txt d:\
#you only input "copy c:\log\log.txt d:\"
#---------------------------------------
#for forcing group policy update on multiple computers
# get-content c:\servers.txt | Run-Remotecommand
#Enter command to run: gpupdate /force
#--------------------------------------
#for stopping the Bits service on multiple computers
# get-content c:\servers.txt | Run-Remotecommand
#Enter command to run: Net stop bits
#---------
#you can always run it against a single server using 
#Run-RemoteCommand server1
#Enter command to run: enter whatever you'd normally enter in cmd.exe shell
======================================================================
Remotely execute cmd.exe commands on multiple computers ~ !!--FuTuRe Of EtHiCaL hAcKiNg--!! http://samhacked.blogspot.com/2011/04/remotely-execute-cmdexe-commands-on.html#ixzz1VbWuVOuN
Under Creative Commons License: Attribution