tg_send_duo 0.0.39 → 0.0.52
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/tg_send_duo.rb +143 -33
- metadata +3 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b88ed60ff231bd01c82a759f4edcb0b025a397cdcd2bce2b0cd99ce7c6cf01f3
|
4
|
+
data.tar.gz: cba64d8331779be9d6c665aa09d398902368d73668159ff8817d170e46681f1f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 10946750195f17c66709d9c8337e62ce784c271d7bbfa9c7c9e268f1eaa49efc0f6454dd1270302556b51a94c42615943a15cd6809e289db2824c77097bae0b2
|
7
|
+
data.tar.gz: 72cccd7b51290c63a7caf6dc3faca3a5b52de25655bcfc4a5eee9fa1d2cd23b15ed72907edfce9f8187343c593bbf670d2f64046cb8e6e8faaef628c6f3e81d7
|
data/lib/tg_send_duo.rb
CHANGED
@@ -8,6 +8,7 @@ require 'clipboard'
|
|
8
8
|
require 'crack'
|
9
9
|
require 'auto_click'
|
10
10
|
require 'rainbow/refinement'
|
11
|
+
require 'win32ole'
|
11
12
|
include AutoClickMethods
|
12
13
|
using Rainbow
|
13
14
|
include Glimmer
|
@@ -17,7 +18,38 @@ class Naver
|
|
17
18
|
|
18
19
|
def initialize
|
19
20
|
@seed = 1
|
21
|
+
kill_selenium_chrome #기존 창 모두 닫는 명령
|
22
|
+
sleep(1)
|
20
23
|
end
|
24
|
+
|
25
|
+
def kill_selenium_chrome #기존 창 모두 닫는 코드
|
26
|
+
wmi = WIN32OLE.connect("winmgmts://")
|
27
|
+
chrome_procs = wmi.ExecQuery("SELECT * FROM Win32_Process WHERE Name = 'chrome.exe'")
|
28
|
+
|
29
|
+
chrome_procs.each do |proc|
|
30
|
+
cmd = proc.CommandLine
|
31
|
+
if cmd && cmd.include?("user-data-dir=C:/telegram_cookie")
|
32
|
+
puts "→ 크롬 창 초기화: PID #{proc.ProcessId}"
|
33
|
+
begin
|
34
|
+
proc.Terminate
|
35
|
+
rescue
|
36
|
+
#puts "→ 이미 종료된 프로세스: #{proc.ProcessId}"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
# chromedriver도 같이 종료
|
42
|
+
chromedrivers = wmi.ExecQuery("SELECT * FROM Win32_Process WHERE Name = 'chromedriver.exe'")
|
43
|
+
chromedrivers.each do |proc|
|
44
|
+
puts "→ 크롬 창 초기화: PID #{proc.ProcessId}"
|
45
|
+
begin
|
46
|
+
proc.Terminate
|
47
|
+
rescue
|
48
|
+
#puts "→ 이미 종료된 chromedriver: #{proc.ProcessId}"
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
21
53
|
def chrome_setup(telegram_number,proxy)
|
22
54
|
telegram_cookie_dir = "C:/telegram_cookie"
|
23
55
|
FileUtils.mkdir_p(telegram_cookie_dir) unless File.exist?(telegram_cookie_dir)
|
@@ -33,9 +65,21 @@ class Naver
|
|
33
65
|
FileUtils.mkdir_p(telegram_cookie_dir) unless File.exist?(telegram_cookie_dir)
|
34
66
|
if proxy == ''
|
35
67
|
begin
|
36
|
-
|
68
|
+
begin
|
69
|
+
Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
|
70
|
+
rescue => e
|
71
|
+
puts "chromedriver 버전 불일치!!"
|
72
|
+
puts "아래 지침을 따라주세요."
|
73
|
+
puts "1.프로그램 종료!"
|
74
|
+
puts "2.크롬 업데이트!"
|
75
|
+
puts "3.프로그램 폴더 내부에 ★tip★-시작시-크롬창이....파일 실행"
|
76
|
+
puts "4.안내된 방식으로 크롬 드라이버 교체"
|
77
|
+
puts "5.재 시작"
|
78
|
+
|
79
|
+
end
|
37
80
|
options = Selenium::WebDriver::Chrome::Options.new
|
38
|
-
|
81
|
+
options.add_argument('--no-first-run') # 자동 실행 시 나타나는 "첫 실행" 화면 방지
|
82
|
+
options.add_argument('--disable-extensions') # 확장 프로그램 초기화 화면 방지
|
39
83
|
options.add_argument('--headless') # 브라우저 UI 없이 실행
|
40
84
|
options.add_argument('--disable-gpu') # GPU 가속을 비활성화 (헤드리스에서 필요할 수 있음)
|
41
85
|
options.add_argument('--no-sandbox')
|
@@ -49,7 +93,14 @@ class Naver
|
|
49
93
|
options.add_argument('user-data-dir=C:/telegram_cookie/' + telegram_number)
|
50
94
|
|
51
95
|
|
52
|
-
|
96
|
+
# 'capabilities'과 'options' 배열로 설정
|
97
|
+
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome
|
98
|
+
capabilities["goog:chromeOptions"] = options.as_json
|
99
|
+
|
100
|
+
# Selenium 4에서는 'capabilities'만 사용하는 방식
|
101
|
+
@driver = Selenium::WebDriver.for(:chrome, capabilities: [capabilities, options])
|
102
|
+
|
103
|
+
@driver.execute_script("Object.defineProperty(navigator, 'webdriver', {get: function(){ return false; }});") # 셀레니움 감지 방지
|
53
104
|
|
54
105
|
|
55
106
|
|
@@ -71,12 +122,25 @@ class Naver
|
|
71
122
|
@driver.switch_to.window(first_window)
|
72
123
|
|
73
124
|
rescue
|
74
|
-
@driver = Selenium::WebDriver.for(:chrome, capabilities: options)
|
125
|
+
@driver = Selenium::WebDriver.for(:chrome, capabilities: [capabilities, options])
|
75
126
|
end
|
76
127
|
else
|
77
128
|
begin
|
78
|
-
|
129
|
+
begin
|
130
|
+
Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
|
131
|
+
rescue => e
|
132
|
+
puts "chromedriver 버전 불일치!!"
|
133
|
+
puts "아래 지침을 따라주세요."
|
134
|
+
puts "1.프로그램 종료!"
|
135
|
+
puts "2.크롬 업데이트!"
|
136
|
+
puts "3.프로그램 폴더 내부에 ★tip★-시작시-크롬창이....파일 실행"
|
137
|
+
puts "4.안내된 방식으로 크롬 드라이버 교체"
|
138
|
+
puts "5.재 시작"
|
139
|
+
|
140
|
+
end
|
79
141
|
options = Selenium::WebDriver::Chrome::Options.new
|
142
|
+
options.add_argument('--no-first-run') # 자동 실행 시 나타나는 "첫 실행" 화면 방지
|
143
|
+
options.add_argument('--disable-extensions') # 확장 프로그램 초기화 화면 방지
|
80
144
|
options.add_argument('--headless') # 브라우저 UI 없이 실행
|
81
145
|
options.add_argument('--disable-gpu') # GPU 가속을 비활성화 (헤드리스에서 필요할 수 있음)
|
82
146
|
options.add_argument('--no-sandbox')
|
@@ -88,26 +152,55 @@ class Naver
|
|
88
152
|
options.add_argument('--disable-notifications')
|
89
153
|
options.add_argument('--remote-debugging-port=9222')
|
90
154
|
options.add_argument('user-data-dir=C:/telegram_cookie/' + telegram_number)
|
91
|
-
|
155
|
+
# 'capabilities'과 'options' 배열로 설정
|
156
|
+
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome
|
157
|
+
capabilities["goog:chromeOptions"] = options.as_json
|
158
|
+
|
159
|
+
# Selenium 4에서는 'capabilities'만 사용하는 방식
|
160
|
+
@driver = Selenium::WebDriver.for(:chrome, capabilities: [capabilities, options])
|
161
|
+
|
162
|
+
@driver.execute_script("Object.defineProperty(navigator, 'webdriver', {get: function(){ return false; }});") # 셀레니움 감지 방지
|
163
|
+
|
92
164
|
rescue => e
|
93
165
|
puts e
|
94
166
|
puts 'proxy error...'
|
95
167
|
begin
|
96
|
-
|
168
|
+
begin
|
169
|
+
Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
|
170
|
+
rescue => e
|
171
|
+
puts "chromedriver 버전 불일치!!"
|
172
|
+
puts "아래 지침을 따라주세요."
|
173
|
+
puts "1.프로그램 종료!"
|
174
|
+
puts "2.크롬 업데이트!"
|
175
|
+
puts "3.프로그램 폴더 내부에 ★tip★-시작시-크롬창이....파일 실행"
|
176
|
+
puts "4.안내된 방식으로 크롬 드라이버 교체"
|
177
|
+
puts "5.재 시작"
|
178
|
+
|
179
|
+
end
|
97
180
|
options = Selenium::WebDriver::Chrome::Options.new
|
98
181
|
options.page_load_strategy = :normal
|
99
182
|
options.timeouts = {page_load: 20_000}
|
100
183
|
options.page_load_strategy = 'none'
|
101
184
|
options.add_argument('--disable-notifications')
|
185
|
+
options.add_argument('--no-first-run') # 자동 실행 시 나타나는 "첫 실행" 화면 방지
|
186
|
+
options.add_argument('--disable-extensions') # 확장 프로그램 초기화 화면 방지
|
102
187
|
options.add_argument('--headless') # 브라우저 UI 없이 실행
|
103
188
|
options.add_argument('--disable-gpu') # GPU 가속을 비활성화 (헤드리스에서 필요할 수 있음)
|
104
189
|
options.add_argument('--no-sandbox')
|
105
190
|
options.add_argument('--disable-popup-blocking')
|
106
191
|
options.add_argument('--remote-debugging-port=9222')
|
107
192
|
options.add_argument('user-data-dir=C:/telegram_cookie/' + telegram_number)
|
108
|
-
|
193
|
+
# 'capabilities'과 'options' 배열로 설정
|
194
|
+
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome
|
195
|
+
capabilities["goog:chromeOptions"] = options.as_json
|
196
|
+
|
197
|
+
# Selenium 4에서는 'capabilities'만 사용하는 방식
|
198
|
+
@driver = Selenium::WebDriver.for(:chrome, capabilities: [capabilities, options])
|
199
|
+
|
200
|
+
@driver.execute_script("Object.defineProperty(navigator, 'webdriver', {get: function(){ return false; }});") # 셀레니움 감지 방지
|
201
|
+
|
109
202
|
rescue
|
110
|
-
@driver = Selenium::WebDriver.for(:chrome, capabilities: options)
|
203
|
+
@driver = Selenium::WebDriver.for(:chrome, capabilities: [capabilities, options])
|
111
204
|
end
|
112
205
|
end
|
113
206
|
end
|
@@ -689,34 +782,51 @@ class Wordpress
|
|
689
782
|
end
|
690
783
|
|
691
784
|
if @data['포스트설정']['테더링'].checked?
|
692
|
-
puts '
|
785
|
+
puts 'Tethering IP change...'
|
786
|
+
|
693
787
|
stdout, stderr, status = Open3.capture3('./adb devices')
|
788
|
+
|
694
789
|
if status.success?
|
695
|
-
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
|
790
|
+
device_id = stdout.split("\n")[1].split("\t")[0]
|
791
|
+
puts device_id
|
792
|
+
|
793
|
+
# ADB 서버 초기화
|
794
|
+
puts 'adb kill-server'
|
795
|
+
Open3.capture3('./adb kill-server')
|
796
|
+
sleep(3)
|
797
|
+
|
798
|
+
# 다시 ADB 서버 실행
|
799
|
+
puts 'adb start-server'
|
800
|
+
Open3.capture3('./adb start-server')
|
801
|
+
sleep(3)
|
802
|
+
|
803
|
+
# 데이터를 끄고 켜기
|
804
|
+
puts 'adb -s ' + device_id + ' shell svc data disable'
|
805
|
+
stdout2, stderr2, status2 = Open3.capture3('./adb -s '+device_id+' shell svc data disable')
|
806
|
+
sleep(3)
|
807
|
+
puts 'adb -s ' + device_id + ' shell svc data enable'
|
808
|
+
Open3.capture3('./adb -s '+device_id+' shell svc data enable')
|
809
|
+
sleep(3)
|
810
|
+
puts 'adb ok'
|
811
|
+
sleep(8)
|
812
|
+
|
813
|
+
robot_ip = lambda do
|
814
|
+
http = HTTP.get('https://www.findip.kr/')
|
815
|
+
noko = Nokogiri::HTML(http.to_s)
|
816
|
+
if noko.xpath('/html/body/header/h2').text != @my_ip
|
817
|
+
@my_ip = noko.xpath('/html/body/header/h2').text
|
818
|
+
puts "IP 변경됨[ #{@my_ip} ]"
|
819
|
+
else
|
820
|
+
puts @my_ip
|
821
|
+
puts '제시도...'
|
822
|
+
sleep(3)
|
823
|
+
robot_ip[]
|
716
824
|
end
|
717
|
-
|
825
|
+
end
|
826
|
+
robot_ip[]
|
827
|
+
|
718
828
|
else
|
719
|
-
puts 'adb error pass'
|
829
|
+
puts 'adb error pass'
|
720
830
|
end
|
721
831
|
end
|
722
832
|
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tg_send_duo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.52
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- zon
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date: 2025-
|
10
|
+
date: 2025-05-29 00:00:00.000000000 Z
|
12
11
|
dependencies: []
|
13
12
|
description: File to Clipboard gem
|
14
13
|
email: mymin26@naver.com
|
@@ -21,7 +20,6 @@ homepage: ''
|
|
21
20
|
licenses:
|
22
21
|
- zon
|
23
22
|
metadata: {}
|
24
|
-
post_install_message:
|
25
23
|
rdoc_options: []
|
26
24
|
require_paths:
|
27
25
|
- lib
|
@@ -36,8 +34,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
36
34
|
- !ruby/object:Gem::Version
|
37
35
|
version: '0'
|
38
36
|
requirements: []
|
39
|
-
rubygems_version: 3.
|
40
|
-
signing_key:
|
37
|
+
rubygems_version: 3.6.7
|
41
38
|
specification_version: 4
|
42
39
|
summary: file to clipboard
|
43
40
|
test_files: []
|