linux poison RSS
linux poison Email
0

White Paper - Zero Day Exploits

"Zero Day Exploits"
A zero day exploit is an attack that was previously unknown to the target or security experts in general.

For several years, most news articles about a computer, network, or Internet compromise has mentioned the phrase "zero day exploit" or "zero day attack," but rarely do these articles define what this is.

Many believe that the term refers to attacks that were just released into the wild or developed by hackers in the current calendar day. This is generally not the case. The "zero day" component of the term refers to the lack of prior knowledge about the attack. That the victim has zero day's notice of an attack. The main feature of a zero day attack is that since it is an unknown attack, there are no specific defenses or filters for it. Thus, a wide number of targets are vulnerable to the exploit.

Download your free copy of "Zero Day Exploits" - here


Read more
0

Perl Script: Creating Class (package) Inheritance

Inheritance provides a powerful and natural mechanism for organizing and structuring your code.In object-oriented programming, inheritance is a way to form new classes using classes that have already been defined. The new classes, known as derived classes, take over (or inherit) attributes and behavior of the pre-existing classes, which are referred to as base classes (or ancestor classes). It is intended to help reuse existing code with little or no modification.

In Perl, Inheritance is accomplished by placing the names of parent classes into a special array called @ISA in your child class.

Below is simple Perl script which demonstrate the usage of Package Inheritance:


Source: Inheritance.pl
#!/usr/bin/perl

package mother;
  sub a {
    print "Inside the package mother \n";
  }
Read more
0

Perl Script - Reading / Writing Binary files

A binary file is a computer file that is not a text file; it may contain any type of data, encoded in binary form for computer storage and processing purposes.

If you want to open a file and read its content in binary mode, you should use the following functions:
 * open() to open the file to a file handle.
 * binmode() to set the file handle to binary mode.
 * read() to read data from the file handle.
 * close() to close the file handle.

Below sample Perl script demonstrate the usage of reading / writing the binary files using binary mode.

Source: binary.pl
#!/usr/bin/perl

$buffer = "";
$infile = "binary.dat";
$outfile = "binary_copy.dat";
Read more
0

Perl Script: Reading the list of files from Directory

There are couple of ways to get the list of files from withing directory.

#1 - Using the built-in Perl glob function
#2 - Using opendir, readdir and closedir

Below Perl script demonstrate the usage of above methods to get the list of files, feel free to copy and use this code.

Source: read_dir.pl
#!/usr/bin/perl

# Method #1 - using the built-in Perl glob function
@filelist = <*>;
foreach $filename (@filelist) {
  print $filename;
} 

# Method #2 - Using opendir, readdir and closedir

$dir = "/home/poison";
opendir(DIR, $dir) || die "Problem reading the dir. \n";

# Read the entire file names into a array
#@filelist = readdir(DIR);

while ($filename = readdir(DIR)) {
  print $filename , "\n";
}
closedir(DIR);



Read more
0

Perl Script: Difference between local and my variables

'my' creates a new variable (but only within the scope it exists in), 'local' temporarily amends the value of a variable

ie, 'local' temporarily changes the value of the variable (or global variable), but only within the scope it exists in.

So with local you basically suspend the use of that global variable, and use a "local value" to work with it. So local creates a temporary scope for a temporary variable.

Below script explains the concepts of local Vs my variables



Source : cat local_my.pl
#!/usr/bin/perl

print " ----- local example ------ \n";
$a = 10;
{
  local $a = 20;
  print "Inside block \$a    : $a \n";
  print "Inside block: \$::a : $::a \n";
}

print "Outside block \$a   : $a \n";
print "Outside block: \$::a: $::a \n";
Read more
Related Posts with Thumbnails