English 中文(简体)
利用旁听器反射镜进行校外检查
原标题:Using bytebuddy reflection to bypass file string check

There s this problem in Codewars https://www.codewars.com/kata/58a3fa665973c2a6e80000c4/train/java

我们必须把一个非常大的根植起来。 当然,我们大家都会想大脑。 sqrt - 但挑战本身拒绝接受这些词语:反思、大专、大dec、花时间、过程、文字。 (P/ss Yousst use unicode or).

最新消息:还封锁了“新信息”,“invoke”

在为这项任务做些什么时,我完全没有un,因此,我目前试图绕过这项任务,使用 by(但幸运的是,他们没有拒绝这样做)。

import net.bytebuddy.ByteBuddy;
import net.bytebuddy.agent.ByteBuddyAgent;
import net.bytebuddy.dynamic.DynamicType.Loaded;
import net.bytebuddy.dynamic.loading.ClassReloadingStrategy;
import net.bytebuddy.implementation.FixedValue;
import net.bytebuddy.matcher.ElementMatchers;

public class Kata { 
  public static String integerSquareRoot(String n) {
    ByteBuddyAgent.install();
        Loaded<Kata> dynamicType = new ByteBuddy().redefine(Kata.class).method(ElementMatchers.named("text"))
                .intercept(FixedValue.value(new java.math.BigInteger(n).sqrt().toString())).make()
                .load(Thread.currentThread().getContextClassLoader(), ClassReloadingStrategy.fromInstalledAgent());
    return Kata.text("forsenCD");
    }
  
  public static String text(String n){
    return n;
  }
}

这里要做的是强行使用text(<>>>>>/em>法,以收回拦截中的东西。

这一解决办法本身解决了这项任务,但正如你能够看到的那样,在拦截中,它仍然有“移民分类”。

I m noob at bytebuddy, so anyone have a way to solve this using bytebuddy reflection, that maybe can change the BigInteger in the intercept with a string (so I can use character array) to solve this.

Or maybe even using Nashorn engine to get to some JavaScript API.

请自由表达您的想法。

问题回答

当然,由于我们走过任何路,这应当是:

  1. Instead of calling the BigInteger constructor directly, call it using reflection: Class.forName("java.math.BigInteger").newInstance(n) *
  2. Now take that String literal, and apply an encoding of your choice. Base64 should do. Save the encoded string as a constant.
  3. At runtime, decode the String and pass it to Class.forName.

* <新编码> 是否有弹性选择? 如果没有,则使用<条码>植被扰动器,将其称作正确。





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...