mirror of
https://github.com/rapid7/metasploit-payloads
synced 2025-03-30 22:19:17 +02:00
Land #467, StringBuffer to StringBuilder
This commit is contained in:
commit
54de384b28
java
javapayload/src/main/java/metasploit
meterpreter
meterpreter/src/main/java/com/metasploit/meterpreter
stdapi/src/main/java/com/metasploit/meterpreter/stdapi
@ -357,7 +357,7 @@ public class Payload extends ClassLoader {
|
|||||||
s.push(thisToken);
|
s.push(thisToken);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
StringBuffer sb = new StringBuffer();
|
StringBuilder sb = new StringBuilder();
|
||||||
for (int i = 0; i < s.size(); i++) {
|
for (int i = 0; i < s.size(); i++) {
|
||||||
if (i > 1) {
|
if (i > 1) {
|
||||||
// not before the filesystem root and not after it, since root
|
// not before the filesystem root and not after it, since root
|
||||||
@ -384,7 +384,7 @@ public class Payload extends ClassLoader {
|
|||||||
//remove the initial separator; the root has it.
|
//remove the initial separator; the root has it.
|
||||||
next = (ca[next] == sep) ? next + 1 : next;
|
next = (ca[next] == sep) ? next + 1 : next;
|
||||||
|
|
||||||
StringBuffer sbPath = new StringBuffer();
|
StringBuilder sbPath = new StringBuilder();
|
||||||
// Eliminate consecutive slashes after the drive spec:
|
// Eliminate consecutive slashes after the drive spec:
|
||||||
for (int i = next; i < ca.length; i++) {
|
for (int i = next; i < ca.length; i++) {
|
||||||
if (ca[i] != sep || ca[i - 1] != sep) {
|
if (ca[i] != sep || ca[i - 1] != sep) {
|
||||||
|
@ -17,13 +17,13 @@ public class Utils {
|
|||||||
public static String runCommand(String command) throws IOException {
|
public static String runCommand(String command) throws IOException {
|
||||||
Process process = Runtime.getRuntime().exec(command);
|
Process process = Runtime.getRuntime().exec(command);
|
||||||
BufferedReader br = new BufferedReader(new InputStreamReader(process.getInputStream()));
|
BufferedReader br = new BufferedReader(new InputStreamReader(process.getInputStream()));
|
||||||
StringBuffer stringBuffer = new StringBuffer();
|
StringBuilder stringBuilder = new StringBuilder();
|
||||||
String line;
|
String line;
|
||||||
while ((line = br.readLine()) != null) {
|
while ((line = br.readLine()) != null) {
|
||||||
stringBuffer.append(line);
|
stringBuilder.append(line);
|
||||||
stringBuffer.append('\n');
|
stringBuilder.append('\n');
|
||||||
}
|
}
|
||||||
return stringBuffer.toString();
|
return stringBuilder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getHostname() {
|
public static String getHostname() {
|
||||||
|
@ -15,10 +15,9 @@ public class core_machine_id implements Command {
|
|||||||
private static String machine_id;
|
private static String machine_id;
|
||||||
|
|
||||||
private String getSerial() throws IOException {
|
private String getSerial() throws IOException {
|
||||||
String stringBuffer = Utils.runCommand("getprop ro.serialno").trim() +
|
return Utils.runCommand("getprop ro.serialno").trim() +
|
||||||
Utils.runCommand("getprop ro.product.brand").trim() +
|
Utils.runCommand("getprop ro.product.brand").trim() +
|
||||||
Utils.runCommand("getprop ro.product.model").trim();
|
Utils.runCommand("getprop ro.product.model").trim();
|
||||||
return stringBuffer;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getHDLabel() {
|
private String getHDLabel() {
|
||||||
|
@ -15,7 +15,7 @@ public class stdapi_sys_process_execute implements Command {
|
|||||||
private static int pid = 0;
|
private static int pid = 0;
|
||||||
|
|
||||||
public int execute(Meterpreter meterpreter, TLVPacket request, TLVPacket response) throws Exception {
|
public int execute(Meterpreter meterpreter, TLVPacket request, TLVPacket response) throws Exception {
|
||||||
StringBuffer cmdbuf = new StringBuffer();
|
StringBuilder cmdbuf = new StringBuilder();
|
||||||
String cmd = request.getStringValue(TLVType.TLV_TYPE_PROCESS_PATH);
|
String cmd = request.getStringValue(TLVType.TLV_TYPE_PROCESS_PATH);
|
||||||
String argsString = request.getStringValue(TLVType.TLV_TYPE_PROCESS_ARGUMENTS, "");
|
String argsString = request.getStringValue(TLVType.TLV_TYPE_PROCESS_ARGUMENTS, "");
|
||||||
int flags = request.getIntValue(TLVType.TLV_TYPE_PROCESS_FLAGS);
|
int flags = request.getIntValue(TLVType.TLV_TYPE_PROCESS_FLAGS);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user