mirror of
https://github.com/elicpeter/nyx.git
synced 2026-06-09 19:45:13 +02:00
Dynamic (#77)
This commit is contained in:
parent
55247b7fcd
commit
991c84a1eb
1464 changed files with 225448 additions and 1985 deletions
|
|
@ -0,0 +1,32 @@
|
|||
// Benign control for recursively constructed Java dependencies.
|
||||
public class Benign {
|
||||
public static class ShellRunner {
|
||||
public String run(String command) {
|
||||
return command.replace("NYX_PWN", "");
|
||||
}
|
||||
}
|
||||
|
||||
public static class UserRepository {
|
||||
private final ShellRunner shellRunner;
|
||||
|
||||
public UserRepository(ShellRunner shellRunner) {
|
||||
this.shellRunner = shellRunner;
|
||||
}
|
||||
|
||||
public String find(String input) {
|
||||
return shellRunner.run(input);
|
||||
}
|
||||
}
|
||||
|
||||
public static class UserService {
|
||||
private final UserRepository userRepository;
|
||||
|
||||
public UserService(UserRepository userRepository) {
|
||||
this.userRepository = userRepository;
|
||||
}
|
||||
|
||||
public String run(String input) {
|
||||
return userRepository.find(input);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
// Class-method fixture with recursively constructed Java dependencies.
|
||||
import java.io.InputStream;
|
||||
|
||||
public class Vuln {
|
||||
public static class ShellRunner {
|
||||
public String run(String command) throws Exception {
|
||||
Process p = new ProcessBuilder("sh", "-c", "true " + command)
|
||||
.redirectErrorStream(true)
|
||||
.start();
|
||||
try (InputStream in = p.getInputStream()) {
|
||||
return new String(in.readAllBytes());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class UserRepository {
|
||||
private final ShellRunner shellRunner;
|
||||
|
||||
public UserRepository(ShellRunner shellRunner) {
|
||||
this.shellRunner = shellRunner;
|
||||
}
|
||||
|
||||
public String find(String input) throws Exception {
|
||||
return shellRunner.run(input);
|
||||
}
|
||||
}
|
||||
|
||||
public static class UserService {
|
||||
private final UserRepository userRepository;
|
||||
|
||||
public UserService(UserRepository userRepository) {
|
||||
this.userRepository = userRepository;
|
||||
}
|
||||
|
||||
public String run(String input) throws Exception {
|
||||
return userRepository.find(input);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue