pseudo code needs help coding


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting pseudo code needs help coding
# 1  
Old 04-12-2009
pseudo code needs help coding

Thanks in advance!!! Can I get someone to write this small script or can you direct me to a web link, etc. to get it done?
---------
Initiate this script every 15 - 20 secs or so through cron.

Gather LAN users' $info(username, mac or ipaddr, PID) OBJECT: Tie each username to a mac or ipaddr,
Write $info(3 pieces) for each logged-on user to a $file,
Open this $file for reading,
While not EOF,
Compare each line of $info(ipaddr or mac) looking for an ipaddr or mac match/duplication
if a ipaddr or mac match, check to see if the $username is the same
if the $username DO NOT match
Provide a warning, if possible, to these $usernames(on the same ipaddr/mac),
Kill both process of these $usernames(on the same ipaddr/mac).
else{}
else{}
rm $file
End
-------

Thank you! Smilie
# 2  
Old 04-12-2009
What have you written so far and where are you stuck?

Some details about your OS, version, etc. would not hurt too.

Right now, the way you presented your problem it looks like homework and asking homework questions is forbidden by the rules. How about persuading us that this is not the case?

bakunin
# 3  
Old 04-12-2009
Thanks for the reply. Unfortunately, I'm not a shell-script coder (compiled languages mostly).

In fact, I am the Comp. Sci. teacher of about 140 HS students. I am running Ubuntu LTS 8.01.2. I allow my students 2 ssh logins ( /etc/security/limits.conf ). This way they can see previous work they have coded, highlight a selection, paste it in the other shell(new work). Why re-invent the wheel for every lesson?

What I am trying to avoid is two(2) different users sharing work via the same process!!! If two different users are using the same terminal, shut them down! I must shut this "cheating" process down!!!! Imagine, my students can only learn by doing work, not from copying others efforts.

Thanks again!!!

Last edited by tuxhats; 04-12-2009 at 10:15 AM..
# 4  
Old 04-12-2009
Quote:
Originally Posted by tuxhats
What I am trying to avoid is two(2) different users sharing work via the same process!!! If two different users are using the same terminal, shut them down! I must shut this "cheating" process down!!!!
Ok, accepted. But (i hope you don't mind) instead of writing a shell script for you i would like to challenge your premise:

Your intention is to prevent users from exchanging work. Alas, as long as you do not take addional measures your concept is not going to work because users could simply share files via publicly accessible directories: copy a file with your work to /tmp, chmod it to 777 and every user could copy it.

Even if this would be prevented somehow you could always exchange work through network-like connections (for instance the "talk" utility, "mail", etc.).

IMHO you need a chrooted environment (see "man chroot") for every student to effectively prevent exchange of work and in this case you could lift the 2-sessions limit because it is an artificial restraint then superfluous.

I hope this helps.

bakunin
# 5  
Old 04-12-2009
Thank you bakunin! Already got this covered!! Students/users are in a chrooted jail and can use only lshell as their shell. It limits the commands they can enter(only: --help,ls,pwd,rm,mkdir,g++,java,javac,vim,clear, firefox[ssh -X]) and they can only see/navigate in their own directory. They do not have access to any public area(/home/jail/tmp) or other, except thru firefox(which I've rewritten restricting them greatly) to which they can access http://mylocalserver, where lessons are located. Still need the script here. I've been on this goal for 4+ years. I need this script made!!!
# 6  
Old 04-12-2009
Thank you bakunin!! I have the students locked into a jail and also have lshell as the only shell they have access to. The lshell limits(by config) the commands they can use(--help,clear,ls,mkdir,rm,g++,java,javac,./,vim,mv,cp, and firefox). I have re-written firefox limiting them to http://mylocalwebserver where I have lessons for them. Their access is by "ssh -X user@myserver". They cannot see others or the file structure and are locked in by lshell's command limits. They have no mail, talk, etc. available to bypass the setup. Pretty cool. I just need a script to accomplish this goal I've stated.
OBJECTIVE:
What I am trying to avoid is two(2) different users sharing work via the same process!!! If two different users are using the same terminal, shut them down! I must shut this "cheating" process down!!!! Imagine, my students can only learn by doing work, not from copying others efforts.

Thanks again!!!
# 7  
Old 04-16-2009
Thank you everyone for your help! I got an answer in the form of a script at:
When using ssh: limit the number of users, that can log on, per IP address -rate - Page 2 - LinuxQuestions.org
It works perfectly. I thought it might be of use to others. Maybe not.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Linux

May you explain step by step where and how I will add pseudo code

Thank all of you. May you explain step by step where and how I will add pseudo code Note : I have Linux 2.6.24-26-server on x86_64 dears kindly help me (3 Replies)
Discussion started by: nonowa
3 Replies

2. Programming

Change Pseudo Code to C Program (print and fork)

I am very new at programming and this is probably an easy question, but I am desperate. I need to change this low level code into a C program that I can run so I can print out every "A" that appears with the fork() command. You help is greatly appreciated. PRINT A p=fork() if( p == 0) {... (0 Replies)
Discussion started by: tpommm
0 Replies

3. UNIX for Dummies Questions & Answers

Pseudo Terminal

How can i view what my colleague is doing in the terminal pts/1 while i have logged into terminal pts/2 ?? Both have remotely logged in via ssh. (4 Replies)
Discussion started by: proactiveaditya
4 Replies

4. UNIX for Advanced & Expert Users

Need pseudo connectivity

Hi All, I have putty on my system (Vista). I need some server details to login via internet for my personnel practice. Can any body help me out. In case this not feasible, just let me know any other way to work with UNIX terminal on Windows Vista itself. Please help me since i am desparately... (3 Replies)
Discussion started by: vikas_kesarwani
3 Replies

5. Shell Programming and Scripting

how to write pseudo code

hi, I'm doing some project, I selected shell script as programming language, I need to write pseudo code for my script, can anyone tell me how to write that.......?:) (1 Reply)
Discussion started by: hanaveenkumar
1 Replies

6. Shell Programming and Scripting

Pseudo code or description

hi I need a Pseudo code or a description of what a program is saying from this spec and code: Just so i can understand how this solution was achieved, thanks here is the spec: Specifications are as follows:- The books records are stored in one csv file and the layout and the contents... (7 Replies)
Discussion started by: ferrycorsten73
7 Replies

7. Solaris

what is /devices/pseudo/ ??

Hi all, what does this mean? if then <something> fi here is what i know.. it checks if the specified argument no($devid) in some function call is made into a block device and then proceeds with the execution of the loop. However am not understand what lofi@0:means? also is there... (3 Replies)
Discussion started by: wrapster
3 Replies

8. Solaris

pseudo: [ID 129642 kern.info] pseudo-device: vol0

Hi I have a system that gave me some messages on bootup that I was not used to seeing: pseudo: pseudo-device: vol0 genunix: vol0 is /pseudo/vol@0 these came with these: Feb 13 17:42:17 system1 eri: SUNW,eri0 : 100 Mbps full duplex link up Feb 13 17:42:21 system1sendmail: My unqualified... (0 Replies)
Discussion started by: mndavies
0 Replies

9. SCO

pseudo driver

explain differences between a device driver & a pseudo driver...???? thanks in advance (1 Reply)
Discussion started by: areef4u
1 Replies

10. Programming

Pseudo Terminals

I need to spawn a number of foreground process by reading a configuration file. Each process needs some form of I/O. Hence I need to run it on different terminals. How it can be done programatically , i.e. , my module needs to find which terminal is not in use, then open it, execute the process... (2 Replies)
Discussion started by: S.P.Prasad
2 Replies
Login or Register to Ask a Question