Skip to content

Perl Scripting for IT Security - download pdf or read online

ISBN-10: 1597491128

ISBN-13: 9781597491129

Show description

Read Online or Download Perl Scripting for IT Security PDF

Similar programming: programming languages books

Download e-book for kindle: Objektorientiertes Programmieren: Mit Beispielen und Übungen by Ute Claussen

"OOP" ist "in". Die modernste artwork, Programme zu schreiben, wird in diesem didaktisch vorz}glich aufbereiteten Lehrbuch vermittelt. Das Schwergewicht der Darstellung liegt auf der methodischen Darstellung der Gurndlagen und Konzepte pbjektorientierten Programmierens: Objekte, Klassen, Vererbung,Instanzen, Botschaften und abstrakte Datentypen werden verdeutlicht.

Additional info for Perl Scripting for IT Security

Sample text

The highlighted class, MSNdis_CurrentPacketFilter, for example, provides us with access to the current filters for the NIC (note that a reference link is embedded in the comments at the beginning of the script). pl script appears as follows: #! pl # # Copyright 2007 H. “\n”; $locatorObj->{Security_}->{impersonationlevel} = 3; my $serverObj = $locatorObj->ConnectServer($server,‘root\wmi’,“”,“”) || die “Error connecting to \\root\\wmi namespace on $server: “. “\n”; foreach my $ndis (in $serverObj->InstancesOf(“MSNdis_CurrentPacketFilter”) ) { if ($ndis->{Active}) { my $wan = “WAN Miniport”; next if ($ndis->{InstanceName} =~ m/^$wan/i); my $instance = (split(/-/,$ndis->{InstanceName}) )[0]; $instance =~ s/\s$//; # $nic{$instance} = 1; my @gpf = (); foreach my $f (keys %filters) { push(@gpf,$f) if ($ndis->{NdisCurrentPacketFilter} & $filters{$f}); } $nic{$instance}{filter} = join(‘,’,@gpf); } } 25 26 Part I • Perl Scripting and Live Response foreach (keys %nic) { print “$_\n”; my @filt = split(/,/,$nic{$_}{filter}); foreach my $f (@filt) { ($f eq “NDIS_PACKET_TYPE_PROMISCUOUS”) ?

For example, to get the system name, you might use the GetComputerNameA2 API function, and to get the name of the logged on user, you might use the GetUserNameA3 API function. Retrieving information from a Windows system via the API can be useful, but it can also lead to problems. Many times, APIs will change between versions of Windows (such as between Windows 2000 and XP), or they may even change when a Service Pack is installed or updated. As such, direct use of the Windows API to collect some information from systems should be thoroughly tested before being deployed on a widespread basis.

Pl Perl script. One is the use of the Getopt::Long module in order to allow for the use of command-line arguments in the script. This allows us to program different functionality into a single script, rather than writing separate scripts to do slightly different things. For example, if you look at the content of the _syntax() function from the script, you’ll see that you can use command-line arguments and switches to modify the output of the script and show different bits of information. This way, we can have one script with a complete set of functionality, rather than half a dozen different scripts.

Download PDF sample

Perl Scripting for IT Security


by Jeff
4.4

Rated 4.80 of 5 – based on 47 votes