<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      Arthas之實例操作

      Arthas之實例操作

      1. 靜態類屬性操作

      獲取public靜態屬性

      ognl -c 7cd84586 '@com.system.framework.ArtahsDemoClassLoader@pubTestPrex'
      ognl -c 7cd84586 "@com.system.framework.ArtahsDemoClassLoader@pubfinalTestPrex"
      

      輸出各式 @Type[屬性值],內容如下

      @String[static public]
      ...
      @String[final static public]
      

      獲取private靜態屬性

      ognl -c 7cd84586 '@com.system.framework.ArtahsDemoClassLoader@privTestPrex'
      ognl -c 7cd84586 '@com.system.framework.ArtahsDemoClassLoader@privFnalTestPrex'
      
      @String[static private]
      ...
      @String[final static private]
      

      修改public靜態屬性,被final修飾,不能被修改

      // author:herbert qq:464884492 date:20220331 測試代碼想修改FINAL修飾符,結果沒有成功
      @Test
      public void testModifyFinal() throws Exception {
        Field finalField = this.getClass().getDeclaredField("privFnalTestPrex");
        finalField.setAccessible(true);
        System.out.println("==========初始值==========");
        System.out.println(finalField.get(null));
        Field modiField = Field.class.getDeclaredField("modifiers");
        modiField.setAccessible(true);
        modiField.setInt(finalField, finalField.getModifiers() & ~Modifier.FINAL);
        finalField.set(null, "修改后FInal");
        System.out.println("==========修改值==========");
        System.out.println(privFnalTestPrex);
      }
      

      靜態變量賦值,不能通過=直接賦值,需要采用反射的方式設置值

      ognl '#c=@com.system.framework.ArtahsDemoClassLoader@class,#f=#c.getDeclaredField("pubTestPrex"),#f.set(#c,"modify static public ")'
      

      修改private靜態屬性,需要在反射時調用方法setAccessible,使private特殊轉化為public

      ognl '#c=@com.system.framework.ArtahsDemoClassLoader@class,#f=#c.getDeclaredField("privTestPrex"),#f.setAccessible(true),#f.set(#c,"modify static private ")'
      

      2. 靜態類方法調用

      靜態方法調用和靜態屬性一樣,格式為@class@method(args)

      無參數調用

      ognl -c 7cd84586 '@com.system.framework.ArtahsDemoClassLoader@setPublicStaticMethod()'
      ognl -c 7cd84586 '@com.system.framework.ArtahsDemoClassLoader@modfiyPrivateStaticFiled()'
      
      ...
      ======第5次輸出======
      源文件初始輸出==>static public/static private/testRefect--1/final static public/final static private
      源文件初始輸出==>static public/static private/testRefect--2/final static public/final static private
      ======第6次輸出======
      源文件初始輸出==>modify by method static public/static private/testRefect--1/final static public/final static private
      源文件初始輸出==>modify by method static public/static private/testRefect--2/final static public/final static private
      ...
      ======第11次輸出======
      源文件初始輸出==>modify by method static public/static private/testRefect--1/final static public/final static private
      源文件初始輸出==>modify by method static public/static private/testRefect--2/final static public/final static private
      ======第12次輸出======
      源文件初始輸出==>modify by method static public/modify by method static private/testRefect--1/final static public/final static private
      源文件初始輸出==>modify by method static public/modify by method static private/testRefect--2/final static public/final static private
      ...
      // author:herbert qq:464884492 date:20220331
      

      有參數調用

      ognl -c 7cd84586 '@com.system.framework.ArtahsDemoClassLoader@getPublicStaticMethod("input params")'
      ...
      ognl -c 7cd84586 '@com.system.framework.ArtahsDemoClassLoader@getStaticPrivateMethod("input params")'
      
      @String[input params <==> public static method return string]
      ...
      @String[input params <==> private static method return string]
      

      從以上的測試結果來說,靜態方法不管是public還是private都可以直接調用。

      3. 獲取非靜態類實例

      查看某個類實例,無 --limit 參數默認10個

      vmtool -c 3e2e18f2 -a getInstances --className *EncryptClass
      vmtool -c 3e2e18f2 -a getInstances --className *EncryptClass --express 'instances.length'
      vmtool -c 3e2e18f2 -a getInstances --className *EncryptClass --express 'instances[0]'
      
      @EncryptClass[][
          @EncryptClass[com.system.framework.EncryptClass@3c573d32],
          @EncryptClass[com.system.framework.EncryptClass@68390fae],
      ]
      ...
      @Integer[2]
      ...
      @EncryptClass[
          note=@String[testRefect--1],
      ]
      

      經過上邊測試發現,一個類存在多個classloader加載時,需要指定classloader。但從返回結果看,返回了所有classloader加載的實例

      4. 實例方法調用

      調用實例 getNotesetNote 方法

      vmtool -c 3e2e18f2 -a getInstances --className *EncryptClass --express '#val=instances[0],#val.getNote()'
      vmtool -c 3e2e18f2 -a getInstances --className *EncryptClass --express '#val=instances[0],#val.setNote("modify by instance"+#val.getNote())'
      
      @String[testRefect--1]
      
      ======第7次輸出======
      源文件初始輸出==>static public/static private/testRefect--1/final static public/final static private
      源文件初始輸出==>static public/static private/testRefect--2/final static public/final static private
      ======第8次輸出======
      源文件初始輸出==>static public/static private/modify by instancetestRefect--1/final static public/final static private
      源文件初始輸出==>static public/static private/testRefect--2/final static public/final static private
      
      

      從控制臺輸出結果,對比第7次和8次輸出,我們可以發現第一個loader加載的class實例已經成功修改了

      5. 實例屬性操作

      獲取或者修改第一個實例 note 屬性

      vmtool -c 3e2e18f2 -a getInstances --className *EncryptClass --express '#val=instances[1].note'
      vmtool -c 3e2e18f2 -a getInstances --className *EncryptClass --express '#val=instances[1],#val.note="modify by instance"+#val.note'
      
      @String[testRefect--2]
      ...
      ======第121次輸出======
      源文件初始輸出==>static public/static private/modify by instancetestRefect--1/final static public/final static private
      源文件初始輸出==>static public/static private/testRefect--2/final static public/final static private
      ======第122次輸出======
      源文件初始輸出==>static public/static private/modify by instancetestRefect--1/final static public/final static private
      源文件初始輸出==>static public/static private/modify by instancetestRefect--2/final static public/final static private
      

      從控制臺輸出結果,對比第121次和122次輸出,我們可以發現第二個loader加載的class實例已經成功修改了

      6. 條件操作

      返回的對象集合,可以做二次篩選投影操作,也可以帶條件查詢符合的數據

      vmtool -c 3e2e18f2 -a getInstances --className *EncryptClass --express '#val=instances'
      vmtool -c 3e2e18f2 -a getInstances --className *EncryptClass --express '#val=instances.{note}'
      vmtool -c 3e2e18f2 -a getInstances --className *EncryptClass --express '#val=instances.{#this.note}'
      vmtool -c 3e2e18f2 -a getInstances --className *EncryptClass --express '#val=instances.{? #this.note.indexOf("1")>0}.{note}'
      
      @EncryptClass[][
          @EncryptClass[com.system.framework.EncryptClass@52790e67],
          @EncryptClass[com.system.framework.EncryptClass@822cf83],
      ]
      ...
      @ArrayList[
          @String[modify by instancetestRefect--1],
          @String[modify by instancetestRefect--2],
      ]
      ...
      @ArrayList[
          @String[modify by instancetestRefect--1],
          @String[modify by instancetestRefect--2],
      ]
      ...
      @ArrayList[
          @String[modify by instancetestRefect--1],
      ]
      

      7. 總結

      歡迎感興趣的朋友關注我的訂閱號“小院不小”,或點擊下方二維碼關注。我將多年開發中遇到的難點,以及一些有意思的功能,體會都會一一發布到我的訂閱號中
      訂閱號

      posted @ 2022-03-31 09:14  _herbert  閱讀(3215)  評論(0)    收藏  舉報
      主站蜘蛛池模板: 最新国产精品拍自在线观看| 国产精品成| 国内熟妇人妻色在线三级| 亚洲AV无码国产成人久久强迫 | 亚洲人午夜精品射精日韩| 四虎影视库国产精品一区| 老湿机69福利区无码| caoporn成人免费公开| 国产精品自产在线观看一| 国产激情第一区二区三区| 在线日韩一区二区| 麻豆亚洲精品一区二区| 国产亚洲精品第一综合| 国内熟妇人妻色在线视频| 久久亚洲中文字幕不卡一二区| 亚洲av免费看一区二区| 成人乱码一区二区三区四区| 边添小泬边狠狠躁视频| 日本一区不卡高清更新二区 | 亚洲精品中文字幕一区二| 啪啪av一区二区三区| 国产亚洲精品久久77777| 亚洲综合小说另类图片五月天| 黄瓜视频在线观看| 在线中文字幕国产一区| 嗯灬啊灬把腿张开灬动态图| 乱妇乱女熟妇熟女网站| 亚洲人成网站在小说| 国产综合色一区二区三区| 东京热人妻无码一区二区av| 国产精品中文字幕自拍| 天天爽夜夜爱| 亚洲AV成人无码精品电影在线| 精品人伦一区二区三区蜜桃免费| 精品国产粉嫩一区二区三区| 精品日韩人妻中文字幕| 久久国产精品免费一区| 在线看片免费人成视频久网| 中文午夜乱理片无码| 午夜欧美精品久久久久久久| 亚洲国产码专区在线观看|