Record once Arthas use

Foreword

During the epidemic, first of all to refuel Wuhan, China! ! !

Work from home, every day is 007, felt he had upgraded to a panda agents, tired heart, body tired! ! !

Today, finally have time to take a break, and then record it simple to use Arthas during the home office.

Download and install

Download the installation will not say more. Directly attached to the official website tutorial.

Download: curl -O alibaba.github.io/arthas/arth...

启动: java -jar arthas-boot.jar

Here it is important to note: You must use the same user and the target process, or start is unsuccessful.

Background problem

I am just on the line the day before yesterday a task. Because a product wrong hands, misuse of online data, delete the data for help.

It's really Nima pit ah, I obviously pit.

Fortunately, there are prescient, no time to do the task will be more or less time to write a few backdoor tool ( not to delete the library running, but these really back door emergency use in specific situations,求人不如求己 ). But this backdoor also transform the look for the job most of the night and find people to help you on the line, but it does not have permission. This time Arthas remembered this tool can heat load.

Focus here

  • jad to decompile the code

jad --source-only com.xxx.xxx.service.aggregate.AggregateNoRoomService > /tmp/AggregateNoRoomService.java复制代码
public AggregateNoRoom getAggregateNoRoom(String agentHotelId) {
    List<AggregateNoRoom> aggregateNoRooms = aggregateNoRoomDao.selectList(agentId);
    if (CollectionUtils.isEmpty(aggregateNoRooms)) {
      return null;
    }
    //新增加的逻辑
    for (AggregateNoRoom room : aggregateNoRooms) {
      aggregateNoRoomDao.delete(room.getId())
    }
    return aggregateNoRooms.get(0);
}复制代码

Follow-up also updates other use Arthas, like a small partner can focus on my public number.

Arthas it is still very strong, we can help troubleshoot line issues, the environment may allow the use of the recommendations, will bring a lot of convenience, here too explained.

to sum up

But here I still emphasize that caution is best, after all, do not take the regular flow back pan. (Doing very content scapegoat, and the product or products little brother little sister next time you will go directly to help me fix point data chanting, directly bypassing your leadership or higher.

That I really do not have black product here, come to hurt each other, right

Time to witness the miracle, the data is cleaned out, did not seek re-ops give you permission to deploy the program, I did not give you a call and say tl provisional approval to a script. Too cool.

Execute backdoor

This is when you can use jad command, decompile about this class, see if it is truly successful update.

Return result: redefine success, size: 1

redefine /tmp/AggregateNoRoomService.class

  • redefine hot update code

Return result: classLoaderHash 1b36fa2

sc -d * AggregateNoRoomService | grep classLoaderHash

  • Find sc loaded AggregateNoRoomService ClassLoader of

Normally should use Arthas the mc command to rebuild after the modified file. But I still did not compile successfully on the server, after the cause of the error in the study.

But here explained, simple program directly javac xxx x.java on it, but my class which is also dependent on the type of the other, so I use maven compiled directly across Java project, but then this new class file copy and then upload it to the server.

  • This class will be re-compiled into class files

  • vim modify the anti-compiled code

There are confidentiality agreements limit, the package has a code path, small partners directly look at the process it.

  • Writing is not easy, please indicate the source, like a small number of partners can focus the public like to see more articles.
  • Contact: [email protected]
  • QQ:95472323
  • Micro letter: ffj2000


Guess you like

Origin juejin.im/post/5e593a41f265da574b7915e7