blackstack-core 1.2.6 → 1.2.8

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/functions.rb +29 -0
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e20eda958e546f00eac3c382b48fed8db4f1135af8812aa7528451874a6062a6
4
- data.tar.gz: f80428ef50682e92675171df3bacaf3ace9fbf27c058ac06c33f8fc98cd6ebec
3
+ metadata.gz: ec4a7f0ff79d1a2d5b75fcfec7b550b0d1bc488cc5d53b5fa38a4c6c56e8988f
4
+ data.tar.gz: 0544bda4b8b7d0ee1c041c34244dfc77c775a45775c7b846cf5213f59cd14950
5
5
  SHA512:
6
- metadata.gz: d20b57b719e81cf67cacd0f0b0138ac6e1d00a964fdb9f238f44f28d4f181580a38eaf80037b2ad39ddaaa02628b1d0e6a3d52edb8336dbb66ea10a586ad18fc
7
- data.tar.gz: aa8b0f4a23e5120eda417b785425fbe28d1990fba701c1d0b9e01ff8ecc3ca72defa45a601ef0ae2ee874973ad41d96915b2be51a720efe1b2427372eb18ca3b
6
+ metadata.gz: 74c684e58c57dac13ad568cad95e1319fb1bc7db9f0e247fd169bbf6862ac205db5ba9a759111ba62c9bb87c5988753e330dbd685a67368847ea7af4aa15290f
7
+ data.tar.gz: 3b51ad3b02c831291832e8e8ac5544ec71be93d52aa222840baf603b461019e25c6395441ade0d953224ade193c3692c3b71598111d2768312ceb81c0ccd1708
data/lib/functions.rb CHANGED
@@ -819,6 +819,35 @@ module BlackStack
819
819
  return a
820
820
  end
821
821
 
822
+ # raise an exception if `email` is not a valid email address.
823
+ # return an array with the companies who are hosting an email address, by running the linux command `host`.
824
+ def self.getMailHandler(email)
825
+ value = email
826
+ # raise an exception if the data type is an email, but the email is not valid.
827
+ raise "Email #{value} is not valid" if !value.email?
828
+ # extract the domain from the email
829
+ domain = value.split('@').last
830
+ # run the `host` command
831
+ s = `host -t mx #{domain}`
832
+ # extract the domains from the output
833
+ a = s.split("\n").map { |l| l.split.last }
834
+ # extract the company who is hosting the mail
835
+ a.map { |d| d.split('.').last(2).join('.') }.uniq
836
+ end
837
+
838
+ # raise an exception if `email` is not a valid email address.
839
+ # return if the email domain is gmail, hotmail, outlook, yahoo, comcast, aol, msn or sbcglobal.
840
+ def self.isPersonalEmail?(email)
841
+ value = email
842
+ # raise an exception if the data type is an email, but the email is not valid.
843
+ raise "Email #{value} is not valid" if !value.email?
844
+ # extract the domain from the email
845
+ domain = value.split('@').last
846
+ #
847
+ domain~=/gmail\.com/ || domain~=/hotmail\.com/ || domain~=/outlook\.com/ || domain~=/yahoo\.com/ || domain~=/comcast\.com/ || domain~=/aol\.com/ || domain~=/msn\.com/ || domain~=/sbcglobal\.net/
848
+ end
849
+
850
+
822
851
  end # module Netting
823
852
 
824
853
  end # module BlackStack
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blackstack-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.6
4
+ version: 1.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leandro Daniel Sardi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-06-28 00:00:00.000000000 Z
11
+ date: 2023-07-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: content_spinning