1
mirror of https://github.com/rapid7/metasploit-payloads synced 2025-01-02 11:36:22 +01:00

fix getenv for missing environment variables

This commit is contained in:
Tim W 2022-01-17 10:11:36 +00:00
parent 25ed0159d4
commit c14e1e7bfe

View File

@ -22,10 +22,12 @@ public class stdapi_sys_config_getenv implements Command {
}
String envVal = System.getenv(envVar);
TLVPacket grp = new TLVPacket();
grp.add(TLVType.TLV_TYPE_ENV_VARIABLE, envVar);
grp.add(TLVType.TLV_TYPE_ENV_VALUE, envVal);
response.addOverflow(TLVType.TLV_TYPE_ENV_GROUP, grp);
if (envVal != null) {
TLVPacket grp = new TLVPacket();
grp.add(TLVType.TLV_TYPE_ENV_VARIABLE, envVar);
grp.add(TLVType.TLV_TYPE_ENV_VALUE, envVal);
response.addOverflow(TLVType.TLV_TYPE_ENV_GROUP, grp);
}
}
} catch (IllegalArgumentException e) {
Map<String,String> envVals = System.getenv();