Subscribe to Blog via Email

Categories

Archives

Penetration Testing

Meterpreter File System Commands Cheatsheet

Hey Friends!

Did you know that meterpreter is known as Hacker’s Swiss Army Knife!!

Well! Now you do.

Meterpreter, a highly developed payload that can be extended dynamically, is known to be Hacker’s Swiss Army Knife. It uses a reflective DLL injection technique to further compromise the target after the attack. Meterpreter is known to influence the functionality of the Metasploit framework. It can help in doing a lot many things. Some of these include covering tracks after the attack, accessing the operating system, and dumping hashes.

This article discusses meterpreter’s Stdapi File System Commands. There are 21 commands including cat, cd, pwd, and checksum. Figure 1 summarises them:

Let’s start discussing them.

cat

It is the very first command in the group of Stdapi File System Commands. It reads the contents of a file to the screen. In other words, cat displays a file’s contents. cat command in meterpreter is same as cat command used in Unix/Linux systems. 

The syntax of cat in meterpreter is as follows:

cat filename

cd and pwd

Though cd and pwd commands are two separate commands, they are usually used together. cd stands for change directory and pwd stands for print working directory. You use pwd command to check the directory you are working in. You can change this directory using the cd command. By default, the current working directory is the one where the connection was established.

The syntaxes of pwd and cd commands in meterpreter are as follows:

pwd

cd <path of the folder to change to>

checksum

This command retrieves the checksum of a file. The syntax of the checksum command is as follows:

checksum [md5/sha1] file1 file2 file 3...

cp

This command copies the content of the old file to the new file. The syntax of the cp command is as follows:

cp <oldfile> < newfile>

 

dir

This command lists files. It is an alias for the ls command. It provides crucial details related to any file or directories such as File Permissions, Size of File, Last modified date and file Name & Type. The syntax of the dir command is as follows:

dir

 

download

This command downloads remote files and directories from a remote location to the local machine. The syntax of download command is as follows:

download [options] src1 src 2 src3... destination

edit

This command edits a file. The syntax of edit command is as follows:

edit <file name>

When you press the Enter key, the screen displayed is as shown in the below image:

After editing the file, type:to save the changes and exit, as shown in the below image

getlwd

This command prints the working directory on the local machine that is, in our case it is Kali Linux. The syntax of the getlwd command is as follows:

getlwd

 

getwd

This command prints the working directory. The syntax of the getwd command is as follows:

getwd

lcd

This command changes the working directory of the local machine that is, in our case it is Kali Linux. The syntax of lcd is as follows:

lcd

You can see that local working directory changes to /root/Desktop

lls

This command lists files on the local machine that is, in our case it is Kali Linux. The syntax of lls command is as follows:

lls

lpwd

This command prints the working directory on the local machine that is, in our case it is Kali Linux. It is the same as the getlwd command. The syntax of the lpwd command is as follows:

lpwd

ls

This command lists files. The syntax of the ls command is as follows:

ls

 

mkdir

This command makes directory. The syntax of the mkdir command is as follows:

mkdir dir1 dir2 dir3...

 

mv

This command moves a file from source to destination and it can also be used to rename the file as shown.  The syntax of the mv command is as follows:

mv oldfile newfile

You can see the moved contents using cat command.

pwd

This command prints the working directory. The syntax of the pwd command is as follows:

pwd

rm

This command deletes the specified file. The syntax of the rm file is as follows:

rm file1 [file2...]

You can see the list of files before and after using rm command.

rmdir

This command removes the directory. The syntax of the rmdir command is as follows:

rmdir dir1 dir 2 dir 3...

search

This command search for files. The syntax of the search command is as follows:

search -f *.doc

show_mount

This command list all mount points/logical drives. The syntax of the show_mount command is as follows:

show_mount

upload

This command uploads a file or directory. The syntax of the upload command is as follows:

upload [options] src1 src2 src3... destination

You can see the uploaded file, as shown in the below image:

Author: Deepti Sharma is an information security enthusiast and a technical content writer. Contact Here

2 thoughts on “Meterpreter File System Commands Cheatsheet

Comments are closed.