Class: Snackhack2::CryptoExtractWebsite
- Inherits:
-
Object
- Object
- Snackhack2::CryptoExtractWebsite
- Defined in:
- lib/snackhack2/cryptoextractor.rb
Instance Attribute Summary collapse
-
#save_file ⇒ Object
Returns the value of attribute save_file.
Instance Method Summary collapse
- #bitcoin ⇒ Object
- #bitcoincash ⇒ Object
- #dash ⇒ Object
- #dogecoin ⇒ Object
- #ethereum ⇒ Object
-
#initialize(site, save_file: true) ⇒ CryptoExtractWebsite
constructor
A new instance of CryptoExtractWebsite.
- #litecoin ⇒ Object
- #monero ⇒ Object
- #run ⇒ Object
- #stellar ⇒ Object
Constructor Details
#initialize(site, save_file: true) ⇒ CryptoExtractWebsite
Returns a new instance of CryptoExtractWebsite.
9 10 11 12 13 |
# File 'lib/snackhack2/cryptoextractor.rb', line 9 def initialize(site, save_file: true) @http = Snackhack2::get(site).body @site = site @save_file = save_file end |
Instance Attribute Details
#save_file ⇒ Object
Returns the value of attribute save_file.
7 8 9 |
# File 'lib/snackhack2/cryptoextractor.rb', line 7 def save_file @save_file end |
Instance Method Details
#bitcoin ⇒ Object
36 37 38 |
# File 'lib/snackhack2/cryptoextractor.rb', line 36 def bitcoin @http.scan(/(bc(0([ac-hj-np-z02-9]{39}|[ac-hj-np-z02-9]{59})|1[ac-hj-np-z02-9]{8,87})|[13][a-km-zA-HJ-NP-Z1-9]{25,35})/) end |
#bitcoincash ⇒ Object
60 61 62 |
# File 'lib/snackhack2/cryptoextractor.rb', line 60 def bitcoincash @http.scan(/[13][a-km-zA-HJ-NP-Z1-9]{33}/) end |
#dash ⇒ Object
40 41 42 |
# File 'lib/snackhack2/cryptoextractor.rb', line 40 def dash @http.scan(/X[1-9A-HJ-NP-Za-km-z]{33}/) end |
#dogecoin ⇒ Object
52 53 54 |
# File 'lib/snackhack2/cryptoextractor.rb', line 52 def dogecoin @http.scan(/D{1}[56789ABCDEFGHJKLMNPQRSTU]{1}[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{32}$/) end |
#ethereum ⇒ Object
56 57 58 |
# File 'lib/snackhack2/cryptoextractor.rb', line 56 def ethereum @http.scan(/0x[a-fA-F0-9]{40}/) end |
#litecoin ⇒ Object
48 49 50 |
# File 'lib/snackhack2/cryptoextractor.rb', line 48 def litecoin @http.scan(/[LM3][a-km-zA-HJ-NP-Z1-9]{26,33}/) end |
#monero ⇒ Object
32 33 34 |
# File 'lib/snackhack2/cryptoextractor.rb', line 32 def monero @http.scan(/[48][0-9AB][1-9A-HJ-NP-Za-km-z]{93}/) end |
#run ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/snackhack2/cryptoextractor.rb', line 15 def run addresses = [] addresses << monero unless monero.nil? addresses << bitcoin unless bitcoin.nil? addresses << dash unless dash.nil? addresses << ethereum unless ethereum.nil? addresses << bitcoincash unless bitcoincash.nil? addresses << litecoin unless litecoin.nil? addresses << dogecoin unless dogecoin.nil? addresses << stellar unless stellar.nil? if @save_file Snackhack2::file_save(@site, "cryptoaddresses", addresses.uniq.join("\n")) else puts addresses.join("\n") end end |
#stellar ⇒ Object
44 45 46 |
# File 'lib/snackhack2/cryptoextractor.rb', line 44 def stellar @http.scan(/G[A-Z0-9]{55}$/) end |