instabot 0.1.75 → 0.1.80

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2ef6db5c38e62a1e5a352d8e88e60c001920e8a2
4
- data.tar.gz: b927e8656eea81c622e75fa5cb953b9f740e544f
3
+ metadata.gz: f89e0b51f16a304b7fe67ed1cc3da8a3bae7d038
4
+ data.tar.gz: e6e624baa761e5cf465df6092c3e1e20407c185c
5
5
  SHA512:
6
- metadata.gz: f55cf8bd4541db3d03e34c76cfff534910d0aec44749063f3a8b4af4c3fb83c20fa5752ee9e1eede78d4019cf802a7fe4f728ca393aaf09f7390a79043b582b9
7
- data.tar.gz: 966b141b4c034c5bffe6ba23af9de88e22836efdfaceeaacc3d2e23658bfc50cc739de8f79b23c06d2019f038de85e9ceafef97263e909a0e35006979d859d17
6
+ metadata.gz: eb26bfbe42fa69f2b3ec8f86d1b0e52490a9e6328bb517d56c16cc2e90b217f053f48a5db2a8aca1008ed120a169bc21635648e6eeff872e4aa6b3bea242fa29
7
+ data.tar.gz: 16fc4a486a600f58d5ad3baef4467b3dd860b2b9bf8d0038bf9b5403b8529304abb292c9201ce25c3293ab8f2b55668d20773cbafeeba6f6a8a5c92f7054fb02
@@ -10,7 +10,7 @@ module Banner
10
10
  ╚═╝╚═╝ ╚═══╝╚══════╝ ╚═╝ ╚═╝ ╚═╝╚═════╝ ╚═════╝ ╚═╝
11
11
 
12
12
  BANNER
13
- puts 'An instagram bot works without instagram api '.white.bold + 'github.com/'.cyan + 'eVanilla/instabot.rb'.cyan.bold.italic
13
+ puts 'An instagram bot works without instagram api '.white.bold + 'github.com/'.cyan + "eVanilla/instabot.rb\n".cyan.bold.italic
14
14
  end
15
15
  end
16
16
  end
@@ -14,7 +14,9 @@ module Config
14
14
  :print_banner, :pre_load, :wait_per_action, :infinite_tags,
15
15
  :max_like_per_day, :max_follow_per_day, :max_unfollow_per_day,
16
16
  :max_comment_per_day, :unwanted_list, :white_list_users,
17
- :log_status, :use_tor
17
+ :log_status, :use_tor, :add_tag_per_post, :unwanted_list,
18
+ :white_list_users
19
+
18
20
  def initialize
19
21
  @wait_per_action = 1 * 60
20
22
  @max_comment_per_day = 50
@@ -31,9 +33,11 @@ module Config
31
33
  @log_status = true
32
34
  @use_proxy = false
33
35
  @use_tor = false
36
+ @add_tag_per_post = 1
34
37
  @tags = []
35
38
  @unwanted_list = []
36
39
  @white_list_users = []
40
+
37
41
  @comments = [
38
42
  %w[this the your],
39
43
  %w[photo picture pic shot snapshot],
@@ -23,16 +23,18 @@ class Instabot
23
23
  attr_accessor :users, :medias, :media_information, :user_information
24
24
 
25
25
  def initialize(mode = :default)
26
- @login_mode = mode
27
- @users = []
28
- @medias = []
29
- @log_counter = 0
30
- @login_counter = 1
31
- @login_status = false
32
- @lib_dir = "#{Dir.pwd}/lib"
33
- @root_dir = Dir.pwd.to_s
34
- @logs_dir = "#@root_dir/logs"
35
- @global_time = Time.new.strftime('%H-%M-%S--%y-%m-%d')
26
+ @login_mode = mode
27
+ @users = []
28
+ @medias = []
29
+ @log_counter = 0
30
+ @login_counter = 1
31
+ @login_status = false
32
+ @lib_dir = "#{Dir.pwd}/lib"
33
+ @root_dir = Dir.pwd.to_s
34
+ @logs_dir = "#@root_dir/logs"
35
+ @started_time = Time.new.strftime('%H-%M-%S--%y-%m-%d')
36
+ @errors_iteration = 0
37
+
36
38
  Configuration.new if @login_mode == :manual
37
39
 
38
40
  @local_stroage = {
@@ -72,12 +74,13 @@ class Instabot
72
74
  print_banner: Config.options.print_banner,
73
75
  proxy: Config.options.proxy,
74
76
  tags: Config.options.tags,
75
- unwanted_list: Config.options.unwanted_list,
76
77
  use_proxy: Config.options.use_proxy,
77
78
  use_tor: Config.options.use_tor,
78
79
  wait_per_action: Config.options.wait_per_action,
80
+ log_status: Config.options.log_status,
81
+ add_tag_per_post: Config.options.add_tag_per_post,
82
+ unwanted_list: Config.options.unwanted_list,
79
83
  white_list_users: Config.options.white_list_users,
80
- log_status: Config.options.log_status
81
84
  }
82
85
  else
83
86
  {
@@ -89,7 +92,6 @@ class Instabot
89
92
  end
90
93
  end
91
94
 
92
- # bot starter
93
95
  def intro(mode)
94
96
  trap('INT') { exit! }
95
97
  print_banner
@@ -35,11 +35,13 @@ module Grabber
35
35
  tags = @media_information[:text].encode('UTF-8', invalid: :replace, undef: :replace, replace: '?').split(/\W+/)
36
36
  id = 0
37
37
  tags.each do |tag|
38
- if tag == '_' || tag == '' || tag.nil?
39
- tags.delete(tag)
40
- else
41
- id += 1
42
- Config.options.tags << tag
38
+ if id < options[:add_tag_per_post]
39
+ if tag == '_' || tag == '' || tag.nil? || tag.include?('?')
40
+ tags.delete(tag)
41
+ else
42
+ id += 1
43
+ Config.options.tags << tag
44
+ end
43
45
  end
44
46
  end
45
47
  puts '[+] '.cyan + '[' + id.to_s.yellow + '] New tags added'
@@ -30,7 +30,7 @@ module Log
30
30
  if logs_status
31
31
  time = Time.new.strftime('%H:%M:%S %y-%m-%d')
32
32
  if File.exists?(@logs_dir)
33
- File.open("#{@logs_dir}/logs-#{@global_time}.log", 'a+') do |log_file|
33
+ File.open("#{@logs_dir}/logs-#{@started_time}.log", 'a+') do |log_file|
34
34
  log_file.puts "[#{@log_counter}] [#{time}] [#{from}] -- : #{text}"
35
35
  end
36
36
  else
@@ -1,4 +1,4 @@
1
- # automatic module and helpers
1
+ # modes module and helpers
2
2
  module Modes
3
3
  # main def and mode selector
4
4
  def mode(mode = :default)
@@ -8,38 +8,27 @@ module Modes
8
8
  log('[Auto] mode is turned on', 'MODES')
9
9
  search(options[:tags])
10
10
  @tomorrow = Time.new + 1.days
11
+ actions = %w[follow unfollow like comment]
11
12
  loop do
12
13
  if !maximums_are_full?
13
- if !follows_in_day_are_full?
14
- @maximums[:follows_in_day] += 1
15
- auto_follow
16
- else
17
- puts '[+] '.cyan + 'Maximum follows per day'.upcase
18
- log('Maximum follows per day', 'MODES')
19
- end
20
-
21
- if !unfollows_in_day_are_full?
22
- @maximums[:unfollows_in_day] += 1
23
- auto_unfollow
24
- else
25
- puts '[+] '.cyan + 'Maximum unfollows per day'.upcase
26
- log('Maximum unfollows per day', 'MODES')
27
- end
28
-
29
- if !likes_in_day_are_full?
30
- @maximums[:likes_in_day] += 1
31
- auto_like
32
- else
33
- puts '[+] '.cyan + 'Maximum likes per day'.upcase
34
- log('Maximum likes per day', 'MODES')
35
- end
36
-
37
- if !comments_in_day_are_full?
38
- @maximums[:comments_in_day] += 1
39
- auto_comment
40
- else
41
- puts '[+] '.cyan + 'Maximum comments per day'.upcase
42
- log('Maximum comments per day', 'MODES')
14
+ action = actions.sample
15
+ case action
16
+ when 'follow'
17
+ if !follows_in_day_are_full?
18
+ auto_follow
19
+ end
20
+ when 'unfollow'
21
+ if !unfollows_in_day_are_full?
22
+ auto_unfollow
23
+ end
24
+ when 'like'
25
+ if !likes_in_day_are_full?
26
+ auto_like
27
+ end
28
+ when 'comment'
29
+ if !comments_in_day_are_full?
30
+ auto_comment
31
+ end
43
32
  end
44
33
  else
45
34
  check_date
@@ -51,6 +40,7 @@ module Modes
51
40
  log('[Clean up] mode is turned on', 'MODES')
52
41
  @local_stroage[:followed_users].each do |user|
53
42
  unfollow(user)
43
+ fall_in_asleep
54
44
  end
55
45
  when :default
56
46
  puts '[-] '.cyan + 'Please choose a mode'.upcase.red
@@ -60,22 +50,33 @@ module Modes
60
50
  end
61
51
 
62
52
  def auto_follow
63
- all_users = users
64
- id = 0
65
- puts '[+] '.cyan + "#{all_users.size} user is ready to follow".upcase
53
+ all_users = @users
54
+ id = 0
55
+ puts '[+] '.cyan + "[follow] ".upcase.yellow.bold + "#{all_users.size} user is ready".upcase
66
56
  while @maximums[:follows_in_day] < @maximums[:max_follows_per_day]
67
57
  begin
68
58
  id += 1 if all_users[id].nil? || all_users[id] == []
69
59
  handle_user_information_data_by_user_id(all_users[id])
70
- puts '[+] '.cyan + "Trying to follow user [#{all_users[id]}]"
71
- follow(@user_information[:id])
72
- puts '[+] '.cyan + 'User followed'.upcase.green.bold
73
- @maximums[:follows_in_day] += 1
74
- id += 1
75
- fall_in_asleep
60
+ if !is_user_valid?(@user_information[:full_name])
61
+ puts '[+] '.cyan + "Trying to follow user [#{all_users[id]}]"
62
+ follow(@user_information[:id])
63
+ @users -= [all_users[id]]
64
+ puts '[+] '.cyan + 'User followed'.upcase.green.bold
65
+ @maximums[:follows_in_day] += 1
66
+ id += 1
67
+ fall_in_asleep
68
+ else
69
+ puts "unwanted user(#{@user_information[:full_name]}) [ignored]".yellow
70
+ id += 1
71
+ end
72
+ break
76
73
  rescue Exception => e
77
74
  puts "An error occured ... #{e.class} #{e.message}\n#{e.backtrace.inspect}\n[ignored]"
78
- id += 1
75
+ # exit! if @errors_iteration > 3
76
+ # id += 1
77
+ # @errors_iteration += 1
78
+ # retry
79
+ break
79
80
  retry
80
81
  end
81
82
  end
@@ -83,76 +84,96 @@ module Modes
83
84
 
84
85
  def auto_unfollow
85
86
  followed_users = @local_stroage[:followed_users]
86
- puts '[+] '.cyan + "#{followed_users.size} user is ready to unfollow".upcase
87
+ puts '[+] '.cyan + "[unfollow] ".upcase.yellow.bold + "#{followed_users.size} user is ready".upcase
87
88
  id = 0
88
89
  while @maximums[:unfollows_in_day] < @maximums[:max_unfollows_per_day]
89
90
  if @local_stroage[:followed_users].size < @maximums[:max_unfollows_per_day]
90
- begin
91
- puts '[+] '.cyan + "Trying to unfollow user [#{followed_users[id]}]"
92
- unfollow(followed_users[id])
93
- puts '[+] '.cyan + 'User unfollowed'.upcase.bold.green
94
- @maximums[:unfollows_in_day] += 1
95
- id += 1
96
- fall_in_asleep
97
- rescue Exception => e
98
- puts "An error occured ... #{e.class} #{e.message}\n#{e.backtrace.inspect}\n[ignored]"
99
- id += 1
100
- retry
91
+ if !followed_users.empty?
92
+ begin
93
+ puts '[+] '.cyan + "Trying to unfollow user [#{followed_users[id]}]"
94
+ unfollow(followed_users[id])
95
+ @local_stroage[:followed_users] -= [followed_users[id]]
96
+ puts '[+] '.cyan + 'User unfollowed'.upcase.bold.green
97
+ @maximums[:unfollows_in_day] += 1
98
+ id += 1
99
+ fall_in_asleep
100
+ break
101
+ rescue Exception => e
102
+ puts "An error occured ... #{e.class} #{e.message}\n#{e.backtrace.inspect}\n[ignored]"
103
+ # exit! if @errors_iteration > 3
104
+ # id += 1
105
+ # @errors_iteration += 1
106
+ # retry
107
+ break
108
+ end
109
+ else
110
+ break
101
111
  end
102
112
  else
103
- puts '[+] '.cyan + '[unfollow per day] is much bigger than [follow per day]'
104
- exit
113
+ puts '[-] '.red + '[unfollow per day] is much bigger than [follow per day]'.upcase.red.bold
114
+ exit!
105
115
  end
106
116
  end
107
117
  end
108
118
 
109
119
  def auto_like
110
- all_medias = medias
111
- puts '[+] '.cyan + "#{all_medias.size} Media is ready to like".upcase
120
+ all_medias = @medias
121
+ puts '[+] '.cyan + "[like] ".upcase.yellow.bold + "#{all_medias.size} Media is ready".upcase
112
122
  id = 0
113
123
  while @maximums[:likes_in_day] < @maximums[:max_likes_per_day]
114
124
  begin
115
125
  handle_media_information_data(all_medias[id])
116
126
  puts '[+] '.cyan + "Trying to like media [#{all_medias[id]}]"
117
127
  like(@media_information[:id])
128
+ @medias -= [all_medias[id]]
118
129
  puts '[+] '.cyan + 'Media liked'.upcase.green.bold
119
130
  @maximums[:likes_in_day] += 1
120
131
  id += 1
121
132
  fall_in_asleep
133
+ break
122
134
  rescue Exception => e
123
135
  puts "An error occured ... #{e.class} #{e.message}\n#{e.backtrace.inspect}\n[ignored]"
124
- id += 1
125
- retry
136
+ # exit! if @errors_iteration > 3
137
+ # id += 1
138
+ # @errors_iteration += 1
139
+ # retry
140
+ break
126
141
  end
127
142
  end
128
143
  end
129
144
 
130
145
  def auto_comment
131
- all_medias = medias
132
- # puts '[+] '.cyan + "#{all_medias.size} Media is ready".upcase
146
+ all_medias = @medias
147
+ puts '[+] '.cyan + "[comment] ".upcase.yellow.bold + "#{all_medias.size} Media is ready".upcase
133
148
  id = 0
134
149
  while @maximums[:comments_in_day] < @maximums[:max_comments_per_day]
135
150
  begin
136
151
  handle_media_information_data(all_medias[id])
137
152
  if @media_information[:comments_disabled]
138
- puts '[-]'.red + 'comments are disable' + "\t[IGNORING]".yellow
153
+ puts '[-]'.cyan + 'comments are disable' + "\t[ignored]".yellow
139
154
  id += 1
140
- next
155
+ # next
141
156
  end
142
157
  generated_comment = generate_a_comment
143
158
  puts '[+] '.cyan + "Trying to send a comment[#{generated_comment}] to media[#{all_medias[id]}]"
144
159
  comment(@media_information[:id], generated_comment)
160
+ @medias -= [all_medias[id]]
145
161
  puts '[+] '.cyan + 'comment has been sent'.upcase.green.bold
146
162
  @maximums[:comments_in_day] += 1
147
163
  id += 1
148
164
  fall_in_asleep
165
+ break
149
166
  rescue Exception => e
150
167
  puts "An error occured ... #{e.class} #{e.message}\n#{e.backtrace.inspect}\n[ignored]"
151
- id += 1
152
- retry
168
+ # exit! if @errors_iteration > 3
169
+ # id += 1
170
+ # @errors_iteration += 1
171
+ # retry
172
+ break
153
173
  end
154
174
  end
155
175
  end
176
+
156
177
  # genrating random comment
157
178
  def generate_a_comment
158
179
  comment = ""
@@ -160,10 +181,19 @@ module Modes
160
181
  comment
161
182
  end
162
183
 
184
+ def is_user_valid?(user)
185
+ if options[:white_list_users].include?(user)
186
+ options[:unwanted_list].find { |unwanted| unwanted =~ /#{user}/ } != nil
187
+ else
188
+ return false
189
+ end
190
+ end
191
+
192
+
163
193
  def check_date
164
194
  time = (@tomorrow - Time.new).to_i # => remained time ...
165
195
  if time.zero?
166
- puts '[+] '.cyan + "It's a new day"
196
+ puts '[+] '.cyan + "[new day]".upcase
167
197
  @local_stroage[:followed_users] = []
168
198
  @local_stroage[:unfollowed_users] = []
169
199
  @local_stroage[:liked_medias] = []
@@ -181,8 +211,7 @@ module Modes
181
211
  end
182
212
  end
183
213
 
184
- def fall_in_asleep
185
- time = options[:wait_per_action]
214
+ def fall_in_asleep(time=options[:wait_per_action])
186
215
  puts '[+] '.cyan + "Waiting for #{time} seconds".upcase
187
216
  sleep time
188
217
  end
@@ -1,5 +1,5 @@
1
1
  module Version
2
- VERSION = '0.1.75'.freeze
2
+ VERSION = '0.1.80'.freeze
3
3
  SUMMARY = 'Ruby instagram bot'.freeze
4
4
  DESCRIPTION = 'An instagram bot works without instagram api, only needs your username and password'.freeze
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: instabot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.75
4
+ version: 0.1.80
5
5
  platform: ruby
6
6
  authors:
7
7
  - eVanilla
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-12-22 00:00:00.000000000 Z
11
+ date: 2017-12-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -126,6 +126,40 @@ dependencies:
126
126
  - - ">="
127
127
  - !ruby/object:Gem::Version
128
128
  version: 2.7.5
129
+ - !ruby/object:Gem::Dependency
130
+ name: socksify
131
+ requirement: !ruby/object:Gem::Requirement
132
+ requirements:
133
+ - - "~>"
134
+ - !ruby/object:Gem::Version
135
+ version: '1.7'
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: 1.7.1
139
+ type: :runtime
140
+ prerelease: false
141
+ version_requirements: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: '1.7'
146
+ - - ">="
147
+ - !ruby/object:Gem::Version
148
+ version: 1.7.1
149
+ - !ruby/object:Gem::Dependency
150
+ name: net-telnet
151
+ requirement: !ruby/object:Gem::Requirement
152
+ requirements:
153
+ - - "~>"
154
+ - !ruby/object:Gem::Version
155
+ version: 0.1.1
156
+ type: :runtime
157
+ prerelease: false
158
+ version_requirements: !ruby/object:Gem::Requirement
159
+ requirements:
160
+ - - "~>"
161
+ - !ruby/object:Gem::Version
162
+ version: 0.1.1
129
163
  description: An instagram bot works without instagram api, only needs your username
130
164
  and password
131
165
  email: