posting_zon 3.109.999 → 3.111.001

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/posting_zon.rb +240 -116
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cf1859679c6edbfdc20717842b37d2c85a99d229b200b6e2bc33635473c0d2fb
4
- data.tar.gz: 87a722cf9e5c09c2db8376017f2baa24bd38fbd1274f23fa3ced10ad3cc87235
3
+ metadata.gz: de9e2dd8ad31a935cc9951e679535245c9e59806626ed8c5bd51bd86047bc9bf
4
+ data.tar.gz: 7fa792d8aac719f062c36bcc2a11767f1f9027f4bb3ad72cfb710b8122afbc0b
5
5
  SHA512:
6
- metadata.gz: 27279d8c1cc87ebabca49de9019958c6a1d6bd822abce9089c71ec2224044c0b1aa034f9997e23247581050a4ee39fcbb14d120c6a6290bef9b17f2412f06f92
7
- data.tar.gz: 4262096807c9b251ed31d674c110232444ebea4fd080237dbc121f414df3afc15c7c8fe257f9873d6f9d8d192e28b34b3b78506dfe2025a7985dee15323b6c60
6
+ metadata.gz: 962b2eda1ba057c5347b23b9f5a09959bec3b98a1eb71c0e625843be48140f0cf8ad033549a57d841d47dafefd28e3c218e0ea3e681292885d63fa373e0a3888
7
+ data.tar.gz: 8599136bb75bb8acaf0c09c54460f2b7d455cc08570aba230bb524b227f7d74d14eb45f1ae918e6d65e65bf085596f27a30401565c78e6f4cf3632b71195b50f
data/lib/posting_zon.rb CHANGED
@@ -691,12 +691,22 @@ def update(user_id, user_pw, title, content, option, post_url, signup_url, login
691
691
 
692
692
  #오른쪽 마우스 해제 코드
693
693
  begin
694
- # 우 클릭 해제
694
+ # 우 클릭 해제
695
695
  @driver.execute_script <<~JS
696
- window.alert = function() {};
696
+ // 모든 요소 순회하면서 oncontextmenu 제거
697
+ document.querySelectorAll('*').forEach(el => {
698
+ el.oncontextmenu = null;
699
+ });
700
+
701
+ // 이벤트 리스너로 막는 것도 제거
697
702
  document.addEventListener('contextmenu', event => event.stopPropagation(), true);
698
703
  document.oncontextmenu = null;
699
- document.body.oncontextmenu = null;
704
+ if (document.documentElement) {
705
+ document.documentElement.oncontextmenu = null; // <html> 태그
706
+ }
707
+ if (document.body) {
708
+ document.body.oncontextmenu = null; // <body> 태그
709
+ }
700
710
  JS
701
711
  rescue
702
712
  end
@@ -1177,7 +1187,9 @@ def update(user_id, user_pw, title, content, option, post_url, signup_url, login
1177
1187
  ##<────────────────────────────────────────────────────────────────────────────────────────────────────────────────캡챠 체크
1178
1188
  ##<────────────────────────────────────────────────────────────────────────────────────────────────────────────────캡챠 체크
1179
1189
  ##<────────────────────────────────────────────────────────────────────────────────────────────────────────────────캡챠 체크
1180
-
1190
+
1191
+
1192
+
1181
1193
  begin
1182
1194
  @driver.find_element(:xpath, '//*[@class="captcha-solver captcha-solver_inner"]')
1183
1195
  check_captcha = 1
@@ -2002,12 +2014,25 @@ def update(user_id, user_pw, title, content, option, post_url, signup_url, login
2002
2014
  sleep(1)
2003
2015
  ##캡챠 이미지,2캡챠,,등등 코드 부분─────────────────────────────────────────────────────────────────────>
2004
2016
  begin
2005
- # 우 클릭 해제
2017
+ # 우 클릭 해제 alert 팝업 활성화
2006
2018
  @driver.execute_script <<~JS
2019
+ // 기존 alert 저장하고 비활성화
2020
+ window._originalAlert = window.alert;
2007
2021
  window.alert = function() {};
2022
+
2023
+ // 전체 DOM 요소에서 우클릭 차단 해제
2024
+ document.querySelectorAll('*').forEach(el => {
2025
+ el.oncontextmenu = null;
2026
+ });
2027
+
2008
2028
  document.addEventListener('contextmenu', event => event.stopPropagation(), true);
2009
2029
  document.oncontextmenu = null;
2010
- document.body.oncontextmenu = null;
2030
+ if (document.documentElement) {
2031
+ document.documentElement.oncontextmenu = null;
2032
+ }
2033
+ if (document.body) {
2034
+ document.body.oncontextmenu = null;
2035
+ }
2011
2036
  JS
2012
2037
  rescue
2013
2038
  end
@@ -3546,15 +3571,19 @@ end
3546
3571
 
3547
3572
 
3548
3573
 
3549
-
3550
-
3551
-
3552
-
3553
-
3554
-
3555
3574
  else
3556
3575
  end
3557
3576
 
3577
+ begin
3578
+ # 우 클릭 해제 alert 금지 비활성
3579
+ @driver.execute_script <<~JS
3580
+ if (window._originalAlert) {
3581
+ window.alert = window._originalAlert;
3582
+ delete window._originalAlert;
3583
+ }
3584
+ JS
3585
+ rescue
3586
+ end
3558
3587
 
3559
3588
  ##<─────────────────────────────────────────────────────────────────────캡챠 해제 입력 코드 부분
3560
3589
 
@@ -3712,12 +3741,22 @@ login_url = option['login_url'].to_s
3712
3741
 
3713
3742
  ##캡챠 해제 입력 코드 부분─────────────────────────────────────────────────────────────────────>
3714
3743
  begin
3715
- # 우 클릭 해제
3744
+ # 우 클릭 해제
3716
3745
  @driver.execute_script <<~JS
3717
- window.alert = function() {};
3746
+ // 모든 요소 순회하면서 oncontextmenu 제거
3747
+ document.querySelectorAll('*').forEach(el => {
3748
+ el.oncontextmenu = null;
3749
+ });
3750
+
3751
+ // 이벤트 리스너로 막는 것도 제거
3718
3752
  document.addEventListener('contextmenu', event => event.stopPropagation(), true);
3719
3753
  document.oncontextmenu = null;
3720
- document.body.oncontextmenu = null;
3754
+ if (document.documentElement) {
3755
+ document.documentElement.oncontextmenu = null; // <html> 태그
3756
+ }
3757
+ if (document.body) {
3758
+ document.body.oncontextmenu = null; // <body> 태그
3759
+ }
3721
3760
  JS
3722
3761
  rescue
3723
3762
  end
@@ -5156,12 +5195,22 @@ begin
5156
5195
 
5157
5196
  sleep(1)
5158
5197
  begin
5159
- # 우 클릭 해제
5198
+ # 우 클릭 해제
5160
5199
  @driver.execute_script <<~JS
5161
- window.alert = function() {};
5200
+ // 모든 요소 순회하면서 oncontextmenu 제거
5201
+ document.querySelectorAll('*').forEach(el => {
5202
+ el.oncontextmenu = null;
5203
+ });
5204
+
5205
+ // 이벤트 리스너로 막는 것도 제거
5162
5206
  document.addEventListener('contextmenu', event => event.stopPropagation(), true);
5163
5207
  document.oncontextmenu = null;
5164
- document.body.oncontextmenu = null;
5208
+ if (document.documentElement) {
5209
+ document.documentElement.oncontextmenu = null; // <html> 태그
5210
+ }
5211
+ if (document.body) {
5212
+ document.body.oncontextmenu = null; // <body> 태그
5213
+ }
5165
5214
  JS
5166
5215
  rescue
5167
5216
  end
@@ -5539,12 +5588,22 @@ post_url = option['post_url'].to_s
5539
5588
 
5540
5589
  sleep(1)
5541
5590
  begin
5542
- # 우 클릭 해제
5591
+ # 우 클릭 해제
5543
5592
  @driver.execute_script <<~JS
5544
- window.alert = function() {};
5593
+ // 모든 요소 순회하면서 oncontextmenu 제거
5594
+ document.querySelectorAll('*').forEach(el => {
5595
+ el.oncontextmenu = null;
5596
+ });
5597
+
5598
+ // 이벤트 리스너로 막는 것도 제거
5545
5599
  document.addEventListener('contextmenu', event => event.stopPropagation(), true);
5546
5600
  document.oncontextmenu = null;
5547
- document.body.oncontextmenu = null;
5601
+ if (document.documentElement) {
5602
+ document.documentElement.oncontextmenu = null; // <html> 태그
5603
+ }
5604
+ if (document.body) {
5605
+ document.body.oncontextmenu = null; // <body> 태그
5606
+ }
5548
5607
  JS
5549
5608
  rescue
5550
5609
  end
@@ -9733,12 +9792,25 @@ rescue
9733
9792
  end
9734
9793
 
9735
9794
  begin
9736
- # 우 클릭 해제
9795
+ # 우 클릭 해제 alert 팝업 활성화
9737
9796
  @driver.execute_script <<~JS
9797
+ // 기존 alert 저장하고 비활성화
9798
+ window._originalAlert = window.alert;
9738
9799
  window.alert = function() {};
9800
+
9801
+ // 전체 DOM 요소에서 우클릭 차단 해제
9802
+ document.querySelectorAll('*').forEach(el => {
9803
+ el.oncontextmenu = null;
9804
+ });
9805
+
9739
9806
  document.addEventListener('contextmenu', event => event.stopPropagation(), true);
9740
9807
  document.oncontextmenu = null;
9741
- document.body.oncontextmenu = null;
9808
+ if (document.documentElement) {
9809
+ document.documentElement.oncontextmenu = null;
9810
+ }
9811
+ if (document.body) {
9812
+ document.body.oncontextmenu = null;
9813
+ }
9742
9814
  JS
9743
9815
  rescue
9744
9816
  end
@@ -11448,7 +11520,49 @@ if check_captcha == 0
11448
11520
  puts '-[√] 캡챠 해제 가능 유무 확인.......'.green
11449
11521
  sleep(1)
11450
11522
  rescue
11451
-
11523
+ begin
11524
+
11525
+ @driver.find_element(:xpath, '//input[@class="input" and @title="보안문자"]').click
11526
+ sleep(1)
11527
+ el2 = @driver.find_element(:xpath, '//input[@class="input" and @title="보안문자"]')
11528
+ @driver.action.context_click(el2).perform
11529
+
11530
+ sleep(1)
11531
+ @driver.action.key_stroke('up')
11532
+ sleep(1)
11533
+ @driver.action.key_stroke('up')
11534
+ sleep(1)
11535
+ @driver.action.key_stroke('enter')
11536
+ sleep(1)
11537
+ begin
11538
+ # 요소 찾기 타임아웃을 7초로 설정
11539
+ wait = Selenium::WebDriver::Wait.new(:timeout => 7)
11540
+ #요소가 나타날 때까지 7초 동안 기다립니다.
11541
+ wait.until { @driver.find_element(:xpath, '//*[@class="captcha-solver captcha-solver_inner"]') }
11542
+ rescue
11543
+ sleep(1)
11544
+ @driver.action.key_stroke('left')
11545
+ sleep(1)
11546
+ @driver.action.key_stroke('up')
11547
+ sleep(1)
11548
+ @driver.action.key_stroke('enter')
11549
+ sleep(1)
11550
+ # 요소 찾기 타임아웃을 7초로 설정
11551
+ wait = Selenium::WebDriver::Wait.new(:timeout => 7)
11552
+ #요소가 나타날 때까지 7초 동안 기다립니다.
11553
+ wait.until { @driver.find_element(:xpath, '//*[@class="captcha-solver captcha-solver_inner"]') }
11554
+ end
11555
+ puts '-[√] 캡챠 코드 타겟 완료2.......'.blue
11556
+
11557
+ puts '-[√] 캡챠 해제 가능 유무 확인.......'.green
11558
+ sleep(2)
11559
+ puts '-[√] 캡챠 해제 가능 유무 확인.......'.green
11560
+ sleep(2)
11561
+ puts '-[√] 캡챠 해제 가능 유무 확인.......'.green
11562
+ sleep(1)
11563
+ rescue
11564
+
11565
+ end
11452
11566
  end
11453
11567
  end
11454
11568
  end
@@ -11593,9 +11707,16 @@ end
11593
11707
 
11594
11708
 
11595
11709
 
11596
-
11597
-
11598
-
11710
+ begin
11711
+ # 우 클릭 해제 alert 금지 비활성
11712
+ @driver.execute_script <<~JS
11713
+ if (window._originalAlert) {
11714
+ window.alert = window._originalAlert;
11715
+ delete window._originalAlert;
11716
+ }
11717
+ JS
11718
+ rescue
11719
+ end
11599
11720
  ##<─────────────────────────────────────────────────────────────────────캡챠 해제 입력 코드 부분
11600
11721
 
11601
11722
 
@@ -12392,87 +12513,7 @@ end
12392
12513
  end
12393
12514
 
12394
12515
 
12395
- begin
12396
- # 타임아웃을 3초로 설정
12397
- wait = Selenium::WebDriver::Wait.new(:timeout => 3)
12398
- # 요소가 나타날 때까지 30초 동안 기다립니다.
12399
- wait.until { @driver.find_element(:xpath, '//*[@data-state="ready"]') }
12400
- sleep(1)
12401
- el_ready = @driver.find_element(:xpath, '//*[@data-state="ready"]')
12402
- @driver.action.move_to(el_ready).perform
12403
- sleep(1)
12404
- begin
12405
- @driver.execute_script(<<~JS)
12406
- document.querySelectorAll('.captcha-solver[data-state="solved"]').forEach(el => el.remove());
12407
- JS
12408
-
12409
- puts "방해 캡차 관련 요소 제거 완료".green
12410
- rescue
12411
- end
12412
- puts '-[√] 캡챠 해제 진행 중 (약 30~60 초 소요됩니다).......'.green
12413
- begin
12414
- @driver.find_element(:xpath, '//*[@data-state="ready"]').click #캡챠우회버튼
12415
- rescue
12416
- begin
12417
- @driver.find_element(:xpath, '//*[@class="captcha-solver-image"]').click #캡챠우회버튼
12418
- rescue
12419
- begin
12420
- @driver.find_element(:xpath, '//*[@class="captcha-solver-info"]').click #캡챠우회버튼
12421
- rescue
12422
- begin
12423
- @driver.find_element(:xpath, '//*[@class="captcha-solver captcha-solver_inner"]').click #캡챠우회버튼
12424
- rescue
12425
- end
12426
- end
12427
- end
12428
- end
12429
12516
 
12430
- sleep(10)
12431
- begin
12432
- @driver.find_element(:xpath, '//*[@data-state="error"]').click
12433
- puts '-[√] 캡챠 해제 실패 !! API번호 및 포인트를 체크해주세요.......'.red
12434
- puts '-[√] 캡챠 해제 실패 !! API번호 및 포인트를 체크해주세요.......'.red
12435
- @driver.window_handles.each do |handle|
12436
- @driver.switch_to.window(handle)
12437
- begin
12438
- # 로딩 중이거나, 페이지가 완전히 로딩되지 않더라도 탭을 닫기
12439
- @driver.close
12440
- rescue Selenium::WebDriver::Error::WebDriverError => e
12441
- puts '-[√] 다음 작업 준비로 약 1초~60초 내외 시간이 소요됩니다.......'.red
12442
- end
12443
- end
12444
- #return 0
12445
- @driver.quit
12446
- sleep(1)
12447
- return 0
12448
- sleep(1)
12449
- rescue
12450
- wait = Selenium::WebDriver::Wait.new(timeout: 150)
12451
-
12452
- begin
12453
- wait.until do
12454
- begin
12455
- # data-state="solved" 요소가 있으면 true (대기 종료)
12456
- @driver.find_element(:xpath, '//*[@data-state="solved"]')
12457
- true
12458
- rescue Selenium::WebDriver::Error::StaleElementReferenceError
12459
- # 페이지가 바뀌면 true (대기 종료)
12460
- true
12461
- rescue Selenium::WebDriver::Error::NoSuchElementError
12462
- # 요소가 아직 없으면 false (계속 대기)
12463
- false
12464
- end
12465
- end
12466
- rescue Selenium::WebDriver::Error::TimeoutError
12467
- # 150초 지나도 못 찾으면 여기로 넘어감
12468
- end
12469
-
12470
- puts '-[√] 캡챠 해제 완료 또는 페이지 변경 감지 → 이어서 진행 합니다.......'.green
12471
- sleep(5)
12472
-
12473
- end
12474
- rescue
12475
- end
12476
12517
 
12477
12518
  ########─────────────────────────────▲▲▲▲▲▲▲ 등록버튼 ▲▲▲▲▲▲▲──────────────────────────────#######
12478
12519
  ########─────────────────────────────▲▲▲▲▲▲▲ 등록버튼 ▲▲▲▲▲▲▲──────────────────────────────#######
@@ -12496,11 +12537,9 @@ rescue => e
12496
12537
  sleep(1)
12497
12538
  end
12498
12539
 
12499
-
12540
+
12500
12541
  begin
12501
-
12502
12542
  banned_word = nil
12503
-
12504
12543
  begin
12505
12544
  wait = Selenium::WebDriver::Wait.new(timeout: 2)
12506
12545
  alert = wait.until { @driver.switch_to.alert }
@@ -12562,16 +12601,101 @@ end
12562
12601
 
12563
12602
  end #반복루프
12564
12603
 
12565
- begin
12566
- wait = Selenium::WebDriver::Wait.new(timeout: 2)
12567
- alert = wait.until { @driver.switch_to.alert }
12568
- alert_text = alert.text # alert 메시지 저장
12569
- alert.accept
12570
- rescue
12604
+ begin
12605
+ wait = Selenium::WebDriver::Wait.new(timeout: 2)
12606
+ alert = wait.until { @driver.switch_to.alert }
12607
+ alert_text = alert.text # alert 메시지 저장
12608
+ alert.accept
12609
+ rescue
12610
+ end
12611
+
12612
+ begin
12613
+ # 타임아웃을 3초로 설정
12614
+ wait = Selenium::WebDriver::Wait.new(:timeout => 3)
12615
+ # 요소가 나타날 때까지 30초 동안 기다립니다.
12616
+ wait.until { @driver.find_element(:xpath, '//*[@data-state="ready"]') }
12617
+ sleep(1)
12618
+ el_ready = @driver.find_element(:xpath, '//*[@data-state="ready"]')
12619
+ @driver.action.move_to(el_ready).perform
12620
+ sleep(1)
12621
+ begin
12622
+ @driver.execute_script(<<~JS)
12623
+ document.querySelectorAll('.captcha-solver[data-state="solved"]').forEach(el => el.remove());
12624
+ JS
12625
+
12626
+ puts "방해 캡차 관련 요소 제거 완료".green
12627
+ rescue
12628
+ end
12629
+ puts '-[√] 캡챠 해제 진행 중 (약 30~60 초 소요됩니다).......'.green
12630
+ begin
12631
+ @driver.find_element(:xpath, '//*[@data-state="ready"]').click #캡챠우회버튼
12632
+ rescue
12633
+ begin
12634
+ @driver.find_element(:xpath, '//*[@class="captcha-solver-image"]').click #캡챠우회버튼
12635
+ rescue
12636
+ begin
12637
+ @driver.find_element(:xpath, '//*[@class="captcha-solver-info"]').click #캡챠우회버튼
12638
+ rescue
12639
+ begin
12640
+ @driver.find_element(:xpath, '//*[@class="captcha-solver captcha-solver_inner"]').click #캡챠우회버튼
12641
+ rescue
12642
+ end
12643
+ end
12644
+ end
12571
12645
  end
12646
+
12647
+ sleep(10)
12648
+ begin
12649
+ @driver.find_element(:xpath, '//*[@data-state="error"]').click
12650
+ puts '-[√] 캡챠 해제 실패 !! API번호 및 포인트를 체크해주세요.......'.red
12651
+ puts '-[√] 캡챠 해제 실패 !! API번호 및 포인트를 체크해주세요.......'.red
12652
+ @driver.window_handles.each do |handle|
12653
+ @driver.switch_to.window(handle)
12654
+ begin
12655
+ # 로딩 중이거나, 페이지가 완전히 로딩되지 않더라도 탭을 닫기
12656
+ @driver.close
12657
+ rescue Selenium::WebDriver::Error::WebDriverError => e
12658
+ puts '-[√] 다음 작업 준비로 약 1초~60초 내외 시간이 소요됩니다.......'.red
12659
+ end
12660
+ end
12661
+ #return 0
12662
+ @driver.quit
12663
+ sleep(1)
12664
+ return 0
12665
+ sleep(1)
12666
+ rescue
12667
+ wait = Selenium::WebDriver::Wait.new(timeout: 150)
12668
+
12669
+ begin
12670
+ wait.until do
12671
+ begin
12672
+ # data-state="solved" 요소가 있으면 true (대기 종료)
12673
+ @driver.find_element(:xpath, '//*[@data-state="solved"]')
12674
+ true
12675
+ rescue Selenium::WebDriver::Error::StaleElementReferenceError
12676
+ # 페이지가 바뀌면 true (대기 종료)
12677
+ true
12678
+ rescue Selenium::WebDriver::Error::NoSuchElementError
12679
+ # 요소가 아직 없으면 false (계속 대기)
12680
+ false
12681
+ end
12682
+ end
12683
+ rescue Selenium::WebDriver::Error::TimeoutError
12684
+ # 150초 지나도 못 찾으면 여기로 넘어감
12685
+ end
12686
+
12687
+ puts '-[√] 캡챠 해제 완료 또는 페이지 변경 감지 → 이어서 진행 합니다.......'.green
12688
+ sleep(5)
12689
+
12690
+ end
12691
+ rescue
12692
+ end
12693
+
12694
+
12572
12695
  sleep(2)
12573
12696
 
12574
12697
 
12698
+
12575
12699
  begin
12576
12700
  # log 디렉토리가 없다면 생성
12577
12701
  Dir.mkdir('./log') unless Dir.exist?('./log')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: posting_zon
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.109.999
4
+ version: 3.111.001
5
5
  platform: ruby
6
6
  authors:
7
7
  - zon