[cs615asa] hw2 grades

Jan Schaumann jschauma at cs.stevens.edu
Sat Apr 4 17:43:39 EDT 2009


Hello,

I will send out your grades for homework #2 in a few minutes.  If you do
not receive an email with a grade from me, please contact me as soon as
possible.  When you do, *please* use your Stevens email address.  I
simply cannot keep track of whatever random hotmail, yahoo or gmail
accounts all of you may have and odds are that a mail sent to me from a
non-stevens account goes straight into a spam folder.


Before I send out your grades, I'd like to comment on the homework
submissions, even though I already did to some degree in the last class:


As some of you have noticed, the assignment "shc" requires you to write
code that, to a large degree, I already provided in the example at
http://www.cs.stevens.edu/~jschauma/615A/examples/checkhosts .

In particular, the function "check_sshd" and the code segment regarding
the ping check do provide parts of what you were supposed to write
yourself.

As rather clearly outlined on the course website as well as mentioned
explicitly again in class:

| Students are responsible for their own work. It is unethical (and in
| some cases illegal) to present as one's work the ideas, words or
| representations of another without the proper indication of the source.
| Therefore, it is the student's responsibility to give credit for any
| quotation, idea or data (such as statistical data or source code)
| borrowed from an outside source.
| 
| Failure to do so constitutes plagiarism, may imply copyright
| infringement and license violations and is viewed as cheating in this
| class.

Taking code that I wrote myself and then made available to you as an
example and submitting it as a solution for the homework assignment is,
to put it mildly, not a particularly smart move.  Not only is the code
copyrighted (explicitly so, even), and not only was it written by me (so
how could I possibly not recognize it immediately), it also does a
number of things that I have reason to believe those of you who chose to
submit it as their own work (without any commentary or acknowledgement
whatsoever) simply do not fully understand.

Therefor, if you happened to hand my own code back to me presenting it
as your work, you will not get any credit for that part.  You may
consider this is the best case scenario for you, as I'm willing to give
you credit for other parts.

==

If two (or more) of you handed in code that is either identical or near
identical, neither of you will receive any credit for that part of the
assignment.  See above re cheating.

===

The assignment very clearly stated that your code needs to work on all
three systems (NetBSD, Linux, Solaris).  Not testing it on all three
platforms is a very easy (and avoidable) way of losing points.  Part of
this assignment was for you to learn how tools on different operating
systems behave differently, and how you cannot rely on every single
feature/module/flag to be supported everywhere.

For each platform your code does not run on, you will lose one third of
the possible points.

===

Please try to avoid the use of temporary files.  Performing any kind of
I/O is highly inefficient, and you'd have to install a signal handler to
have the temporary files removed when your program exits unexpectedly.
Creating temporary files also can lend itself to a number of security
exploits (a user on the system can guess the name of the file you'll try
to create, create a symlink to some other file beforehand and your
program might be used to overwrite that file, to name but one example),
and frequently the error checking you have to do around temporary files
is just not worth the effort.

Pretty much any construct

command1 > file
command2 file

can be done without a temporary file by just using a pipe.


If you are using temporary files, make sure to remove them when your
program finishes.  Be careful not to remove any other files.  For
example, you can't just say "rm *.txt" -- if the user invokes the tool
in a directory where he has other files named "foo.txt", then you're
deleting his files as well.

Temporary files should (if at all) only be created in specific temporary
directories, never in the current working directory.

===

Any pipeline of the form

command1 | grep something | wc -l

is a Useless Use of Wc.  Use 'grep -c' instead.  If you're just counting
the output to see if it's larger than 0, use grep's exit status (see
grep's "-q" flag, too).


===

shc
---

Please note that the assignment stated:

| Each of these checks, if not passed, causes your program to generate a
| notice on stdout indicating the failure and then to move on to the next
| host.

That is, if a given host does not resolve, it's a waste of resources to
try to move on and ping it or to check port 22 on the host.  It also
takes much too long to let the connection ot port 22 on a host that's
not up time out.  This doesn't scale.

Some of the tests I did:
On drude, I disabled ssh.

$ ./shc shell.cs.stevens.edu
$ ./shc lab.cs.stevens.edu
$ ./shc does.not.exist
$ ./shc dab.cs.stevens.edu
$ ./shc drude.cs.stevens.edu
$ ./shc shell.cs.stevens.edu does.not.exist dab.cs.stevens.edu drude.cs.stevens.edu
$ cat /tmp/hosts
does.not.exist
dab.cs.stevens.edu
drude.cs.stevens.edu
shell.cs.stevens.edu
# www.yahoo.com

guinness.cs.stevens.edu # with a comment


$ ./shc -f /tmp/hosts
$ ./shc -f /tmp/hosts heineken.cs.stevens.edu
$ ./shc -f /tmp/hosts -f heineken.cs.stevens.edu

====

chipp
-----

The important thing here is that you can't just simply say "take the
first field and the last field" or "take anything after either an A or a
AAAA".  The zone file syntax is more complex.  In particular, there are
comments, the order in which records are specified is not fixed etc.
etc.

The number of items in each row is not fixed, so you can't say "if the
fourth field is A or AAAA", since it might be the second (or some other)
field.  The file provided to you does include examples.

Some of the tests I did:

./chipp /tmp/f

./chipp /tmp/f | grep ns.nic.kz
ns.nic.kz       75.126.233.106
ns.nic.kz       75.126.233.107
ns.nic.kz       75.126.233.108
ns.nic.kz       75.126.233.109
ns.nic.kz       75.126.233.110

./chipp /tmp/f | grep ns.amnic.net
ns.amnic.net    195.250.64.90
ns.amnic.net    2001:4d00::90

./chipp /tmp/f | grep aunic.aunic.net
aunic.aunic.net 203.29.5.1

./chipp /tmp/f | grep a.nic.ac       
a.nic.ac        64.251.31.177

./chipp /tmp/f | grep dns3.ad
(empty)

./chipp /tmp/f | grep ns2.dns.ws       
ns2.dns.ws      64.70.19.80

====

fbvlist
-------

Some of the tests I did:

$ time ./fbvlist > out

$ wc -l out

$ grep ^tor out

$ grep fcba5764-506a-11db-a5ae-00508d6a62df out

$ grep 40774927-f6b4-11dd-94d9-0030843d3802 out

$ grep b9077cc4-6d04-4bcb-a37a-9ceaebfdcc9e out

$ grep 5e92e8a2-5d7b-11d8-80e3-0020ed76ef5a out

$ grep 9c2460a4-f6b1-11dd-94d9-0030843d3802 out

$ grep db449245-870d-11dc-a3ec-001921ab2fa4 out


===

There will be another programming assignment, since it is clear from
this exercise that the majority of you have very little experience in
this area.  I'll give the assignment in next week's class.

-Jan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 186 bytes
Desc: not available
Url : https://lists.stevens.edu/cgi-bin/mailman/private/cs615asa/attachments/20090404/42d367e0/attachment.pgp 


More information about the Cs615asa mailing list