trazodone
asked on
linux curl command to login form with random token including in POST data
Hello Expert,
I am trying to login to my bank form data to get total balance for further use. I used Firefox'Tamper data to capture POST data needed to login. When I click submit I 've got info like below.
You will see random auto-generate "tokenID" always including in POSTDATA.
I wish to use curl command (Centos linux) to successfuly login but I have no idea to how to have tokenID including in the POSTDATA.
Does anyone experienced this kind of login and how to make it work?
Thank you.
I am trying to login to my bank form data to get total balance for further use. I used Firefox'Tamper data to capture POST data needed to login. When I click submit I 've got info like below.
POSTDATA=tokenId=20619099050&userName=MyUserName&password=MyPassword&cmd=authenticate&locale=en&custType=&app=0
You will see random auto-generate "tokenID" always including in POSTDATA.
I wish to use curl command (Centos linux) to successfuly login but I have no idea to how to have tokenID including in the POSTDATA.
Does anyone experienced this kind of login and how to make it work?
Thank you.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hello,
Asking information from bank can be more complicate. I would like to have something functioned like a standard web browser but command line then I can successfully login regardless what tokenID is and can have get info I'd like. I am trying Apache JMeter.
Asking information from bank can be more complicate. I would like to have something functioned like a standard web browser but command line then I can successfully login regardless what tokenID is and can have get info I'd like. I am trying Apache JMeter.
That token is being generated by the bank's systems to make sure that nobody can do what you are trying to do.
Is there a reason you accepted #41782361 over the others? Every single expert has told you the same thing - contact your bank and ask for an API. Anything else is likely to fail or actually create new problems...
BS4 can easily repost random tokens and pinch counter-pixel or even parse simple javascripts.
Others skipped it.
Others skipped it.
That's unfortunate. It is a -really- bad idea to try to do this without the bank's permission, even if a framework or library can assist (for now).
In generic conditions one can crawl website with login that way. Ermmm never thought to do so with the bank...
Yeah, normal crawling / web scraping isn't an issue with generic sites. Financial institutions tend to be much more sensitive to anything resembling non-standard usage (e.g. HTML pages load but not there are no requests for the images = almost always a script), and they often have terms and conditions regarding how you can legally access the site.
Plus, more and more financial institutions are implementing two-factor authentication (e.g. if the client browser isn't recognized, a code is sent via SMS to the mobile phone on file), which a script wouldn't be able to circumvent normally. However, an API would allow him consistent and safe access to the information, with much lower risk of minor changes causing his script to break.
-shrug- All that said, if the OP wants to take that chance, it's his or her risk to take.
Plus, more and more financial institutions are implementing two-factor authentication (e.g. if the client browser isn't recognized, a code is sent via SMS to the mobile phone on file), which a script wouldn't be able to circumvent normally. However, an API would allow him consistent and safe access to the information, with much lower risk of minor changes causing his script to break.
-shrug- All that said, if the OP wants to take that chance, it's his or her risk to take.
Incidentally, QuickBooks Online can connect to most major banks via -their- APIs and has an available API that a normal developer could use:
https://developer.intuit.com/v2/apiexplorer
https://developer.intuit.com/v2/apiexplorer
The basic idea is you need to download the login page first and extract the token from the page. If it's set via Javascript, you might not be able to do this programmatically. If it's just on the page, then you can use regular expressions to extract the token ID from the login page, and then use it in your next request.
Sometimes the token is in the page content, sometimes it's in the page header, sometimes it comes from a separate AJAX call, etc, etc... So you'd have to know how the token is generated before you can scrape it.
All that said, don't do this.
Again, most banks will think your attempts are a potential hacking attempt and could potentially ban your IP address, or could even trigger off automated security lockdowns on your account.
If you want to programmatically access your account, then you need to contact your bank and ask if they provide an API that you can use. The API will come with documentation that will describe exactly how you can access it and what you can do with the API. More importantly, it's designed specifically for what you're trying to do (access your account via cURL), so it won't look like a hacking attempt.