nblog_duo 0.0.61 → 0.0.63
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/nblog_duo.rb +85 -25
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 857e0fcb6a167f4547ed718eeff26da29c3506d4cc3e8b3e7291d60e6042b1a3
|
4
|
+
data.tar.gz: 2082ea5537919d1ca80dd0148ffc0b943ab4f34a7a4910f469833d13132da11c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8407a60ca79af5af2c4dee652ca5e2037e1520a05a7cf0547aff0cd338e0ef40a9fc705373b26451a1b05ab77c7a8ef3857428dc0524ac8fd58bc5b925ec3f49
|
7
|
+
data.tar.gz: f2c7d5bd694791756aadc7dc992e2c084db5362c0212a709af5a3cfb91d2819df7a9eaf384ee5a060f6723eb8de9e2eb52f1431f06015576a39566e47b2966e2
|
data/lib/nblog_duo.rb
CHANGED
@@ -230,9 +230,19 @@ class Naver
|
|
230
230
|
options.add_argument('--disable-gpu')
|
231
231
|
options.add_argument('--remote-debugging-port=9222')
|
232
232
|
options.add_argument('user-data-dir=C:/naver_cookie/' + user_id)
|
233
|
-
|
234
|
-
|
235
|
-
|
233
|
+
options.add_argument('--disable-blink-features=AutomationControlled') # JavaScript로 navigator.webdriver 숨기기
|
234
|
+
|
235
|
+
# 'capabilities'과 'options' 배열로 설정
|
236
|
+
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome
|
237
|
+
capabilities["goog:chromeOptions"] = options.as_json
|
238
|
+
|
239
|
+
# Selenium 4에서는 'capabilities'만 사용하는 방식
|
240
|
+
@driver = Selenium::WebDriver.for(:chrome, capabilities: [capabilities, options])
|
241
|
+
|
242
|
+
@driver.execute_script("Object.defineProperty(navigator, 'webdriver', {get: function(){ return false; }});") # 셀레니움 감지 방지
|
243
|
+
|
244
|
+
rescue => e
|
245
|
+
@driver = Selenium::WebDriver.for(:chrome, capabilities: [capabilities, options])
|
236
246
|
end
|
237
247
|
else
|
238
248
|
begin
|
@@ -248,7 +258,17 @@ class Naver
|
|
248
258
|
options.add_argument('--disable-gpu')
|
249
259
|
options.add_argument('--remote-debugging-port=9222')
|
250
260
|
options.add_argument('user-data-dir=C:/naver_cookie/' + user_id)
|
251
|
-
|
261
|
+
|
262
|
+
options.add_argument('--disable-blink-features=AutomationControlled') # JavaScript로 navigator.webdriver 숨기기
|
263
|
+
|
264
|
+
# 'capabilities'과 'options' 배열로 설정
|
265
|
+
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome
|
266
|
+
capabilities["goog:chromeOptions"] = options.as_json
|
267
|
+
|
268
|
+
# Selenium 4에서는 'capabilities'만 사용하는 방식
|
269
|
+
@driver = Selenium::WebDriver.for(:chrome, capabilities: [capabilities, options])
|
270
|
+
|
271
|
+
@driver.execute_script("Object.defineProperty(navigator, 'webdriver', {get: function(){ return false; }});") # 셀레니움 감지 방지
|
252
272
|
rescue => e
|
253
273
|
puts e
|
254
274
|
puts 'proxy error...'
|
@@ -264,9 +284,18 @@ class Naver
|
|
264
284
|
options.add_argument('--disable-gpu')
|
265
285
|
options.add_argument('--remote-debugging-port=9222')
|
266
286
|
options.add_argument('user-data-dir=C:/naver_cookie/' + user_id)
|
267
|
-
|
287
|
+
options.add_argument('--disable-blink-features=AutomationControlled') # JavaScript로 navigator.webdriver 숨기기
|
288
|
+
|
289
|
+
# 'capabilities'과 'options' 배열로 설정
|
290
|
+
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome
|
291
|
+
capabilities["goog:chromeOptions"] = options.as_json
|
292
|
+
|
293
|
+
# Selenium 4에서는 'capabilities'만 사용하는 방식
|
294
|
+
@driver = Selenium::WebDriver.for(:chrome, capabilities: [capabilities, options])
|
295
|
+
|
296
|
+
@driver.execute_script("Object.defineProperty(navigator, 'webdriver', {get: function(){ return false; }});") # 셀레니움 감지 방지
|
268
297
|
rescue
|
269
|
-
@driver = Selenium::WebDriver.for(:chrome,
|
298
|
+
@driver = Selenium::WebDriver.for(:chrome, capabilities: [capabilities, options])
|
270
299
|
end
|
271
300
|
end
|
272
301
|
end
|
@@ -274,6 +303,7 @@ class Naver
|
|
274
303
|
|
275
304
|
|
276
305
|
|
306
|
+
|
277
307
|
def login(user_id, user_pw, proxy)
|
278
308
|
@user_id = user_id
|
279
309
|
@user_id11 = user_id
|
@@ -2370,36 +2400,66 @@ class Wordpress
|
|
2370
2400
|
|
2371
2401
|
if table[8].to_i > table[11].to_i
|
2372
2402
|
if @data['포스트설정']['테더링'].checked?
|
2373
|
-
puts '
|
2403
|
+
puts 'Tethering IP change...'
|
2404
|
+
|
2374
2405
|
stdout, stderr, status = Open3.capture3('./adb devices')
|
2406
|
+
|
2375
2407
|
if status.success?
|
2376
|
-
|
2377
|
-
|
2378
|
-
|
2379
|
-
|
2408
|
+
device_id = stdout.split("\n")[1].split("\t")[0]
|
2409
|
+
puts device_id
|
2410
|
+
|
2411
|
+
# ADB 서버 초기화
|
2412
|
+
puts 'adb kill-server'
|
2413
|
+
Open3.capture3('adb kill-server')
|
2414
|
+
sleep(2)
|
2415
|
+
|
2416
|
+
# 다시 ADB 서버 실행
|
2417
|
+
puts 'adb start-server'
|
2418
|
+
Open3.capture3('adb start-server')
|
2419
|
+
sleep(2)
|
2420
|
+
|
2421
|
+
# 데이터를 끄고 켜기
|
2422
|
+
puts 'adb -s ' + device_id + ' shell svc data disable'
|
2423
|
+
stdout2, stderr2, status2 = Open3.capture3('./adb -s ' + device_id + ' shell svc data disable')
|
2424
|
+
|
2425
|
+
if status2.success?
|
2380
2426
|
sleep(3)
|
2381
|
-
puts 'adb -s '+device_id+' shell svc data enable'
|
2382
|
-
Open3.capture3('./adb -s '+device_id+' shell svc data enable')
|
2427
|
+
puts 'adb -s ' + device_id + ' shell svc data enable'
|
2428
|
+
Open3.capture3('./adb -s ' + device_id + ' shell svc data enable')
|
2383
2429
|
sleep(3)
|
2384
2430
|
puts 'adb ok'
|
2385
2431
|
sleep(8)
|
2432
|
+
|
2433
|
+
# IP 변경을 확인하는 람다 함수
|
2386
2434
|
robot_ip = lambda do
|
2387
|
-
|
2388
|
-
|
2389
|
-
|
2390
|
-
|
2391
|
-
|
2392
|
-
|
2393
|
-
|
2394
|
-
|
2395
|
-
|
2435
|
+
loop do # 무한 루프
|
2436
|
+
begin
|
2437
|
+
http = HTTP.get('https://www.findip.kr/')
|
2438
|
+
noko = Nokogiri::HTML(http.to_s)
|
2439
|
+
new_ip = noko.xpath('/html/body/header/h2').text.strip
|
2440
|
+
|
2441
|
+
if new_ip != @my_ip
|
2442
|
+
@my_ip = new_ip
|
2443
|
+
puts "IP 변경됨: #{@my_ip}"
|
2444
|
+
break # IP가 변경되었으면 루프 종료
|
2445
|
+
else
|
2446
|
+
puts 'IP가 변경되지 않음. 재시도...'
|
2447
|
+
sleep(3) # 3초 후 재시도
|
2448
|
+
end
|
2449
|
+
rescue => e
|
2450
|
+
puts "IP 확인 중 오류 발생: #{e.message}. 재시도 중..."
|
2451
|
+
sleep(3) # 3초 후 재시도
|
2396
2452
|
end
|
2453
|
+
end
|
2397
2454
|
end
|
2398
|
-
robot_ip[]
|
2455
|
+
robot_ip[] # 최초 호출
|
2456
|
+
else
|
2457
|
+
puts 'Failed to disable data. Error: ' + stderr2
|
2458
|
+
end
|
2399
2459
|
else
|
2400
|
-
|
2460
|
+
puts 'adb error, unable to get devices. Error: ' + stderr
|
2401
2461
|
end
|
2402
|
-
|
2462
|
+
end
|
2403
2463
|
|
2404
2464
|
check_success = 1
|
2405
2465
|
@data['table'][index][-1] = 0
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nblog_duo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.63
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- zon
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-02-
|
11
|
+
date: 2025-02-10 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: File to Clipboard gem
|
14
14
|
email: mymin26@naver.com
|