Solved

linux curl command to login form with random token including in POST data

Posted on 2016-09-01
10
125 Views
Last Modified: 2016-09-07
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.
POSTDATA=tokenId=20619099050&userName=MyUserName&password=MyPassword&cmd=authenticate&locale=en&custType=&app=0

Open in new window


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.
0
Comment
Question by:trazodone
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
10 Comments
 
LVL 35

Expert Comment

by:gr8gonzo
ID: 41782030
There are lots of ways to implement tokens, so it really depends on how your bank chose to do it. Often times, financial institutions are more cautious about these things and try to actively prevent you from doing this type of thing because it is the way that malicious attacks are performed.

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.
2
 
LVL 62

Accepted Solution

by:
gheist earned 500 total points
ID: 41782361
1) Correct approach would be politely asking BANK if there is official API to do the stuff you need.
2) Normally some web crawling framework like beautifulsoup from EPEL is used for such forms
3) Read (1) - there could be othr traps than random token in login form only
0
 

Author Comment

by:trazodone
ID: 41782570
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.
0
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 
LVL 12

Expert Comment

by:William Nettmann
ID: 41782588
That token is being generated by the bank's systems to make sure that nobody can do what you are trying to do.
1
 
LVL 35

Expert Comment

by:gr8gonzo
ID: 41788002
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...
0
 
LVL 62

Expert Comment

by:gheist
ID: 41788390
BS4 can easily repost random tokens and pinch counter-pixel or even parse simple javascripts.
Others skipped it.
0
 
LVL 35

Expert Comment

by:gr8gonzo
ID: 41788629
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).
0
 
LVL 62

Expert Comment

by:gheist
ID: 41788635
In generic conditions one can crawl website with login that way. Ermmm never thought to do so with the bank...
0
 
LVL 35

Expert Comment

by:gr8gonzo
ID: 41788793
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.
0
 
LVL 35

Expert Comment

by:gr8gonzo
ID: 41788805
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
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Color can increase conversions, create feelings of warmth or even incite people to get behind a cause. If you want your website to really impact site visitors, then it is vital to consider the impact color has on them.
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question