Before I start a series on remote exploitation, I think we should learn the basics of Perl. Perl, Ruby, C, C++, Cython and more are languages that some penetration testers just need to learn. Perl is a great language for multiple things, sadly, like many other scripting languages, it is limited by the environment in which it is designed to work in.
In this tutorial, we'll be going over the basics of Perl.
As you may know, most Perl scripts start with the hello world:
#!/usr/bin/perl
print "Hello world!\n";
You may see lots of scripts start with the "!#/usr/bin/perl", this is known as the 'Shebang'.
You may see the line ends with a semicolon. In Perl, almost every line ends with a semicolon although some of them don't need to, but usually, you're better of putting the semicolon anyways.
Variables
Perl, obviously has a lot of data structures, the most common of them being the scalar variable. Variables in Perl are always addressed with a $.
Example:
#!/usr/bin/perl
print "Hello! My name is Ax0n. What is yours?\n";
$name =
chomp $name;
print "$name is a pretty rad name, bro.\n";
In that script, we didn't just use a variable, we used a couple of things. Let's walk through them. We have the shebang in the first line, as usual. On the second line we give out a proper introduction. The next line defines our variable '$name' and awaits input from
That is all for today!
Comments
No Comments Exist
Be the first, drop a comment!