Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Create a programmed Script

Programming languages, Coding, Executables, Package Creation, and Scripting.
Post Reply
Message
Author
Leito21
Posts: 3
Joined: 2016-05-16 00:46

Create a programmed Script

#1 Post by Leito21 »

Hi everyone, I have a homework in which I'm asked to build a script, so I came here for some advise on the way I can make it

The exercise says: Set up a local network of N virtual machines. Create a script that executed from any machine install in other certain machines another script whose function is to monitor urls you accessed for each target machine.
The local monitor Script on each machine must feed a common file that is located in one of the machines acting as a server.
The display allows clearly identify each machine and the active user and organize the report according to certain chained order criteria obtained from the available fields. The information will be in a file duly named, with title, description of what it represents and the time span of the log. Each time you want to view the report, it will display options mentioned above.

Note: I don't want you to make the Script, I just want guidance on the way to build it, for know I only found that for monitoring URL's I can use Iftop. So any ideas are more than welcome.

Thank you so much.

User avatar
GarryRicketson
Posts: 5644
Joined: 2015-01-20 22:16
Location: Durango, Mexico

Re: Create a programmed Script

#2 Post by GarryRicketson »

So any ideas are more than welcome.
Study, I would think that the text books you have been using for your class
have covered the basic script writing techniques, etc. And the teacher has
given some sort of "lectures", etc. leading up to the home work assignment.
If you do not have a good teacher, or do not have any "text books", no problem,
All you need to do is learn how to use a search engine, use it to find the "text books", or written material, on the subject you are studying, in this case "Create a programmed script" .
That in itself is a very broad subject, however, you can browse the wide range of material, then start trying to narrow it down to more specific material, related more specifically to the problem / home work assignment.
Learn how to read and study all the material available, your school books, and the results you get when you do on line searches.
If you have not been studying , like you should have been, then you are in trouble
because this "programmed Script" you have to write requires some knowledge in networking , as well as "script writing",.. Do you even have some idea as to what
"script language" you will use ? Is there a specific language, IE: bash, perl, java, etc--that you are supposed to use ?, or is that your choice. Bash, and a simple command line script probably could be used. Since your "teacher" has neglected to
even teach you the basic ,essential skill of using search engines, to find and get data and information needed to perform any given task, I did some examples, to try to help you learn how to do that.
Good luck on your home work, actually, if you have started working on it early enough,
you should have plenty of time to browse , and study the material that comes up in the
searches, and I am sure you will find the information you need,..you might even find
a good script, all ready written ,or very close to what you need, then modify it to suit your assignment specifically.
But that is ONLY IF, you go through the results carefully, you also will learn
a lot of other interesting stuff in the process.
You probably can get some even better results if you do some experimenting
with "key words",..and use some imagination.

How to Create a programmed Script
====================================================================

local monitor script that uses iftop to get and record the information

============================================================
How to Create a script that executed from any machine install in other certain machines another script whose function is to monitor urls you accessed for each target machine
-------------Note: Just "click" the highlighted,underlined links, and you will get
the search results.

User avatar
dasein
Posts: 7680
Joined: 2011-03-04 01:06
Location: Terra Incantationum

Re: Create a programmed Script

#3 Post by dasein »

Leito21 wrote:I just want guidance on the way to build it...
There are multiple ways to achieve the goal(s) in question, but they all involve learning about TCP/IP sockets, and how to write a process that responds to a particular event. Whether that event is network activity, or file system changes, or something else--that's the part you need to think through in detail. (And recognize that different scripts may need to respond to different type of events.)

Plus, this is not "a" script. It's multiple scripts. (Think: "Do one thing and do it well.")

Leito21
Posts: 3
Joined: 2016-05-16 00:46

Re: Create a programmed Script

#4 Post by Leito21 »

dasein wrote:
Leito21 wrote:I just want guidance on the way to build it...
There are multiple ways to achieve the goal(s) in question, but they all involve learning about TCP/IP sockets, and how to write a process that responds to a particular event. Whether that event is network activity, or file system changes, or something else--that's the part you need to think through in detail. (And recognize that different scripts may need to respond to different type of events.)

Plus, this is not "a" script. It's multiple scripts. (Think: "Do one thing and do it well.")

Hi, thanks for your answer, as you said I also believe that this is a multiscript, at least two. Look my idea is create an Script called for an example ServerScript in which is crearly defined who is going to be the host and it's obviously being deployed on the server, and another called ClientScript in which is defined the server it is going to connect to, and the whole code. For this client Script I think I can run Iftop, log all the activity to a log file, capture the username and the hostname and pack it into the same file and send it to the server, once on the server I could read the file, search for hostname and put it in an array or list having the separated files. So I believe this is the "algorithm" I can use to achieve the goal but as you said this involves TCP/IP sockets and writing a process... so this is where is start panic and that's why I asked for suggestions from an expert point of view (you guys)

Note 1: For the esceneario in which I have to copy files I think SSH could be a solution.
Note 2: For the sheduling of execution I think I can use Cron

User avatar
dasein
Posts: 7680
Joined: 2011-03-04 01:06
Location: Terra Incantationum

Re: Create a programmed Script

#5 Post by dasein »

Leito21 wrote:...as you said this involves TCP/IP sockets and writing a process... so this is where is start panic and that's why I asked for suggestions from an expert point of view (you guys)
You're now starting to move away from "give me ideas" to "do the assignment for me."

I've identified some areas in which you need to do some research and learning (research and learning being the whole point of this or any other homework assignment). But actually doing that research/learning is up to you.

And I'll say it once more--there are multiple solutions to this (or virtually any other) problem. A cron job, as you've identified, is one approach; writing a daemon is another. Similarly, you could use SSH/SFTP, or you could use NFS, or a direct connection to the destination machine. There's no single "right" answer.

Leito21
Posts: 3
Joined: 2016-05-16 00:46

Re: Create a programmed Script

#6 Post by Leito21 »

dasein wrote: You're now starting to move away from "give me ideas" to "do the assignment for me."
Absolutely NOT, you're wrong I'm not here to ask for someone to write it for me, in that case It's easier to say: I'll pay for this and so on so on..
I really want to learn it's just that didn't know how to focus the research. :shock:
And I'll say it once more--there are multiple solutions to this (or virtually any other) problem. A cron job, as you've identified, is one approach; writing a daemon is another. Similarly, you could use SSH/SFTP, or you could use NFS, or a direct connection to the destination machine. There's no single "right" answer.
You're right there should be lot's of solutions for this, and as for now you gave a few ideas, I'll make it!

Thank you so much. :wink:

User avatar
dasein
Posts: 7680
Joined: 2011-03-04 01:06
Location: Terra Incantationum

Re: Create a programmed Script

#7 Post by dasein »

Leito21 wrote:You're right there should be lot's of solutions for this, and as for now you gave a few ideas, I'll make it!

Thank you so much. :wink:
Always happy to provide food for thought. Explore well and learn much.

Post Reply