File size: 2,838 Bytes
018c5c4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import requests
from bs4 import BeautifulSoup as Bs4
import time
import os
import datetime
import random,json
from urllib.parse import unquote
import aiohttp
import base64,re

async def login(user,password):
  url='https://apiapp.acb.com.vn/mb/v2/auth/tokens'
  data={
    "username":user,
    "password": password,
    "clientId": "iuSuHYVufIUuNIREV0FB9EoLn9kHsDbm"
  }
  headers={
    'user-agent':'ACB-MBA/5 CFNetwork/1325.0.1 Darwin/21.1.0'
  }
  async with aiohttp.ClientSession(cookie_jar=aiohttp.CookieJar()) as session:
    async with session.post(url,headers=headers,json=data) as res:
      if res.status<400:
        js=await res.json()
        headers['authorization']='Bearer '+js['refreshToken']
        refreshTk=js['refreshToken']
        url='https://apiapp.acb.com.vn/mb/v2/auth/refresh'
        async with aiohttp.ClientSession(cookie_jar=aiohttp.CookieJar()) as session:
          async with session.post(url,headers=headers) as res:
            url='https://apiapp.acb.com.vn/mb/legacy/ss/cs/bankservice/transfers/list/account-payment'
            if res.status<400:
              js=await res.json()
              headers['authorization']='Bearer '+js['accessToken']
              print(user+' login success')
              return {'headers':headers,'refreshTk':refreshTk,'username':user}
      return False
async def getRefreshTk(headers):
  url='https://apiapp.acb.com.vn/mb/auth/refresh'
  headers['authorization']='Bearer '+headers['refreshTk']
  async with aiohttp.ClientSession(cookie_jar=aiohttp.CookieJar()) as session:
    async with session.post(url,headers=headers) as res:
      if res.status<400:
        js=await res.json()
        headers['authorization']='Bearer '+js['accessToken']
        print(headers['username']+' get refresh token success')
        return {headers['']+'headers':headers,'refreshTk':headers['refreshTk'],'username':headers['username']}
async def getListAccount(headers):
  url='https://apiapp.acb.com.vn/mb/legacy/ss/cs/bankservice/transfers/list/account-payment'
  async with aiohttp.ClientSession(cookie_jar=aiohttp.CookieJar()) as session:
    async with session.get(url,headers=headers['headers']) as res:
      if res.status<400:
        js=await res.json()
        print(headers['username']+' get list account success')
        return {'list':js['data']}
    return False
async def getBalance(headers,id):
  url='https://apiapp.acb.com.vn/mb/legacy/ss/cs/person/transaction-history/list?account=15895127&transactionType=&from=&to=&min=&max='
  async with aiohttp.ClientSession(cookie_jar=aiohttp.CookieJar()) as session:
    async with session.get(url,headers=headers['headers']) as res:
      if res.status<400:
        js=await res.json()
        print(headers['username']+' get balance success')
        return {
          'data':js['data']
        }
      return False