zoukankan      html  css  js  c++  java
  • rex 怎么检查远程运行命令的退出值?

    怎么检查远程运行命令的退出值?
    
    Rex 会把远程运行的 run 或者 shell_block 语句的退出值存入 $? 变量。
    
    task "task2", group=>"myservers", sub {
      my $output = run "df -h";
      say '----------------------';
      say $?;
      say '----------------------';
      say $output;
    };
    [root@node01 Rex]# rex task2
    [2017-04-30 14:09:10] INFO - Running task task2 on 192.168.137.3
    ----------------------
    0
    ----------------------
    Filesystem      Size  Used Avail Use% Mounted on
    /dev/sda3        19G   11G  7.1G  60% /
    tmpfs           497M     0  497M   0% /dev/shm
    /dev/sda1       194M   29M  155M  16% /boot
    [2017-04-30 14:09:22] INFO - All tasks successful on all hosts
    
    
    
    
    
    task "task2", group=>"myservers", sub {
      my $output = run "ld";
      say '----------------------';
      say $?;
      say '----------------------';
      say $output;
    };
    [root@node01 Rex]# rex task2
    [2017-04-30 14:09:55] INFO - Running task task2 on 192.168.137.3
    ----------------------
    1
    ----------------------
    
    
    
    

  • 相关阅读:
    DNS欺骗&嗅探监听
    linux下的ARP攻击(kali)
    隐匿攻击
    跨边界传输之反弹shell
    跨边界传输之内网代理
    跨边界传输之端口转发
    权限维持
    内网提权-服务篇
    内网提权-系统篇
    Laxcus大数据管理系统2.0(14)- 后记
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13349740.html
Copyright © 2011-2022 走看看