Skip to content

Instantly share code, notes, and snippets.

@BirkhoffLee
Last active June 28, 2019 04:42
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BirkhoffLee/484439af2a481ce2dda4479ca9ea8791 to your computer and use it in GitHub Desktop.
Save BirkhoffLee/484439af2a481ce2dda4479ca9ea8791 to your computer and use it in GitHub Desktop.
Steamguard data & device id extractor
// yarn add binary-cookies bplist-parser
/*
To get the Steamguard file, you don't necessarily need to be jailbroken, but
if you're jailbroken: head to
/private/var/mobile/Containers/Data/Application/6BE5C937-51C0-4365-811D-F2717BAD1213/Documents
and you can get them. I'm not sure the UUID is same on all devices, but this is the actual path
on my device (iOS 12)
If you're non-jailbroken, you need to get an unencrypted backup using iTunes,
and search for the Steamguard file in the backup folder.
The device id: I used iMazing to get it, but if you used the iTunes method you can
directly get it from Info.plist (uncomment the bottom code and pass the path to
this script). It should be a 40-character random string.
The JSON result is meant to be pasted in WinAuth, in the device field paste:
android:YOUR_DEVICE_UUID_HERE
*/
// Credit to https://bitbucket.org/srabouin/node-steamparser, last updated: 2015-12-16
// Modified by birkhoff, tested on June 2nd, 2019
// * Fixed bugs based on the original version, including incomplete extraction
// * Added feature: Extract device id from Info.plist
// Usage: node steamguard [path-to-Steamguard-file] <path-to-Info.plist>
let bplist = require('bplist-parser')
let fs = require('fs')
let CookieParser = require('binary-cookies')
let p = CookieParser()
let steamkeys = [
'shared_secret',
'secret_1',
'identity_secret',
'revocation_code',
'serial_number',
'steamguard_scheme',
'steamid',
'uri',
'account_name',
'token_gid',
'server_time',
'status'
]
let res = {}
if (!process.argv[2]) {
console.log("Usage: node steamguard [Steamguard-xxxxxx] <Info.plist>\n")
process.exit(1)
}
bplist.parseFile(process.argv[2], (err, plist) => {
if (err) throw err
for (var key in plist[0]["$objects"]) {
if (steamkeys.indexOf(plist[0]["$objects"][key]) !== -1) {
let prop = plist[0]["$objects"][key]
let val = plist[0]["$objects"][parseInt(key) + 12]
if (prop == 'steamid')
val = parseInt(val)
res[prop] = val
}
}
console.log(JSON.stringify(res))
})
// bplist.parseFile(process.argv[3], (err, plist) => {
// if (err) throw err
// let uid = plist[0]["Unique Identifier"]
// if (uid)
// console.log("Device ID: \"android:" + plist[0]["Unique Identifier"] + "\"")
// else
// console.log("Failed to parse device id")
// })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment