CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Scripting Help Needed...

 



TeraR
New User

Jul 13, 2013, 9:45 AM

Post #1 of 7 (643 views)
Scripting Help Needed... Can't Post

Hello everyone, I am new to the forum community and need help with some scripts. First off let me put that this is “NOT” a homework assignment as I have been given this information where I work (IUPUI-UITS) and need help on this since I have no experience in this area. The only reason I am turning to forum posting is the person that ran the system is no longer available and now it is on me to run this so I am trying to find out whatever information I can. I just want to see what people may suggest about the code posted and good sites that may relate to what I am asking.

I have attached what I have been given so far and these are scripts that have been passed on to me. To tell the truth I have never really worked with scripts and have no clue how these even work (so any information or help that is dumbed down would be beneficial). The person that passed this on to me is no longer is available to be reached and they did not provide any documentation on this information.

I know the scripts are supposed to create new users to be used with mysql and phpmyadmin on a server. My questions are how do these even work and what do they do? Also if anyone has suggestions on how to make these more effective and secure feel free to try and help out or point me in the right direction. Another thing that I was wondering with these is how would I go about making changes to allow tracking of the accounts created and to create a script to remove all files associated with a specific user and have it stored in an archive. Thanks everyone and I appreciate you help.


(This post was edited by TeraR on Jul 13, 2013, 9:46 AM)
Attachments: Scripts.zip (4.10 KB)


FishMonger
Veteran / Moderator

Jul 13, 2013, 12:02 PM

Post #2 of 7 (631 views)
Re: [TeraR] Scripting Help Needed... [In reply to] Can't Post

Those scripts are very poorly written. I'm pretty curtain they were written by a student for a homework assignment. I can not believe that an IT admin at "University Information Technology Services" would write and use such code in a production environment.

Based on your other thread where you're offering to pay someone to "get this task completed very soon (less than 1 week)", I can only assume that you are a student at UTIS and this is your homework assignment. If that's not the case, then you need to tell the people that assigned this task to you that you will need more time to learn how to program.


FishMonger
Veteran / Moderator

Jul 13, 2013, 12:07 PM

Post #3 of 7 (630 views)
Re: [TeraR] Scripting Help Needed... [In reply to] Can't Post

Here are s few resources.

Beginner books - http://learn.perl.org/books/
Perl Programming Documentation - http://perldoc.perl.org/
Perl Beginners' Site - http://perl-begin.org/


TeraR
New User

Jul 13, 2013, 12:36 PM

Post #4 of 7 (628 views)
Re: [FishMonger] Scripting Help Needed... [In reply to] Can't Post

Thanks for the reply. It is a sad fact but that is what they are using to create users for a few of their classes on the campus that use mysql and phpmyadmin. I was assigned the task to revise these even though they know that I have no previous experience with this... Well I will look into those links and hopefully get somewhere on this. Also the reason I was wanting to pay someone is that I do not want to get fired over this ordeal if I cannot get what they want done by the end of the month (talked them into giving me another week : /). As with the state law here they can fire someone for anything... Thanks again.


FishMonger
Veteran / Moderator

Jul 13, 2013, 12:49 PM

Post #5 of 7 (605 views)
Re: [TeraR] Scripting Help Needed... [In reply to] Can't Post

What programming experience do you have?

Are the scripts doing what they expect?

Did they provide you with a clear outline of what they want changed/added?

If you post specific questions on the parts you're having trouble with, I will see what I can do to help.

To be honest, the best thing to do would be to dump those scripts and start over.

EDIT:
You will need to post sample lines from the files they process so I can suggest better methods of parsing.


(This post was edited by FishMonger on Jul 13, 2013, 12:59 PM)


Laurent_R
Veteran / Moderator

Jul 13, 2013, 2:42 PM

Post #6 of 7 (593 views)
Re: [FishMonger] Scripting Help Needed... [In reply to] Can't Post

I completely agree with Fishmongere that these scripts are very poorly written. I can't believe an IT professional would write such garbage.

I think the worst case (at least I had never seen something like that before) is this undo_script.pl script:


Code
#!/usr/bin/perl 

system("rm -r /home/student1 /home/student2 /home/instructor1 /home/instructor2");
system("rm -r /var/www/student1");
system("rm -r /var/www/student2");
system("rm -r /var/www/instructor1");
system("rm -r /var/www/instructor2");

system("groupdel instructorsgroup");
system("groupdel studentsgroup");

system("userdel instructor1");
system("userdel instructor2");
system("userdel student1");
system("userdel student2");


This is just pathetically silly.

It is supposed to be a Perl script and there isn't even one single Perl command, just a list of system commands with shell commands. Why is it not done in a shell script?

I agree with Fishmonger, these scripts should most probably be completely rewritten from scratch.

One last additional point: it seems, from what you are saying, that you have been asked to rewrite/improve/refactor these scripts whereas you are not a developper (or at least not a Perl developper). I am a bit surprised (which is not to say that I challenge in any respect what you are saying). A university usually has a huge mass of talented individuals with knowledge in dozens of different technologies. And Perl might not be the dominant language today, but it is still probably among the top 5 or at least top 10 languages of today. I am puzzled that your university does not have the necessary competencies. Can you please give me the name of that university, I want to make sure that my children will not go to such a rotten place (this is not just rhetorical discussion, my son will actually be completing next year his IT master cursus, I really want him to go in a real place).


FishMonger
Veteran / Moderator

Jul 13, 2013, 2:50 PM

Post #7 of 7 (590 views)
Re: [Laurent_R] Scripting Help Needed... [In reply to] Can't Post


Quote
Can you please give me the name of that university


This appears to be the one in question.
http://uits.iu.edu/

You probably noticed this as well, but the "create-accts.pl" script doesn't do anything and the "script.pl" script doesn't do what it's supposed to do because 2 key vars ($i and $n) are never assigned any value.


(This post was edited by FishMonger on Jul 13, 2013, 2:57 PM)

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives