hsbc_latest_download 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +0 -0
- data/.gitignore +9 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +26 -0
- data/Rakefile +2 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/certs/mattfawcett.pem +22 -0
- data/exe/hsbc_latest_download +8 -0
- data/hsbc_latest_download.gemspec +29 -0
- data/lib/hsbc_latest_download/download.rb +70 -0
- data/lib/hsbc_latest_download/version.rb +3 -0
- data/lib/hsbc_latest_download.rb +4 -0
- data.tar.gz.sig +0 -0
- metadata +123 -0
- metadata.gz.sig +0 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ccc086b62d278e04d34a9969c63d09f3ef1f7976
|
4
|
+
data.tar.gz: 098f83f5384a8d75b07fea7611204d0178613cd2
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 82a24b826e6d60e1dc2030490fec05a2bf6b238643b1097e96e3ad013eeb0825eef507e57e6cd3092f0ded3d1d3dfee57c7b356e2eba6e469ea5f6e906614e75
|
7
|
+
data.tar.gz: d09c06a73b1ac87b45172afea0ef935406e77c06a0f149c9a32a973870e3da142fb98e3d8ce17f5638a943f74fb89f18d010af6ed4fce256fca72a3ddaf79264
|
checksums.yaml.gz.sig
ADDED
Binary file
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Matt Fawcett
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# HsbcLatestDownload
|
2
|
+
|
3
|
+
A script to download latest transactional data as OFX from HSBC personal online banking.
|
4
|
+
|
5
|
+
Use at own risk.
|
6
|
+
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
$ gem install hsbc_latest_download
|
11
|
+
|
12
|
+
## Usage
|
13
|
+
|
14
|
+
# Options
|
15
|
+
hsbc_latest_download username memorableword password [optionalaccountname=HSBC ADVANCE]
|
16
|
+
|
17
|
+
# Example. Passing credentials like this is insecure. At minimum use [HISTCONTROL](http://www.linuxjournal.com/content/using-bash-history-more-efficiently-histcontrol)
|
18
|
+
hsbc_latest_download IB1234567890 mymemorableword mypassword
|
19
|
+
|
20
|
+
# Example using [password manager](https://www.passwordstore.org/)
|
21
|
+
hsbc_latest_download IB1234567890 `pass hsbc.co.uk.memorable` `pass hsbc.co.uk.password`
|
22
|
+
|
23
|
+
## License
|
24
|
+
|
25
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
26
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "hsbc_latest_download"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
-----BEGIN CERTIFICATE-----
|
2
|
+
MIIDsDCCApigAwIBAgIBATANBgkqhkiG9w0BAQUFADBXMQ0wCwYDVQQDDARtYWls
|
3
|
+
MR4wHAYKCZImiZPyLGQBGRYObWF0dGhld2Zhd2NldHQxEjAQBgoJkiaJk/IsZAEZ
|
4
|
+
FgJjbzESMBAGCgmSJomT8ixkARkWAnVrMB4XDTE2MDczMTA5MTMyMloXDTE3MDcz
|
5
|
+
MTA5MTMyMlowVzENMAsGA1UEAwwEbWFpbDEeMBwGCgmSJomT8ixkARkWDm1hdHRo
|
6
|
+
ZXdmYXdjZXR0MRIwEAYKCZImiZPyLGQBGRYCY28xEjAQBgoJkiaJk/IsZAEZFgJ1
|
7
|
+
azCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMD79gWa1lNLhS4uyQdu
|
8
|
+
W0a0wB7ovDJxVMbVWhXm086S9yi7Sb71NmpWZmaWB54eXS/IfBRFLiiJl9+7LEJ+
|
9
|
+
xlpDXbOfQmHFHyt21ED0y5m9ixDBSpZux0HnWPEo3yDWwvg4jehuk7VpOsKCSpf9
|
10
|
+
uX0GNDr4GsVZDp7KpVGVE5FjLdq+Scg0zCOY1kut5DOBw1sxbZC6xW7JjAlB8Rka
|
11
|
+
NkMsFBA98sBAl1Pz+tn2e1Du7hV6OX72v3AncC5uchvLXO2SQxlhOxQxjqOaqogy
|
12
|
+
yP8WLCN///eepc6ISpLemIUT4KHdRz9L8jKHErpuzaBiNtWIhcyv7MB7ZaMcrb8U
|
13
|
+
Oh8CAwEAAaOBhjCBgzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQU
|
14
|
+
ScxklEbsSKSeOy+I+86Ccis1ggMwJAYDVR0RBB0wG4EZbWFpbEBtYXR0aGV3ZmF3
|
15
|
+
Y2V0dC5jby51azAkBgNVHRIEHTAbgRltYWlsQG1hdHRoZXdmYXdjZXR0LmNvLnVr
|
16
|
+
MA0GCSqGSIb3DQEBBQUAA4IBAQCipFpXBV8hjLb4dzeheyhQTooWL76WOXiUjipj
|
17
|
+
ekBR82RzUlXx+YBJ3A+s9/lTsn70ravEK9tfpkDXGXIg/fF6aaVCX085PIaghAzJ
|
18
|
+
gz8uuzaUp/kGrbhzYvyC5r3e8iugTylHkiftYF5w2Xn02l21yK/AubKYDUU/KinL
|
19
|
+
w3lz0KwTmsyupgzc6y7yHW3jdCAFe8iXlPwhbfbqID2iSm8wuQwO6RzJn07Ejtus
|
20
|
+
yJIQ7BnT75VQEqtWMfkSjOW64AVlWuD/LU/4NQykWZrh6sAaxKvhYBU/PiujaXyL
|
21
|
+
rUw5QSvC1QClur/I5qvjk8o8/hbxgQuoy5zjq8/vPBuaVDJY
|
22
|
+
-----END CERTIFICATE-----
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'hsbc_latest_download/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "hsbc_latest_download"
|
8
|
+
spec.version = HsbcLatestDownload::VERSION
|
9
|
+
spec.authors = ["Matt Fawcett"]
|
10
|
+
spec.email = ["mail@matthewfawcett.co.uk"]
|
11
|
+
|
12
|
+
spec.summary = %q{Download latest hsbc transactions as OFX}
|
13
|
+
spec.description = %q{Download latest hsbc transactions as OFX}
|
14
|
+
spec.homepage = "https://github.com/mattfawcett/hsbc_latest_download"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = "exe"
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.cert_chain = ['certs/mattfawcett.pem']
|
23
|
+
spec.signing_key = File.expand_path("~/.ssh/gem-private_key.pem") if $0 =~ /gem\z/
|
24
|
+
|
25
|
+
spec.add_dependency "selenium-webdriver", "~> 2.53"
|
26
|
+
|
27
|
+
spec.add_development_dependency "bundler", "~> 1.12"
|
28
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
29
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
require "selenium-webdriver"
|
2
|
+
|
3
|
+
module HsbcLatestDownload
|
4
|
+
class Download
|
5
|
+
HSBC_URL = 'https://www.hsbc.co.uk/'
|
6
|
+
|
7
|
+
def initialize(username, memorable_answer, password, account_name)
|
8
|
+
@username = username
|
9
|
+
@memorable_answer = memorable_answer
|
10
|
+
@password = password
|
11
|
+
@account_name = account_name || 'HSBC ADVANCE'
|
12
|
+
end
|
13
|
+
|
14
|
+
def run!
|
15
|
+
driver = Selenium::WebDriver.for :chrome
|
16
|
+
driver.navigate.to HSBC_URL
|
17
|
+
|
18
|
+
driver.find_element(partial_link_text: 'Log on').click
|
19
|
+
|
20
|
+
element = driver.find_element(:name, 'userid')
|
21
|
+
element.send_keys @username
|
22
|
+
element.submit
|
23
|
+
|
24
|
+
driver.find_element(partial_link_text: 'Without Secure Key').click
|
25
|
+
|
26
|
+
driver.find_element(name: 'memorableAnswer').send_keys(@memorable_answer)
|
27
|
+
|
28
|
+
(1..8).each do |char|
|
29
|
+
field = driver.find_element(name: "pass#{char}")
|
30
|
+
unless field.attribute('disabled')
|
31
|
+
letter = password_character(char)
|
32
|
+
field.send_keys(letter)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
driver.find_element(class: 'submit_input').click
|
37
|
+
|
38
|
+
driver.find_element(:link_text, @account_name).click
|
39
|
+
driver.find_element(:link_text, 'Download transactions').click
|
40
|
+
|
41
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 10)
|
42
|
+
wait.until { driver.find_element(:name => 'downloadType') }
|
43
|
+
|
44
|
+
file_type = driver.find_element(:name, 'downloadType')
|
45
|
+
file_type.find_elements( :tag_name => "option" ).find do |option|
|
46
|
+
option.text == 'Money 98 onwards (OFX)'
|
47
|
+
end.click
|
48
|
+
|
49
|
+
driver.find_element(:link_text, 'Continue').click
|
50
|
+
driver.find_element(:link_text, 'Confirm').click
|
51
|
+
|
52
|
+
sleep 10
|
53
|
+
|
54
|
+
driver.find_element(partial_link_text: 'Log off').click
|
55
|
+
driver.quit
|
56
|
+
end
|
57
|
+
|
58
|
+
def password_character(number)
|
59
|
+
if number <= 6
|
60
|
+
return @password[number-1, 1]
|
61
|
+
elsif number == 7
|
62
|
+
# second to last character
|
63
|
+
return @password[@password.length-2, 1]
|
64
|
+
else
|
65
|
+
# last character
|
66
|
+
return @password[@password.length-1, 1]
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
data.tar.gz.sig
ADDED
Binary file
|
metadata
ADDED
@@ -0,0 +1,123 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: hsbc_latest_download
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Matt Fawcett
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain:
|
11
|
+
- |
|
12
|
+
-----BEGIN CERTIFICATE-----
|
13
|
+
MIIDsDCCApigAwIBAgIBATANBgk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
+
ekBR82RzUlXx+YBJ3A+s9/lTsn70ravEK9tfpkDXGXIg/fF6aaVCX085PIaghAzJ
|
29
|
+
gz8uuzaUp/kGrbhzYvyC5r3e8iugTylHkiftYF5w2Xn02l21yK/AubKYDUU/KinL
|
30
|
+
w3lz0KwTmsyupgzc6y7yHW3jdCAFe8iXlPwhbfbqID2iSm8wuQwO6RzJn07Ejtus
|
31
|
+
yJIQ7BnT75VQEqtWMfkSjOW64AVlWuD/LU/4NQykWZrh6sAaxKvhYBU/PiujaXyL
|
32
|
+
rUw5QSvC1QClur/I5qvjk8o8/hbxgQuoy5zjq8/vPBuaVDJY
|
33
|
+
-----END CERTIFICATE-----
|
34
|
+
date: 2016-07-31 00:00:00.000000000 Z
|
35
|
+
dependencies:
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: selenium-webdriver
|
38
|
+
requirement: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - "~>"
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '2.53'
|
43
|
+
type: :runtime
|
44
|
+
prerelease: false
|
45
|
+
version_requirements: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - "~>"
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '2.53'
|
50
|
+
- !ruby/object:Gem::Dependency
|
51
|
+
name: bundler
|
52
|
+
requirement: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - "~>"
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '1.12'
|
57
|
+
type: :development
|
58
|
+
prerelease: false
|
59
|
+
version_requirements: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - "~>"
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '1.12'
|
64
|
+
- !ruby/object:Gem::Dependency
|
65
|
+
name: rake
|
66
|
+
requirement: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - "~>"
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '10.0'
|
71
|
+
type: :development
|
72
|
+
prerelease: false
|
73
|
+
version_requirements: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - "~>"
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '10.0'
|
78
|
+
description: Download latest hsbc transactions as OFX
|
79
|
+
email:
|
80
|
+
- mail@matthewfawcett.co.uk
|
81
|
+
executables:
|
82
|
+
- hsbc_latest_download
|
83
|
+
extensions: []
|
84
|
+
extra_rdoc_files: []
|
85
|
+
files:
|
86
|
+
- ".gitignore"
|
87
|
+
- Gemfile
|
88
|
+
- LICENSE.txt
|
89
|
+
- README.md
|
90
|
+
- Rakefile
|
91
|
+
- bin/console
|
92
|
+
- bin/setup
|
93
|
+
- certs/mattfawcett.pem
|
94
|
+
- exe/hsbc_latest_download
|
95
|
+
- hsbc_latest_download.gemspec
|
96
|
+
- lib/hsbc_latest_download.rb
|
97
|
+
- lib/hsbc_latest_download/download.rb
|
98
|
+
- lib/hsbc_latest_download/version.rb
|
99
|
+
homepage: https://github.com/mattfawcett/hsbc_latest_download
|
100
|
+
licenses:
|
101
|
+
- MIT
|
102
|
+
metadata: {}
|
103
|
+
post_install_message:
|
104
|
+
rdoc_options: []
|
105
|
+
require_paths:
|
106
|
+
- lib
|
107
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - ">="
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
112
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - ">="
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '0'
|
117
|
+
requirements: []
|
118
|
+
rubyforge_project:
|
119
|
+
rubygems_version: 2.4.5.1
|
120
|
+
signing_key:
|
121
|
+
specification_version: 4
|
122
|
+
summary: Download latest hsbc transactions as OFX
|
123
|
+
test_files: []
|
metadata.gz.sig
ADDED
Binary file
|