GithubHelp home page GithubHelp logo

rucko24 / instrumentacion-con-bytebuddy Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 1.13 MB

Instrumentacion con bytebuddy a constructor, basico

Home Page: https://rubn0x52.com/2020/10/06/instrumentation-with-bytebuddy-execute-premain-method/#_ejecutando

Java 100.00%
java8 junit5 bytebuddy instrumentation maven premain agentmain dynamic-attach static-attach

instrumentacion-con-bytebuddy's Introduction

Instrumentation with ByteBuddy

Here a simple example with the use of bytebuddy is done instrumentation to the constructor of a class at runtime by changing the value of a variable.

Executing the premain and agentmain method

Instrumentation-with-bytebuddy-execute-premain-method

Usuario: pran-u375177

The premain method

The agentmain method

To implement a class, as in this case, elhacker.User, this class is loaded before our agent implements.

The only way it works is that we load our agent just when it asks for the user's ID.

Instrument User class inside Program class

image

(1) The User instance is not yet instantiated, so the dialog input is displayed.

(2) Here, the user instance is created.

When the instrumentation works

Point (1)

The class to implement is not yet instantiated, and allows us to load our agent, the User class is loaded in the main main method, but without instantiating, at that time if we load our agent the instrumentation works.

instrument-user-class

When the instrumentation has not been applied

Point (2)

The User instance has been loaded to the JVM before our agent, so we cannot implement it.

no-instrumentation

And there, the instrumentation will be applied to the User class.

instrumentacion-con-bytebuddy's People

Contributors

rucko24 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.