cafe_buy_duo 0.0.39 → 0.0.51

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/cafe_buy_duo.rb +99 -57
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d31236851bcf2d4dee34c03e6a241d00b94506fa3c4ec26eddd9c273a6d30dcb
4
- data.tar.gz: 960b15432b170414ccf59240adf793eaed67b0587f60a93a19bf0e4813446092
3
+ metadata.gz: 5190146a15ac1b0efb060a051aaed921593c9cb7b40a131f3316ecd15c994bd4
4
+ data.tar.gz: 6923fea1091b14ad9e728be5269ac4b317283913069e01e31ad72556a0160552
5
5
  SHA512:
6
- metadata.gz: 6422148e457afc190a2e698afda92fc73738437864427cf17717cecfab61a64b686c341dd6cc5c3c20e4bb5c8f97a67b464bcf81c2974b33a3e608c4debc1090
7
- data.tar.gz: 61a7df43d0fd9bc65046cbfd438f01083e53ff40a5e52d6cb1430c8446ee206005a66ac895b12f0718eb5daad627961333d9384b4e1d8d9d235213eb92717103
6
+ metadata.gz: ef0b0967d98c3b9c0123ed516bd19a72e4e9ece8e1ca003a3b5fc6d7af1d4a4968e6a11efff3167fcc4795f24a8de7f04ae3bacd3aae94fb3b2d08323ebd0f15
7
+ data.tar.gz: 42e034f833d5f14dc4a2aea963bd84128ef933488d24df5af5564c146d3e4a5c01cabe3a932cd0db51bd4d68293d8e236c10f420726afc8c485044acb2d93e8d
data/lib/cafe_buy_duo.rb CHANGED
@@ -235,9 +235,19 @@ class Naver
235
235
  options.add_argument('--disable-gpu')
236
236
  options.add_argument('--remote-debugging-port=9222')
237
237
  options.add_argument('user-data-dir=C:/naver_cookie/' + user_id)
238
- @driver = Selenium::WebDriver.for(:chrome, options: options)
239
- rescue
240
- @driver = Selenium::WebDriver.for(:chrome, options: options)
238
+ options.add_argument('--disable-blink-features=AutomationControlled') # JavaScript로 navigator.webdriver 숨기기
239
+
240
+ # 'capabilities'과 'options' 배열로 설정
241
+ capabilities = Selenium::WebDriver::Remote::Capabilities.chrome
242
+ capabilities["goog:chromeOptions"] = options.as_json
243
+
244
+ # Selenium 4에서는 'capabilities'만 사용하는 방식
245
+ @driver = Selenium::WebDriver.for(:chrome, capabilities: [capabilities, options])
246
+
247
+ @driver.execute_script("Object.defineProperty(navigator, 'webdriver', {get: function(){ return false; }});") # 셀레니움 감지 방지
248
+
249
+ rescue => e
250
+ @driver = Selenium::WebDriver.for(:chrome, capabilities: [capabilities, options])
241
251
  end
242
252
  else
243
253
  begin
@@ -253,7 +263,17 @@ class Naver
253
263
  options.add_argument('--disable-gpu')
254
264
  options.add_argument('--remote-debugging-port=9222')
255
265
  options.add_argument('user-data-dir=C:/naver_cookie/' + user_id)
256
- @driver = Selenium::WebDriver.for(:chrome, options: options)
266
+
267
+ options.add_argument('--disable-blink-features=AutomationControlled') # JavaScript로 navigator.webdriver 숨기기
268
+
269
+ # 'capabilities'과 'options' 배열로 설정
270
+ capabilities = Selenium::WebDriver::Remote::Capabilities.chrome
271
+ capabilities["goog:chromeOptions"] = options.as_json
272
+
273
+ # Selenium 4에서는 'capabilities'만 사용하는 방식
274
+ @driver = Selenium::WebDriver.for(:chrome, capabilities: [capabilities, options])
275
+
276
+ @driver.execute_script("Object.defineProperty(navigator, 'webdriver', {get: function(){ return false; }});") # 셀레니움 감지 방지
257
277
  rescue => e
258
278
  puts e
259
279
  puts 'proxy error...'
@@ -269,9 +289,18 @@ class Naver
269
289
  options.add_argument('--disable-gpu')
270
290
  options.add_argument('--remote-debugging-port=9222')
271
291
  options.add_argument('user-data-dir=C:/naver_cookie/' + user_id)
272
- @driver = Selenium::WebDriver.for(:chrome, options: options)
292
+ options.add_argument('--disable-blink-features=AutomationControlled') # JavaScript로 navigator.webdriver 숨기기
293
+
294
+ # 'capabilities'과 'options' 배열로 설정
295
+ capabilities = Selenium::WebDriver::Remote::Capabilities.chrome
296
+ capabilities["goog:chromeOptions"] = options.as_json
297
+
298
+ # Selenium 4에서는 'capabilities'만 사용하는 방식
299
+ @driver = Selenium::WebDriver.for(:chrome, capabilities: [capabilities, options])
300
+
301
+ @driver.execute_script("Object.defineProperty(navigator, 'webdriver', {get: function(){ return false; }});") # 셀레니움 감지 방지
273
302
  rescue
274
- @driver = Selenium::WebDriver.for(:chrome, options: options)
303
+ @driver = Selenium::WebDriver.for(:chrome, capabilities: [capabilities, options])
275
304
  end
276
305
  end
277
306
  end
@@ -279,6 +308,7 @@ class Naver
279
308
 
280
309
 
281
310
 
311
+
282
312
  def login(user_id, user_pw, proxy)
283
313
  @user_id = user_id
284
314
  @user_id11 = user_id
@@ -2520,65 +2550,77 @@ class Wordpress
2520
2550
  puts table[10]
2521
2551
  if table[7].to_i > table[10].to_i
2522
2552
  if @data['포스트설정']['테더링'].checked?
2523
- puts 'tethering ip change...'
2524
-
2525
- # ADB devices 확인
2526
- stdout, stderr, status = Open3.capture3('./adb devices')
2527
- if status.success?
2528
- device_id = stdout.split("\n")[1].split("\t")[0]
2529
- puts device_id
2530
- puts 'adb -s ' + device_id + ' shell svc data disable'
2531
-
2532
- stdout2, stderr2, status2 = Open3.capture3('./adb -s ' + device_id + ' shell svc data disable')
2533
- if status2.success?
2534
- sleep(3)
2535
- puts 'adb -s ' + device_id + ' shell svc data enable'
2536
- Open3.capture3('./adb -s ' + device_id + ' shell svc data enable')
2537
- sleep(3)
2538
- puts 'adb ok'
2539
- sleep(8)
2540
-
2541
- # IP 확인 및 재시도 (반복문 사용)
2542
- retry_count = 0
2543
- max_retries = 5
2544
- current_ip = nil
2545
-
2546
- # 무한 루프 방지
2547
- while retry_count < max_retries
2548
- begin
2549
- http = HTTP.get('https://www.findip.kr/')
2550
- noko = Nokogiri::HTML(http.to_s)
2551
- new_ip = noko.xpath('/html/body/header/h2').text.strip
2552
-
2553
- puts "Current IP: #{@my_ip}, New IP: #{new_ip}"
2554
-
2555
- # IP가 변경되었으면 @my_ip를 갱신하고 종료
2556
- if new_ip != @my_ip
2557
- @my_ip = new_ip
2558
- puts "IP 변경됨: #{@my_ip}"
2559
- break
2560
- else
2561
- puts 'IP가 변경되지 않음. 재시도...'
2553
+ puts 'tethering ip change...'
2554
+
2555
+ # ADB devices 확인
2556
+ stdout, stderr, status = Open3.capture3('./adb devices')
2557
+ if status.success?
2558
+ device_id = stdout.split("\n")[1].split("\t")[0]
2559
+ puts device_id
2560
+
2561
+ # ADB 서버 초기화
2562
+ puts 'adb kill-server'
2563
+ Open3.capture3('adb kill-server')
2564
+ sleep(2)
2565
+
2566
+ # 다시 ADB 서버 실행
2567
+ puts 'adb start-server'
2568
+ Open3.capture3('adb start-server')
2569
+ sleep(2)
2570
+
2571
+ # 데이터를 끄고 켜기
2572
+ puts 'adb -s ' + device_id + ' shell svc data disable'
2573
+ stdout2, stderr2, status2 = Open3.capture3('./adb -s ' + device_id + ' shell svc data disable')
2574
+
2575
+ if status2.success?
2576
+ sleep(3)
2577
+ puts 'adb -s ' + device_id + ' shell svc data enable'
2578
+ Open3.capture3('./adb -s ' + device_id + ' shell svc data enable')
2579
+ sleep(3)
2580
+ puts 'adb ok'
2581
+ sleep(8)
2582
+
2583
+ # IP 확인 재시도 (반복문 사용)
2584
+ retry_count = 0
2585
+ max_retries = 5
2586
+ current_ip = nil
2587
+
2588
+ # 무한 루프 방지
2589
+ while retry_count < max_retries
2590
+ begin
2591
+ http = HTTP.get('https://www.findip.kr/')
2592
+ noko = Nokogiri::HTML(http.to_s)
2593
+ new_ip = noko.xpath('/html/body/header/h2').text.strip
2594
+
2595
+ puts "Current IP: #{@my_ip}, New IP: #{new_ip}"
2596
+
2597
+ # IP가 변경되었으면 @my_ip를 갱신하고 종료
2598
+ if new_ip != @my_ip
2599
+ @my_ip = new_ip
2600
+ puts "IP 변경됨: #{@my_ip}"
2601
+ break
2602
+ else
2603
+ puts 'IP가 변경되지 않음. 재시도...'
2604
+ retry_count += 1
2605
+ sleep(3) # 3초 후 재시도
2606
+ end
2607
+ rescue => e
2562
2608
  retry_count += 1
2563
2609
  sleep(3) # 3초 후 재시도
2564
2610
  end
2565
- rescue => e
2566
- retry_count += 1
2567
- sleep(3) # 3초 재시도
2568
- end
2569
-
2570
- # 최대 재시도 횟수를 초과하면 예외 발생시키기
2571
- if retry_count >= max_retries
2572
- raise "최대 재시도 횟수 초과. IP 변경 실패."
2611
+
2612
+ # 최대 재시도 횟수를 초과하면 예외 발생시키기
2613
+ if retry_count >= max_retries
2614
+ raise "최대 재시도 횟수 초과. IP 변경 실패."
2615
+ end
2573
2616
  end
2617
+ else
2618
+ puts 'Failed to disable data. Error: ' + stderr2
2574
2619
  end
2575
2620
  else
2576
- puts 'Failed to disable data. Error: ' + stderr2
2621
+ puts 'adb error, unable to get devices. Error: ' + stderr
2577
2622
  end
2578
- else
2579
- puts 'adb error, unable to get devices. Error: ' + stderr
2580
2623
  end
2581
- end
2582
2624
 
2583
2625
 
2584
2626
  check_success = 1
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cafe_buy_duo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.39
4
+ version: 0.0.51
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-07 00:00:00.000000000 Z
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