tri 0.0.13 → 0.1.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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/tri.rb +225 -249
  3. metadata +7 -13
  4. data/lib/get.rb +0 -182
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6ef3f6b25b54883c200229d16b29a7dcdd6f48bf
4
- data.tar.gz: 7e2974f391573bb9c6a6c060953fea9380d08652
3
+ metadata.gz: 2725b2f7d1797d43c8337ab6c00c868decfe68f9
4
+ data.tar.gz: 2b8570cb258a54ae3c061f569ccaf370c9de95b2
5
5
  SHA512:
6
- metadata.gz: 3103454f6935a5c8cf20ed43e0ae397dd2065853facd1bd5d26d120645c9608ed32b4053ae6e36a836c4be84a2d5fadc6e1796210b7582f3b50b9f6563f97a95
7
- data.tar.gz: e44a9b5d594f9989fb78b57062a9e1c70cbcca35e612c5f644d68a05f87e2791adc6571fed04de9da39bb63effb34cb54b909524998afebbb03b71113feeaa9c
6
+ metadata.gz: a1b69639c0f9abd52c1a9b8c6f148954c01f34a0c5b4892ee63da941376a9b57891957ffc70a6c93a2eea517019463401191dd789937362d954239bd55010626
7
+ data.tar.gz: 83198b95e44c0393c2ba0e07fb5b355f0c495f43de071e7ecf384bb43e5a60bd949c3b482d537580fd22fcf7cf82ce2f7c9e4c9bd21c5934a37174ba6c38888e
data/lib/tri.rb CHANGED
@@ -1,267 +1,243 @@
1
- require_relative 'get.rb'
1
+ require 'socket' # Provides TCPServer and TCPSocket classes
2
+ require 'digest' # Using decode SHA1 from a base64 digest
2
3
 
3
4
  module Tri
4
-
5
- def self::name
6
- Get::NAME[rand(Get::NAME.length)]
7
- end
8
-
9
- def self::fullname
10
- middle = [" II", " III", ", Jr.", ", Sr."]
11
- if (rand(100)<80)
12
- Get::NAME[rand(Get::NAME.length)] + " " + Get::NAME[rand(Get::NAME.length)]
13
- else
14
- if (rand(100)<50)
15
- Get::NAME[rand(Get::NAME.length)] + " " + Get::NAME[rand(Get::NAME.length)][0].upcase + ". " + Get::NAME[rand(Get::NAME.length)]
5
+ # Start a WetSocket with TCP/IP layer
6
+ def self.start(input1="localhost", input2 = 888)
7
+ # Check input parameters
8
+ if !input1.is_a? String
9
+ hostname = "localhost"
10
+ port = input1
16
11
  else
17
- Get::NAME[rand(Get::NAME.length)] + " " + Get::NAME[rand(Get::NAME.length)] + middle[rand(middle.length)]
12
+ hostname = input1
13
+ port = input2
14
+ end
15
+ # Trying to init a new TCPserver
16
+ begin
17
+ @server = TCPServer.new(hostname,port)
18
+ # Catch err raised by the command above
19
+ rescue SystemCallError => err
20
+ # Return error code
21
+ "[ERROR] Trying to start the server @" + hostname + ":" + port.to_s + ".\r\n[ERROR] " + err.to_s
22
+ else
23
+ # Return success message
24
+ "[SERVER] The server is now listening @" + hostname + ":" + port.to_s + "."
18
25
  end
19
- end
20
26
  end
21
27
 
22
- def self::sentence
23
- case rand(57)
24
- when 0
25
- "My #{Get::PRONOUN[rand(Get::PRONOUN.length)]} love to see the #{Get::ANIMAL[rand(Get::ANIMAL.length)]} in the local zoo."
26
- when 1
27
- "Our #{Get::PRONOUN[rand(Get::PRONOUN.length)]} love to see the #{Get::ANIMAL[rand(Get::ANIMAL.length)]} in the local zoo."
28
- when 2
29
- "#{Get::NAME[rand(Get::NAME.length)]}'s #{Get::PRONOUN[rand(Get::PRONOUN.length)]} do not like the local zoo because it has the #{Get::ANIMAL[rand(Get::ANIMAL.length)]}."
30
- when 3
31
- "My #{Get::PRONOUN[rand(Get::PRONOUN.length)]} love to see the #{Get::FISH[rand(Get::FISH.length)]} in the local aquarium."
32
- when 4
33
- "Our #{Get::PRONOUN[rand(Get::PRONOUN.length)]} love to see the #{Get::FISH[rand(Get::FISH.length)]} in the local aquarium."
34
- when 5
35
- "#{Get::NAME[rand(Get::NAME.length)]}'s #{Get::PRONOUN[rand(Get::PRONOUN.length)]} do not like the local aquarium because it has the #{Get::FISH[rand(Get::FISH.length)]}."
36
- when 6
37
- "#{Get::EMOTION_GOOD[rand(Get::EMOTION_GOOD.length)]} I just meet #{Get::CELEBRITY[rand(Get::CELEBRITY.length)]}."
38
- when 7
39
- "#{Get::EMOTION_GOOD[rand(Get::EMOTION_GOOD.length)]} My #{Get::PRONOUN[rand(Get::PRONOUN.length)]} just take a selfie picture with #{Get::CELEBRITY[rand(Get::CELEBRITY.length)]}."
40
- when 8
41
- "#{Get::EMOTION_GOOD[rand(Get::EMOTION_GOOD.length)]} #{Get::CELEBRITY[rand(Get::CELEBRITY.length)]} adds 'friend' with our #{Get::PRONOUN[rand(Get::PRONOUN.length)]} on Facbook."
42
- when 9
43
- "Should I watch #{Get::SPORT[rand(Get::SPORT.length)]} or #{Get::SPORT[rand(Get::SPORT.length)]} match on TV?"
44
- when 10
45
- "Should I buy tickets for #{Get::SPORT[rand(Get::SPORT.length)]} or #{Get::SPORT[rand(Get::SPORT.length)]} match this weekend?"
46
- when 11
47
- "Should I become a #{Get::SPORT[rand(Get::SPORT.length)]} or #{Get::SPORT[rand(Get::SPORT.length)]} fan of my town team?"
48
- when 12
49
- "I usually like #{Get::HOBBY[rand(Get::HOBBY.length)]} with my leisure time."
50
- when 13
51
- "#{Get::HOBBY[rand(Get::HOBBY.length)].capitalize} with my #{Get::PRONOUN[rand(Get::PRONOUN.length)]} whenever I have free time is my favorite hobby."
52
- when 14
53
- "Is not a good idea to spend time #{Get::HOBBY[rand(Get::HOBBY.length)]} with #{Get::NAME[rand(Get::NAME.length)]}'s #{Get::PRONOUN[rand(Get::PRONOUN.length)]}."
54
- when 15
55
- "I just wonder if #{Get::CELEBRITY[rand(Get::CELEBRITY.length)]} loves #{Get::HOBBY[rand(Get::HOBBY.length)]} like me?"
56
- when 16
57
- "I dont think #{Get::CELEBRITY[rand(Get::CELEBRITY.length)]} likes #{Get::HOBBY[rand(Get::HOBBY.length)]}."
58
- when 17
59
- "People say that #{Get::HOBBY[rand(Get::HOBBY.length)]} is the only hobby of #{Get::CELEBRITY[rand(Get::CELEBRITY.length)]}."
60
- when 18
61
- "Finally, #{Get::CITY[rand(Get::CITY.length)]}, home sweet home!"
62
- when 19
63
- "Me and my #{Get::PRONOUN[rand(Get::PRONOUN.length)]} will visit #{Get::CITY[rand(Get::CITY.length)]} next #{Get::NUMBER[rand(Get::NUMBER.length)]} #{Get::TIME[rand(Get::TIME.length)]}."
64
- when 20
65
- "Next #{Get::NUMBER[rand(Get::NUMBER.length)]} #{Get::TIME[rand(Get::TIME.length)]}, I will move back to #{Get::CITY[rand(Get::CITY.length)]}."
66
- when 21
67
- "I am going to transit at #{Get::CITY[rand(Get::CITY.length)]}'s airport for a few hours."
68
- when 22
69
- "My #{Get::PRONOUN[rand(Get::PRONOUN.length)]} think the #{Get::LANDMARK[rand(Get::LANDMARK.length)]} belongs to #{Get::COUNTRY[rand(Get::COUNTRY.length)]}."
70
- when 23
71
- "Is it true that #{Get::LANDMARK[rand(Get::LANDMARK.length)]} resides in #{Get::COUNTRY[rand(Get::COUNTRY.length)]}."
72
- when 24
73
- "The air tickets flying to #{Get::LANDMARK[rand(Get::LANDMARK.length)]} will be sky high in next #{Get::NUMBER[rand(Get::NUMBER.length)]} #{Get::TIME[rand(Get::TIME.length)]}."
74
- when 25
75
- "I used to be a #{Get::JOB[rand(Get::JOB.length)]} before becoming a #{Get::JOB[rand(Get::JOB.length)]}."
76
- when 26
77
- "#{Get::NUMBER[rand(Get::NUMBER.length)].capitalize} #{Get::TIME[rand(Get::TIME.length)]} ago, I still was a #{Get::JOB[rand(Get::JOB.length)]}."
78
- when 27
79
- "Becoming a #{Get::JOB[rand(Get::JOB.length)]} is one of my childish dreams!"
80
- when 28
81
- "My son wants a #{Get::FISH[rand(Get::FISH.length)]} fish pet while his sister demands a #{Get::ANIMAL[rand(Get::ANIMAL.length)]}!"
82
- when 29
83
- "Would you like a #{Get::BIRD[rand(Get::BIRD.length)]} bird or a #{Get::FISH[rand(Get::FISH.length)]} fish for your birthday gift?"
84
- when 30
85
- "My #{Get::PRONOUN[rand(Get::PRONOUN.length)]} just found a brand new #{Get::BIRD[rand(Get::BIRD.length)]} bird in #{Get::CITY[rand(Get::CITY.length)]}."
86
- when 31
87
- "According to the #{Get::NEWS[rand(Get::NEWS.length)]} news channel, #{Get::COMPANY[rand(Get::COMPANY.length)]} will expand its business to #{Get::COUNTRY[rand(Get::COUNTRY.length)]}."
88
- when 32
89
- "There are alot of rumors about the #{Get::COMPANY[rand(Get::COMPANY.length)]} corp will be accquiring the #{Get::COMPANY[rand(Get::COMPANY.length)]} within #{Get::NUMBER[rand(Get::NUMBER.length)]} #{Get::TIME[rand(Get::TIME.length)]}."
90
- when 33
91
- "Wait a minute! Is it true that the #{Get::COMPANY[rand(Get::COMPANY.length)]} corp is hiring alot of #{Get::JOB[rand(Get::JOB.length)]} positions?!?!"
92
- when 34
93
- "I am trying to apply for a job in the #{Get::COMPANY[rand(Get::COMPANY.length)]} company in #{Get::CITY[rand(Get::CITY.length)]} city."
94
- when 35
95
- "Have you ever tried the #{Get::FOOD[rand(Get::FOOD.length)]} food in #{Get::CITY[rand(Get::CITY.length)]} yet?"
96
- when 36
97
- "I have heard my #{Get::PRONOUN[rand(Get::PRONOUN.length)]} say something good about the #{Get::FOOD[rand(Get::FOOD.length)]} food."
98
- when 37
99
- "Somebody say that the #{Get::FOOD[rand(Get::FOOD.length)]} deli is came from #{Get::COUNTRY[rand(Get::COUNTRY.length)]}."
100
- when 38
101
- "I love to make the #{Get::FOOD[rand(Get::FOOD.length)]} for my #{Get::PRONOUN[rand(Get::PRONOUN.length)]}."
102
- when 40
103
- "#{Get::COLOR[rand(Get::COLOR.length)].capitalize} is a #{Get::ADJECTIVE[rand(Get::ADJECTIVE.length)]} color."
104
- when 41
105
- "Althought #{Get::COLOR[rand(Get::COLOR.length)]} color is a #{Get::ADJECTIVE[rand(Get::ADJECTIVE.length)]}, its not my favorite."
106
- when 42
107
- "I love that #{Get::COLOR[rand(Get::COLOR.length)]} car, but I buy the #{Get::COLOR[rand(Get::COLOR.length)]}."
108
- when 43
109
- "I am not really fond of the #{Get::TVSHOW[rand(Get::TVSHOW.length)]} season #{Get::NUMBER[rand(Get::NUMBER.length)]}, but my #{Get::PRONOUN[rand(Get::PRONOUN.length)]} are."
110
- when 44
111
- "Hurry up guys! the #{Get::TVSHOW[rand(Get::TVSHOW.length)]} show will be on in any minutes."
112
- when 45
113
- "Its been awhile from the last season of the #{Get::TVSHOW[rand(Get::TVSHOW.length)]} show."
114
- when 46
115
- "We are expecting the realease of the #{Get::TVSHOW[rand(Get::TVSHOW.length)]} show will be next #{Get::NUMBER[rand(Get::NUMBER.length)]} #{Get::TIME[rand(Get::TIME.length)]}."
116
- when 47
117
- "It is hard to understand why all of my #{Get::PRONOUN[rand(Get::PRONOUN.length)]} can watch the #{Get::MOVIE[rand(Get::MOVIE.length)]} many times."
118
- when 48
119
- "The main actress of the #{Get::MOVIE[rand(Get::MOVIE.length)]} is so #{Get::ADJECTIVE[rand(Get::ADJECTIVE.length)]}."
120
- when 49
121
- "The #{Get::MOVIE[rand(Get::MOVIE.length)]} movie is indeed a good one."
122
- when 50
123
- "Should I turn this $@$*@ #{Get::TVSHOW[rand(Get::TVSHOW.length)]} show off to watch the #{Get::MOVIE[rand(Get::MOVIE.length)]} movie."
124
- when 51
125
- "We love to use #{Get::TRANSPORT[rand(Get::TRANSPORT.length)]} around the #{Get::CITY[rand(Get::CITY.length)]} city."
126
- when 52
127
- "Now I know why #{Get::CELEBRITY[rand(Get::CELEBRITY.length)]} never uses freaking #{Get::TRANSPORT[rand(Get::TRANSPORT.length)]} any more."
128
- when 53
129
- "My favorite movie of all time is the #{Get::MOVIE[rand(Get::MOVIE.length)]}."
130
- when 54
131
- "After I watched the #{Get::MOVIE[rand(Get::MOVIE.length)]} movie many times, I still dont know the story!"
132
- when 55
133
- "I would rather buy the ticket for the #{Get::MOVIE[rand(Get::MOVIE.length)]} or the #{Get::MOVIE[rand(Get::MOVIE.length)]}?"
134
- when 56
135
- "One of my #{Get::PRONOUN[rand(Get::PRONOUN.length)]} suggests that I should download the #{Get::MOVIE[rand(Get::MOVIE.length)]} movie right away."
136
- else
137
- "When I was little I had a car door slammed shut on my hand. I still remember it quite vividly."
138
- end
28
+ # Check if the server is till running
29
+ def self.is_running?
30
+ !@server.nil?
139
31
  end
140
32
 
141
- def self.email_with_gravatar(id = 0)
142
- max = 1 + rand(130);
143
- if (id == 0)
144
- "user" + max.to_s + "@hdtri.ca"
145
- elsif (id > 0)
146
- "user" + id.to_s + "@hdtri.ca"
147
- else
148
- "Please input a number that greater than zero."
149
- end
33
+ # Accept the connection from client
34
+ def self.get_client
35
+ if is_running?
36
+ client = @server.accept
37
+
38
+ # Got a connection from a client
39
+ if key = validWebSocketRequest?(client)
40
+ # Send the respone back for handshaking phase
41
+ client.print caculateRequestReply(key)
42
+ else
43
+ # Close the connection due to invalid WebSocket requests
44
+ client.close
45
+ client = nil
46
+ end
47
+ end
48
+
49
+ # Return the client
50
+ client
150
51
  end
151
52
 
152
- def self.email(name = nil)
153
- if (name == nil)
154
- generate_email_prefix + "@" + generate_email_domain + generate_email_suffix
155
- else
156
- name.to_s + "@" + generate_email_domain + generate_email_suffix
157
- end
53
+ # Accept the connection from client with a keep alive
54
+ def self.get_client_with_keep_alive(second)
55
+ if is_running?
56
+ client = @server.accept
57
+
58
+ # Got a connection from a client
59
+ if key = validWebSocketRequest?(client)
60
+ # Send the respone back for handshaking phase
61
+ client.print caculateRequestReply(key)
62
+ # Sending PING, for every 28 sec
63
+ Thread.new {
64
+ while client
65
+ ping_to(client)
66
+ sleep(second)
67
+ end
68
+ }
69
+ else
70
+ # Close the connection due to invalid WebSocket requests
71
+ client.close
72
+ client = nil
73
+ end
74
+ end
75
+
76
+ # Return the client
77
+ client
78
+ end
79
+
80
+ # Trying to get data from client
81
+ def self.receive_from(client)
82
+ data = getData(client)
83
+ case data
84
+ when -2
85
+ [-2,"[ERROR] Huge payload - should close the connection."]
86
+ when -1
87
+ [-2,"[ERROR] No data due to connection timeout."]
88
+ when 8
89
+ [8, "[CLOSE] Close frame sent from the client."]
90
+ when 9
91
+ [8, "[OPCODE] PING frame sent from the client."]
92
+ when 10
93
+ [9, "[OPCODE] PONG frame sent from the client."]
94
+ else
95
+ [1, data]
96
+ end
158
97
  end
159
98
 
160
- def self.url(name = nil)
161
- if (name == nil)
162
- "http://" + generate_email_domain + generate_email_suffix
163
- else
164
- "http://" + generate_email_domain + generate_email_suffix + "/" + name.to_s + "/"
165
- end
166
- end
167
-
168
- private
99
+ # Send a PING frame to client
100
+ def self.ping_to(client)
101
+ pingData = "CHAT4NINJA"
102
+ firstByte = "10001001".to_i(2).chr
103
+ secondByte = pingData.size.chr
104
+ client.write(firstByte + secondByte + pingData)
105
+ end
169
106
 
170
- def self.generate_email_suffix
171
- suffix_code = ""
172
- case rand(3)
173
- when 0
174
- # generate contry code: .ca, .uk, us
175
- suffix_code += "." + Get::ALPHABET.shuffle[0] + Get::ALPHABET.shuffle[0]
176
- when 1
177
- # generate original code: .com, .net, .org
178
- suffix_code += Get::EMAIL_SUFFIX[rand(Get::EMAIL_SUFFIX.length)]
179
- else
180
- suffix_code += Get::EMAIL_SUFFIX[rand(Get::EMAIL_SUFFIX.length)] + "." + Get::ALPHABET.shuffle[0] + Get::ALPHABET.shuffle[0]
181
- end
182
- end
183
-
184
- def self.generate_email_prefix
185
- prefix_name = ""
186
- case rand(6)
187
- when 0
188
- prefix_name += Get::NAME[rand(Get::NAME.length)]
189
- when 1
190
- prefix_name += Get::NAME[rand(Get::NAME.length)][0] + "." + Get::NAME[rand(Get::NAME.length)]
191
- when 2
192
- prefix_name += Get::NAME[rand(Get::NAME.length)][0] + "-" + Get::NAME[rand(Get::NAME.length)]
193
- when 3
194
- prefix_name += Get::NAME[rand(Get::NAME.length)] + "." + Get::NAME[rand(Get::NAME.length)]
195
- when 4
196
- prefix_name += Get::NAME[rand(Get::NAME.length)] + "-" + Get::NAME[rand(Get::NAME.length)]
107
+ # Send data to client
108
+ def self.send_to(client,data)
109
+ firstByte = "10000001".to_i(2).chr
110
+ if data.size <=127
111
+ secondByte = data.size.chr
112
+ client.write(firstByte + secondByte + data)
197
113
  else
198
- prefix_name += Get::EMAIL_PREFIX[rand(Get::EMAIL_PREFIX.length)]
114
+ binaryString= data.size.to_s(2)
115
+ extraZero = ""
116
+ (16 - binaryString.size).times do
117
+ extraZero += "0"
118
+ end
119
+ extraZero = extraZero + binaryString
120
+ secondByte = "01111110".to_i(2).chr
121
+ thirdByte = extraZero[0..7].to_i(2).chr
122
+ forthByte = extraZero[8..15].to_i(2).chr
123
+
124
+ begin
125
+ client.write(firstByte + secondByte + thirdByte + forthByte + data)
126
+ # Catch err raised by the command above
127
+ rescue SystemCallError => err
128
+ # Return error code
129
+ "[ERROR] Trying to send {" + firstByte + secondByte + thirdByte + forthByte + data + "} " + err.to_s
130
+ else
131
+ # Return success message
132
+
133
+ end
199
134
  end
200
- prefix_name.downcase
201
- end
202
-
203
- def self.generate_email_domain
204
- domain_name = ""
205
- case rand(25)
206
- when 0
207
- domain_name += Get::EMAIL_DOMAIN[rand(Get::EMAIL_DOMAIN.length)].downcase
208
- when 1
209
- domain_name += Get::ADJECTIVE[rand(Get::ADJECTIVE.length)].downcase
210
- when 2
211
- domain_name += Get::NEWS[rand(Get::NEWS.length)].downcase
212
- when 3
213
- domain_name += Get::COMPANY[rand(Get::COMPANY.length)].downcase.gsub(" ", "-")
214
- when 4
215
- domain_name += Get::TIME[rand(Get::TIME.length)]
216
- when 5
217
- domain_name += Get::NUMBER[rand(Get::NUMBER.length)]
218
- when 6
219
- domain_name += Get::JOB[rand(Get::JOB.length)].downcase.gsub(" ", "-")
220
- when 7
221
- domain_name += Get::HOBBY[rand(Get::HOBBY.length)].downcase.gsub(" ", "-")
222
- when 8
223
- domain_name += Get::FISH[rand(Get::FISH.length)].downcase.gsub(" ", "-")
224
- when 9
225
- domain_name += Get::JOB[rand(Get::JOB.length)].downcase.gsub(" ", "-")
226
- when 10
227
- domain_name += Get::BIRD[rand(Get::BIRD.length)].downcase.gsub(" ", "-")
228
- when 11
229
- domain_name += Get::ANIMAL[rand(Get::ANIMAL.length)].downcase.gsub(" ", "-")
230
- when 12
231
- domain_name += Get::LANDMARK[rand(Get::LANDMARK.length)].downcase.gsub(" ", "-")
232
- when 13
233
- domain_name += Get::COUNTRY[rand(Get::COUNTRY.length)].downcase.gsub(" ", "-")
234
- when 14
235
- domain_name += Get::CITY[rand(Get::CITY.length)].downcase.gsub(" ", "-")
236
- when 15
237
- domain_name += Get::COLOR[rand(Get::COLOR.length)].downcase.gsub(" ", "-")
238
- when 16
239
- domain_name += Get::TRANSPORT[rand(Get::TRANSPORT.length)].downcase.gsub(" ", "-")
240
- when 17
241
- domain_name += Get::FOOD[rand(Get::FOOD.length)].downcase.gsub(" ", "-")
242
- when 18
243
- domain_name += Get::SPORT[rand(Get::SPORT.length)].downcase.gsub(" ", "-")
244
- when 19
245
- domain_name += Get::TVSHOW[rand(Get::TVSHOW.length)].downcase.gsub(" ", "-")
246
- when 20
247
- domain_name += Get::MOVIE[rand(Get::MOVIE.length)].downcase.gsub(" ", "-")
248
- when 21
249
- domain_name += Get::PRONOUN[rand(Get::PRONOUN.length)].downcase.gsub(" ", "-")
250
- when 22
251
- domain_name += Get::CELEBRITY[rand(Get::CELEBRITY.length)].downcase.gsub(" ", "-")
252
- else
253
- domain_name += Get::NAME[rand(Get::NAME.length)].downcase.gsub(" ", "-")
135
+ end
136
+
137
+ #Private variables and functions
138
+ private
139
+ # Check if the client sent right request for WebSocket protocol
140
+ def self.validWebSocketRequest?(client)
141
+ handshakeKeys = Hash.new
142
+ if (client.gets.include?("GET / HTTP/1.1"))
143
+ while (requests = client.gets) && (requests != "\r\n")
144
+ if requests.include?(": ")
145
+ requests = requests.split(": ")
146
+ if requests.size == 2
147
+ handshakeKeys[requests[0]] = requests[1].chomp
148
+ end
149
+ end
150
+ end
151
+ handshakeKeys["sec-websocket-key"] # return the key
152
+ else
153
+ "" # return nil
154
+ end
254
155
  end
255
156
 
256
- case rand(8)
257
- when 0
258
- domain_name += "mail"
259
- when 1
260
- domain_name += "-mail"
261
- when 2
262
- domain_name += (rand(99) + 1).to_s
263
- else
264
- domain_name
157
+ # Respond the request of the WebSocket client
158
+ def self.caculateRequestReply(key)
159
+ "HTTP/1.1 101 Switching Protocols\r\n" +
160
+ "Upgrade: websocket\r\n" +
161
+ "Connection: Upgrade\r\n" +
162
+ "Sec-WebSocket-Accept: #{sha_1(key)}\r\n\r\n"
265
163
  end
266
- end
267
- end
164
+
165
+ # Return SHA1 for the base64 digest
166
+ def self.sha_1(input)
167
+ Digest::SHA1.base64digest(input+"258EAFA5-E914-47DA-95CA-C5AB0DC85B11")
168
+ end
169
+
170
+ # Decode payload data using the mask-keys
171
+ def self.decodeData(input, mask)
172
+ data = ""
173
+ for i in 0..7 do
174
+ if input[i]==mask[i]
175
+ data += "0"
176
+ else
177
+ data += "1"
178
+ end
179
+ end
180
+ data.to_i(2).chr
181
+ end
182
+
183
+ # Receiving all payload data from client
184
+ def self.getData(client)
185
+ frame = Hash.new
186
+ # First 8 bits after connected
187
+ receiveByte = client.recv(1).unpack("B*").join
188
+ if receiveByte != ""
189
+
190
+ frame["fin"] = receiveByte[0].to_i(2)
191
+ frame["rsv"] = receiveByte[1..3].to_i(2)
192
+ frame["opcode"] = receiveByte[4..7].to_i(2)
193
+
194
+ # Second 8 bits
195
+ receiveByte = client.recv(1).unpack("B*").join
196
+ frame["mask"] = receiveByte[0].to_i(2)
197
+ frame["payload"]= receiveByte[1..7].to_i(2)
198
+
199
+
200
+ # Load more frame["payload"]?
201
+ if frame["payload"] >= 126
202
+ loadMore = 0
203
+ newPayload = ""
204
+ if frame["payload"] == 126
205
+ loadMore = 2
206
+ end
207
+ if frame["payload"] == 127
208
+ loadMore = 8
209
+ end
210
+ loadMore.times do
211
+ newPayload += client.recv(1).unpack("B*").join
212
+ end
213
+ frame["payload"] = newPayload.to_i(2)
214
+ end
215
+
216
+ if frame["payload"] <= 500
217
+ # Load the MASKEY or not
218
+ if frame["mask"] == 1
219
+ frame["mask-key"] = Array.new
220
+ for i in 0..3
221
+ frame["mask-key"].push client.recv(1).unpack("B*").join
222
+ end
223
+ end
224
+
225
+ # Load data based-on the payload
226
+ frame["data"] = ""
227
+ for i in 0..(frame["payload"]-1)
228
+ frame["data"] += decodeData(client.recv(1).unpack("B*").join,frame["mask-key"][i % 4])
229
+ end
230
+
231
+ if frame["opcode"] != 1
232
+ frame["opcode"]
233
+ else
234
+ frame["data"]
235
+ end
236
+ else
237
+ -2
238
+ end
239
+ else
240
+ -1 # no data
241
+ end
242
+ end
243
+ end
metadata CHANGED
@@ -1,29 +1,24 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tri
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.13
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tri Huynh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-19 00:00:00.000000000 Z
11
+ date: 2016-01-29 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description: "Generate sound-like-real information: sentence, name, email, email with
14
- gravatar ready, url:\n [Tri::name], \n [Tri::fullname],
15
- \n [Tri::sentence], \n [Tri::email],
16
- \n [Tri::email(name)],\n [Tri::email_with_gravatar],\n
17
- \ [Tri::email_with_gravatar(number>0)],\n [Tri::url],\n
18
- \ [Tri::url(name)]\n "
19
- email: hdtri.expert@gmail.com
13
+ description: Pure ruby code to run a WebSocket server.
14
+ email:
15
+ - hdtri.expert@gmail.com
20
16
  executables: []
21
17
  extensions: []
22
18
  extra_rdoc_files: []
23
19
  files:
24
- - lib/get.rb
25
20
  - lib/tri.rb
26
- homepage: https://trihuynh.herokuapp.com
21
+ homepage: http://chat4ninja.com
27
22
  licenses:
28
23
  - MIT
29
24
  metadata: {}
@@ -46,6 +41,5 @@ rubyforge_project:
46
41
  rubygems_version: 2.5.1
47
42
  signing_key:
48
43
  specification_version: 4
49
- summary: 'Generate sound-like-real information: sentence, name, email, email with
50
- gravatar ready, url.'
44
+ summary: Simple WebSocket server.
51
45
  test_files: []
data/lib/get.rb DELETED
@@ -1,182 +0,0 @@
1
- module Get
2
-
3
- NAME = ["Tri", "Huynh", "Nguyen", "Hoang", "Le", "Trang", "Tam", "Phuong", "Huong", "Hong", "Linh", "Thang", "Tin", "Khoi",
4
- "Phan", "Trinh", "Do", "Ho", "Ngo", "Duong", "Ly", "An", "Bach", "Banh", "Chau", "Chu", "Chung", "Diep", "Doan",
5
- "Giang", "Ha", "Han", "Kieu", "Kim", "Kim", "La", "Lac", "Luong", "Ma", "Nghiem", "Than", "Thao", "To", "Tong",
6
- "Trang", "Trinh", "Trieu", "Truong", "Vinh", "Vuong", "Vuu", "Wang", "Li", "Chang", "Liu", "Chen", "Yang", "Huang",
7
- "Wu", "Hsu", "Sun", "Chu", "Zeng", "Leung", "Yuen", "Poon", "Jyu", "Yip", "Zhang", "Wei", "Min", "Xiuying", "Wang",
8
- "Yuka", "Ren", "Hiroki", "Kana", "Haruka", "Kazuki", "Ayano", "Daiki", "Yamoto", "Daisuke", "Shinji", "Hiroaki",
9
- "Sayaka", "Tomoko", "Natsuki", "Makoto", "Ayana", "Toshi", "Narumi", "Mika", "Takeshi", "Yoko", "Kyoko", "Takaya",
10
- "Min-jun", "Ju-won", "Jun-seo", "Ji-hu", "Min-hun", "Ji-min", "Su-bin", "Eun-seo", "Hyeon-u", "U-jin", "Ji-min",
11
- "Anastasia", "Dima", "Alex", "Maria", "Sergey", "Vlad", "Max", "Egor", "Roman", "Oleg", "Kostya", "Daniel", "Nick",
12
- "Lena", "Kristina", "Sofia", "Natalia", "Helen", "Andrei", "Victoria", "Kseniya", "Svetlana", "Nikolai", "Sophia",
13
- "Asya", "Alexander", "Ksenya", "Vova", "Valentina", "Bekhan", "Katherine", "Aleksei", "Michael", "Eugene", "Leonid",
14
- "James", "David", "Chirstoper", "George", "Ronald", "John", "Richard", "Daniel", "Patrica", "Maria", "Margaret",
15
- "Elizabeth", "Dorothy", "Betty", "Karen", "Sarah", "Laura", "Michelle", "Donna", "Edward", "Jason", "Jeff", "Mark",
16
- "Kevin", "Paul", "Nathan", "Fever", "Amy", "George", "Nancy", "Carol", "Susan", "Deborah", "Kimberly", "Joseph",
17
- "Marie", "Nicolas", "Antoinie", "Lucas", "Athur", "Jodan", "Caroline", "Amelie", "Celine", "Celia", "Sophie", "Elise",
18
- "Charlotte", "Guillaume", "Pierre", "Pauline", "Oceane", "Justine", "Clara", "Cassandra", "Cindy", "Stepphane",
19
- "Sylvain", "Gergory", "Christophe", "Phillippe", "Angelique", "Pablo", "Paula", "Lucia", "Alejandro", "Carlos",
20
- "Javier", "Miguel", "Raquel", "Pedro", "Diego", "Raul", "Alberto", "Gloria", "Jaime", "Marina", "Angela", "Silvia",
21
- "Aurora", "Patri", "Yago", "Mario", "Ariadna", "Amin", "Igor", "Nacho", "Rose", "Suri", "Jose miguel", "Ommar",
22
- "Ammar", "Sultan", "Mohamed", "Ahmed", "Nirmmen", "Ghadda", "Shehab", "Enass", "Farah", "Ali", "Ahmed", "Ramzi",
23
- "Abdoul", "Mustafa", "Yaasir", "Abdul shire", "Khaalid", "Ahakim", "Caleb", "Dominik", "Julia", "Daniel", "Lukas",
24
- "Melanie", "Dominik", "Annika", "Franzi", "Jannik", "Henry", "Hendrik", "Olaf", "Elisabeth", "Melissa", "Louisa",
25
- "Rebecca", "Kathrin", "Jakob", "Konrad", "Ludwig", "Matthias", "Lennart", "Natascha", "Tanya", "Rahul", "Divya",
26
- "Priyanka", "Aishwarya", "Mahese", "Shardul", "Sayem", "Krithika", "Riharika", "Neeraij", "Mayank", "Deepak",
27
- "Admaris", "Addison", "Ainsley", "Amanda", "Anastasia", "Andrea", "Angela", "Anjancette", "Araminta", "Ashley",
28
- "Ashton", "Barbara", "Berenice", "Braelyn", "Burgundy", "Camellia", "Cassandra", "Channing", "Chelsea", "Cornelia",
29
- "Danette", "Demelza", "Dreama", "Earlene", "Ebony", "Edmonda", "Edmonia", "Edwina", "Gaynelle", "Indiana", "Hollis",
30
- "Isabella", "Lawanda", "Lindsay", "Madison", "Magnolia", "Meadow", "Paisley", "Parker", "Payton", "Priscilla",
31
- "Regina", "Roseanne", "Scarlett", "Sabrina", "Serena", "Shelley", "Shirley", "Shnshine", "Synnove", "Tanika",
32
- "Tempest", "Tyler", "Vanessa", "Veronica", "Velvet", "Whitley", "Wilda", "Winifred", "Winnie", "Wynne", "Zola",
33
- "Princeton", "Ramsey", "Remington", "Rodney", "Rutherford", "Sheldon", "Justice", "Kelsey", "Kamden", "Kamden"]
34
-
35
- CELEBRITY = ["Kim Kardashian", "Kanye West", "Gwyneth Paltrow", "Miley Cyrus", "Angelina Jolie", "Brad Pitt", "Ashlee Simpson",
36
- "Jay Z", "Reese Witherspoon", "Gwen Stefani", "Nicolas Cage", "Rihanna", "Craig Ferguson", "David Arquette", "Katy Perry",
37
- "Mila Kunis", "Jason Lee", "Demi Moore", "Chris Martin", "Natalie Portman", "Zoeey Deschanel", "Tom Cruise",
38
- "Lady Gaga", "Elton John", "Pete Wentz", "Nicole Richie", "Ashton Kutcher", "Madonna", "Sylvester Stallone",
39
- "Whoopi Goldberg", "Jennifer Aniston", "Ben Affleck", "Victoria Beckham", "Gavin Rossdale", "Kate Hudson", "Jamie Foxx",
40
- "David Beckham", "Mariah Carey", "Justin Bieber", "Jennifer Garner", "Nicole Kidman", "Jennifer Lopez",
41
- "Dwayne Johnson", "Will Smith", "Barack Obama", "Vladimir Putin", "Donald Trump", "George W. Bush", "Bill Clinton",
42
- "Bill Gate", "Warren Buffett", "Kim Jong-un", "Celine Dion", "Arnold Schwarzenegger", "Van Damme", "Jason Statham",
43
- "Bruce Willis", "Harrison Ford", "Mel Gibson", "Chuck Norris", "James Cameron"]
44
-
45
- PRONOUN = ["colleagues", "friends", "co-workers", "enemies", "foes", "relatives", "in-laws", "classmates", "guildies",
46
- "neighbors", "supervisors", "managers", "teachers", "professors", "facebook friends", "ex-s", "girl friends",
47
- "boy friends", "buddies", "auntes", "uncles", "nephews", "cousins", "niece", "sons", "daughters", "staffs",
48
- "employees", "siblings", "brothers", "sisters", "parents", "grandparents", "closet friends", "kids", "roommates",
49
- "customers", "fans"]
50
-
51
- MOVIE = ["Godfather", "Shawshank Redemption", "Schindler's List", "One Flew Over the Cuckoo's Nest", "Gone with the Wind",
52
- "Wizard of Oz", "Lawrence of Arabia", "Forrest Gump", "Star Wars", "E.T. the Extra-Terrestrial", "2001: A Space Odyssey",
53
- "The Silence of the Lambs", "Bridge on the River Kwai", "Apocalypse Now", "The Lord of the Rings", "The Hobbits",
54
- "Gladiator", "From Here to Eternity", "Titanic", "Saving Private Ryan", "Unforgiven", "Raiders of the Lost Ark",
55
- "To Kill a Mockingbird", "Jaws", "Braveheart", "Dances with Wolves", "Pianist", "Exorcist", "Deer Hunter",
56
- "French Connection", "City Lights", "Birdman", "Grand Budapest Hotel", "Guardians of the Galaxy", "Interstellar",
57
- "Transformers: Age of Extinction", "X-Men: Days of Future Past", "Captain America", "The Hunger Games",
58
- "Dawn of the Planet of the Apes", "Fury", "Big Hero 6", "Frozen", "How to train your dragon", "Mad Max: Fury Road",
59
- "Martian", "Fast & Furious", "Iron Man", "Ant-Man", "Jurassic World", "Reveanant", "Terminator", "Spectre",
60
- "Twilight Saga", "Wolf of Wall Street", "Man of Steel", "World War Z", "Despicable Me", "Oblivion", "Pacific Rim"]
61
-
62
- TVSHOW = ["Sherlock", "Homeland", "Game of Thrones", "Mad Men", "Girls", "The American", "Mr.Robot", "Marvel's Daredevil",
63
- "Better Call Saul", "Catastrophe", "Deutschland 83", "Jane the Virgin", "Good Wife", "Hannibal", "Orphan Black",
64
- "Orange if the New Black", "Walking Dead", "Breaking Bad", "Master of Sex", "Sex and City", "Last Kingdom",
65
- "Family guys", "American Dad", "Simpson", "Ash vs. Evel Dead", "Supergirl", "Fargo", "You're the Worst",
66
- "Crazy Ex-Girlfriend", "Affair", "Show Me a Hero", "Man in the High Castle", "Shannara Chronicles", "Last Ship",
67
- "Nova"]
68
-
69
- SPORT = ["Baseball", "Basketball", "Football", "Hockey", "Soccer", "Volleyball", "Archery", "Golf", "Badminton", "Canoeing",
70
- "Kayaking", "Cricket", "Cycling", "Gymnastics", "Judo", "Polo", "Rackets", "Rowing", "Boxing", "Softball",
71
- "Table tennis", "Tennis", "Wrestling", "Weightlifting", "Taekwondo", "Swimming", "Sailing", "Skiing", "Curling",
72
- "Skating", "Snowboarding"]
73
-
74
- FOOD = ["Massaman curry", "Neapolitan pizza", "Chocolate cake", "Sushi", "Peking duck", "Hamburger", "Penang assam laksa",
75
- "Tom yum goong", "Chicken muamba", "Rendang", "Shepherd’s pie", "Corn on the Cob", "Kalua pig", "Egg tart",
76
- "Kebab", "Brownie and vanilla ice cream", "Lasagna", "Butter garlic crab", "Montreal-style smoked meat",
77
- "Pho's noodle", "Ohmi-gyu beef steak", "Summer roll", "Parma ham", "Fish ‘n’ chips", "Chili crab", "French toast",
78
- "Stinky tofu", "Seafood paella", "Masala dosa", "Buttered popcorn"]
79
-
80
- TRANSPORT = ["ferries", "trains", "metro", "subway", "carpool", "motorbikes", "bikes", "cars", "taxies", "buses", "Uber"]
81
-
82
- COLOR = ["red", "green", "blue", "yellow", "orange", "purple", "pink", "brown", "black", "gray", "white", "magenta",
83
- "cyan", "ebony", "golden", "salmon", "silver", "skyblue", "violet", "navy", "indigo", "aqua", "coral",
84
- "chocolate", "crimson", "azure", "olive"]
85
-
86
- CITY = ["Amsterdam", "Ankara", "Athens", "Atlantic", "Baltimore", "Bangkok", "Beijing", "Berlin", "Berne", "Brussels",
87
- "Budapest", "Buenos Aires", "Cairo", "Canberra", "Cannes", "Cape Town", "Chicago", "Cologne", "Copenhagen", "Damascus",
88
- "Delhi", "Dubai", "Dublin", "Florence", "Geneve", "Hague", "Hanoi", "Havana", "Helsinki", "Hong Kong", "Honolulu", "Istanbul",
89
- "Jakarta", "Jerusalem", "Kansas", "Kathmandu", "Kuala Lumpur", "Lisbon", "London", "Los Angeles", "Luxembourg",
90
- "Madrid", "Manila", "Melbourne", "Mexico", "Milan", "Montreal", "Moscow", "Mumbai", "Munich", "Nazareth", "Nice",
91
- "Osaka", "Ottawa", "Oslo", "Paris", "Philadelphia", "Phnom Penh", "Prague", "Quito", "Reykjavik", "Rio de Janeiro",
92
- "San Francisco", "Santa Fe", "Santiago", "Sao Paulo", "Shanghai", "Singapore", "Stockholm", "Saint-Peter", "Sydney",
93
- "Taipei", "Tokyo", "Toronto", "Venice", "Vienna", "Washington", "Zurich", "Vancouver", "Vatican", "Las Vegas"]
94
-
95
- COUNTRY = ["Canada", "United States", "Mehico", "Venezuela", "Peru", "Chile", "Argentina", "Brazil", "Iceland", "Ireland",
96
- "United Kingdom", "France", "Spain", "German", "Poland", "Morocco", "Algeria", "Italia", "Ukranie", "Turkey", "Audi Arabia",
97
- "Pakistan", "China", "India", "Nepal", "Myanmar", "Thailand", "Vietnam", "Korea", "Japan", "Philipin", "Singapore",
98
- "Australia", "New Zealand", "Taiwan", "Egypt", "Greece", "Malaysia", "Sweden", "Finland", "Indonesia"]
99
-
100
- LANDMARK = ["Statue of Liberty", "Eiffel Tower", "St. Basil's Cathedral", "Blue Domed Church", "Great Sphinx", "Pyramids",
101
- "Little Mermaid", "Neptune and the Palace", "Windmills", "Great Wall", "Taj Mahal", "Machu Picchu", "Big Ben",
102
- "Burj al Arab Hotel", "Tower of Pisa", "Christ the Redeemer", "Mecca", "Loch Ness", "Mont St. Michel", "Bran Castle",
103
- "Agia Sophia Castle", "Brandenburg Gate", "Acropolis", "Sagrada Familia", "Neuschwanstein", "Mount Fuji", "Al Aqsa Mosque",
104
- "Niagra Falls", "Ankor Wat", "Mannken Pis", "Mount Everest", "St. Peter's Cathedral", "Victoria Falls",
105
- "Grand Canyon", "Trevi Fountain", "Cape of Good Hope", "Chichen Itza", "Table Mountain", "Golden Gate Bridge",
106
- "Shell Opera House", "Forbidden City", "Colosseum", "Tower Bridge", "Luxor Temple", "Empire State Building",
107
- "Temple of Besakih", "Holywood Sign", "Lee surrenders to Grant", "Golden Spike", "Gold Rush 1849", "Panama Canal",
108
- "Stonehenge", "Suez Canal", "Palace of Parliament"]
109
-
110
- ANIMAL = ["polar bear", "lion", "tiger", "giraffe", "panda", "elephant", "penguin", "wolf", "gorilla", "chimpanzee", "owl",
111
- "monkey", "kangaroo", "zebra", "moose", "koala", "rhinoceros", "jaguar", "camel", "meerkat", "peacock", "snake",
112
- "hippopotamus", "platypus", "otter", "badger", "cat", "seal", "dog", "seal", "deer", "skunk", "crocodile",
113
- "leopard", "bat", "sloth", "lynx", "fox", "sea lion", "cheetah", "tortoise", "buffalo", "cougar", "ostrich", "frog",
114
- "alligator", "reindeer", "anteater", "walrus", "grizzly bear", "goat", "raccoon", "squirrel", "sheep", "wild board",
115
- "pig", "horse"]
116
-
117
- BIRD = ["hummingbird" , "owl", "penguin", "finch", "cockatoo", "crane", "toucan", "swallow", "heron", "cuckoos", "sparrow",
118
- "flamingo", "albatross", "moa", "stork", "sandpiper", "plover", "kiwis", "woodpecker", "hornbill", "gull", "falconidae",
119
- "rheas", "swift", "tem", "cormorant", "grouse", "spoonbill", "parrots", "goose", "fowl", "eagle", "accipitriformes",
120
- "rallidae", "bee-eater", "skua", "pelecaniformes", "bustard", "neognathae", "curlew", "snipe", "shearwater", "shag",
121
- "raven", "merlin", "stonechat"]
122
-
123
- FISH = ["guppy", "carp", "shark", "gold", "cat", "arowana", "sunfish", "northen pike", "zander", "oscar", "seabass",
124
- "trout", "cobia", "snook", "candiru", "salmon", "swordtail", "mahi-mahi", "bream", "salmon", "barramundi", "vetiprovidentiae",
125
- "striped bass", "neon tetra", "artic char", "bluegill", "escolar", "surgeon", "pumpkinseed", "platy", "grouper",
126
- "blob", "eel", "naddock", "turbot", "grey mullet", "sea horse", "clown", "snakehead", "beluga", "trumpet", "jellow",
127
- "moa trunk", "dolphin"]
128
-
129
- HOBBY = ["reading books", "watching TVs", "speding time with family", "watching movies", "fishing", "playing computer games",
130
- "gardening", "walking", "listening to music", "window shopping", "sleeping and relaxing", "cooking", "playing golf",
131
- "socializing", "sewing", "hiking", "eating out", "camping", "working on cars", "writing", "motorcycling", "dancing",
132
- "painting", "horseback riding", "working volunteer", "chatting"]
133
-
134
- JOB = ["carpenter", "welder", "plumper", "acter", "actress", "waiter", "waitress", "reporter", "programer",
135
- "nurse", "doctor", "cleaner", "manager", "cashier", "bartender", "taxi driver", "trucker", "college professer",
136
- "truck driver", "crane operator", "machine operator", "machinist", "accountant", "consultant", "layer", "judge",
137
- "politcian", "policeman", "president", "spy", "scecret agent", "astronount", "businessman", "teacher", "veteran",
138
- "comedian", "doctor", "thief", "robber", "baker", "priminister", "sport professor player", "librarian", "fire fighter",
139
- "realtor", "bocker", "flight-attendent", "pilot", "ship captain", "singer", "musician", "detective"]
140
-
141
- EMOTION_GOOD= ["Holycow!", "Holy $#@%@!", "Unbelivable!", "Awesome!", "So lovely!", "Fanstatic!", "WoW!", "Cool!", "Yay!",
142
- "Hurray!", "Wonderful!", "Excellent!", "Luckily!", "Yippi!", "Good job!", "Ingredible!"]
143
-
144
- NUMBER = ["two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven"]
145
-
146
- TIME = ["minutes", "hours", "days", "weeks", "months", "years", "decades"]
147
-
148
- COMPANY = ["Walmart", "Exxon Mobil", "Chevron", "Berkshire Hathaway", "Apple Inc", "General Motors", "General Electric",
149
- "ATT", "Verizon", "Fannie Mae", "Costco", "Hewlet Packer", "JP Morgan Chase", "Bank of America Corp",
150
- "Marathon Petroleum", "Boeing", "Citigroup", "Amazon", "Microsoft", "Facebook", "Google", "Home Depot",
151
- "Target", "Johnson n Johnson", "Freddie Mac", "Comcast", "Netflix", "Fedex", "UPS", "Lowes", "Intel",
152
- "Walt Disney", "Cisco Systems", "Coca-Cola", "Best Buy", "Goldman Sachs Group", "Oracle", "Safeway",
153
- "American Express", "Time Warner", "Macy's", "Tech Data", "McDonald's", "eBay"]
154
-
155
- NEWS = ["BBC", "CNN", "FOX", "ABC", "CTV", "NBC", "CBSN", "LiveTV"]
156
-
157
- ADJECTIVE = ["lovely", "good", "important", "adorable", "beautiful", "elegant", "fancy", "glamorous", "nice"]
158
-
159
- EMAIL_SUFFIX= [".biz", ".info", ".work", ".club", ".mobi", ".net", ".co", ".party", ".solutions", ".com", ".org",
160
- ".guru", ".directory", ".voyage", ".photopraphy", ".photos", ".com.pl", ".expert", ".technology", ".clothing",
161
- ".training", ".football", ".services", ".media", ".systems", ".education", ".maison", ".rentals", ".fitness",
162
- ".international", ".parts", ".hockey", ".estate", ".support", ".toys", ".deals", ".properties", ".cards",
163
- ".direct", ".design", ".futbol", ".xyz"]
164
-
165
- EMAIL_DOMAIN= ["gmail", "hotmail", "hushmail", "zohomail", "mail", "outlook", "gmxmail", "inbox", "yandex", "shortmail",
166
- "yahoomail", "rocketmail", "aimmail", "aussimail", "bigstring", "bluebottle", "boarderemail", "canoe",
167
- "care2", "dcemail", "dbzmail", "didamail", "emailaccount", "faster", "fast", "gawab", "graffiti", "hotpop",
168
- "icqmail", "inbox", "indiatimes", "inmail24", "jubii", "linuxmail", "lycosmail", "mail2world", "mailsnare",
169
- "merseymail", "msnhotmail", "muchomail", "myway", "operamail", "outgun", "postmaster", "prontomail",
170
- "rediff", "runbox", "sacmail", "safe-mail", "ureach", "vfemail", "ziladog", "fuser", "grabmail", "mail2web",
171
- "myemail", "tamadaa", "techemail", "earthclassmail", "futureme", "hoaxmail", "postful", "shinyletter",
172
- "dodgeit", "emailias", "gishpyppy", "spam", "spambox", "zoemail", "notaspam", "spamme", "nospam", "spamming"]
173
-
174
- EMAIL_PREFIX= ["admin", "noreply", "me", "inbox", "mail", "finance", "administrator", "boss", "staff", "service", "helpdesk",
175
- "it", "itdepart", "pr", "server", "client", "secrectary", "office", "headquater", "hr", "humanresource", "security",
176
- "important", "about", "aboutus", "contact", "shouldreply", "spam", "subcrible", "unsubcrible", "infor", "warning",
177
- "danger", "vip", "members", "notice", "fail-delivery", "delivery"]
178
-
179
- ALPHABET = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s",
180
- "t", "u", "v", "w", "x", "y", "z"]
181
-
182
- end