I use Steam Guard 2FA and I can't solve this one.
Right now, the sentry file is ignored on subsequent login attempts, and I'm always asked for the 2FA. Here are some observations on the code.
An observation on the gsbot's Auth type HandleEvent method:
func (a *Auth) HandleEvent(event interface{}) {
switch e := event.(type) {
case *steam.MachineAuthUpdateEvent:
a.machineAuthHash = e.Hash
err := ioutil.WriteFile(a.sentryPath, e.Hash, 0666)
if err != nil {
panic(err)
}
}
}
It never informs Steam servers of accepting the Sentry file.
An observation on SteamKit's MachineAuthUpdateEvent:
static void OnMachineAuth( SteamUser.UpdateMachineAuthCallback callback )
{
Console.WriteLine( "Updating sentryfile..." );
// write out our sentry file
// ideally we'd want to write to the filename specified in the callback
// but then this sample would require more code to find the correct sentry file to read during logon
// for the sake of simplicity, we'll just use "sentry.bin"
int fileSize;
byte[] sentryHash;
using ( var fs = File.Open( "sentry.bin", FileMode.OpenOrCreate, FileAccess.ReadWrite ) )
{
fs.Seek( callback.Offset, SeekOrigin.Begin );
fs.Write( callback.Data, 0, callback.BytesToWrite );
fileSize = ( int )fs.Length;
fs.Seek( 0, SeekOrigin.Begin );
using ( var sha = SHA1.Create() )
{
sentryHash = sha.ComputeHash( fs );
}
}
// inform the steam servers that we're accepting this sentry file
steamUser.SendMachineAuthResponse( new SteamUser.MachineAuthDetails
{
JobID = callback.JobID,
FileName = callback.FileName,
BytesWritten = callback.BytesToWrite,
FileSize = fileSize,
Offset = callback.Offset,
Result = EResult.OK,
LastError = 0,
OneTimePassword = callback.OneTimePassword,
SentryFileHash = sentryHash,
} );
Console.WriteLine( "Done!" );
}
It informs Steam servers of accepting the sentry file.
Source: SteamKit SteamGuard example
I use Steam Guard 2FA and I can't solve this one.
Right now, the sentry file is ignored on subsequent login attempts, and I'm always asked for the 2FA. Here are some observations on the code.
An observation on the
gsbot'sAuthtypeHandleEventmethod:It never informs Steam servers of accepting the Sentry file.
An observation on SteamKit's
MachineAuthUpdateEvent:It informs Steam servers of accepting the sentry file.
Source: SteamKit SteamGuard example