Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19
O(x) logic help
Results 1 to 5 of 5

Thread: O(x) logic help

  1. #1

    O(x) logic help

    Having a little problem here with a perl script. The idea is that it (with the help of find) will search out suids and check it against a list of suids that are allright to have (which is, of course, created by the admin). Here the sript so far:

    Code:
    if(@ARGV[1]) { die "You cannot use more than one switch.\n"; } 
    
    if(@ARGV[0] eq "-h" || NULL ) { 
     * * *print "Usage: suidcheck -[achu]\n"; 
     * * *print "----------------\n";
     * * *print "-a\tAutomaticaly fix suid files\n";
     * * *print "-c\tPrint out the config file\n";
     * * *print "-h\tYour looking at it!\n";
     * * *exit; * * *
    } 
    
    if(@ARGV[0] eq "-c") { 
     * * *config();
     * * *exit;
    }
    
    if(@ARGV[0] eq "-a") {
     * * *check();
     * * *exit;
    }
    
    sub config {
     * * *print "\nHere is your current registered suids:\n";
     * * *open(FILE, "/etc/suidck.config") || die "cannot find file!";
     * * *while(<FILE>) {
     * * * * * *print $_;
     * * *}
     * * *close(FILE);
     * * *exit;
    }
    
    sub check { 
     * * *open(FILE, "/etc/suidck.config") || die "cannot find /etc/suidck.config";
     * * *# Open the list of suids that are fine to have 
     * * *@ok_suids = <FILE>;
     * * *sort(@ok_suids);
     * * *close(FILE);
     * * *system "find / -type f -perm +6000 > /tmp/suid";
     * * *# Open the file of suids on the system
     * * *open(FILE, "/tmp/suid") || die "cannot open /tmp/suid";
     * * *@suid_list = <FILE>;
     * * *sort(@suid_list);
     * * *close(FILE);
     * * *# Remove the file
     * * *system "rm -rf /tmp/suid" || die "cannot remove /tmp/suid";
    
     * * * # Can't find a good O(x) logic for here
     * * * # Needing to check suid_list against ok_suids
     * * * # and report back any suids showing in suid_list
     * * * # that isn't in ok_suids
    
    }

  2. #2

    Re: O(x) logic help

    Oops, I forgot the code tags :P ...

  3. #3

    Re: O(x) logic help

    No other perl h4x0rz?

  4. #4
    Moderator
    Advisor
    redhead's Avatar
    Join Date
    Jun 2001
    Location
    Copenhagen, Denmark
    Posts
    811

    Re: O(x) logic help

    Since the OK_SUID list is smaller than the SUID_LIST, you would want the innerloop to say if SUID_LIST[counter] is not in OK_SUID then change to an OK_SUID or report the missing UID, else the runtime of the innermost loop would bee too long and in the run with every itteration would be the time hog.

    (sorry bout the missing perl notation, but I'm not a hax0r in perl)

  5. #5

    Re: O(x) logic help

    Yes, but here is the thing. If the suid is not an OK_SUID then it needs to be checked against the OK_SUID list afterwards. Is there any way to dit it without hogging up mem?

Similar Threads

  1. Man, I love that finnish logic
    By in forum General Chat
    Replies: 11
    Last Post: 03-15-2002, 02:58 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •