Computer Science Canada

[Tutorial] Using Shell commands in turing

Author:  ReN3g@de [ Tue Mar 09, 2004 10:59 pm ]
Post subject:  [Tutorial] Using Shell commands in turing

You can use Shell commands in Turing and do such things as Restart, Shutdown, etc. LOL!! but be wise these commands could be used for evil things so use this information usefully!

First off here's the syntax:
code:
system ( command : string, var ret : int )


Your Shell command goes in the command : string area
and the return variable goes in the var ret: int area.

For every command run there is an interger that is returned to determine if the command worked properly or if not then what went wrong...

code:
var ret: int
system("cmd",ret)

This program will make the command prompt open

Here are the possible errors (the lines before the numbers are needed, they're negatives):
0 Works properly
-1 Not enough memory to load command.com
-2 Not enough memory to run command
-3 Argument list greater than 128 bytes or environment info
is greater than 32k
-4 Couldn't find command.com
-5 command.com is corrupt
-6 -noshell option is selected, the system procedure is
disallowed

To interpret these errors you could set up an if statement to see whether the execution has worked...

code:
var ret: int
system("cmd",ret)
if ret=-7 then
   put "Command cannot be found"
end if

some thing along these lines will do just fine!

code:
var ret: int
system("shutdown -s -c message-here",ret)

This program will shutdown the computer...
the -s means shutdown you can change it to -r to reboot... but the -c must stau the same!
the message here part is a message that appers... because this form of shutting down makes a message prompt appear counting down 30 seconds till shut down and a message is written below. There cannot be any spaces or the command will not work!

Thats all for today boys and girls hope you liked it!!

Author:  jonos [ Wed Mar 10, 2004 12:38 pm ]
Post subject: 

wow, great tutorial. so turing's shell syntax is almost exactly like c++. thanks for the help, though i have a feeling some noobs gonna come and do the shutdown one, hehe.

Author:  recneps [ Wed Mar 10, 2004 1:43 pm ]
Post subject: 

Yeah, this is what i was talking about in some other post in help section, someone wanted to know how to delete, and i said there was one that let you use command prompts (as an alternative Wink) And thats crazy, how does your sig pic work? lol

Author:  ReN3g@de [ Wed Mar 10, 2004 4:47 pm ]
Post subject: 

who mine?
im really not sure lol... i found it on the net and i thot it was pretty cool!

Author:  recneps [ Thu Mar 11, 2004 4:05 pm ]
Post subject: 

Its scary, its like "OMG how does he know my ip?!" And that im using IE (well most ppl do, but still lol)

Author:  octopi [ Thu Mar 11, 2004 4:15 pm ]
Post subject: 

Its pretty simple, I used to have a avatar that would check to see if your computer had a firewall or not.


Basically he enters the html code, which loads an image from the server. But the image is not an image, its a cgi program, this program then gets information about the user from the headers, and then enters that info into an image, and returns the image to the browser.

Author:  ReN3g@de [ Thu Mar 11, 2004 6:02 pm ]
Post subject: 

well there u have it

Author:  zylum [ Thu Mar 11, 2004 7:45 pm ]
Post subject: 

you could also do it using flash and php i think... where the php would figure out the info and then make an xml file and flash would read it and put the text on the image...

Author:  recneps [ Fri Mar 12, 2004 2:29 pm ]
Post subject: 

Interesting stuff! Wink

Author:  SuperGenius [ Mon Mar 29, 2004 7:36 pm ]
Post subject: 

About that pic.... it got my os and browser right, but the IP is wrong I think. At least it is way different than what turing told me when i was working with my connect 4 game.

Author:  octopi [ Mon Mar 29, 2004 8:28 pm ]
Post subject: 

Turing will probally tell you the internal network ip address of your system's NIC card, usually 192.168.0.X, or similar, could also be 10.X, or 169.X

When on the internet, you external IP address is given.

Author:  SuperGenius [ Mon May 17, 2004 4:06 pm ]
Post subject: 

octopi wrote:


When on the internet, you external IP address is given.


My connect 4 game uses Net.LocalAdress to give a number which the client types to connect to the host. So if it it the internal ip then my program should work fine within a network, but how do i get it to connect two computers that are not networked?

Author:  octopi [ Mon May 17, 2004 6:36 pm ]
Post subject: 

You dont.....they have to be networked....unless you intend to send data back and forth via carrier pidgeon.

Author:  SuperGenius [ Mon May 17, 2004 7:30 pm ]
Post subject: 

What a rip off.

Author:  octopi [ Mon May 17, 2004 8:29 pm ]
Post subject: 

Just so were both on the same page....


not networked means not connected to the internet, correct?

Author:  DaVe g [ Sun Sep 19, 2004 10:34 am ]
Post subject: 

nobody will make viruses with this info?

Laughing

Author:  Dan [ Sun Sep 19, 2004 10:40 am ]
Post subject: 

DaVe g wrote:
nobody will make viruses with this info?

Laughing


No more dnageruges then any real lang and u could not format the main hard drive just by using that comand. Whould have to reporgame some of the boot files to do that Rolling Eyes

Author:  jeffgreco13 [ Thu Jun 05, 2008 11:03 am ]
Post subject:  Re: [Tutorial] Using Shell commands in turing

HEY HEY, I wrote this back in the day lol.

Oh and it's very possible to make a virus with this info lol. More or less a very very very annoying one rather than something really destructive.

Then again, with the right commands and the right files deleted... who knows......

Not giving any ideas or anything.

Author:  Tony [ Thu Jun 05, 2008 11:20 am ]
Post subject:  Re: [Tutorial] Using Shell commands in turing

jeffgreco13 @ Thu Jun 05, 2008 11:03 am wrote:
Oh and it's very possible to make a virus with this info

No. No, you cannot make a virus with that.


Posted Image, might have been reduced in size. Click Image to view fullscreen.

Author:  jeffgreco13 [ Thu Jun 05, 2008 11:24 am ]
Post subject:  Re: [Tutorial] Using Shell commands in turing

well that just made me bite my tongue lol... thanks for the info tho

Author:  Insectoid [ Thu Jun 05, 2008 3:42 pm ]
Post subject:  RE:[Tutorial] Using Shell commands in turing

Well, almost the exact code can be typed into any text program and saved as batch file. The only difference is that it works over networks and thus requires the computer's 'name'. In my compsci class, 9-10 kids found out how to open the remote shutdown dialog box, and were wreaking havoc in class. So I wiki'd remote shutdown and found the direct shutdown code, wrote one for every computer in the room, and shut down every person who had ever shut me down. I really had the upper hand, because they had to go to the dialog box and manually change settings, while I just had to click an icon! It didn't help that the computer names are all printed on the computer cases...

I did eventually delete all my codes and swap out my computer's hard drive to change the name. Now, when someone tries to shut me down, the computer of the very guy who started the whole shutdown thing will go off. They all think I implemented some genious code to cause codes to rebound of my computer!

good times...

Oh, and my friend wrote a code in turing that would delete all system files on the computer, so EXTREMELY malicious software can be created in turing.

Author:  Xypher [ Thu Jan 08, 2009 1:27 pm ]
Post subject:  Re: [Tutorial] Using Shell commands in turing

I have a question...I see it opens a new command window every time. I want to go to a directory to copy one file into another. I thought by default it would run the file from the directory the .t or .exe doing this is located in. Apperantly it doesn't so I would like it to run something like this:

code:
U:
cd:\<directory>
copy /b fileout + filein outputfile


I will obiously be reciving input for the name of the drive they're using to take into consideration some people may have it on another hardrive or partition, and a directory. Other than that the file already asks for the files being worked with. The code looks like this

code:
setscreen("nocursor")
   var x,y:int
   var filein,fileout,name,fin:string
put"This program is designed to embed one file into another.",skip,"Please make sure that the files are in the same directory as this program!",skip
put"Press any key to continue!"
 Input.Pause
 cls
 setscreen("cursor")
put"Please enter the name of the file which will be embedded in the target file!",skip,skip,"File Name: "..
 color(red)
   get filein
 color(black)
 cls
put"Please enter the name of the target file which will contain the file:",skip,skip,"File Name: "..
 color(red)
   get fileout
 color(black)
 cls
put"Please enter the name of the file that will be a product of the target file:",skip,skip,"File Name: "..
 color(red)
   get name
 color(black)
 cls
put"EMBEDDING..."
fin:="copy /b "+fileout+" + "+filein+" "+name
 system(fin,x)
 cls
put"Embedding complete!",skip,skip,"Enter '1' to delete the original files or '0' to close this program: "..
   get y
 cls
if y=1then
   fin:="del "+filein
 put fin
    system(fin,x)
   fin:="del "+fileout
 put fin
    system(fin,x)
end if



Thanks for any help Smile.


EDIT: I'm also unsure how to type something such as '\Administrator' in a put statment as I get the error "Illigal extended character in string literal". Anybody have a fix for this?

Author:  Nick [ Thu Jan 08, 2009 3:17 pm ]
Post subject:  RE:[Tutorial] Using Shell commands in turing

code:
put Dir.Current


is that what you want?

Quote:
I'm also unsure how to type something such as '\Administrator' in a put statment as I get the error "Illigal extended character in string literal". Anybody have a fix for this?


try \\Administrator

Author:  Xypher [ Fri Jan 09, 2009 3:33 pm ]
Post subject:  Re: [Tutorial] Using Shell commands in turing

Not quite but that's a useful command to know. I want to know how to navigate to a directory, then excecute a comman which embeds one file with another. Basically if somebody could show me a quick example program on how to move one file to another location it would help...I just really need to be able to excecute 2 statments in the same command prompt.

Author:  Lekegolo killer [ Wed Jan 14, 2009 1:12 pm ]
Post subject:  Re: [Tutorial] Using Shell commands in turing

ReN3g@de @ Tue Mar 09, 2004 10:59 pm wrote:
You can use Shell commands in Turing and do such things as Restart, Shutdown, etc. LOL!! but be wise these commands could be used for evil things so use this information usefully!

First off here's the syntax:
code:
system ( command : string, var ret : int )


Your Shell command goes in the command : string area
and the return variable goes in the var ret: int area.

For every command run there is an interger that is returned to determine if the command worked properly or if not then what went wrong...

code:
var ret: int
system("cmd",ret)

This program will make the command prompt open

Here are the possible errors (the lines before the numbers are needed, they're negatives):
0 Works properly
-1 Not enough memory to load command.com
-2 Not enough memory to run command
-3 Argument list greater than 128 bytes or environment info
is greater than 32k
-4 Couldn't find command.com
-5 command.com is corrupt
-6 -noshell option is selected, the system procedure is
disallowed

To interpret these errors you could set up an if statement to see whether the execution has worked...

code:
var ret: int
system("cmd",ret)
if ret=-7 then
   put "Command cannot be found"
end if

some thing along these lines will do just fine!

code:
var ret: int
system("shutdown -s -c message-here",ret)

This program will shutdown the computer...
the -s means shutdown you can change it to -r to reboot... but the -c must stau the same!
the message here part is a message that appers... because this form of shutting down makes a message prompt appear counting down 30 seconds till shut down and a message is written below. There cannot be any spaces or the command will not work!

Thats all for today boys and girls hope you liked it!!



My friend can do all this stuff in notepad.

Author:  [Gandalf] [ Wed Jan 14, 2009 4:29 pm ]
Post subject:  RE:[Tutorial] Using Shell commands in turing

I doubt it. Notepad is a text editor, much like the one the Turing environment provides. You probably mean he can do this stuff by making batch (*.bat) files or similar.

Author:  ritama [ Tue Oct 22, 2019 4:10 am ]
Post subject:  Re: [Tutorial] Using Shell commands in turing

Turing will probably tell you the internal ip address of your system, which is usually 192.168.1.1, When on the internet, you external IP address is given.

Author:  basiblaster [ Fri Nov 29, 2019 8:55 am ]
Post subject:  RE:[Tutorial] Using Shell commands in turing

hey, just wondering, how would you get the output from the terminal and put it on the turing window?


: