[REQ] macro script/program to automate the login on different accounts ?

Discussion in 'Scripting' started by LostED, Aug 16, 2018.

  1. LostED

    LostED SVF Patch Lover

    Jul 30, 2009
    5,497
    13,817
    180
    #1 LostED, Aug 16, 2018
    Last edited: Oct 15, 2018
    my problem is that i have some accounts on mega.nz/pcloud.com/mediafire.com gmail.com/outlook.com/yahoo.com & i want to login every some time or else i lost the account/data

    for mega now i use megatools+Easy Macro Recorder but i need something quicker & more easy

    thnx
     
  2. LiteOS

    LiteOS MDL Expert

    Mar 7, 2014
    1,661
    710
    60
    Use profiles in forefox there addon to open another profile
     
  3. LostED

    LostED SVF Patch Lover

    Jul 30, 2009
    5,497
    13,817
    180
    @LiteOS

    manual??

    is not a solution for 300+ acount
     
  4. Mr.X

    Mr.X MDL Guru

    Jul 14, 2013
    6,425
    14,169
    210
    :jawdrop:

    :p
     
  5. LostED

    LostED SVF Patch Lover

    Jul 30, 2009
    5,497
    13,817
    180
  6. vanelle

    vanelle MDL Expert

    Sep 22, 2014
    1,066
    824
    60
    300+ accounts are realy much
    if i understand you right, you want only login and then logout to avoid loosing your account.
    is it right ?
    in this case you can use JDownloader2
    for most of your accounts (from type webspace)
    you can add such type of account and uncheck the activate checkbox by default
    from time to time go to account management and anable the account for a short time
    that would be the simplest thing that comes to mind first
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  7. LostED

    LostED SVF Patch Lover

    Jul 30, 2009
    5,497
    13,817
    180
    yes


    someone tell me that is a easy way through script/api but i dont know how/code
     
  8. jean_phile

    jean_phile MDL Junior Member

    Sep 13, 2008
    79
    66
    0
    Script on AutoIT.
    is not very easy, , but it can do it
     
  9. vanelle

    vanelle MDL Expert

    Sep 22, 2014
    1,066
    824
    60
    #9 vanelle, Dec 11, 2018
    Last edited: Dec 11, 2018
    i do it also with autoit
    but the way to do it is the folow
    1. you need to know the login process for each of the 300+ accounts (have fun)
    2. for easch login prozedur you must create a Cookie handling
    3a. create "WinHttpRequest.5.1" object ($o_HttpReq)
    3b. i manage the header with a "Scripting.Dictionary" object $dH - it is more easy
    Code:
    Global $o_HttpReq    = ObjCreate("WinHttp.WinHttpRequest.5.1")    ; create the request object
    Global $dREQHEADER    = ObjCreate('Scripting.Dictionary')            ; request header backup object
    If @error Then Exit 1
    With $dREQHEADER
        .add('Host',                            $Host)
        .add('Referer',                            'https://my.visualstudio.com')
        .add('Content-Type',                    'application/json')
        .add('Accept',                            'application/json;api-version=4.0-preview.1;excludeUrls=true')
        .add('X-VSS-ReauthenticationAction',    'Suppress')
        .add('X-Requested-With',                'XMLHttpRequest')
        .add('Accept-Language',                    'en-us')
        ;.add('Accept-Encoding',                'gzip, deflate')            ;we dont want encoded response !!!
        .add('Connection',                        'Keep-Alive')
        .add('Cache-Control',                    'no-cache')
        If IsString($aVSCOOKIE[0][1]) Then .add('Cookie',    $aVSCOOKIE[0][1])
    EndWith
    
    3c. fill the header of the "WinHttpRequest.5.1" object compleatly (some part can be fixed, som part must be variable)
    Code:
    ;eg fixed part
        With $o_HttpReq
           .SetTimeouts(60000, 60000, 60000, 60000)   ;set timeouts
           .Option(0) = "Mozilla/5.0 (Windows NT 6.1; rv:54.0) Gecko/20100101 Firefox/54.0"   ;
           .Option(4) = 13056                           ;set ssl ignore errors                   "WinHttpRequestOption_SslErrorIgnoreFlags"
           .Option(6) = True                           ;set redirects                           "WinHttpRequestOption_EnableRedirects"
           .Option(12) = True                           ;allow http to redirect to https       "WinHttpRequestOption_EnableHttpsToHttpRedirects"
           .Open($Typ, $URL, false)                   ;make the request, http verb (method), url, false to force syncronous
       EndWith
    ;variable part
       For $key in $dH.Keys()
           $o_HttpReq.SetRequestHeader($key, $dH.Item($key))
       Next
       ; Finally we can send the Request, this is being done with the Send method.
       $o_HttpReq.Send($sSend)
    
    
    4. after $o_HttpReq.Send method you must manage the status and the response header of the $o_HttpReq object
    .... and so on

    the way is is not complicated but 300+ accounts need 300+ $o_HttpReq object with 300+ different header settings
    by the way the jear have 265/266 days - have fun


    HTTP / JSON protocol

    is the
    .add('Content-Type', 'application/json')
    .add('Accept', 'application/json;api-version=4.0-preview.1;excludeUrls=true')
    .add('X-Requested-With', 'XMLHttpRequest')

    off the $dREQHEADER wich is addet later to the $o_HttpReq header
    --> this is what web-pages typical do to log in

    @LostED
    lets talk privat if you realy want to go this way
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  10. Mr.X

    Mr.X MDL Guru

    Jul 14, 2013
    6,425
    14,169
    210
    Based on your English spelling, I have my doubts on that code. Have fun ... :tooth:
     
  11. vanelle

    vanelle MDL Expert

    Sep 22, 2014
    1,066
    824
    60
    You should have noticed that it is only code-snipset and no complete functions.
    i keep the compleat function for me (because of Member like you) :D
    have fun with your notes
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  12. Mr.X

    Mr.X MDL Guru

    Jul 14, 2013
    6,425
    14,169
    210
    So you are being selfish with me huh?

    I feel kinda hurt. :tooth:
     
  13. LostED

    LostED SVF Patch Lover

    Jul 30, 2009
    5,497
    13,817
    180
    mega.nz/pcloud.com is out of the game

    all thnx @ vanelle

    :cheers: