SCRIPT:
#!/usr/bin/perl
# Description: Upon execution of this script, it will report the User-accounts with UID bit set to Zero and
# the User-accounts with Empty passwords.
# Supported Platform: Linux OS
# Execution method: By root user
my @pass = `cat /etc/passwd`;
my @array = `cat /etc/shadow`;
foreach(@pass)
{
if ( $_ =~ m/^(\w+):\w:(\d+):\d+:/ ) {
if( $2 == '0' ) {
print "Username $1 has UID set to Zero\n" if ($1 ne root); }
}
}
foreach(@array) {
if ($_ =~ m/^(\w+):([^:]*):\d+:\d:\d+/) {
if ( length $2 == 0 ) {
print "Username $1 has Empty password\n"; }
}
}
SAMPLE EXECUTION:
# perl find_setuid.pl
Username ashok has UID set to Zero
Username raj1 has Empty password
#!/usr/bin/perl
# Description: Upon execution of this script, it will report the User-accounts with UID bit set to Zero and
# the User-accounts with Empty passwords.
# Supported Platform: Linux OS
# Execution method: By root user
my @pass = `cat /etc/passwd`;
my @array = `cat /etc/shadow`;
foreach(@pass)
{
if ( $_ =~ m/^(\w+):\w:(\d+):\d+:/ ) {
if( $2 == '0' ) {
print "Username $1 has UID set to Zero\n" if ($1 ne root); }
}
}
foreach(@array) {
if ($_ =~ m/^(\w+):([^:]*):\d+:\d:\d+/) {
if ( length $2 == 0 ) {
print "Username $1 has Empty password\n"; }
}
}
SAMPLE EXECUTION:
# perl find_setuid.pl
Username ashok has UID set to Zero
Username raj1 has Empty password
#