Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Disable Guest Account Subnet Sweep

by OzzyOsbourne (Chaplain)
on Mar 07, 2002 at 20:28 UTC ( #150116=sourcecode: print w/replies, xml ) Need Help??
Category: NT Admin
Author/Contact Info OzzyOsbourne
Description: Disables guest accounts on all machines on a subnet
# Disables the guest account on every machine on a subnet

use strict;
use Win32::AdminMisc;
use Win32::NetAdmin qw(LocalGroupGetMembers LocalGroupIsMember UsersEx
+ist);

use Net::Ping;
my (%Hash, @accounts,$p);
my $subnet='117';
for(113..113){
  chomp;
  my $ip="10.1.$subnet.$_";
  $p = Net::Ping->new("icmp");
  if ($p->ping("$ip")){
      my $Domain="\\\\$ip";
      my $User='Guest';
      if (UsersExist($Domain, $User)){
        Win32::AdminMisc::UserGetMiscAttributes( $Domain, $User, \%Has
+h );
        my $Disable=$Hash{USER_FLAGS}&UF_ACCOUNTDISABLE;
        if ($Disable==2){
          print "$ip: $User Disabled\t";
        }
        elsif ($Disable==0){
          $Hash{USER_FLAGS} = $Hash{USER_FLAGS}|UF_ACCOUNTDISABLE;
          Win32::AdminMisc::UserSetMiscAttributes( $Domain, $User, USE
+R_FLAGS, $Hash{USER_FLAGS} );
          print "$ip: $User ENABLED\t";
        }
        LocalGroupGetMembers($ip,"Administrators",\@accounts);
        if (@accounts&&LocalGroupIsMember($ip,"Administrators", "Guest
+")){
      print "Guest in Admin Group";
        }
      }else{
        print "$ip: $User does not exist or Access Denied";
      }

  }else{
      print "$ip: not available";
  }
  $p->close();
  print "\n";
  print OUT "\n"
}
Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: sourcecode [id://150116]
help
Chatterbox?
[Corion]: ... don't support server-side precompilation (which means the client has to compile all templates to Javascript themselves), or are giant frameworks that expect to do everything (which is not what I want)
[Corion]: I feel that there is a talk somewhere in there, either about the structure and parts, or how I used several parts to get a complete whole.
[Corion]: Maybe I can still find something that is compatible with handlebars.js (which has JS precompilation) but allows for two-way data binding (which is great for the UI)
[Corion]: Two-way data binding means that if you change something in a text box, the corresponding variable in your Javascript gets updated immediately as well, and if you then change the variable, the corresponding text box also gets updated
[Corion]: That is a horrible approach that was also taken by Access, but if you have hooks that prevent automatic saving to the database, it is incredibly handy

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (3)
As of 2017-03-30 07:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (355 votes). Check out past polls.