LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 09-09-2005, 03:36 PM   #1
Whiteghost
Member
 
Registered: Apr 2003
Distribution: red hat 9.0
Posts: 50

Rep: Reputation: 15
shell script question


How do connect to a windows box ?Do you have to use a socket in your shell script?
 
Old 09-09-2005, 03:43 PM   #2
zaichik
Member
 
Registered: May 2004
Location: Iowa USA
Distribution: CentOS
Posts: 419

Rep: Reputation: 30
Hi Whiteghost,

The question is entirely too vague to answer. How are you trying to connect to the Windows box? For what purpose? What do you need to do with the connection? From what kind of system are you connecting?
 
Old 09-09-2005, 05:05 PM   #3
Whiteghost
Member
 
Registered: Apr 2003
Distribution: red hat 9.0
Posts: 50

Original Poster
Rep: Reputation: 15
Well i want to try to have my linux box connect to a port with the shell script.I doing this just to test some tool i make out.
 
Old 09-09-2005, 06:14 PM   #4
twantrd
Senior Member
 
Registered: Nov 2002
Location: CA
Distribution: redhat 7.3
Posts: 1,438

Rep: Reputation: 52
uhhh, you just want to connect to a port? Why not just use 'telnet <hostname> <port>"?

-twantrd
 
Old 09-09-2005, 06:31 PM   #5
zaichik
Member
 
Registered: May 2004
Location: Iowa USA
Distribution: CentOS
Posts: 419

Rep: Reputation: 30
In order to for you to connect to a socket on the Windows box, there must be some specific process/service with which you intend to communicate. For example, if you want to connect to the SMTP service on the Windows box, you could try what twantrd suggested:

telnet <windows box hostname or IP address> 25

Is that what you are looking for? If there is nothing listening for your connection attempt, you are not going to be able to connect to it.
 
Old 09-09-2005, 07:41 PM   #6
Whiteghost
Member
 
Registered: Apr 2003
Distribution: red hat 9.0
Posts: 50

Original Poster
Rep: Reputation: 15
What about makeing shell script that would work with netcat?
 
Old 09-09-2005, 07:49 PM   #7
zaichik
Member
 
Registered: May 2004
Location: Iowa USA
Distribution: CentOS
Posts: 419

Rep: Reputation: 30
netcat can do a number of different things. Again, what are you trying to accomplish?
 
Old 09-09-2005, 08:26 PM   #8
Whiteghost
Member
 
Registered: Apr 2003
Distribution: red hat 9.0
Posts: 50

Original Poster
Rep: Reputation: 15
I want to make a shell script that would do what netcat would do.i try to make my own shell script tools..


I seen some shell script that have some shellcode in them.
 
Old 09-10-2005, 12:01 AM   #9
michaelk
Moderator
 
Registered: Aug 2002
Posts: 11,850

Rep: Reputation: 736Reputation: 736Reputation: 736Reputation: 736Reputation: 736Reputation: 736Reputation: 736
Shell programming is an interpreted high level language and does not have the capability of network communications all by itself. You can create a shell script that can execute netcat but without more information it is difficult to provide help.
 
Old 09-10-2005, 08:20 AM   #10
eddiebaby1023
Member
 
Registered: May 2005
Posts: 378

Rep: Reputation: 33
Use perl, that has network connectivity facilities builtin.
 
Old 09-10-2005, 10:47 AM   #11
Whiteghost
Member
 
Registered: Apr 2003
Distribution: red hat 9.0
Posts: 50

Original Poster
Rep: Reputation: 15
Quote:
Originally posted by eddiebaby1023
Use perl, that has network connectivity facilities builtin.



How would i use perl for networking?I just thinking of make a tool that would connect to pport and gie me output thinga something like a rootkits.I seen shell script can do this.
 
Old 09-10-2005, 11:24 AM   #12
michaelk
Moderator
 
Registered: Aug 2002
Posts: 11,850

Rep: Reputation: 736Reputation: 736Reputation: 736Reputation: 736Reputation: 736Reputation: 736Reputation: 736
Can you explain in detail what you are trying to accomplish?
What do you mean by "pport". A network port?
What type of tool are you building?
 
Old 09-10-2005, 11:46 AM   #13
Whiteghost
Member
 
Registered: Apr 2003
Distribution: red hat 9.0
Posts: 50

Original Poster
Rep: Reputation: 15
Well i try to build a tcp/ip tool like netcat.When i said port i mean like a remote port.And i try to make a shell script that would do the samething that what i try to accomplish.


I know this going to be hard to learn i hope this well work out.
 
Old 09-10-2005, 12:17 PM   #14
michaelk
Moderator
 
Registered: Aug 2002
Posts: 11,850

Rep: Reputation: 736Reputation: 736Reputation: 736Reputation: 736Reputation: 736Reputation: 736Reputation: 736
I didn't ask you what you meant by a shell script. I think of a shell script as a program written using shell programming. The shell, I assume you are using bash does not contain any internal network functions. Maybe we are not talking about the same thing.

netcat is written in c. However, your not limited to c. Some other languages are perl, java or php.

You can google for socket programming and find lots of information, tutorials and sample code.
 
Old 09-10-2005, 12:40 PM   #15
Whiteghost
Member
 
Registered: Apr 2003
Distribution: red hat 9.0
Posts: 50

Original Poster
Rep: Reputation: 15
Do you know where i can the sourcecode for netcat?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Shell Script Question abdul_zu Programming 7 10-06-2005 03:33 AM
shell script Question Whiteghost Programming 4 09-25-2005 10:05 PM
Shell Script Question. rvijay Linux - General 2 07-14-2005 06:41 PM
Shell script question... defa0009 Linux - General 7 04-26-2005 08:16 PM
shell script question rrwhite Linux - General 3 09-15-2004 01:01 AM


All times are GMT -5. The time now is 10:14 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration