hsbc_latest_download 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/README.md +18 -9
- data/exe/hsbc_latest_download +39 -1
- data/lib/hsbc_latest_download/download.rb +8 -11
- data/lib/hsbc_latest_download/version.rb +1 -1
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 23d44d8743197b3c812686bb68aae4bbf0d4fb13
|
4
|
+
data.tar.gz: e8e2429eeb6892a3a2e3545f6d54f85671934087
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a8e5b6437d97f751ae25e48efa5734850ff240a8a4827b9066615351326821e4b0689419d57ab239067c24009dbf02008f1232f8d42ef11cfb9201d1bcbd3363
|
7
|
+
data.tar.gz: 70a6976ae11c43ba8188df895b304396184ed5627323ef3c97ac32856b502a1eb45ba98c22954f327b0cd4e7d7a6b9900283744a91e09b8167f43670b7820488
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/README.md
CHANGED
@@ -1,24 +1,33 @@
|
|
1
1
|
# HsbcLatestDownload
|
2
2
|
|
3
|
-
A script to download latest transactional data as OFX from HSBC personal online banking.
|
3
|
+
A selenium script written in ruby to download latest transactional data as OFX from HSBC personal online banking.
|
4
4
|
|
5
5
|
Use at own risk.
|
6
6
|
|
7
|
-
|
8
7
|
## Installation
|
9
8
|
|
10
|
-
|
9
|
+
### Basic installation
|
10
|
+
|
11
|
+
gem install hsbc_latest_download
|
12
|
+
|
13
|
+
### To install with signature checks to ensure that the gem has not been tampered with
|
14
|
+
|
15
|
+
gem cert --add <(curl -Ls https://raw.githubusercontent.com/mattfawcett/hsbc_latest_download/master/certs/mattfawcett.pem)
|
16
|
+
|
17
|
+
gem install hsbc_latest_download -P MediumSecurity
|
11
18
|
|
12
19
|
## Usage
|
20
|
+
Example. Run with no arguments and you will be promted for username, memorable word, and password
|
21
|
+
|
22
|
+
hsbc_latest_download
|
23
|
+
|
24
|
+
Example. Passing credentials like this is insecure. At minimum use [HISTCONTROL](http://www.linuxjournal.com/content/using-bash-history-more-efficiently-histcontrol)
|
13
25
|
|
14
|
-
|
15
|
-
hsbc_latest_download username memorableword password [optionalaccountname=HSBC ADVANCE]
|
26
|
+
hsbc_latest_download -u username -m memorableword -p password [-a optionalaccountname]
|
16
27
|
|
17
|
-
|
18
|
-
hsbc_latest_download IB1234567890 mymemorableword mypassword
|
28
|
+
Example using [password manager](https://www.passwordstore.org/)
|
19
29
|
|
20
|
-
|
21
|
-
hsbc_latest_download IB1234567890 `pass hsbc.co.uk.memorable` `pass hsbc.co.uk.password`
|
30
|
+
hsbc_latest_download -u IB1234567890 -m `pass hsbc.co.uk.memorable` -p `pass hsbc.co.uk.password`
|
22
31
|
|
23
32
|
## License
|
24
33
|
|
data/exe/hsbc_latest_download
CHANGED
@@ -1,8 +1,46 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
+
require "optparse"
|
3
4
|
require "bundler/setup"
|
4
5
|
require "hsbc_latest_download/download"
|
5
6
|
|
6
|
-
|
7
|
+
options = {account_name: 'HSBC ADVANCE'}
|
7
8
|
|
9
|
+
OptionParser.new do |opts|
|
10
|
+
opts.banner = "Usage: hsbc_latest_download options"
|
11
|
+
|
12
|
+
opts.on("-u", "--username USERNAME", "Username. Eg IB123456789") do |u|
|
13
|
+
options[:username] = u
|
14
|
+
end
|
15
|
+
|
16
|
+
opts.on("-p", "--password PASSWORD", "Password") do |p|
|
17
|
+
options[:password] = p
|
18
|
+
end
|
19
|
+
|
20
|
+
opts.on("-m", "--memorable-answer MEMORABLE", "Memorable Phrase") do |m|
|
21
|
+
options[:memorable_answer] = m
|
22
|
+
end
|
23
|
+
|
24
|
+
opts.on("-a", "--account-name ACCOUNT_NAME", "Account name: Default 'HSBC ADVANCE'") do |a|
|
25
|
+
options[:account_name] = a
|
26
|
+
end
|
27
|
+
end.parse!
|
28
|
+
|
29
|
+
unless options[:username]
|
30
|
+
puts "Enter Username:"
|
31
|
+
options[:username] = gets.chomp
|
32
|
+
end
|
33
|
+
|
34
|
+
unless options[:password]
|
35
|
+
puts "Enter Password"
|
36
|
+
options[:password] = gets.chomp
|
37
|
+
end
|
38
|
+
|
39
|
+
unless options[:memorable_answer]
|
40
|
+
puts "Enter Memorable Answer"
|
41
|
+
options[:memorable_answer] = gets.chomp
|
42
|
+
end
|
43
|
+
|
44
|
+
|
45
|
+
download = HsbcLatestDownload::Download.new(options)
|
8
46
|
download.run!
|
@@ -4,11 +4,8 @@ module HsbcLatestDownload
|
|
4
4
|
class Download
|
5
5
|
HSBC_URL = 'https://www.hsbc.co.uk/'
|
6
6
|
|
7
|
-
def initialize(
|
8
|
-
@
|
9
|
-
@memorable_answer = memorable_answer
|
10
|
-
@password = password
|
11
|
-
@account_name = account_name || 'HSBC ADVANCE'
|
7
|
+
def initialize(options)
|
8
|
+
@options = options
|
12
9
|
end
|
13
10
|
|
14
11
|
def run!
|
@@ -18,12 +15,12 @@ module HsbcLatestDownload
|
|
18
15
|
driver.find_element(partial_link_text: 'Log on').click
|
19
16
|
|
20
17
|
element = driver.find_element(:name, 'userid')
|
21
|
-
element.send_keys @username
|
18
|
+
element.send_keys @options[:username]
|
22
19
|
element.submit
|
23
20
|
|
24
21
|
driver.find_element(partial_link_text: 'Without Secure Key').click
|
25
22
|
|
26
|
-
driver.find_element(name: 'memorableAnswer').send_keys(@memorable_answer)
|
23
|
+
driver.find_element(name: 'memorableAnswer').send_keys(@options[:memorable_answer])
|
27
24
|
|
28
25
|
(1..8).each do |char|
|
29
26
|
field = driver.find_element(name: "pass#{char}")
|
@@ -35,7 +32,7 @@ module HsbcLatestDownload
|
|
35
32
|
|
36
33
|
driver.find_element(class: 'submit_input').click
|
37
34
|
|
38
|
-
driver.find_element(:link_text, @account_name).click
|
35
|
+
driver.find_element(:link_text, @options[:account_name]).click
|
39
36
|
driver.find_element(:link_text, 'Download transactions').click
|
40
37
|
|
41
38
|
wait = Selenium::WebDriver::Wait.new(:timeout => 10)
|
@@ -57,13 +54,13 @@ module HsbcLatestDownload
|
|
57
54
|
|
58
55
|
def password_character(number)
|
59
56
|
if number <= 6
|
60
|
-
return @password[number-1, 1]
|
57
|
+
return @options[:password][number-1, 1]
|
61
58
|
elsif number == 7
|
62
59
|
# second to last character
|
63
|
-
return @password[@password.length-2, 1]
|
60
|
+
return @options[:password][@options[:password].length-2, 1]
|
64
61
|
else
|
65
62
|
# last character
|
66
|
-
return @password[@password.length-1, 1]
|
63
|
+
return @options[:password][@options[:password].length-1, 1]
|
67
64
|
end
|
68
65
|
end
|
69
66
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hsbc_latest_download
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Fawcett
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
31
31
|
yJIQ7BnT75VQEqtWMfkSjOW64AVlWuD/LU/4NQykWZrh6sAaxKvhYBU/PiujaXyL
|
32
32
|
rUw5QSvC1QClur/I5qvjk8o8/hbxgQuoy5zjq8/vPBuaVDJY
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date: 2016-
|
34
|
+
date: 2016-08-03 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: selenium-webdriver
|
metadata.gz.sig
CHANGED
Binary file
|