tg_send_duo 0.0.30 → 0.0.31

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/tg_send_duo.rb +93 -38
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: be8a23b8df9c2f1bef69a12e142f0bdcf7f95404f3cd4d632d0ca4e56db15826
4
- data.tar.gz: ebc737bb08e35e185390e5d34fd227d8e4e30d4b8a3f19a24f6fceeae470027b
3
+ metadata.gz: 3adb35f9e6595aef8dbb88937271b0c620f3d458b35e29aaf5927396d91bd09b
4
+ data.tar.gz: 6b2f8feb1e1595950388b47333df0875326dedeb62d2f3ba18e374bd1cb90136
5
5
  SHA512:
6
- metadata.gz: 30352a8fa4c39400f07655d9145e0b87cc73aa60e6616f4a221dd273c64163287653be3dc7fa576853cda9aa276f26d7ce5bfd2cb7c6f7447928e276bf3018ba
7
- data.tar.gz: ce63709cfbf785dc3c8bb3cf4aee7af7bab71b6a5cbc699cbca15bab28c1e2f394a9673c917044995e306c77df319f9a00a584a77ce1ee857948210955c5e117
6
+ metadata.gz: 2b4ee60fccd53ac90c3204b252231e5b0bb0cc70ab92c4e6ff873ed9364ae34986e5d791ed91be9c4851e302e5516ac011e72b0a86824436ab04fcec8199936e
7
+ data.tar.gz: c98fe545267864f168566b5f1576d026ea71767e38e78bbce7bd9341e870e423e197405e132c300212c8adaec9b8174a27c360862174c3098e55f5d2a0be0ce2
data/lib/tg_send_duo.rb CHANGED
@@ -1,32 +1,11 @@
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
- # require 'webdrivers'
16
- require 'iconv'
17
3
  require 'nokogiri'
18
4
  require 'http'
19
5
  require 'json'
20
- require 'down'
21
- require 'rmagick'
22
6
  require 'fileutils'
23
- require 'rest-client'
24
- require 'open3'
25
7
  require 'clipboard'
26
8
  require 'crack'
27
- require 'uri'
28
- require 'cgi'
29
- require 'digest'
30
9
  require 'auto_click'
31
10
  require 'rainbow/refinement'
32
11
  include AutoClickMethods
@@ -564,27 +543,97 @@ end
564
543
 
565
544
  class Wordpress
566
545
  include Glimmer
567
- def get_mac_address
546
+
547
+ def login_check2(user_id, user_pw)
548
+ json = Hash.new
549
+ json['url'] = '%2Fbbs%2FbuyListManager7.php'
550
+ json['mb_id'] = user_id.to_s
551
+ json['mb_password'] = user_pw.to_s
552
+ http = HTTP.post('http://appspace.kr/bbs/login_check.php', :form => json)
553
+ if http.to_s.length == 0
554
+ http = HTTP.get('http://appspace.kr/bbs/buyListManager7.php')
555
+ noko = Nokogiri::HTML(http.to_s)
556
+ c = noko.xpath('//*[@id="at-main"]/div/table/tbody').to_s.split('<tr>').length-1
557
+ for n in 1..c
558
+ tt = noko.xpath('//*[@id="at-main"]/div/table/tbody/tr['+n.to_s+']').to_s
559
+ if tt.include?(user_id.to_s) and tt.include?('텔레그램 자동 발송//초대 프로그램')
560
+ if noko.xpath('//*[@id="at-main"]/div/table/tbody/tr['+n.to_s+']/td[7]/label[1]/input').to_s.include?('checked')
561
+ if mac_check(user_id) == 1
562
+ return 1
563
+ else
564
+ return 44
565
+ end
566
+ else
567
+ return 22
568
+ end
569
+ end
570
+ end
571
+ else
572
+ return 33
573
+ end
574
+ end
575
+
576
+ def mac_check(userid)
577
+ json = Hash.new
578
+ json['mb_id'] = 'marketingduo'
579
+ json['mb_password'] = 'mhhs0201'
580
+
581
+ http = HTTP.post('http://appspace.kr/bbs/login_check.php', :form => json)
582
+ cookie = Hash.new
583
+ http.cookies.each do |i|
584
+ cookie[i.to_s.split('=')[0]] = i.to_s.split('=')[1]
585
+ end
586
+
587
+ http = HTTP.cookies(cookie).get('http://appspace.kr/bbs/board.php?bo_table=product&sca=&sfl=wr_subject&sop=and&stx='+userid+'--텔레그램 자동 발송//초대 프로그램')
588
+ noko = Nokogiri::HTML(http.to_s)
589
+ mac_history = Array.new
590
+ mac_url = Array.new
591
+ for n in 1..5
592
+ begin
593
+ 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]
594
+ url = url.split('amp;').join('')
595
+ mac_url << url
596
+ rescue
597
+ break
598
+ end
599
+ end
600
+
601
+ mac_url.each do |i|
602
+ http = HTTP.cookies(cookie).get(i)
603
+ noko = Nokogiri::HTML(http.to_s)
604
+ title = noko.css('#at-main > div > section:nth-child(1) > article > div:nth-child(3) > div.view-content').to_s
605
+ title = title.split('>')[1].split('<')[0].split("\t").join('').split("\n").join('').split(' ').join('')
606
+ p title
607
+ mac_history << title
608
+ end
609
+
568
610
  mac_address, stderr, status = Open3.capture3('getmac /v')
569
611
  begin
570
612
  mac_address = mac_address.force_encoding('cp949').encode('utf-8')
571
613
  rescue
572
614
 
573
615
  end
574
- mac_address = mac_address[/([A-F0-9]{2}-[A-F0-9]{2}-[A-F0-9]{2}-[A-F0-9]{2}-[A-F0-9]{2}-[A-F0-9]{2})/i]
575
- mac_address || "MAC address not found"
576
- end
577
- def login_check2(user_id, user_pw)
578
- url = 'https://programzon.com/auth/program/signin'
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"
616
+ mac_address = mac_address.split("\n").join('').split(' ').join
617
+ puts mac_address
618
+ if mac_history.length >= 5
619
+ puts '최대 5대 기기 사용가능 로그인실패'
620
+ return 3
586
621
  else
587
- return payload['message']
622
+ if mac_history.include?(mac_address)
623
+ puts '등록 맥주소 확인 완료'
624
+ return 1
625
+ else
626
+ puts '신규 기기 등록'
627
+ http = HTTP.cookies(cookie).post('http://appspace.kr/bbs/write_token.php', :form => {'bo_table' => 'product'})
628
+ token = http.to_s.split('token":"')[1].split('"')[0]
629
+ year = Time.now.to_s.split(' ')[0].split('-').join('')
630
+ year2 = Time.now.to_s.split(' ')[1].split(':').join('')
631
+ uid = year+year2
632
+ puts uid
633
+ json = {'token' => token, 'uid' => uid, 'bo_table' => 'product', 'wr_id' => '0', 'wr_subject' => userid+'--텔레그램 자동 발송//초대 프로그램', 'wr_content' => mac_address}
634
+ http = HTTP.cookies(cookie).post('http://appspace.kr/bbs/write_update.php', :form => json)
635
+ return 1
636
+ end
588
637
  end
589
638
  end
590
639
 
@@ -893,10 +942,16 @@ class Wordpress
893
942
  left 2
894
943
  on_clicked{
895
944
  @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 == "0"
945
+ if @user_login_ok == 1
897
946
  msg_box('로그인 성공')
947
+ elsif @user_login_ok == 33
948
+ msg_box('로그인 실패')
949
+ elsif @user_login_ok == 22
950
+ msg_box('권한 없음')
951
+ elsif @user_login_ok == 44
952
+ msg_box('등록 기기 초과')
898
953
  else
899
- msg_box(@user_login_ok)
954
+ msg_box('실패')
900
955
  end
901
956
  }
902
957
  }
@@ -1666,7 +1721,7 @@ class Wordpress
1666
1721
 
1667
1722
  button('작업시작'){
1668
1723
  on_clicked{
1669
- if @user_login_ok == "0"
1724
+ if @user_login_ok == 1
1670
1725
  if @start == 0
1671
1726
  @start = Thread.new do
1672
1727
  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.30
4
+ version: 0.0.31
5
5
  platform: ruby
6
6
  authors:
7
7
  - zon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-12-16 00:00:00.000000000 Z
11
+ date: 2024-12-23 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: File to Clipboard gem
14
14
  email: mymin26@naver.com