Skip to content

Commit

Permalink
Merge pull request #194 from LossyDragon/PR132
Browse files Browse the repository at this point in the history
Create obfuscated_private_ip object when LoginID is provided
  • Loading branch information
LossyDragon authored Jan 19, 2022
2 parents 4d562f6 + 52bacdf commit eaf23cb
Showing 1 changed file with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import in.dragonbra.javasteam.generated.MsgClientLogon;
import in.dragonbra.javasteam.generated.MsgClientMarketingMessageUpdate2;
import in.dragonbra.javasteam.handlers.ClientMsgHandler;
import in.dragonbra.javasteam.protobufs.steamclient.SteammessagesBase;
import in.dragonbra.javasteam.protobufs.steamclient.SteammessagesClientserver.CMsgClientSessionToken;
import in.dragonbra.javasteam.protobufs.steamclient.SteammessagesClientserver.CMsgClientWalletInfoUpdate;
import in.dragonbra.javasteam.protobufs.steamclient.SteammessagesClientserver2.CMsgClientEmailAddrInfo;
Expand Down Expand Up @@ -144,13 +145,24 @@ public void logOn(LogOnDetails details) {

SteamID steamID = new SteamID(details.getAccountID(), details.getAccountInstance(), client.getUniverse(), EAccountType.Individual);

SteammessagesBase.CMsgIPAddress.Builder ipAddress = SteammessagesBase.CMsgIPAddress.newBuilder();
if (details.getLoginID() != null) {
logon.getBody().setDeprecatedObfustucatedPrivateIp(details.getLoginID()); // NOTE: Using deprecated method.
ipAddress.setV4(details.getLoginID());

logon.getBody().setObfuscatedPrivateIp(ipAddress.build());
} else {
int localIp = NetHelpers.getIPAddress(client.getLocalIP());
logon.getBody().setDeprecatedObfustucatedPrivateIp(localIp ^ MsgClientLogon.ObfuscationMask); // NOTE: Using deprecated method.
ipAddress.setV4(localIp ^ MsgClientLogon.ObfuscationMask);

logon.getBody().setObfuscatedPrivateIp(ipAddress.build());
}

// Legacy field, Steam client still sets it
if (logon.getBody().getObfuscatedPrivateIp().hasV4()) {
logon.getBody().setDeprecatedObfustucatedPrivateIp(logon.getBody().getObfuscatedPrivateIp().getV4());
}


logon.getProtoHeader().setClientSessionid(0);
logon.getProtoHeader().setSteamid(steamID.convertToUInt64());

Expand Down

0 comments on commit eaf23cb

Please sign in to comment.