The first line is often the one that throws people. OK so we are going to cat something into /tmp/root.pm (a .pm file is a Perl Module file) but then this strange << EOF is at the end of the line?
Well the << EOF acts as a “marker” to state that you are about to begin a multi-line cat to the root.pm file. As soon as you hit return on the keyboard after than first line, you’ll be presented with a > which effectively says, “OK I’m ready for you to give me the stuff you want me to add to this file, line-by line”
So we add the first line, which in this example is: package root;
We hit return and we move to the next line, which in this case is: use strict;
hit return again….this time we want to have a space in the file, so hit return again and move down an extra line.
Finally type in the final line which is: system(“/bin/sh”); and hit return
Our file is complete, so we finish off by typing EOF, which tells linux to cease the cat command and the file is done. That’s all there is to it 🙂
quick note regarding this particular example: you might need to create the file first of all, using:
<strong>root@kali:~#</strong> touch /tmp/root.pm
you might also need to give it write and execute privileges using chmod.
“There are risks and costs to a program of action—but they are far less than the long range cost of comfortable inaction.”
- John F. Kennedy