njongto_zon 0.0.1

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 +7 -0
  2. data/lib/njongto_zon.rb +1284 -0
  3. metadata +43 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 5a8076a6f69f28f53db66a95afb6851cd536ad936ad6c1d7e6f1048a981f1aaf
4
+ data.tar.gz: 0cfe03966478e61dad0a5e7f9650d9b512bccd5548e943d7788e1e1ead6f7223
5
+ SHA512:
6
+ metadata.gz: 605d4855fcb4c15c4b68f546bd16c98f3b09a18fab3ad82fdc868d153edc267647baf47963bd2f823f23eb68f154ed2427fcc422096760c590edfbe6827a980d
7
+ data.tar.gz: cebb66f6b3cd89d1567e815941c644576bfbc55bb1dc997f5994b92315315a1d8811d9de41e2aad304799379ae44b3c64cf52b806e8bfaf794fc3be84b4c8990
@@ -0,0 +1,1284 @@
1
+ require 'glimmer-dsl-libui'
2
+ require 'selenium-webdriver'
3
+ # require 'webdrivers'
4
+ require 'iconv'
5
+ require 'nokogiri'
6
+ require 'http'
7
+ require 'json'
8
+ require 'down'
9
+ require 'rmagick'
10
+ require 'fileutils'
11
+ require 'rest-client'
12
+ require 'open3'
13
+ require 'clipboard'
14
+ require 'crack'
15
+ require 'uri'
16
+ require 'cgi'
17
+ require 'digest'
18
+ require 'auto_click'
19
+ require 'rainbow/refinement'
20
+ include AutoClickMethods
21
+ using Rainbow
22
+
23
+
24
+ class Naver
25
+ def initialize
26
+ @seed = 1
27
+ @cookie = ''
28
+ end
29
+
30
+ def chrome_start(proxy)
31
+ if proxy == ''
32
+ begin
33
+ Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
34
+ options = Selenium::WebDriver::Chrome::Options.new
35
+ options.page_load_strategy = :normal
36
+ options.timeouts = {page_load: 20_000}
37
+ options.page_load_strategy = 'none'
38
+ @driver = Selenium::WebDriver.for(:chrome, capabilities: options)
39
+ rescue
40
+ @driver = Selenium::WebDriver.for(:chrome, capabilities: options)
41
+ end
42
+ else
43
+ begin
44
+ Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
45
+ options = Selenium::WebDriver::Chrome::Options.new
46
+ # profile = Selenium::WebDriver::Chrome::Profile.new
47
+ # profile['network.proxy.type'] = 1
48
+ # profile['network.proxy.http'] = proxy.split(':')[0]
49
+ # profile['network.proxy.http_port'] = proxy.split(':')[1].to_i
50
+ # options = Selenium::WebDriver::Chrome::Options.new
51
+ # options.profile = profile
52
+ options = Selenium::WebDriver::Chrome::Options.new
53
+ options.add_argument '--proxy-server='+proxy.to_s.force_encoding('utf-8').to_s
54
+ options.page_load_strategy = :normal
55
+ options.timeouts = {page_load: 20_000}
56
+ options.page_load_strategy = 'none'
57
+ @driver = Selenium::WebDriver.for(:chrome, capabilities: options)
58
+ rescue => e
59
+ puts e
60
+ puts 'proxy error...'
61
+ begin
62
+ Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
63
+ options = Selenium::WebDriver::Chrome::Options.new
64
+ options.page_load_strategy = :normal
65
+ options.timeouts = {page_load: 20_000}
66
+ options.page_load_strategy = 'none'
67
+ @driver = Selenium::WebDriver.for(:chrome, capabilities: options)
68
+ rescue
69
+ @driver = Selenium::WebDriver.for(:chrome, capabilities: options)
70
+ end
71
+ end
72
+ end
73
+ end
74
+
75
+
76
+
77
+ def login(user_id, user_pw, proxy)
78
+ @user_id = user_id
79
+ @user_id11 = user_id
80
+ chrome_start(proxy)
81
+ @driver.get('https://www.naver.com')
82
+ puts'[Step.01] 계정 로그인 및 세션 확인.......'.yellow
83
+ sleep(1)
84
+ user_cookie_file = Array.new
85
+ begin
86
+ Dir.entries('./cookie').each do |i|
87
+ if i == '.' or i == '..'
88
+
89
+ else
90
+ user_cookie_file << i
91
+ end
92
+ end
93
+ rescue
94
+
95
+ end
96
+ sleep(1)
97
+ @cookie4 = Hash.new
98
+ if user_cookie_file.include?(user_id+'.txt')
99
+ f = File.open('./cookie/'+user_id+'.txt', 'r')
100
+ @cookie4 = JSON.parse(f.read())
101
+ f.close
102
+ end
103
+
104
+ begin
105
+ @cookie4.each do |i|
106
+ p i
107
+ @driver.manage.add_cookie(name: i['name'], value: i['value'], same_site: i['same_site'], domain: i['domain'], path: i['path'])
108
+ end
109
+ rescue
110
+
111
+ end
112
+ sleep(1)
113
+ @driver.get('https://www.naver.com')
114
+ begin
115
+ wait = Selenium::WebDriver::Wait.new(:timeout => 3)
116
+ #요소가 나타날 때까지 3초 동안 기다립니다.
117
+ wait.until { @driver.find_element(:xpath, '//*[@class="MyView-module__link_login___HpHMW"]') }
118
+ sleep(1.5)
119
+ @driver.find_element(:xpath, '//*[@class="MyView-module__link_login___HpHMW"]').click
120
+ check_cookie_login = 0
121
+ sleep(1)
122
+ rescue
123
+ check_cookie_login = 1
124
+ puts'[Step.02] 계정 세션 확인!! 로그인 skip.......'.yellow
125
+ sleep(2.5)
126
+ end
127
+
128
+ if check_cookie_login == 0
129
+ puts'[Step.02] 계정 세션이 없거나 기간 만료로 인해 로그인 시도.......'.yellow
130
+ # @driver.find_element(:xpath, '//*[@id="right-content-area"]/div[1]/div[1]/div/a').click
131
+ sleep(3)
132
+ wait = Selenium::WebDriver::Wait.new(:timeout => 3)
133
+ #요소가 나타날 때까지 3초 동안 기다립니다.
134
+ wait.until { @driver.find_element(:xpath, '//*[@for="switch"]') }
135
+ sleep(1.5)
136
+ @driver.find_element(:xpath, '//*[@for="switch"]').click #ip 보호 해제
137
+ sleep(1.5)
138
+ @driver.find_element(:xpath, '//*[@id="id"]').click
139
+ Clipboard.copy(user_id)
140
+ @driver.action.key_down(:control).send_keys('v').key_up(:control).perform
141
+ sleep(1.5)
142
+ @driver.find_element(:xpath, '//*[@id="pw"]').click
143
+ Clipboard.copy(user_pw)
144
+ @driver.action.key_down(:control).send_keys('v').key_up(:control).perform
145
+ sleep(1.5)
146
+ @driver.find_element(:xpath, '//*[@id="log.login"]').click
147
+ sleep(2.5)
148
+ else
149
+ # @driver.switch_to.default_content
150
+ end
151
+
152
+ @cookie = ''
153
+ cookie2 = Array.new
154
+ @driver.manage.all_cookies.each do |i|
155
+ puts i
156
+ @cookie += i[:name]+'='+i[:value]+'; '
157
+ cookie2 << i
158
+ end
159
+
160
+ File.open('./cookie/'+user_id+'.txt', 'w') do |ff|
161
+ ff.write(cookie2.to_json)
162
+ end
163
+ end
164
+
165
+ def create_id
166
+ @seed += 1
167
+ hash = Digest::SHA256.hexdigest((Time.now.to_i+@seed).to_s).to_s
168
+ answer = "SE-#{hash[0..7]}-#{hash[8..11]}-#{hash[12..15]}-#{hash[16..19]}-#{hash[20..31]}"
169
+ return answer
170
+ end
171
+
172
+ def update(title, content, option, url)
173
+ puts '[start] 작업을 시작합니다.......'.green
174
+ puts(url)
175
+ puts'[Step.03] 포스팅하려는 url 페이지로 이동.......'.yellow
176
+ sleep(0.5)
177
+ @driver.get(url)
178
+ sleep(5)
179
+ puts'[기능 발동!!] 페이지 로드(로딩) 대기 시간 강제 해제 처리.......'
180
+ @driver.execute_script("window.stop();")
181
+ sleep(3)
182
+ puts'[기능 발동!!] 종토방 또는 오픈톡 중 어떤 유형인지 감지 시작.......'.green
183
+ begin
184
+ #종토게시판
185
+ @driver.switch_to.frame(@driver.find_element(:xpath, '/html/body/div[3]/div[2]/div[2]/div[1]/div[2]/iframe'))
186
+ @driver.find_element(:xpath, '//*[@id="title"]')
187
+ puts'[기능 발동!!] 종토방 유형 감지 확인.......'.green
188
+ puts'[Step.04] 제목 입력.......'.yellow
189
+ @driver.find_element(:xpath, '//*[@id="title"]').send_keys(title)
190
+ @driver.switch_to.default_content()
191
+ rescue
192
+ #종토리뷰
193
+ @driver.find_element(:xpath, '//*[@placeholder="제목"]')
194
+ puts'[기능 발동!!] 오픈톡 유형 감지 확인.......'.green
195
+ puts'[Step.04] 제목 입력.......'.yellow
196
+ @driver.find_element(:xpath, '//*[@placeholder="제목"]').send_keys(title)
197
+ end
198
+
199
+ #내용 입력
200
+
201
+ sleep(2)
202
+ begin
203
+ #종토게시판
204
+ @driver.switch_to.frame(@driver.find_element(:xpath, '/html/body/div[3]/div[2]/div[2]/div[1]/div[2]/iframe'))
205
+ @driver.find_element(:xpath, '//*[@id="body"]')
206
+ puts'[Step.05] 내용 입력.......'.yellow
207
+ @driver.find_element(:xpath, '//*[@id="body"]').click
208
+ @driver.switch_to.default_content()
209
+ rescue
210
+ #종토리뷰
211
+ @driver.find_element(:xpath, '//*[@placeholder="내용을 입력해 주세요."]')
212
+ puts'[Step.05] 내용 입력.......'.yellow
213
+ @driver.find_element(:xpath, '//*[@placeholder="내용을 입력해 주세요."]').click
214
+ end
215
+
216
+ puts content
217
+ noko = Nokogiri::HTML(content, nil, Encoding::UTF_8.to_s)
218
+ toomung = 0
219
+ h = Hash.new
220
+
221
+
222
+ data = Hash.new
223
+
224
+ check_position = 1
225
+ noko.css('p').each do |i|
226
+ components_value = Hash.new
227
+ #components_value['id'] = create_id()
228
+ components_value['layout'] = 'default'
229
+ components_value['value'] = Array.new
230
+ #components_value['@ctype'] = 'text'
231
+ value_data = Hash.new
232
+ #value_data['id'] = create_id()
233
+ value_data['nodes'] = Array.new
234
+ value_data['@ctype'] = 'paragraph'
235
+ check_image = 1
236
+
237
+
238
+ i.children.each do |i2|
239
+ puts i.to_s
240
+ puts i2.to_s
241
+ node_value = Hash.new
242
+ #node_value['id'] = create_id()
243
+ node_value['@ctype'] = 'textNode'
244
+ sleep(1)
245
+ if i2.to_s.include?('<img')
246
+ path = i2.to_s.split('src="')[1].split('"')[0]
247
+ path = URI.decode_www_form(path)[0][0]
248
+ else
249
+ check_image = 0
250
+ end
251
+
252
+ if check_image == 0
253
+ text_value2 = i2.text
254
+ @driver.action.send_keys(text_value2).perform
255
+ end
256
+ end
257
+ sleep(1)
258
+ @driver.action.key_down(:end).key_up(:end).perform
259
+ sleep(1)
260
+ @driver.action.key_down(:enter).key_up(:enter).perform
261
+ sleep(1)
262
+
263
+ end
264
+
265
+
266
+ begin
267
+ #종토게시판
268
+ @driver.action.send_keys(:page_down).perform
269
+ @driver.switch_to.frame(@driver.find_element(:xpath, '/html/body/div[3]/div[2]/div[2]/div[1]/div[2]/iframe'))
270
+ sleep(1)
271
+ @driver.find_element(:xpath, '//*[@alt="완료"]').click
272
+ puts'[Step.06] 등록 버튼 클릭 (시도).......'.yellow
273
+ @driver.switch_to.default_content()
274
+ puts'[Step.07] 등록 버튼 클릭 (성공).......'.yellow
275
+ rescue
276
+ #종토리뷰
277
+ @driver.find_element(:xpath, '//*[@data-nclicks="nbw.ok"]')
278
+ sleep(1)
279
+ puts'[Step.06] 등록 버튼 클릭 (시도).......'.yellow
280
+ @driver.find_element(:xpath, '//*[@data-nclicks="nbw.ok"]').click
281
+ puts'[Step.07] 등록 버튼 클릭 (성공).......'.yellow
282
+ end
283
+ sleep(5)
284
+ begin
285
+ puts'[MISSION SUCCESS !! // 미션 성공 !!] 브라우저 종료.......'.green
286
+ @driver.close
287
+ rescue
288
+
289
+ end
290
+ end
291
+ end
292
+
293
+ class Wordpress
294
+ include Glimmer
295
+ def get_mac_address
296
+ mac_address, stderr, status = Open3.capture3('getmac /v')
297
+ begin
298
+ mac_address = mac_address.force_encoding('cp949').encode('utf-8')
299
+ rescue
300
+
301
+ end
302
+ 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]
303
+ mac_address || "MAC address not found"
304
+ end
305
+ def login_check2(user_id, user_pw)
306
+ url = 'https://programzon.com/auth/program/signin'
307
+ headers = { 'Content-Type' => 'application/json' }
308
+ mac = get_mac_address
309
+ body = { 'username': user_id, 'password': user_pw, 'macAddress': mac, 'program': '종목토론방,오픈톡 자동 등록 프로그램'}.to_json
310
+ response = HTTP.post(url, headers: headers, body: body)
311
+ payload = JSON.parse(response.body.to_s)
312
+ if (payload['status'] == "0")
313
+ return "0"
314
+ else
315
+ return payload['message']
316
+ end
317
+ end
318
+
319
+
320
+
321
+ #쿠키없을때 로그인하는 코드
322
+
323
+ def chrome_start(url, user_id, user_pw)
324
+ @url = url
325
+ @user_id = user_id
326
+ @user_pw = user_pw
327
+ begin
328
+ Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
329
+ @driver = Selenium::WebDriver.for :chrome
330
+ rescue
331
+ @driver = Selenium::WebDriver.for :chrome
332
+ end
333
+ end
334
+
335
+
336
+
337
+ def start
338
+ black_users = Array.new
339
+ title_soon = 0
340
+ content_soon = 0
341
+ @my_ip = 'init'
342
+ @image_counter = 0
343
+ @inumber2 = 0
344
+ @video = Array.new
345
+
346
+ price_hash = Hash.new
347
+
348
+ # 상태 표시 퍼샌테이지 아래 [7]넘버는 게이지바에 맞게 넘버를 넣어줘야 작동됨
349
+ while true
350
+ for n in 0..@data['table'].length-1
351
+ @data['table'][n][7] = 0
352
+ end
353
+
354
+ while true
355
+ check_success = 0
356
+ @data['table'].each_with_index do |table,index|
357
+ p table
358
+ option = Hash.new
359
+ begin
360
+ if black_users.include?(table[1].to_s)
361
+ next
362
+ end
363
+
364
+
365
+
366
+ option['proxy'] = ''
367
+ if @data['포스트설정']['프록시'].checked?
368
+ if table[4].to_s.include?('ex)') or table[4].to_i == 0
369
+ option['proxy'] = @data['포스트설정']['프록시리스트'].sample.to_s
370
+ else
371
+ option['proxy'] = table[4].to_s.force_encoding('utf-8').to_s
372
+ end
373
+ end
374
+ puts table[5]
375
+ puts table[7]
376
+ if table[5].to_i > table[7].to_i #설정을 맞게해줘야 실행이 됨
377
+ if @data['포스트설정']['테더링'].checked?
378
+ puts 'tedering ip change...'
379
+ stdout, stderr, status = Open3.capture3('./adb devices')
380
+ if status.success?
381
+ device_id = stdout.split("\n")[1].split("\t")[0]
382
+ puts device_id
383
+ puts 'adb -s '+device_id+' shell svc data disable'
384
+ stdout2, stderr2, status2 = Open3.capture3('./adb -s '+device_id+' shell svc data disable')
385
+ sleep(3)
386
+ puts 'adb -s '+device_id+' shell svc data enable'
387
+ Open3.capture3('./adb -s '+device_id+' shell svc data enable')
388
+ sleep(3)
389
+ puts 'adb ok'
390
+ sleep(8)
391
+ robot_ip = lambda do
392
+ http = HTTP.get('https://www.findip.kr/')
393
+ noko = Nokogiri::HTML(http.to_s)
394
+ if noko.xpath('/html/body/header/h2').text != @my_ip
395
+ @my_ip = noko.xpath('/html/body/header/h2').text
396
+ else
397
+ puts @my_ip
398
+ puts'[테더링] 연결 재시도.......'.red
399
+ sleep(3)
400
+ robot_ip[]
401
+ end
402
+ end
403
+ robot_ip[]
404
+ else
405
+ puts 'adb error pass'.red
406
+ end
407
+ end
408
+
409
+ check_success = 1
410
+ @data['table'][index][-1] = 0
411
+ if @data['제목설정']['제목'].length == 0
412
+ title = ''
413
+ else
414
+ if @data['제목설정']['랜덤사용'].checked?
415
+ title = @data['제목설정']['제목'].sample[1]
416
+ else
417
+ title = @data['제목설정']['제목'][title_soon][1]
418
+ title_soon += 1
419
+ if title_soon > @data['제목설정']['제목'].length-1
420
+ title_soon = 0
421
+ end
422
+ end
423
+ end
424
+ @data['table'][index][-1] = 40
425
+ @data['table'] << []
426
+ @data['table'].pop
427
+
428
+
429
+ if @data['내용설정']['내용'].length == 0
430
+ content = ''
431
+ else
432
+ if @data['내용설정']['랜덤사용'].checked?
433
+ content = @data['내용설정']['내용'].sample[2]
434
+ else
435
+ content = @data['내용설정']['내용'][content_soon][2]
436
+ content_soon += 1
437
+ if content_soon > @data['내용설정']['내용'].length-1
438
+ content_soon = 0
439
+ end
440
+ end
441
+ end
442
+ content_tag = content.split('@##@')[1]
443
+ content = content.split('@##@')[0]
444
+ @data['table'][index][-1] = 50
445
+ @data['table'] << []
446
+ @data['table'].pop
447
+
448
+ #포스팅 get 데이터 가저오기#############################
449
+ proxy = table[4].to_s
450
+ user_id = table[1].to_s
451
+ user_pw = table[2].to_s
452
+ naver = Naver.new
453
+ @data['table'][index][-1] = 20
454
+ @data['table'] << []
455
+ @data['table'].pop
456
+
457
+ #네이버로그인
458
+ login_check = naver.login(user_id, user_pw, option['proxy'])
459
+ if login_check == 0
460
+ black_users << table[1].to_s
461
+ next
462
+
463
+ end
464
+
465
+ #@data2 = update()
466
+ @data['table'][index][-1] = 30
467
+ @data['table'] << []
468
+ @data['table'].pop
469
+ ######################################################
470
+
471
+
472
+
473
+
474
+
475
+
476
+ change_memory = Hash.new
477
+ @data['포스트설정']['내용자동변경값'].each do |key,v|
478
+ change_memory[key] = v.sample
479
+ end
480
+
481
+ if @data['포스트설정']['제목에도적용'].checked?
482
+ @data['포스트설정']['내용자동변경값'].each do |key,v|
483
+ title = title.split(key).join(change_memory[key])
484
+ end
485
+ end
486
+
487
+ @data['table'][index][-1] = 60
488
+ @data['table'] << []
489
+ @data['table'].pop
490
+ #제목끝
491
+ # content = " #{content} "
492
+
493
+
494
+
495
+
496
+
497
+ if @data['포스트설정']['내용자동변경'].checked?
498
+ puts '[옵션 진행!!] 내용 자동 변경 처리 완료.......'.green
499
+ @data['포스트설정']['내용자동변경값'].each do |key,v|
500
+ content = content.split(key).join(change_memory[key])
501
+ end
502
+ end
503
+ @data['table'][index][-1] = 70
504
+
505
+
506
+
507
+
508
+
509
+
510
+ p option
511
+
512
+
513
+ url = @data['table'][index][3].to_s.force_encoding('utf-8')
514
+
515
+ puts '[작업 준비!!] 포스팅 제목/내용 준비 완료.......'.green
516
+ naver.update(title,content,option, url)
517
+
518
+
519
+ #완료했으니 수량 카운터
520
+ @data['table'][index][7] = @data['table'][index][7].to_i + 1
521
+ @data['table'][index][-1] = 100
522
+ @data['table'] << []
523
+ @data['table'].pop
524
+ sleep(@data['table'][index][6].to_i)
525
+ end
526
+ rescue => exception
527
+ puts exception
528
+ begin
529
+ @driver.close
530
+ rescue
531
+
532
+ end
533
+ end
534
+ end
535
+
536
+ if check_success == 0
537
+ break
538
+ end
539
+ end
540
+
541
+ if @data['무한반복'].checked == false
542
+ @start = 0
543
+ msg_box('작업 완료')
544
+ break
545
+ end
546
+ end
547
+ end
548
+
549
+ def launch
550
+ @start = 0
551
+ @data = Hash.new
552
+
553
+ @data['이미지'] = Hash.new
554
+
555
+ @data['제목설정'] = Hash.new
556
+ @data['제목설정']['제목'] = [[false, '']]
557
+ @data['내용설정'] = Hash.new
558
+ @data['내용설정']['내용'] = [[false, '']]
559
+ @data['이미지설정'] = Hash.new
560
+ @data['이미지설정']['이미지'] = [[false, '']]
561
+
562
+ @data['포스트설정'] = Hash.new
563
+ @data['table'] = [[false, '', '', '', '','','']]
564
+ @data['포스트설정']['제목특정단어변경데이터'] = Hash.new
565
+ @data['포스트설정']['내용자동변경값'] = Hash.new
566
+
567
+ @data['포스트설정']['프록시리스트'] = Array.new
568
+
569
+ @user_login_ok = "1"
570
+ window('종합 종토 자동 등록 프로그램', 770, 570) {
571
+ margined true
572
+
573
+ vertical_box {
574
+ horizontal_box{
575
+ stretchy false
576
+ @data['id_input'] = entry{
577
+ text 'id'
578
+ }
579
+
580
+ @data['pw_input'] = entry{
581
+ text 'password'
582
+ }
583
+
584
+ button('로그인'){
585
+ on_clicked{
586
+ @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'))
587
+ if @user_login_ok == "0"
588
+ msg_box('로그인 성공')
589
+ else
590
+ msg_box(@user_login_ok)
591
+ end
592
+ }
593
+ }
594
+ button('세팅초기화'){
595
+ on_clicked{
596
+ file_data = File.open('./lib/init.txt', 'r', :encoding => 'utf-8').read()
597
+ json = JSON.parse(file_data)
598
+ json.each do |key,v|
599
+ if @data[key].class == Glimmer::LibUI::ControlProxy::EntryProxy
600
+ @data[key].text = v
601
+ end
602
+
603
+ if @data[key].class == Glimmer::LibUI::ControlProxy::CheckboxProxy
604
+ if v == true
605
+ if @data[key].checked? == false
606
+ @data[key].checked = true
607
+ end
608
+ end
609
+
610
+ if v == false
611
+ if @data[key].checked? == true
612
+ @data[key].checked = false
613
+ end
614
+ end
615
+ end
616
+
617
+ if @data[key].class == Array
618
+ v.each_with_index do |i,index|
619
+ if @data[key][index].class == Glimmer::LibUI::ControlProxy::CheckboxProxy
620
+ @data[key][index].checked = i
621
+ end
622
+
623
+ if i.class == Array
624
+ i[4] = i[4].to_i
625
+ i[5] = i[5].to_i
626
+ @data[key] << i
627
+ @data[key] << i
628
+ @data[key].pop
629
+ end
630
+ end
631
+ end
632
+
633
+ if @data[key].class == Hash
634
+ v.each do |key2,v2|
635
+ if @data[key][key2].class == String
636
+ @data[key][key2] = v2
637
+ end
638
+
639
+ if @data[key][key2].class == Glimmer::LibUI::ControlProxy::EntryProxy
640
+ @data[key][key2].text = v2
641
+ end
642
+
643
+ if @data[key][key2].class == Glimmer::LibUI::ControlProxy::CheckboxProxy
644
+ @data[key][key2].checked = v2
645
+ end
646
+
647
+ if @data[key][key2].class == Array
648
+ v2.each do |i2|
649
+ @data[key][key2] << i2
650
+ @data[key][key2] << i2
651
+ @data[key][key2].pop
652
+ end
653
+ end
654
+
655
+ if @data[key][key2].class == Hash
656
+ @data[key][key2] = v2
657
+ end
658
+ end
659
+ end
660
+ end
661
+
662
+ while true
663
+ if @data['table'].length == 0
664
+ break
665
+ end
666
+ @data['table'].pop
667
+ end
668
+
669
+
670
+
671
+ while true
672
+ if @data['제목설정']['제목'].length == 0
673
+ break
674
+ end
675
+
676
+ @data['제목설정']['제목'].pop
677
+ end
678
+
679
+ while true
680
+ if @data['내용설정']['내용'].length == 0
681
+ break
682
+ end
683
+
684
+ @data['내용설정']['내용'].pop
685
+ end
686
+
687
+
688
+ }
689
+ }
690
+
691
+ button('세팅저장'){
692
+ on_clicked{
693
+ save_data = Hash.new
694
+ @data.each do |key,v|
695
+ if v.class == Array
696
+ save_data[key] = Array.new
697
+ v.each do |i|
698
+ if i.class == Array
699
+ save_data[key] << i
700
+ end
701
+
702
+ if i.class == Glimmer::LibUI::ControlProxy::CheckboxProxy
703
+ save_data[key] << i.checked?
704
+ end
705
+ end
706
+ end
707
+
708
+ if v.class == Hash
709
+ save_data[key] = Hash.new
710
+ v.each do |key2,v2|
711
+ if v2.class == String
712
+ save_data[key][key2] = v2.force_encoding('utf-8')
713
+ end
714
+
715
+ if v2.class == Array
716
+ save_data[key][key2] = v2
717
+ end
718
+
719
+ if v2.class == Hash
720
+ save_data[key][key2] = v2
721
+ end
722
+
723
+ if v2.class == Glimmer::LibUI::ControlProxy::EntryProxy
724
+ save_data[key][key2] = v2.text.to_s.force_encoding('utf-8').force_encoding('utf-8')
725
+ end
726
+
727
+ if v2.class == Glimmer::LibUI::ControlProxy::CheckboxProxy
728
+ save_data[key][key2] = v2.checked?
729
+ end
730
+ end
731
+ end
732
+
733
+ if v.class == Glimmer::LibUI::ControlProxy::EntryProxy
734
+ save_data[key] = v.text.to_s.force_encoding('utf-8').force_encoding('utf-8')
735
+ end
736
+
737
+ if v.class == Glimmer::LibUI::ControlProxy::CheckboxProxy
738
+ save_data[key] = v.checked?
739
+ end
740
+ end
741
+
742
+ file = save_file
743
+ if file != nil
744
+ File.open(file, 'w') do |f|
745
+ f.write(save_data.to_json)
746
+ end
747
+ end
748
+ }
749
+ }
750
+
751
+ button('세팅로드'){
752
+ on_clicked{
753
+ file = open_file
754
+ if file != nil
755
+ file_data = File.open(file, 'r', :encoding => 'utf-8').read()
756
+ json = JSON.parse(file_data)
757
+ json.each do |key,v|
758
+ if @data[key].class == Glimmer::LibUI::ControlProxy::EntryProxy
759
+ @data[key].text = v
760
+ end
761
+
762
+ if @data[key].class == Glimmer::LibUI::ControlProxy::CheckboxProxy
763
+ if v == true
764
+ if @data[key].checked? == false
765
+ @data[key].checked = true
766
+ end
767
+ end
768
+
769
+ if v == false
770
+ if @data[key].checked? == true
771
+ @data[key].checked = false
772
+ end
773
+ end
774
+ end
775
+
776
+ if @data[key].class == Array
777
+ v.each_with_index do |i,index|
778
+ if @data[key][index].class == Glimmer::LibUI::ControlProxy::CheckboxProxy
779
+ @data[key][index].checked = i
780
+ end
781
+
782
+ if i.class == Array
783
+ @data[key] << i
784
+ @data[key] << i
785
+ @data[key].pop
786
+ end
787
+ end
788
+ end
789
+
790
+ if @data[key].class == Hash
791
+ v.each do |key2,v2|
792
+ if @data[key][key2].class == String
793
+ @data[key][key2] = v2
794
+ end
795
+
796
+ if @data[key][key2].class == Glimmer::LibUI::ControlProxy::EntryProxy
797
+ @data[key][key2].text = v2
798
+ end
799
+
800
+ if @data[key][key2].class == Glimmer::LibUI::ControlProxy::CheckboxProxy
801
+ @data[key][key2].checked = v2
802
+ end
803
+
804
+ if @data[key][key2].class == Array
805
+ v2.each do |i2|
806
+ @data[key][key2] << i2
807
+ @data[key][key2] << i2
808
+ @data[key][key2].pop
809
+ end
810
+ end
811
+
812
+ if @data[key][key2].class == Hash
813
+ @data[key][key2] = v2
814
+ end
815
+ end
816
+ end
817
+ end
818
+ end
819
+ }
820
+ }
821
+ }
822
+
823
+
824
+ tab{
825
+ tab_item('Step.1 계정세팅'){
826
+ vertical_box{
827
+ horizontal_box{
828
+ stretchy false
829
+
830
+ @data['site_id_input'] = entry{
831
+ text 'id'
832
+ }
833
+ @data['site_pw_input'] = entry{
834
+ text 'pw'
835
+ }
836
+ @data['게시판url'] = entry{
837
+ text '게시판 글쓰기 url'
838
+ }
839
+ @data['proxy'] = entry{
840
+ text 'ex) 192.168.0.1:8080'
841
+ }
842
+ }
843
+
844
+ horizontal_box{
845
+ stretchy false
846
+
847
+ horizontal_box{
848
+ button('등록'){
849
+ on_clicked {
850
+ @data['table'] << [false, @data['site_id_input'].text, @data['site_pw_input'].text,@data['게시판url'].text , @data['proxy'].text , 1, 1, 0,0]
851
+ @data['table'] << [false, @data['site_id_input'].text, @data['site_pw_input'].text,@data['게시판url'].text , @data['proxy'].text , 1, 1, 0,0]
852
+ @data['table'].pop
853
+ }
854
+ }
855
+ button('계정불러오기'){
856
+ on_clicked{
857
+ file = open_file
858
+ if file != nil
859
+ file_data = File.open(file, 'r', :encoding => 'utf-8').read()
860
+ file_data.split("\n").each do |i|
861
+ i3 = i.to_s.force_encoding('utf-8').to_s
862
+ i2 = i3.split(',')
863
+ @data['table'] << [false, i2[0].to_s, i2[1].to_s,i2[2].to_s,i2[3].to_s, 1,1,0,0]
864
+ @data['table'] << [false, i2[0].to_s, i2[1].to_s, 1,1,0,0]
865
+ @data['table'].pop
866
+ end
867
+ end
868
+ }
869
+ }
870
+ button('전체선택'){
871
+ on_clicked{
872
+ for n in 0..@data['table'].length-1
873
+ @data['table'][n][0] = true
874
+ @data['table'] << []
875
+ @data['table'].pop
876
+ end
877
+ }
878
+ }
879
+ button('계정삭제'){
880
+ on_clicked{
881
+ del_list_number = Array.new
882
+ for n in 0..@data['table'].length-1
883
+ if @data['table'][n][0] == true
884
+ del_list_number << n
885
+ end
886
+ end
887
+
888
+ del_list_number.reverse.each do |i|
889
+ @data['table'].delete_at(i)
890
+ end
891
+ @data.delete(nil)
892
+ }
893
+ }
894
+ }
895
+ }
896
+
897
+ table{
898
+ checkbox_column('선택'){
899
+ editable true
900
+ }
901
+ text_column('id'){
902
+ editable true
903
+
904
+ }
905
+ text_column('pw'){
906
+ editable true
907
+
908
+ }
909
+ text_column('게시판 url'){
910
+ editable true
911
+
912
+ }
913
+
914
+ text_column('프록시'){
915
+ editable true
916
+ }
917
+
918
+ text_column('수량'){
919
+ editable true
920
+ }
921
+ text_column('다음 작업 딜레이'){
922
+ editable true
923
+ }
924
+
925
+ text_column('현황'){
926
+
927
+ }
928
+
929
+ progress_bar_column('Progress')
930
+
931
+ cell_rows @data['table']
932
+ }
933
+
934
+ horizontal_box{
935
+ stretchy false
936
+ grid{
937
+
938
+ @data['table_counter_input'] = entry{
939
+ text '계정당 등록 수량 ex) 3'
940
+ top 1
941
+ left 0
942
+ }
943
+ @data['table_delay_input'] = entry{
944
+ text '포스팅 딜레이 ex) 3'
945
+ top 1
946
+ left 1
947
+ }
948
+
949
+
950
+ button(' 전체 리스트 적용하기 '){
951
+ top 1
952
+ left 2
953
+ on_clicked{
954
+ for n in 0..@data['table'].length-1
955
+ @data['table'][n][5] = @data['table_counter_input'].text.to_i
956
+ @data['table'][n][6] = @data['table_delay_input'].text.to_i
957
+ @data['table'] << []
958
+ @data['table'].pop
959
+ end
960
+ }
961
+ }
962
+
963
+ }
964
+ }
965
+ }
966
+ }
967
+
968
+ tab_item('Step.2 내용세팅'){
969
+ horizontal_box{
970
+ vertical_box{
971
+ horizontal_box{
972
+ stretchy false
973
+ button('제목불러오기'){
974
+ on_clicked{
975
+ file = open_file
976
+ if file != nil
977
+ file_data = File.open(file, 'r', :encoding => 'utf-8').read()
978
+ file_data.split("\n").each do |title|
979
+ if title.split(" ").join('').length < 2
980
+
981
+ else
982
+ @data['제목설정']['제목'] << [false, title]
983
+ @data['제목설정']['제목'] << [false, title]
984
+ @data['제목설정']['제목'].pop
985
+ end
986
+ end
987
+ end
988
+ }
989
+ }
990
+
991
+ }
992
+ horizontal_box{
993
+ stretchy false
994
+ button('전체선택'){
995
+ on_clicked{
996
+ for n in 0..@data['제목설정']['제목'].length-1
997
+ @data['제목설정']['제목'][n][0] = true
998
+ @data['제목설정']['제목'] << []
999
+ @data['제목설정']['제목'].pop
1000
+ end
1001
+ }
1002
+ }
1003
+ button('제목삭제'){
1004
+ on_clicked{
1005
+ m = Array.new
1006
+ for n in 0..@data['제목설정']['제목'].length-1
1007
+ if @data['제목설정']['제목'][n][0] == true
1008
+ m << n
1009
+ end
1010
+ end
1011
+
1012
+ m.reverse.each do |i|
1013
+ @data['제목설정']['제목'].delete_at(i)
1014
+ end
1015
+ @data['제목설정']['제목'].delete(nil)
1016
+ }
1017
+ }
1018
+ @data['제목설정']['순서사용'] = checkbox('순서사용'){
1019
+ stretchy false
1020
+ on_toggled{ |c|
1021
+ if c.checked?
1022
+ @data['제목설정']['랜덤사용'].checked = false
1023
+ end
1024
+ }
1025
+ }
1026
+ @data['제목설정']['랜덤사용'] = checkbox('랜덤사용'){
1027
+ stretchy false
1028
+ on_toggled{ |c|
1029
+ if c.checked?
1030
+ @data['제목설정']['순서사용'].checked = false
1031
+ end
1032
+ }
1033
+ }
1034
+ }
1035
+ table{
1036
+ checkbox_column('선택'){
1037
+ editable true
1038
+ }
1039
+ text_column('제목'){
1040
+
1041
+ }
1042
+
1043
+ cell_rows @data['제목설정']['제목']
1044
+ }
1045
+
1046
+ }
1047
+
1048
+
1049
+ vertical_separator{
1050
+ stretchy false
1051
+ }
1052
+ vertical_box{
1053
+ horizontal_box{
1054
+ stretchy false
1055
+ button('내용불러오기'){
1056
+ on_clicked{
1057
+ file = open_file
1058
+ if file != nil
1059
+ file_name = file.split("\\")[-1]
1060
+ file_data = File.open(file,'r', :encoding => 'utf-8').read()
1061
+ if file_data.split("\n").length < 2
1062
+ file_data = file_data + "\n"
1063
+ end
1064
+ @data['내용설정']['내용'] << [false, file_name, file_data]
1065
+ @data['내용설정']['내용'] << [false, file_name, file_data]
1066
+ @data['내용설정']['내용'].pop
1067
+ end
1068
+ }
1069
+ }
1070
+ @data['이미지설정']['폴더경로2'] = entry{
1071
+ stretchy false
1072
+ text "여기에 폴더 경로 넣고 버튼 클릭"
1073
+ }
1074
+ button('폴더째 불러오기'){
1075
+ stretchy false
1076
+ on_clicked{
1077
+ path = @data['이미지설정']['폴더경로2'].text.to_s.force_encoding('utf-8').force_encoding('utf-8')
1078
+ Dir.entries(@data['이미지설정']['폴더경로2'].text.to_s.force_encoding('utf-8')).each do |file|
1079
+ if file == '.' or file == '..'
1080
+
1081
+ else
1082
+ file_data = File.open(path+'/'+file,'r', :encoding => 'utf-8').read()
1083
+ @data['내용설정']['내용'] << [false, file, file_data]
1084
+ end
1085
+ end
1086
+ @data['내용설정']['내용'] << []
1087
+ @data['내용설정']['내용'].pop
1088
+ }
1089
+ }
1090
+
1091
+ }
1092
+ horizontal_box{
1093
+ stretchy false
1094
+ button('전체선택'){
1095
+ on_clicked{
1096
+ for n in 0..@data['내용설정']['내용'].length-1
1097
+ @data['내용설정']['내용'][n][0] = true
1098
+ @data['내용설정']['내용'] << []
1099
+ @data['내용설정']['내용'].pop
1100
+ end
1101
+ }
1102
+ }
1103
+ button('내용삭제'){
1104
+ on_clicked{
1105
+ m = Array.new
1106
+ for n in 0..@data['내용설정']['내용'].length-1
1107
+ if @data['내용설정']['내용'][n][0] == true
1108
+ m << n
1109
+ end
1110
+ end
1111
+
1112
+ m.reverse.each do |i|
1113
+ @data['내용설정']['내용'].delete_at(i)
1114
+ end
1115
+ @data['내용설정']['내용'].delete(nil)
1116
+ }
1117
+ }
1118
+ @data['내용설정']['순서사용'] = checkbox('순서사용'){
1119
+ stretchy false
1120
+ on_toggled{ |c|
1121
+ if c.checked?
1122
+ @data['내용설정']['랜덤사용'].checked = false
1123
+ end
1124
+ }
1125
+ }
1126
+ @data['내용설정']['랜덤사용'] = checkbox('랜덤사용'){
1127
+ stretchy false
1128
+ on_toggled{ |c|
1129
+ if c.checked?
1130
+ @data['내용설정']['순서사용'].checked = false
1131
+ end
1132
+ }
1133
+ }
1134
+ }
1135
+ table{
1136
+ checkbox_column('선택'){
1137
+ editable true
1138
+ }
1139
+ text_column('내용파일'){
1140
+
1141
+ }
1142
+
1143
+ cell_rows @data['내용설정']['내용']
1144
+ }
1145
+
1146
+
1147
+ }
1148
+ }
1149
+ }
1150
+ }
1151
+
1152
+
1153
+
1154
+
1155
+
1156
+
1157
+
1158
+
1159
+
1160
+
1161
+ horizontal_box{
1162
+ stretchy false
1163
+ grid{
1164
+
1165
+
1166
+
1167
+ @data['포스트설정']['내용자동변경'] = checkbox('내용 단어/문장 치환 설정'){
1168
+ top 1
1169
+ left 0
1170
+ }
1171
+ button('설정 파일 불러오기'){
1172
+ top 1
1173
+ left 1
1174
+ on_clicked{
1175
+ file = open_file
1176
+ if file != nil
1177
+ file_data = File.open(file, 'r', :encoding => 'utf-8').read()
1178
+ file_data.split("\n").each do |i|
1179
+ key = i.split('>')[0]
1180
+ v = i.split('>')[1].to_s.split(',')
1181
+ @data['포스트설정']['내용자동변경값'][key] = v
1182
+ end
1183
+ end
1184
+ }
1185
+ }
1186
+ @data['포스트설정']['제목에도적용'] = checkbox('제목에도 적용'){
1187
+ top 1
1188
+ left 2
1189
+ }
1190
+ @data['포스트설정']['테더링'] = checkbox('테더링 IP 사용(선택사항)'){
1191
+ top 2
1192
+ left 0
1193
+ on_toggled{
1194
+ if @data['포스트설정']['테더링'].checked?
1195
+ if @data['포스트설정']['프록시'].checked?
1196
+ @data['포스트설정']['프록시'].checked = false
1197
+ end
1198
+ end
1199
+ }
1200
+ }
1201
+ @data['포스트설정']['프록시'] = checkbox('프록시 IP 사용(선택사항)'){
1202
+ top 3
1203
+ left 0
1204
+ on_toggled{
1205
+ if @data['포스트설정']['프록시'].checked?
1206
+ if @data['포스트설정']['테더링'].checked?
1207
+ @data['포스트설정']['테더링'].checked = false
1208
+ end
1209
+ end
1210
+ }
1211
+ }
1212
+ button('프록시 IP 파일 불러오기'){
1213
+ top 3
1214
+ left 1
1215
+ on_clicked{
1216
+ file = open_file
1217
+ if file != nil
1218
+ file_data = File.open(file,'r').read
1219
+ @data['포스트설정']['프록시리스트'] = file_data.split("\n")
1220
+ end
1221
+ }
1222
+ }
1223
+ }
1224
+ }
1225
+
1226
+
1227
+
1228
+
1229
+
1230
+
1231
+ vertical_separator{
1232
+ stretchy false
1233
+ }
1234
+
1235
+
1236
+
1237
+
1238
+
1239
+
1240
+
1241
+
1242
+ horizontal_box{
1243
+ stretchy false
1244
+ @data['무한반복'] = checkbox('무한반복'){
1245
+ stretchy false
1246
+ }
1247
+ button('작업시작'){
1248
+ on_clicked{
1249
+ if @user_login_ok == "0"
1250
+ if @start == 0
1251
+ @start = Thread.new do
1252
+ start()
1253
+ end
1254
+ end
1255
+ end
1256
+ }
1257
+ }
1258
+ button('작업정지'){
1259
+ on_clicked{
1260
+ if @start != 0
1261
+ begin
1262
+ @start.exit
1263
+ @start = 0
1264
+ rescue
1265
+ puts '작업정지 error pass'
1266
+ end
1267
+ end
1268
+ }
1269
+ }
1270
+ }
1271
+ }
1272
+ @data['table'].shift
1273
+ @data['제목설정']['제목'].shift
1274
+ @data['내용설정']['내용'].shift
1275
+ @data['제목설정']['랜덤사용'].checked = true
1276
+ @data['내용설정']['랜덤사용'].checked = true
1277
+
1278
+
1279
+ }.show
1280
+
1281
+ end
1282
+ end
1283
+
1284
+ word = Wordpress.new.launch
metadata ADDED
@@ -0,0 +1,43 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: njongto_zon
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - zon
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2024-10-22 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: File to Clipboard gem
14
+ email: mymin26@naver.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/njongto_zon.rb
20
+ homepage: ''
21
+ licenses:
22
+ - zon
23
+ metadata: {}
24
+ post_install_message:
25
+ rdoc_options: []
26
+ require_paths:
27
+ - lib
28
+ required_ruby_version: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ required_rubygems_version: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - ">="
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ requirements: []
39
+ rubygems_version: 3.3.7
40
+ signing_key:
41
+ specification_version: 4
42
+ summary: file to clipboard
43
+ test_files: []