| View previous topic :: View next topic |
| Author |
Message |
tim6389 Professional Member


Joined: 01 Aug 2002 Posts: 790
|
Posted: Tue Oct 29, 2002 2:27 am Post subject: running a a batch file remotely???? |
|
|
hello all
is they a way to make a vds script let a person (thru the internet ) connect to a machine and the person can run a batch file remotely ( and have the user be able to pick which batch file to run)?
thanks |
|
| Back to top |
|
 |
tim6389 Professional Member


Joined: 01 Aug 2002 Posts: 790
|
Posted: Tue Oct 29, 2002 5:10 am Post subject: hummm |
|
|
there has to be way way to do this...hummmm
ANY ideas would be great
thanks |
|
| Back to top |
|
 |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Tue Oct 29, 2002 5:37 am Post subject: |
|
|
Sure, there's various ways you can do this. Make your own psuedo telnet server and client, which I have done in the past (code lost now), or if there's a web server running you can setup a cgi script.
I've made cgi scripts that let me take over the entire remote computer. Task Manger, File Manger, Executing Programs.
But these are not simple projects. And you'll need one of the dlls for tcp/ip.
Take a look at some of the chat program source codes. You can basically convert one of those to a mini telnet system. Send a request for a list of batch files that the user can run, server does a list filelist bit and sends the list back to the user. User picks the batch file by double clicking and it's sent back to the server. Server then does a RUN or a SHELL on the batch file.
-Garrett |
|
| Back to top |
|
 |
tim6389 Professional Member


Joined: 01 Aug 2002 Posts: 790
|
Posted: Tue Oct 29, 2002 6:11 am Post subject: hummm |
|
|
i think i follow what you mean.....hummmm
let me look aorund to see what i can find
thanks |
|
| Back to top |
|
 |
tim6389 Professional Member


Joined: 01 Aug 2002 Posts: 790
|
Posted: Tue Oct 29, 2002 9:37 pm Post subject: hummm |
|
|
well i'am not having much luck with this...Garrett do you have any examples? that i could see?
thanks |
|
| Back to top |
|
 |
tim6389 Professional Member


Joined: 01 Aug 2002 Posts: 790
|
Posted: Wed Oct 30, 2002 1:30 am Post subject: :( |
|
|
i have even search for cgi script that could do this no luck yet  |
|
| Back to top |
|
 |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Wed Oct 30, 2002 3:19 am Post subject: |
|
|
The telnet code I had can't be found. Not sure what I did with it. The cgi program I speak of I can't really share because it's actually in use on several of my client's servers right now.
Back to the chat program examples. I'm sure there's some around, and probably even with either of the dlls that allow tcp/ip stuff.
Instead of sending chat stuff, send commands and requests from client to server. Server checks command or request against a pre-defined database of commands and requests, and if it's good, it runs command or sends back to client the data requested.
Do this for a starting block:
Take one of the chat server examples, rip it apart until you're left with just bare code. Then make it to where after a connection is made from a client, wait for for some data to come in. If the data equals "TIME", then have the server send back the current time.
In the client, do as above, and then just let it send only the word "TIME" to the server. Any data that comes back from the server, have it show you that in a INFO message.
Tell ya what. I've got nothing better to do tonight, I'll make you a very basic example for this.
Back soon,
-Garrett |
|
| Back to top |
|
 |
tim6389 Professional Member


Joined: 01 Aug 2002 Posts: 790
|
Posted: Wed Oct 30, 2002 5:06 am Post subject: cooooooool |
|
|
great i can't wait to see it
thanks |
|
| Back to top |
|
 |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Wed Oct 30, 2002 6:43 pm Post subject: |
|
|
Sorry, had to finish this morning.
Ok, this is VDS 4.x code, so if you're using 3.x, check for modifications if
needed. And this uses the vdsinet.dll from the vdsdll.dll 2.7 which can be
found on the main site here, or at sools.com
When using the client, type Time or Date after you're connected. The server will respond by sending back the date or time. Now you just add
commands and such from here.
SERVER
| Code: | external vdsinet.dll,Public Freeware Key|90257236
DIALOG CREATE,NotQuiteTelnet Server,-1,0,138,148
DIALOG ADD,BUTTON,BUTTON1,4,4,64,24,Svr On
DIALOG ADD,BUTTON,BUTTON2,4,68,64,24,Svr Off
DIALOG ADD,LIST,LIST1,58,4,128,64
DIALOG ADD,TEXT,TEXT1,36,6,,,Port:
DIALOG ADD,EDIT,EDIT1,34,36,40,19,2525
DIALOG ADD,STATUS,STATUS1,Server off
DIALOG SHOW
DIALOG DISABLE,BUTTON2
net socket,auto,1
net socket,vdsevents,
:evloop
%E = @event()
if %E
goto %E
end
%E = @net(socket,event)
if %E
goto %E
end
goto evloop
:BUTTON1BUTTON
net socket,port,@dlgtext(EDIT1)
net socket,server
%B = 1
repeat
%A = @event()
until @not(@equal(@net(socket,status),open))%A
if %A
goto %A
end
if @equal(@net(socket,status),listening)
dialog set,STATUS1,Server on
Dialog Enable,button2
Dialog Disable,button1
else
goto closec
end
goto evloop
:BUTTON2BUTTON
net socket,close
Dialog Disable,button2
Dialog Enable,button1
dialog set,STATUS1,Server off
goto closec
:NETWORK
%%Data = @net(socket,data)
%%User = @net(socket,senderaddr)
list add,LIST1,%%User:%%Data
list seek,LIST1,@pred(@count(LIST1))
If @equal(%%Data,DATE)
NET SOCKET,SENDADDR,%%User,@datetime(dddddd)
End
If @equal(%%Data,TIME)
NET SOCKET,SENDADDR,%%User,@datetime(tt)
End
goto evloop
:CONNECT
dialog set,STATUS1,@net(socket,status)
goto evloop
:ACCEPT
list add,LIST1,@net(socket,senderaddr):Hello
list seek,LIST1,@pred(@count(LIST1))
goto evloop
:CLOSEC
if @equal(@net(socket,status),listening)
list add,LIST1,@net(socket,senderaddr):Bye Bye
list seek,LIST1,@pred(@count(LIST1))
else
dialog set,STATUS1,Server off
end
goto evloop
:ERROR
net socket,close
warn Network error: @net(socket,error)
goto closec
:close
Exit |
CLIENT
| Code: | external vdsinet.dll,Public Freeware Key|90257236
DIALOG CREATE,NotQuiteTelnet Client,-1,0,316,200
DIALOG ADD,STYLE,STYLE1,,,,BLACK,LIME
DIALOG ADD,BUTTON,BUTTON1,4,4,64,24,Connect
DIALOG ADD,BUTTON,BUTTON2,4,68,64,24,Disconnect
DIALOG ADD,TEXT,TEXT1,10,144,,,Port:
DIALOG ADD,EDIT,EDIT1,8,172,40,19,2525,,STYLE1
DIALOG ADD,TEXT,TEXT2,10,226,,,IP:
DIALOG ADD,EDIT,EDIT2,8,246,64,19,127.0.0.1,,STYLE1
DIALOG ADD,LIST,LIST1,34,4,306,118,,STYLE1
DIALOG ADD,EDIT,EDIT3,158,4,236,19,,,STYLE1
DIALOG ADD,STATUS,STATUS1
DIALOG ADD,BUTTON,BUTTON3,158,246,64,19,Send
DIALOG SHOW
net socket,auto,1
net socket,vdsevents,
:evloop
%E = @event()
if %E
goto %E
end
%E = @net(socket,event)
if %E
goto %E
end
goto evloop
:BUTTON1BUTTON
net socket,addr,@dlgtext(EDIT2)
net socket,port,@dlgtext(EDIT1)
net socket,client
%B =
dialog set,STATUS1,@net(socket,status)
goto evloop
:BUTTON3BUTTON
net socket,sendserver,@dlgtext(EDIT3)
dialog set,EDIT3,
goto evloop
:BUTTON2BUTTON
net socket,close
goto closec
:NETWORK
%%Data = @net(socket,data)
list add,LIST1,%%Data
list seek,LIST1,@pred(@count(LIST1))
goto evloop
:CONNECT
dialog set,STATUS1,@net(socket,status)
list add,LIST1,Connected.
list seek,LIST1,@pred(@count(LIST1))
goto evloop
:CLOSEC
if @equal(@net(socket,status),listening)
dialog set,STATUS1,Listening: @net(socket,clients) clients.
else
dialog set,STATUS1,@net(socket,status)
list add,LIST1,Disconnected
list seek,LIST1,@pred(@count(LIST1))
end
goto evloop
:ERROR
net socket,close
warn Network error: @net(socket,error)
goto closec
:close
Exit |
-Garrett |
|
| Back to top |
|
 |
tim6389 Professional Member


Joined: 01 Aug 2002 Posts: 790
|
Posted: Thu Oct 31, 2002 2:36 am Post subject: ok |
|
|
ok so then can i just added a button like this run test.bat on the clinet side.. what about server side?
thanks |
|
| Back to top |
|
 |
tim6389 Professional Member


Joined: 01 Aug 2002 Posts: 790
|
Posted: Thu Oct 31, 2002 2:47 am Post subject: ahhh k |
|
|
ok i see on the client side there is a button called send now if i could chnage that is i could enter a batch file name then when i hit send it would run that batch file  |
|
| Back to top |
|
 |
tim6389 Professional Member


Joined: 01 Aug 2002 Posts: 790
|
Posted: Thu Oct 31, 2002 3:18 am Post subject: ok |
|
|
ok the way to do it is in this part of the code, but it don't like it when i tried to added 202.bat to it....but i think this is the part where i have to chnage ( i hope) i'am right on this.
| Code: |
%%Data = @net(socket,data)
%%User = @net(socket,senderaddr)
%%202 = @net(socket,data)
list add,LIST1,%%User:%%Data
list seek,LIST1,@pred(@count(LIST1))
If @equal(%%202,channel)
NET SOCKET,SENDADDR,%%User,run 202.bat
End
If @equal(%%Data,TIME)
NET SOCKET,SENDADDR,%%User,@datetime(tt)
End
goto evloop
|
|
|
| Back to top |
|
 |
tim6389 Professional Member


Joined: 01 Aug 2002 Posts: 790
|
Posted: Thu Oct 31, 2002 5:56 am Post subject: i got it |
|
|
i think i got it working
thanks a mil for helping me get started  |
|
| Back to top |
|
 |
tim6389 Professional Member


Joined: 01 Aug 2002 Posts: 790
|
Posted: Thu Oct 31, 2002 7:33 am Post subject: question |
|
|
how do i make it say "not connected" when it don't connected i try adding if not statements no go here is the part of the code i'am talking about
thanks
| Code: |
:CONNECT
dialog set,STATUS1,@net(socket,status)
list add,LIST1,Connected.
list seek,LIST1,@pred(@count(LIST1))
goto evloop
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|