instabot 0.1.81 → 0.1.90

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,81 +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
-
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
+
@@ -1,5 +1,5 @@
1
- module Version
2
- VERSION = '0.1.81'.freeze
3
- SUMMARY = 'Ruby instagram bot'.freeze
4
- DESCRIPTION = 'An instagram bot works without instagram api, only needs your username and password'.freeze
5
- end
1
+ module Version
2
+ VERSION = '0.1.90'.freeze
3
+ SUMMARY = 'Ruby instagram bot'.freeze
4
+ DESCRIPTION = 'An instagram bot works without instagram api, only needs your username and password'.freeze
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.81
4
+ version: 0.1.90
5
5
  platform: ruby
6
6
  authors:
7
7
  - eVanilla
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-01-03 00:00:00.000000000 Z
11
+ date: 2018-01-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -200,7 +200,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
200
200
  version: '0'
201
201
  requirements: []
202
202
  rubyforge_project:
203
- rubygems_version: 2.6.4
203
+ rubygems_version: 2.7.3
204
204
  signing_key:
205
205
  specification_version: 4
206
206
  summary: Ruby instagram bot