nblog_zon 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_zon.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: 2ca36b0fe8b268337d4c28ec3dc35522a87c41cbfc933c14be07cd376e1650c8
|
4
|
+
data.tar.gz: c33148e61f13e5a174795f005e76668c05e2faa40241c2cc37cbad7301b41ece
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 614b7e0ba725ad4a4d3461d97ca81fad1381576cf48dde835192e3c9cfa0cf203817ed0a39bed55b2e11261f78b04b2428e99f336ab0ff22340a565e1fea2861
|
7
|
+
data.tar.gz: 912194165b3216b3a2d87cfc2bfc1fb2a4cbd73ac2ab2c37f776be84661a8797964911425fa5d25fa21c8ba7f824c4aef867e99aa76f9b95bacd49e559d9631d
|
data/lib/nblog_zon.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
|
@@ -275,6 +304,7 @@ class Naver
|
|
275
304
|
|
276
305
|
|
277
306
|
|
307
|
+
|
278
308
|
def login(user_id, user_pw, proxy)
|
279
309
|
@user_id = user_id
|
280
310
|
@user_id11 = user_id
|
@@ -2304,36 +2334,66 @@ class Wordpress
|
|
2304
2334
|
|
2305
2335
|
if table[8].to_i > table[11].to_i
|
2306
2336
|
if @data['포스트설정']['테더링'].checked?
|
2307
|
-
puts '
|
2337
|
+
puts 'Tethering IP change...'
|
2338
|
+
|
2308
2339
|
stdout, stderr, status = Open3.capture3('./adb devices')
|
2340
|
+
|
2309
2341
|
if status.success?
|
2310
|
-
|
2311
|
-
|
2312
|
-
|
2313
|
-
|
2342
|
+
device_id = stdout.split("\n")[1].split("\t")[0]
|
2343
|
+
puts device_id
|
2344
|
+
|
2345
|
+
# ADB 서버 초기화
|
2346
|
+
puts 'adb kill-server'
|
2347
|
+
Open3.capture3('adb kill-server')
|
2348
|
+
sleep(2)
|
2349
|
+
|
2350
|
+
# 다시 ADB 서버 실행
|
2351
|
+
puts 'adb start-server'
|
2352
|
+
Open3.capture3('adb start-server')
|
2353
|
+
sleep(2)
|
2354
|
+
|
2355
|
+
# 데이터를 끄고 켜기
|
2356
|
+
puts 'adb -s ' + device_id + ' shell svc data disable'
|
2357
|
+
stdout2, stderr2, status2 = Open3.capture3('./adb -s ' + device_id + ' shell svc data disable')
|
2358
|
+
|
2359
|
+
if status2.success?
|
2314
2360
|
sleep(3)
|
2315
|
-
puts 'adb -s '+device_id+' shell svc data enable'
|
2316
|
-
Open3.capture3('./adb -s '+device_id+' shell svc data enable')
|
2361
|
+
puts 'adb -s ' + device_id + ' shell svc data enable'
|
2362
|
+
Open3.capture3('./adb -s ' + device_id + ' shell svc data enable')
|
2317
2363
|
sleep(3)
|
2318
2364
|
puts 'adb ok'
|
2319
2365
|
sleep(8)
|
2366
|
+
|
2367
|
+
# IP 변경을 확인하는 람다 함수
|
2320
2368
|
robot_ip = lambda do
|
2321
|
-
|
2322
|
-
|
2323
|
-
|
2324
|
-
|
2325
|
-
|
2326
|
-
|
2327
|
-
|
2328
|
-
|
2329
|
-
|
2369
|
+
loop do # 무한 루프
|
2370
|
+
begin
|
2371
|
+
http = HTTP.get('https://www.findip.kr/')
|
2372
|
+
noko = Nokogiri::HTML(http.to_s)
|
2373
|
+
new_ip = noko.xpath('/html/body/header/h2').text.strip
|
2374
|
+
|
2375
|
+
if new_ip != @my_ip
|
2376
|
+
@my_ip = new_ip
|
2377
|
+
puts "IP 변경됨: #{@my_ip}"
|
2378
|
+
break # IP가 변경되었으면 루프 종료
|
2379
|
+
else
|
2380
|
+
puts 'IP가 변경되지 않음. 재시도...'
|
2381
|
+
sleep(3) # 3초 후 재시도
|
2382
|
+
end
|
2383
|
+
rescue => e
|
2384
|
+
puts "IP 확인 중 오류 발생: #{e.message}. 재시도 중..."
|
2385
|
+
sleep(3) # 3초 후 재시도
|
2330
2386
|
end
|
2387
|
+
end
|
2331
2388
|
end
|
2332
|
-
robot_ip[]
|
2389
|
+
robot_ip[] # 최초 호출
|
2390
|
+
else
|
2391
|
+
puts 'Failed to disable data. Error: ' + stderr2
|
2392
|
+
end
|
2333
2393
|
else
|
2334
|
-
|
2394
|
+
puts 'adb error, unable to get devices. Error: ' + stderr
|
2335
2395
|
end
|
2336
|
-
|
2396
|
+
end
|
2337
2397
|
|
2338
2398
|
check_success = 1
|
2339
2399
|
@data['table'][index][-1] = 0
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nblog_zon
|
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: rnjstnswp123@naver.com
|