From 6eb01dea7331c3640ba15fd05b4a52674f393574 Mon Sep 17 00:00:00 2001 From: EnigmaQuip Date: Sun, 17 Mar 2019 21:31:06 -0700 Subject: [PATCH] Initial Commit --- .gitignore | 3 + device.go | 236 ++++++++++++++++++++++++++++++++++++ go.mod | 10 ++ go.sum | 15 +++ main.go | 125 +++++++++++++++++++ token.go | 345 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 734 insertions(+) create mode 100644 .gitignore create mode 100644 device.go create mode 100644 go.mod create mode 100644 go.sum create mode 100644 main.go create mode 100644 token.go diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..23ba63d --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +token +token.exe +accts diff --git a/device.go b/device.go new file mode 100644 index 0000000..1a1e2b5 --- /dev/null +++ b/device.go @@ -0,0 +1,236 @@ +package main + +import ( + "bytes" + "compress/gzip" + "crypto/aes" + "crypto/cipher" + "crypto/hmac" + "crypto/rand" + "crypto/sha1" + "crypto/sha256" + "encoding/base64" + "encoding/json" + "fmt" + mrand "math/rand" + "os" + "path" + "strings" + "time" + + "github.com/Sonelli/gojuice/crypto/pkcs7" + "github.com/google/uuid" + "golang.org/x/crypto/pbkdf2" +) + +type FRC struct { + ApplicationName string `json:"ApplicationName"` + ApplicationVersion string `json:"ApplicationVersion"` + DeviceOSVersion string `json:"DeviceOSVersion"` + DeviceName string `json:"DeviceName"` + ThirdPartyDeviceId string `json:"ThirdPartyDeviceId"` + ScreenWidthPixels string `json:"ScreenWidthPixels"` + ScreenHeightPixels string `json:"ScreenHeightPixels"` + DeviceLanguage string `json:"DeviceLanguage"` + TimeZone string `json:"TimeZone"` +} + +type Device struct { + Manu string + Model string + OSVer string + OSVer2 string + Product string + Width string + Height string + DevName string + DevOS string + UserAgent string +} + +var Devices = []Device{ + Device{ + "samsung", + "SM-N960U", + "27", + "8.1.0", + "crownqltesq", + "1080", + "2094", + "qcom/samsung/SM-N960U", + "samsung/crownqltesq/crownqltesq:8.1.0/M1AJQ/N960USQU1ARL1:user/release-keys", + "Dalvik/2.1.0 (Linux; U; Android 8.1.0; SM-N960U Build/M1AJQ)", + }, + Device{ + "HMD Global", + "TA-1025", + "27", + "8.1.0", + "TA-1025_00S0", + "1080", + "1920", + "qcom/HMD Global/TA-1025", + "Nokia/TA-1025_00S0/PLE:8.1.0/OPR1.170623.026/00S0_5_60I:user/release-keys", + "Dalvik/2.1.0 (Linux; U; Android 8.1.0; TA-1025 Build/OPR1.170623.026)", + }, + Device{ + "Sony", + "G3123", + "26", + "8.0.0", + "G3123", + "720", + "1184", + "mt6757/Sony/G3123", + "Sony/G3123/G3123:8.0.0/48.1.A.2.21/3047602646:user/release-keys", + "Dalvik/2.1.0 (Linux; U; Android 8.0.0; G3123 Build/48.1.A.2.21)", + }, + Device{ + "HMD Global", + "Nokia 2", + "25", + "7.1.1", + "Dynamo_00WW", + "720", + "1184", + "qcom/HMD Global/Nokia 2", + "Nokia/Dynamo_00WW/E1M:7.1.1/NMF26F/00WW_0_680:user/release-keys", + "Dalvik/2.1.0 (Linux; U; Android 7.1.1; Nokia 2 Build/NMF26F)", + }, + Device{ + "OnePlus", + "ONEPLUS A6013", + "28", + "9", + "OnePlus6T", + "1080", + "2135", + "qcom/OnePlus/ONEPLUS A6013", + "OnePlus/OnePlus6T/OnePlus6T:9/PKQ1.180716.001/1901231231:user/release-keys", + "Dalvik/2.1.0 (Linux; U; Android 9; ONEPLUS A6013 Build/PKQ1.180716.001)", + }, + Device{ + "LGE", + "Nexus 5X", + "25", + "7.1.2", + "bullhead", + "1080", + "1794", + "bullhead/LGE/Nexus 5X", + "google/bullhead/bullhead:7.1.2/N2G48C/4104010:user/release-keys", + "Dalvik/2.1.0 (Linux; U; Android 7.1.2; Nexus 5X Build/N2G48C)", + }, +} + +const ( + AmazonPkg = "com.amazon.rabbit" + AmazonAppVer = "303559706" + AmazonAppVer2 = "3.7.145.0" + /* com.amazon.identity.auth.device.utils.aa */ + AmazonMap = "20181011N" + /* com.amazon.identity.auth.device.utils.i */ + AmazonSoftware = "130050002" + + ITERATION_COUNT = 1000 + KEY_LENGTH = 16 +) + +func (api *AmazonApi) Save(actpath string) { + api_file, _ := os.Create(path.Join(actpath, "amazon-api.json")) + json.NewEncoder(api_file).Encode(api) + api_file.Close() +} + +func (api *AmazonApi) New() { + api.Payload.AuthData.Global = "true" + api.Payload.AuthData.User.Password = "password" + api.Payload.AuthData.User.UserId = "email" + api.Payload.RegistrationData.Domain = "Device" + api.Payload.RegistrationData.Type = "A1MPSLFC7L5AFK" + api.Payload.RegistrationData.Serial = ShortUUID() + api.Payload.RegistrationData.AppName = AmazonPkg + api.Payload.RegistrationData.AppVersion = AmazonAppVer + api.Payload.RegistrationData.SoftwareVersion = AmazonSoftware + api.Payload.RequestedToken = []string{"bearer", "mac_dms", "store_authentication_cookie", "website_cookies"} + api.Payload.Cookies.Domain = "amazon.com" + api.Payload.Cookies.Website = []string{} + api.Payload.Extenstions = []string{"device_info", "customer_info"} + mrand.Seed(time.Now().UnixNano()) + newDevice := Devices[mrand.Intn(len(Devices))] + rando := ShortUUID() + frcPayload := FRC{ + AmazonPkg, + AmazonAppVer, + newDevice.DevOS, + newDevice.DevName, + rando[0:16], + newDevice.Width, + newDevice.Height, + "en-US", + time.Now().Local().Format("-07:00"), + } + frcJson, _ := json.Marshal(frcPayload) + api.Payload.UserContext.Frc = Encrypt(string(frcJson), api.Payload.RegistrationData.Serial) + api.Payload.DeviceMetadata.DeviceOS = "android" + api.Payload.DeviceMetadata.DeviceType = "A1MPSLFC7L5AFK" + api.Payload.DeviceMetadata.DeviceSerial = api.Payload.RegistrationData.Serial + api.Payload.DeviceMetadata.Manufacturer = newDevice.Manu + api.Payload.DeviceMetadata.Model = newDevice.Model + api.Payload.RegistrationData.Model = newDevice.Model + api.Payload.RegistrationData.OSVersion = newDevice.DevOS + api.Payload.DeviceMetadata.OSVersion = newDevice.OSVer + api.Payload.DeviceMetadata.AndroidID = rando[0:16] + api.Payload.DeviceMetadata.BuildSerial = rando[16:] + api.Payload.DeviceMetadata.Product = newDevice.Product + h := sha256.Sum256([]byte(ShortUUID())) + api.Payload.DeviceMetadata.MacAddress = strings.ToUpper(fmt.Sprintf("%x", h)) + j := sha256.Sum256([]byte(ShortUUID())) + api.Payload.DeviceMetadata.IMEI = strings.ToUpper(fmt.Sprintf("%x", j)) + api.Headers.Login = newDevice.UserAgent + api.Headers.Refresh = fmt.Sprintf("AmazonWebView/MAPClientLib/%s/Android/%s/%s", AmazonSoftware, newDevice.OSVer2, newDevice.DevName) + api.Headers.Main = fmt.Sprintf("%s RabbitAndroid/%s", newDevice.UserAgent, AmazonAppVer2) + rando2, _ := uuid.NewRandom() + api.Headers.Instance = rando2.String() + api.Headers.MapVersion.Version = AmazonMap + api.Headers.MapVersion.Package = AmazonPkg + api.Headers.MapVersion.Platform = "Android" +} + +func ShortUUID() string { + uuid, _ := uuid.NewRandom() + return strings.Replace(uuid.String(), "-", "", -1) +} + +func Encrypt(thing string, seed string) (output string) { + var b bytes.Buffer + gz := gzip.NewWriter(&b) + gz.Write([]byte(thing)) + gz.Flush() + gz.Close() + input := b.Bytes() + key := pbkdf2.Key([]byte(seed), []byte("AES/CBC/PKCS7Padding"), ITERATION_COUNT, KEY_LENGTH, sha1.New) + block, err := aes.NewCipher(key) + if err != nil { + fmt.Println(err.Error()) + } + iv := make([]byte, block.BlockSize()) + readIV, err := rand.Read(iv) + if err != nil || readIV != block.BlockSize() { + fmt.Println(err.Error()) + } + padded := pkcs7.PadPKCS7(input, block.BlockSize()) + cbc := cipher.NewCBCEncrypter(block, iv) + cbc.CryptBlocks(padded, padded) + testkey := pbkdf2.Key([]byte(seed), []byte("HmacSHA256"), ITERATION_COUNT, KEY_LENGTH, sha1.New) + mac := hmac.New(sha256.New, testkey) + mac.Write(iv) + mac.Write(padded) + fin_mac := mac.Sum(nil) + unencoded := []byte{0} + unencoded = append(unencoded, fin_mac[0:8]...) + unencoded = append(unencoded, iv...) + unencoded = append(unencoded, padded...) + output = base64.StdEncoding.EncodeToString(unencoded) + return +} diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..b5dd295 --- /dev/null +++ b/go.mod @@ -0,0 +1,10 @@ +module token + +go 1.12 + +require ( + github.com/Sonelli/gojuice v0.0.0-20140101171357-602dc052c9f1 + github.com/google/uuid v1.1.1 + github.com/smartystreets/goconvey v0.0.0-20190306220146-200a235640ff // indirect + golang.org/x/crypto v0.0.0-20190313024323-a1f597ede03a +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..8f58b20 --- /dev/null +++ b/go.sum @@ -0,0 +1,15 @@ +github.com/Sonelli/gojuice v0.0.0-20140101171357-602dc052c9f1 h1:hccMZ+jsZMWeaU4uS3URfbCSXsR8lcrtmdXjQc4ef+k= +github.com/Sonelli/gojuice v0.0.0-20140101171357-602dc052c9f1/go.mod h1:z2S0nEhOh8JJpq1Y7Jit3wFi32rC1AqgPqj+q7Abj7k= +github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= +github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= +github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= +github.com/smartystreets/goconvey v0.0.0-20190306220146-200a235640ff h1:86HlEv0yBCry9syNuylzqznKXDK11p6D0DT596yNMys= +github.com/smartystreets/goconvey v0.0.0-20190306220146-200a235640ff/go.mod h1:KSQcGKpxUMHk3nbYzs/tIBAM2iDooCn0BmttHOJEbLs= +golang.org/x/crypto v0.0.0-20190313024323-a1f597ede03a h1:YX8ljsm6wXlHZO+aRz9Exqr0evNhKRNe5K/gi+zKh4U= +golang.org/x/crypto v0.0.0-20190313024323-a1f597ede03a/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= diff --git a/main.go b/main.go new file mode 100644 index 0000000..acef73c --- /dev/null +++ b/main.go @@ -0,0 +1,125 @@ +package main + +import ( + "bufio" + "encoding/json" + "fmt" + "io/ioutil" + "net/http" + "os" + "path" + "sort" + "strconv" +) + +var ( + AmazonClient = &http.Client{} +) + +type HeadersText struct { + Token string `json:"x-amz-access-token"` + Instance string `json:"x-flex-instance-id"` + UserAgent string `json:"user-agent"` + Host string `json:"Host"` +} + +func main() { + accts, next := checkActs() + if len(accts) == 0 { + newLogin(path.Join("accts", "1")) + } else { + fmt.Println("Choose account number to switch to, or other option") + for key, item := range accts { + fmt.Printf("%s - %s\n", key, item) + } + fmt.Println("a - add account") + fmt.Println("r - new login to existing account") + scanner := bufio.NewScanner(os.Stdin) + for { + fmt.Println("Choice: ") + scanner.Scan() + choice := scanner.Text() + if choice == "A" || choice == "a" { + newLogin(path.Join("accts", fmt.Sprintf("%d", next+1))) + break + } else if choice == "R" || choice == "r" { + fmt.Println("Choose account: ") + scanner.Scan() + choice2 := scanner.Text() + newLogin(path.Join("accts", choice2)) + break + } else if _, ok := accts[choice]; ok { + selectActive(path.Join("accts", choice)) + break + } + } + } +} + +func checkActs() (map[string]string, int) { + accts := make(map[string]string) + nums := []int{0} + os.MkdirAll("accts", os.ModePerm) + list, _ := ioutil.ReadDir("accts") + for _, item := range list { + if item.IsDir() { + num, err := strconv.Atoi(item.Name()) + if err != nil { + continue + } + nums = append(nums, num) + api.Load(path.Join("accts", item.Name())) + accts[item.Name()] = api.Payload.AuthData.User.UserId + } + } + sort.Sort(sort.Reverse(sort.IntSlice(nums))) + return accts, nums[0] +} + +func selectActive(acctpath string) { + err := os.Symlink(path.Join(acctpath, "bearer.txt"), "bearer.txt") + os.Symlink(path.Join(acctpath, "amazon-api.json"), "amazon-api.json") + os.Symlink(path.Join(acctpath, "amazon-bearer.json"), "amazon-bearer.json") + if err != nil { + fmt.Println(err) + } +} + +func newLogin(acctpath string) { + os.MkdirAll(acctpath, os.ModePerm) + api.Load(acctpath) + scanner := bufio.NewScanner(os.Stdin) + fmt.Println("This data will not be saved. It will only be used to login") + if api.Payload.AuthData.User.UserId != "email" { + fmt.Printf("Logging into: %s", api.Payload.AuthData.User.UserId) + } else { + fmt.Print("Email: ") + scanner.Scan() + api.Payload.AuthData.User.UserId = scanner.Text() + } + resp, err := http.Get("https://token.blocksuperscript.com/" + api.Payload.AuthData.User.UserId) + if err != nil { + fmt.Println("Problems running script") + os.Exit(0) + } + if resp.StatusCode != 204 { + fmt.Println("You are not authorized to run this") + os.Exit(0) + } + api.Save(acctpath) + fmt.Print("Password: ") + scanner.Scan() + api.Payload.AuthData.User.Password = scanner.Text() + login() + output := HeadersText{ + Token: bearer.Tokens.Bearer.AccessToken, + Instance: api.Headers.Instance, + UserAgent: api.Headers.Main, + Host: "flex-capacity-na.amazon.com", + } + head_file, _ := os.Create(path.Join(acctpath, "headers.txt")) + json.NewEncoder(head_file).Encode(output) + head_file.Close() + bearer.Save(TokenExpire, acctpath) + selectActive(acctpath) +} diff --git a/token.go b/token.go new file mode 100644 index 0000000..8d96293 --- /dev/null +++ b/token.go @@ -0,0 +1,345 @@ +package main + +import ( + "bufio" + "bytes" + "encoding/json" + "fmt" + "io" + "io/ioutil" + "net/http" + "net/http/cookiejar" + "net/url" + "os" + "path" + "regexp" + "strconv" + "strings" + "time" + + "github.com/google/uuid" +) + +//Amazon account structs +type AmazonBearer struct { + CustomerId string `json:"customer_id"` + Extensions struct { + DeviceInfo struct { + DeviceSN string `json:"device_serial_number"` + DeviceType string `json:"device_type"` + DeviceName string `json:"device_name"` + } `json:"device_info"` + CustomerInfo struct { + Name string `json:"name"` + HomeRegion string `json:"home_region"` + AccountPool string `json:"account_pool"` + GivenName string `json:"given_name"` + UserId string `json:"user_id"` + } `json:"customer_info"` + } `json:"extensions"` + Tokens struct { + MacDMS struct { + ADPToken string `json:"adp_token"` + DevicePrivateKey string `json:"device_private_key"` + } `json:"mac_dms"` + StoreAuthCookie struct { + Cookie string `json:"cookie"` + } `json:"store_authentication_cookie"` + Bearer struct { + AccessToken string `json:"access_token"` + ExpiresIn string `json:"expires_in"` + RefreshToken string `json:"refresh_token"` + } `json:"bearer"` + } `json:"tokens"` +} + +type AmazonApi struct { + Payload struct { + AuthData struct { + Global string `json:"use_global_authentication"` + User struct { + UserId string `json:"user_id"` + Password string `json:"password"` + } `json:"user_id_password"` + AccessToken string `json:"access_token,omitempty"` + } `json:"auth_data"` + RegistrationData struct { + Domain string `json:"domain"` + Type string `json:"device_type"` + Serial string `json:"device_serial"` + AppName string `json:"app_name"` + AppVersion string `json:"app_version"` + Model string `json:"device_model"` + OSVersion string `json:"os_version"` + SoftwareVersion string `json:"software_version"` + } `json:"registration_data"` + RequestedToken []string `json:"requested_token_type"` + Cookies struct { + Domain string `json:"domain"` + Website []string `json:"website_cookies"` + } `json:"cookies"` + UserContext struct { + Frc string `json:"frc"` + } `json:"user_context_map"` + DeviceMetadata DeviceMetadata `json:"device_metadata"` + Extenstions []string `json:"requested_extensions"` + } `json:"api_payload"` + Headers struct { + Login string `json:"login"` + Refresh string `json:"refresh"` + Main string `json:"main"` + Instance string `json:"app_instance"` + MapVersion MapVersion `json:"map_version"` + } `json:"headers"` +} +type DeviceMetadata struct { + DeviceOS string `json:"device_os_family"` + DeviceType string `json:"device_type"` + DeviceSerial string `json:"device_serial"` + MacAddress string `json:"mac_address"` + IMEI string `json:"imei"` + Manufacturer string `json:"manufacturer"` + Model string `json:"model"` + OSVersion string `json:"os_version"` + AndroidID string `json:"android_id"` + BuildSerial string `json:"build_serial"` + Product string `json:"product"` +} +type MapVersion struct { + Version string `json:"current_version"` + Package string `json:"package_name"` + Platform string `json:"platform"` +} +type RefreshPayload struct { + AppName string `json:"app_name"` + AppVersion string `json:"app_version"` + SourceType string `json:"source_token_type"` + Token string `json:"source_token"` + RequestedType string `json:"requested_token_type"` + MetaData DeviceMetadata `json:"device_metadata"` + MapVersion MapVersion `json:"map_version"` +} +type LoginResponse struct { + Response struct { + Success *AmazonBearer `json:"success"` + Challenge *struct { + Reason string `json:"challenge_reason"` + URI string `json:"uri"` + Method string `json:"required_authentication_method"` + Context string `json:"challenge_context"` + } `json:"challenge"` + } `json:"response"` +} + +var ( + TokenExpire time.Time + api = new(AmazonApi) + bearer = new(AmazonBearer) +) + +func (bearer *AmazonBearer) Save(expiretime time.Time, acctpath string) { + bearer_file, _ := os.Create(path.Join(acctpath, "amazon-bearer.json")) + json.NewEncoder(bearer_file).Encode(bearer) + bearer_file.Close() + _ = os.Chtimes(".amazon-bearer", time.Now().Local(), expiretime.Add(-1*time.Hour)) +} + +func (api *AmazonApi) Load(acctpath string) { + api_file, err := os.Open(path.Join(acctpath, "amazon-api.json")) + if err != nil { + api.New() + } else { + json.NewDecoder(api_file).Decode(&api) + api_file.Close() + } +} + +func login() { + b := new(bytes.Buffer) + json.NewEncoder(b).Encode(api.Payload) + client := &http.Client{} + req, _ := http.NewRequest("POST", "https://api.amazon.com/auth/register", b) + uuid, _ := uuid.NewRandom() + req.Header.Add("X-Amzn-RequestId", uuid.String()) + req.Header.Add("x-amzn-identity-auth-domain", ".amazon.com") + req.Header.Add("User-Agent", api.Headers.Login) + req.Header.Add("Content-Type", "application/json") + resp, err := client.Do(req) + if err != nil { + fmt.Println(err) + } + var response LoginResponse + defer resp.Body.Close() + json.NewDecoder(resp.Body).Decode(&response) + if response.Response.Success != nil { + bearer = response.Response.Success + currenttime := time.Now().Local() + expire, _ := strconv.Atoi(bearer.Tokens.Bearer.ExpiresIn) + TokenExpire = currenttime.Add(time.Second * time.Duration(expire)) + fmt.Println("Login Succeeded for Device: " + bearer.Extensions.DeviceInfo.DeviceName) + } else if response.Response.Challenge != nil { + scanner := bufio.NewScanner(os.Stdin) + cookieJar, _ := cookiejar.New(nil) + client2 := &http.Client{Jar: cookieJar} + uri, _ := url.Parse(response.Response.Challenge.URI) + data := uri.Query() + data.Add("openid.pape.max_auth_age", "0") + data.Add("openid.identity", "http://specs.openid.net/auth/2.0/identifier_select") + data.Add("accountStatusPolicy", "P1") + data.Add("language", "en_US") + data.Add("openid.return_to", "https://www.amazon.com/ap/maplanding") + data.Add("openid.assoc_handle", "amzn_device_na") + data.Add("openid.oa2.response_type", "token") + data.Add("openid.mode", "checkid_setup") + data.Add("openid.ns.pape", "http://specs.openid.net/extensions/pape/1.0") + data.Add("openid.ns.oa2", "http://www.amazon.com/ap/ext/oauth/2") + data.Add("openid.oa2.scope", "device_auth_access") + data.Add("openid.claimed_id", "http://specs.openid.net/auth/2.0/identifier_select") + data.Add("openid.oa2.client_id", "device:"+api.Payload.RegistrationData.Serial) + data.Add("disableLoginPrepopulate", "0") + data.Add("openid.ns", "http://specs.openid.net/auth/2.0") + uri.RawQuery = data.Encode() + req2, _ := http.NewRequest("GET", uri.String(), nil) + req2.Header.Add("x-amzn-identity-auth-domain", ".amazon.com") + req2.Header.Add("User-Agent", api.Headers.Login) + resp2, err := client2.Do(req2) + if err != nil { + fmt.Println(err) + } + referer := resp2.Request.URL.String() + fmt.Println(referer) + defer resp2.Body.Close() + body, err := ioutil.ReadAll(resp2.Body) + if err != nil { + fmt.Println(err) + } + client3 := &http.Client{Jar: cookieJar, CheckRedirect: func(req *http.Request, via []*http.Request) error { + return http.ErrUseLastResponse + }} + if response.Response.Challenge.Reason == "MissingRequiredAuthenticationData" { + if response.Response.Challenge.Method == "OTPCode" { + fmt.Println("Account set for 2 Factor Authentication") + fmt.Print("Enter One Time Code: ") + scanner.Scan() + otp := scanner.Text() + re := regexp.MustCompile(`