instabot 0.1.73 → 0.1.75
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
- data/lib/instabot.rb +1 -0
- data/lib/instabot/config.rb +3 -1
- data/lib/instabot/core.rb +4 -2
- data/lib/instabot/create_protocol.rb +9 -1
- data/lib/instabot/tor_protocol.rb +81 -0
- data/lib/instabot/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ef6db5c38e62a1e5a352d8e88e60c001920e8a2
|
4
|
+
data.tar.gz: b927e8656eea81c622e75fa5cb953b9f740e544f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f55cf8bd4541db3d03e34c76cfff534910d0aec44749063f3a8b4af4c3fb83c20fa5752ee9e1eede78d4019cf802a7fe4f728ca393aaf09f7390a79043b582b9
|
7
|
+
data.tar.gz: 966b141b4c034c5bffe6ba23af9de88e22836efdfaceeaacc3d2e23658bfc50cc739de8f79b23c06d2019f038de85e9ceafef97263e909a0e35006979d859d17
|
data/lib/instabot.rb
CHANGED
data/lib/instabot/config.rb
CHANGED
@@ -13,7 +13,8 @@ module Config
|
|
13
13
|
attr_accessor :username, :password, :tags, :use_proxy, :proxy, :comments,
|
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
|
-
:max_comment_per_day, :unwanted_list, :white_list_users
|
16
|
+
:max_comment_per_day, :unwanted_list, :white_list_users,
|
17
|
+
:log_status, :use_tor
|
17
18
|
def initialize
|
18
19
|
@wait_per_action = 1 * 60
|
19
20
|
@max_comment_per_day = 50
|
@@ -29,6 +30,7 @@ module Config
|
|
29
30
|
@print_banner = true
|
30
31
|
@log_status = true
|
31
32
|
@use_proxy = false
|
33
|
+
@use_tor = false
|
32
34
|
@tags = []
|
33
35
|
@unwanted_list = []
|
34
36
|
@white_list_users = []
|
data/lib/instabot/core.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
# @Authors eVanilla + https://github.com/eVanilla/instabot.rb/graphs/contributors
|
4
4
|
#
|
5
5
|
|
6
|
-
%w[colorize mechanize io/console hashie json logger pp active_support/core_ext/numeric/time rbconfig].each { |gem| require gem }
|
6
|
+
%w[colorize mechanize io/console hashie json logger pp active_support/core_ext/numeric/time rbconfig net/telnet socksify socksify/http].each { |gem| require gem }
|
7
7
|
|
8
8
|
# main core class
|
9
9
|
class Instabot
|
@@ -18,6 +18,7 @@ class Instabot
|
|
18
18
|
include Login
|
19
19
|
include Log
|
20
20
|
include Protocol
|
21
|
+
include TorProtocol
|
21
22
|
|
22
23
|
attr_accessor :users, :medias, :media_information, :user_information
|
23
24
|
|
@@ -73,6 +74,7 @@ class Instabot
|
|
73
74
|
tags: Config.options.tags,
|
74
75
|
unwanted_list: Config.options.unwanted_list,
|
75
76
|
use_proxy: Config.options.use_proxy,
|
77
|
+
use_tor: Config.options.use_tor,
|
76
78
|
wait_per_action: Config.options.wait_per_action,
|
77
79
|
white_list_users: Config.options.white_list_users,
|
78
80
|
log_status: Config.options.log_status
|
@@ -94,7 +96,7 @@ class Instabot
|
|
94
96
|
check_log_files
|
95
97
|
log('log files are checked', 'CORE')
|
96
98
|
log('Machine started', 'CORE')
|
97
|
-
|
99
|
+
create_protocol
|
98
100
|
puts '[+] '.cyan + 'Processing successfully completed'
|
99
101
|
log('Processing successfully completed', 'CORE')
|
100
102
|
unless mode != :default
|
@@ -1,5 +1,8 @@
|
|
1
1
|
module Protocol
|
2
|
-
def
|
2
|
+
def create_protocol
|
3
|
+
if options[:use_tor]
|
4
|
+
@tor = TorProtocol::Tor.new
|
5
|
+
end
|
3
6
|
@agent = Mechanize.new
|
4
7
|
@agent.max_history = 2
|
5
8
|
# @agent.ca_file = './cacert.pem' # Because i use windows and... you know... ._.
|
@@ -12,6 +15,11 @@ module Protocol
|
|
12
15
|
@agent.set_proxy(proxy[0], proxy[1].to_i, proxy[2], proxy[3])
|
13
16
|
end
|
14
17
|
end
|
18
|
+
|
19
|
+
if options[:use_tor]
|
20
|
+
@agent.agent.set_socks('localhost', 9050)
|
21
|
+
log('tor has been started', 'CREATE_PROTOCOL')
|
22
|
+
end
|
15
23
|
|
16
24
|
puts 'PROCESSING: '.cyan.bold + 'protocol created'
|
17
25
|
log('Protocol successfully created', 'CREATE_PROTOCOL')
|
@@ -0,0 +1,81 @@
|
|
1
|
+
require 'mechanize'
|
2
|
+
module TorProtocol
|
3
|
+
class Tor
|
4
|
+
# debug
|
5
|
+
# Socksify::debug = true
|
6
|
+
|
7
|
+
def initialize(control_port='9051',socks_port='9050')
|
8
|
+
puts '[+] '.cyan + "[TOR] STARTED"
|
9
|
+
@tor_control_port = control_port
|
10
|
+
@tor_socks_port = socks_port
|
11
|
+
TCPSocket::socks_server = "127.0.0.1"
|
12
|
+
TCPSocket::socks_port = @tor_socks_port
|
13
|
+
puts '[+] '.cyan + "[TOR] current ip [#{current_ip.yellow}]"
|
14
|
+
end
|
15
|
+
|
16
|
+
def current_ip
|
17
|
+
a = Mechanize.new
|
18
|
+
a.user_agent_alias = 'Mac Safari'
|
19
|
+
return a.get('http://www.myexternalip.com/raw').body.chomp
|
20
|
+
rescue Exception => e
|
21
|
+
puts "error getting ip: #{e.class} #{e.message}\n#{e.backtrace.inspect}".red
|
22
|
+
# break
|
23
|
+
# puts "An error occured ... #{e.class} #{e.message}\n#{e.backtrace.inspect}\n[ignored]"
|
24
|
+
end
|
25
|
+
|
26
|
+
def get_new_ip
|
27
|
+
puts '[+] '.cyan + "[TOR] trying to get a new ip address.."
|
28
|
+
old_ip_address = current_ip
|
29
|
+
tor_switch_endpoint
|
30
|
+
sleep 10
|
31
|
+
new_ip_address = current_ip
|
32
|
+
if (old_ip_address != new_ip_address)
|
33
|
+
puts '[+] '.cyan + "[TOR] ip changed from [#{old_ip_address.yellow}] to [#{new_ip_address.yellow}]"
|
34
|
+
return true
|
35
|
+
else
|
36
|
+
puts '[+] '.yellow + "[TOR] ip same [#{old_ip_address}]"
|
37
|
+
get_new_ip
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def tor_switch_endpoint
|
42
|
+
# puts "tor_switch_endpoint.."
|
43
|
+
tor_protocol = Net::Telnet::new("Host" => "localhost", "Port" => "#{@tor_control_port}", "Timeout" => 10, "Prompt" => /250 OK\n/)
|
44
|
+
tor_protocol.cmd('AUTHENTICATE ""') { |c| throw "Cannot authenticate to Tor" if c != "250 OK\n" }
|
45
|
+
tor_protocol.cmd('signal NEWNYM') { |c| throw "Cannot switch Tor to new route" if c != "250 OK\n" }
|
46
|
+
tor_protocol.close
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
|
53
|
+
class Mechanize::HTTP::Agent
|
54
|
+
public
|
55
|
+
def set_socks addr, port
|
56
|
+
set_http unless @http
|
57
|
+
class << @http
|
58
|
+
attr_accessor :socks_addr, :socks_port
|
59
|
+
|
60
|
+
def http_class
|
61
|
+
Net::HTTP.SOCKSProxy(socks_addr, socks_port)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
@http.socks_addr = addr
|
65
|
+
@http.socks_port = port
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
# tor = Tor.new
|
70
|
+
# agent = Mechanize.new
|
71
|
+
# agent.agent.set_socks('localhost', 9050)
|
72
|
+
# 3.times do |i|
|
73
|
+
# puts "##{i}"
|
74
|
+
# page = agent.get('http://myexternalip.com/raw')
|
75
|
+
# puts "Body << #{page.body.chomp}..."
|
76
|
+
# tor.get_new_ip
|
77
|
+
# end
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
|
data/lib/instabot/version.rb
CHANGED
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.
|
4
|
+
version: 0.1.75
|
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-
|
11
|
+
date: 2017-12-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -144,6 +144,7 @@ files:
|
|
144
144
|
- lib/instabot/logger.rb
|
145
145
|
- lib/instabot/login.rb
|
146
146
|
- lib/instabot/modes.rb
|
147
|
+
- lib/instabot/tor_protocol.rb
|
147
148
|
- lib/instabot/version.rb
|
148
149
|
homepage: https://github.com/eVanilla/instabot.rb
|
149
150
|
licenses:
|