Navigate
Home
ArticleWiki
Forum
Journal
Search
Newsletter
Links
Tech News
expertsrt.com
Welcome Guest.
Username:

Password:

Remember me

ASP and .vbs file
Welcome, Guest. Please login or register.
December 02, 2008, 07:17:51 AM
11304 Posts in 1248 Topics by 498 Members
Latest Member: katCheeme
Experts Round Table Network  |  Serverside Technology  |  ASP  |  ASP and .vbs file « previous next »
Pages: [1]
Author Topic: ASP and .vbs file  (Read 1237 times)
seandelaney
Mentor

Offline Offline

Posts: 119



WWW
« on: June 07, 2006, 04:13:11 AM »

here is my .vbs file "IPAddress.vbs"

Code:
Option Explicit

Dim StrComputer
strComputer = "192.168.0.79"

Dim sFileName
sFileName = strComputer & ".txt"

WriteFile(sFileName)


All i want to do is run my .vbs file from a ASP page, but passing my .vbs file the remote IP address...

as you can see i have hardcoded a test IP address into my .vbs file.  

How can i do this without hardcoding an IP address into the .vbs file?

all i want to do is get remote ip address using asp and run my .vbs file...

can somebody help me please?
Logged

RQuadling
Guest
« Reply #1 on: June 07, 2006, 05:04:28 AM »

Why bother with the VBS?

Just put the code into your ASP file.
Logged
seandelaney
Mentor

Offline Offline

Posts: 119



WWW
« Reply #2 on: June 07, 2006, 06:40:30 AM »

can ASP execute command line args?

can i can run my test.vbs 192.168.0.2 from DOS and it works fine, but i need to be able to run it from a webpage of sort kind...
Logged

rdivilbiss
Moderator
*
Offline Offline

Posts: 414



WWW
« Reply #3 on: August 17, 2006, 09:50:27 AM »

can ASP execute command line args?

Maybe.  It depends on the security settings of the IIS server (or the client if you want to execute there.)

On IIS 5 you could execute wscript.shell commands. On IIS 6 you need to assign a user for the subweb and give that user permissions to execute wscript and cmd.exe. Obvioulsy (or maybe not so) if a remote user can upload a malicious script and execute it under that context the attacker can own your server.

e.g. It is doable but much caution is needed.

Server example: (run a ping piping the results to a file the open the file and echo results to the web page)

Code:
<%
Dim objFSO, objShell, objTempFile, objTextFile

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("Wscript.Shell")
objName = objFSO.GetTempName
objTempFile = objName
objShell.Run "cmd /c ping -n 3 -w 1000 64.126.4.193 >" & _
    objTempFile, 0, True
Set objTextFile = objFSO.OpenTextFile(objTempFile, 1)
Do While objTextFile.AtEndOfStream <> True
    strText = objTextFile.ReadLine
    If Instr(strText, "Reply") > 0 Then
        response.write "Reply received."
    End If
Loop
objTextFile.Close
objFSO.DeleteFile(objTempFile)
%>

Client example: http://www.rodsdot.com/ee/runClientSideExecutable.asp (IE/Win only)
Logged

Rod
Pages: [1]
« previous next »
    Jump to: