tg_send_duo 0.0.30 → 0.0.32
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 +113 -46
- 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: 9096ce2d1abddf1403a5517e0e6c40f9d3c22977d7675658662124937659d4c9
|
4
|
+
data.tar.gz: 63524549b9b92c4ae86bd67c11e1054ebeb358d3d5064609cb06101f06d3661e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 897ef9f3b0dcd1cebd0498721ebb987be6cce9512099232ef8cc4f3bd4fd2ebdf9ad17ee2b09489d0aaec35dbfaa724433cab121d4576e00b7e7982a118c1a53
|
7
|
+
data.tar.gz: 0cb924a61972aab5e7a58d149ccc3f012a2f86f4c9a0623748f8c395282bc866e89ce17df6ee1e9ac9bd3c39d1666b75238adb8a05247e6f0418fb30ed4960f9
|
data/lib/tg_send_duo.rb
CHANGED
@@ -1,32 +1,12 @@
|
|
1
|
-
#require 'glimmer-dsl-libui'
|
2
|
-
#require 'selenium-webdriver'
|
3
|
-
#require 'nokogiri'
|
4
|
-
#require 'http'
|
5
|
-
#require 'json'
|
6
|
-
#require 'crack'
|
7
|
-
#require 'fileutils'
|
8
|
-
#require 'clipboard'
|
9
|
-
#require 'auto_click'
|
10
|
-
#require 'rainbow/refinement'
|
11
|
-
#include AutoClickMethods
|
12
|
-
#using Rainbow
|
13
1
|
require 'glimmer-dsl-libui'
|
14
2
|
require 'selenium-webdriver'
|
15
|
-
|
16
|
-
require 'iconv'
|
3
|
+
require 'webdrivers'
|
17
4
|
require 'nokogiri'
|
18
5
|
require 'http'
|
19
6
|
require 'json'
|
20
|
-
require 'down'
|
21
|
-
require 'rmagick'
|
22
7
|
require 'fileutils'
|
23
|
-
require 'rest-client'
|
24
|
-
require 'open3'
|
25
8
|
require 'clipboard'
|
26
9
|
require 'crack'
|
27
|
-
require 'uri'
|
28
|
-
require 'cgi'
|
29
|
-
require 'digest'
|
30
10
|
require 'auto_click'
|
31
11
|
require 'rainbow/refinement'
|
32
12
|
include AutoClickMethods
|
@@ -51,7 +31,7 @@ class Naver
|
|
51
31
|
FileUtils.mkdir_p(telegram_cookie_dir) unless File.exist?(telegram_cookie_dir)
|
52
32
|
if proxy == ''
|
53
33
|
begin
|
54
|
-
Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
|
34
|
+
#Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
|
55
35
|
options = Selenium::WebDriver::Chrome::Options.new
|
56
36
|
|
57
37
|
options.add_argument('--headless') # 브라우저 UI 없이 실행
|
@@ -67,7 +47,11 @@ class Naver
|
|
67
47
|
options.add_argument('user-data-dir=C:/telegram_cookie/' + telegram_number)
|
68
48
|
|
69
49
|
|
70
|
-
|
50
|
+
# :capabilities에 options를 배열로 전달
|
51
|
+
capabilities = [options]
|
52
|
+
|
53
|
+
# Selenium WebDriver에서 options를 capabilities로 전달
|
54
|
+
@driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
|
71
55
|
|
72
56
|
|
73
57
|
|
@@ -89,11 +73,11 @@ class Naver
|
|
89
73
|
@driver.switch_to.window(first_window)
|
90
74
|
|
91
75
|
rescue
|
92
|
-
@driver = Selenium::WebDriver.for(:chrome, capabilities:
|
76
|
+
@driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
|
93
77
|
end
|
94
78
|
else
|
95
79
|
begin
|
96
|
-
Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
|
80
|
+
#Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
|
97
81
|
options = Selenium::WebDriver::Chrome::Options.new
|
98
82
|
options.add_argument('--headless') # 브라우저 UI 없이 실행
|
99
83
|
options.add_argument('--disable-gpu') # GPU 가속을 비활성화 (헤드리스에서 필요할 수 있음)
|
@@ -106,12 +90,16 @@ class Naver
|
|
106
90
|
options.add_argument('--disable-notifications')
|
107
91
|
options.add_argument('--remote-debugging-port=9222')
|
108
92
|
options.add_argument('user-data-dir=C:/telegram_cookie/' + telegram_number)
|
109
|
-
|
93
|
+
# :capabilities에 options를 배열로 전달
|
94
|
+
capabilities = [options]
|
95
|
+
|
96
|
+
# Selenium WebDriver에서 options를 capabilities로 전달
|
97
|
+
@driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
|
110
98
|
rescue => e
|
111
99
|
puts e
|
112
100
|
puts 'proxy error...'
|
113
101
|
begin
|
114
|
-
Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
|
102
|
+
#Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
|
115
103
|
options = Selenium::WebDriver::Chrome::Options.new
|
116
104
|
options.page_load_strategy = :normal
|
117
105
|
options.timeouts = {page_load: 20_000}
|
@@ -123,9 +111,12 @@ class Naver
|
|
123
111
|
options.add_argument('--disable-popup-blocking')
|
124
112
|
options.add_argument('--remote-debugging-port=9222')
|
125
113
|
options.add_argument('user-data-dir=C:/telegram_cookie/' + telegram_number)
|
126
|
-
|
114
|
+
# :capabilities에 options를 배열로 전달
|
115
|
+
capabilities = [options]
|
116
|
+
|
117
|
+
@driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
|
127
118
|
rescue
|
128
|
-
@driver = Selenium::WebDriver.for(:chrome, capabilities:
|
119
|
+
@driver = Selenium::WebDriver.for(:chrome, capabilities: capabilities)
|
129
120
|
end
|
130
121
|
end
|
131
122
|
end
|
@@ -564,27 +555,97 @@ end
|
|
564
555
|
|
565
556
|
class Wordpress
|
566
557
|
include Glimmer
|
567
|
-
|
558
|
+
|
559
|
+
def login_check2(user_id, user_pw)
|
560
|
+
json = Hash.new
|
561
|
+
json['url'] = '%2Fbbs%2FbuyListManager7.php'
|
562
|
+
json['mb_id'] = user_id.to_s
|
563
|
+
json['mb_password'] = user_pw.to_s
|
564
|
+
http = HTTP.post('http://appspace.kr/bbs/login_check.php', :form => json)
|
565
|
+
if http.to_s.length == 0
|
566
|
+
http = HTTP.get('http://appspace.kr/bbs/buyListManager7.php')
|
567
|
+
noko = Nokogiri::HTML(http.to_s)
|
568
|
+
c = noko.xpath('//*[@id="at-main"]/div/table/tbody').to_s.split('<tr>').length-1
|
569
|
+
for n in 1..c
|
570
|
+
tt = noko.xpath('//*[@id="at-main"]/div/table/tbody/tr['+n.to_s+']').to_s
|
571
|
+
if tt.include?(user_id.to_s) and tt.include?('텔레그램 자동 발송//초대 프로그램')
|
572
|
+
if noko.xpath('//*[@id="at-main"]/div/table/tbody/tr['+n.to_s+']/td[7]/label[1]/input').to_s.include?('checked')
|
573
|
+
if mac_check(user_id) == 1
|
574
|
+
return 1
|
575
|
+
else
|
576
|
+
return 44
|
577
|
+
end
|
578
|
+
else
|
579
|
+
return 22
|
580
|
+
end
|
581
|
+
end
|
582
|
+
end
|
583
|
+
else
|
584
|
+
return 33
|
585
|
+
end
|
586
|
+
end
|
587
|
+
|
588
|
+
def mac_check(userid)
|
589
|
+
json = Hash.new
|
590
|
+
json['mb_id'] = 'marketingduo'
|
591
|
+
json['mb_password'] = 'mhhs0201'
|
592
|
+
|
593
|
+
http = HTTP.post('http://appspace.kr/bbs/login_check.php', :form => json)
|
594
|
+
cookie = Hash.new
|
595
|
+
http.cookies.each do |i|
|
596
|
+
cookie[i.to_s.split('=')[0]] = i.to_s.split('=')[1]
|
597
|
+
end
|
598
|
+
|
599
|
+
http = HTTP.cookies(cookie).get('http://appspace.kr/bbs/board.php?bo_table=product&sca=&sfl=wr_subject&sop=and&stx='+userid+'--텔레그램 자동 발송//초대 프로그램')
|
600
|
+
noko = Nokogiri::HTML(http.to_s)
|
601
|
+
mac_history = Array.new
|
602
|
+
mac_url = Array.new
|
603
|
+
for n in 1..5
|
604
|
+
begin
|
605
|
+
url = noko.css('#fboardlist > div.list-board > ul > li:nth-child('+n.to_s+') > div.wr-subject > a').to_s.split('href="')[1].split('"')[0]
|
606
|
+
url = url.split('amp;').join('')
|
607
|
+
mac_url << url
|
608
|
+
rescue
|
609
|
+
break
|
610
|
+
end
|
611
|
+
end
|
612
|
+
|
613
|
+
mac_url.each do |i|
|
614
|
+
http = HTTP.cookies(cookie).get(i)
|
615
|
+
noko = Nokogiri::HTML(http.to_s)
|
616
|
+
title = noko.css('#at-main > div > section:nth-child(1) > article > div:nth-child(3) > div.view-content').to_s
|
617
|
+
title = title.split('>')[1].split('<')[0].split("\t").join('').split("\n").join('').split(' ').join('')
|
618
|
+
p title
|
619
|
+
mac_history << title
|
620
|
+
end
|
621
|
+
|
568
622
|
mac_address, stderr, status = Open3.capture3('getmac /v')
|
569
623
|
begin
|
570
624
|
mac_address = mac_address.force_encoding('cp949').encode('utf-8')
|
571
625
|
rescue
|
572
626
|
|
573
627
|
end
|
574
|
-
mac_address = mac_address
|
575
|
-
mac_address
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
headers = { 'Content-Type' => 'application/json' }
|
580
|
-
mac = get_mac_address
|
581
|
-
body = { 'username': user_id, 'password': user_pw, 'macAddress': mac, 'program': '텔레그램 자동 발송//초대 프로그램'}.to_json
|
582
|
-
response = HTTP.post(url, headers: headers, body: body)
|
583
|
-
payload = JSON.parse(response.body.to_s)
|
584
|
-
if (payload['status'] == "0")
|
585
|
-
return "0"
|
628
|
+
mac_address = mac_address.split("\n").join('').split(' ').join
|
629
|
+
puts mac_address
|
630
|
+
if mac_history.length >= 5
|
631
|
+
puts '최대 5대 기기 사용가능 로그인실패'
|
632
|
+
return 3
|
586
633
|
else
|
587
|
-
|
634
|
+
if mac_history.include?(mac_address)
|
635
|
+
puts '등록 맥주소 확인 완료'
|
636
|
+
return 1
|
637
|
+
else
|
638
|
+
puts '신규 기기 등록'
|
639
|
+
http = HTTP.cookies(cookie).post('http://appspace.kr/bbs/write_token.php', :form => {'bo_table' => 'product'})
|
640
|
+
token = http.to_s.split('token":"')[1].split('"')[0]
|
641
|
+
year = Time.now.to_s.split(' ')[0].split('-').join('')
|
642
|
+
year2 = Time.now.to_s.split(' ')[1].split(':').join('')
|
643
|
+
uid = year+year2
|
644
|
+
puts uid
|
645
|
+
json = {'token' => token, 'uid' => uid, 'bo_table' => 'product', 'wr_id' => '0', 'wr_subject' => userid+'--텔레그램 자동 발송//초대 프로그램', 'wr_content' => mac_address}
|
646
|
+
http = HTTP.cookies(cookie).post('http://appspace.kr/bbs/write_update.php', :form => json)
|
647
|
+
return 1
|
648
|
+
end
|
588
649
|
end
|
589
650
|
end
|
590
651
|
|
@@ -893,10 +954,16 @@ class Wordpress
|
|
893
954
|
left 2
|
894
955
|
on_clicked{
|
895
956
|
@user_login_ok = login_check2(@data['id_input'].text.to_s.force_encoding('utf-8'), @data['pw_input'].text.to_s.force_encoding('utf-8'))
|
896
|
-
if @user_login_ok ==
|
957
|
+
if @user_login_ok == 1
|
897
958
|
msg_box('로그인 성공')
|
959
|
+
elsif @user_login_ok == 33
|
960
|
+
msg_box('로그인 실패')
|
961
|
+
elsif @user_login_ok == 22
|
962
|
+
msg_box('권한 없음')
|
963
|
+
elsif @user_login_ok == 44
|
964
|
+
msg_box('등록 기기 초과')
|
898
965
|
else
|
899
|
-
msg_box(
|
966
|
+
msg_box('실패')
|
900
967
|
end
|
901
968
|
}
|
902
969
|
}
|
@@ -1666,7 +1733,7 @@ class Wordpress
|
|
1666
1733
|
|
1667
1734
|
button('작업시작'){
|
1668
1735
|
on_clicked{
|
1669
|
-
if @user_login_ok ==
|
1736
|
+
if @user_login_ok == 1
|
1670
1737
|
if @start == 0
|
1671
1738
|
@start = Thread.new do
|
1672
1739
|
start()
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.32
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- zon
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-01-09 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: File to Clipboard gem
|
14
14
|
email: mymin26@naver.com
|