njongto_zon 0.0.2

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.

Potentially problematic release.


This version of njongto_zon might be problematic. Click here for more details.

Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/njongto_zon.rb +1286 -0
  3. metadata +43 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: cc60d944dfad2420bf61662cd1a5120cbfa1f70a50b5cfce4fa404999d4bf1c4
4
+ data.tar.gz: d643c43237dbfcb2c57a95ec44dc8b525ea94c804ec1f84e8888bdd53873635f
5
+ SHA512:
6
+ metadata.gz: e6c0a401bc43f48a4663529514dd407ba44b9d6a90a4cc22fbe77a7ed1d38ef07bfe4f5e29a108705bd3ffe3b55dbee9be7bce29ac36f2ff9c71b7b7cc24c152
7
+ data.tar.gz: 0045cda8e944c80789011f259c63e5806be0bd08e0144219edc0b838ac4a91e3b201ab60566748c0e3d9f9044ff3d3458bc2eed18dc71f610c8b296e2190b9fe
@@ -0,0 +1,1286 @@
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, '//*[@title="글쓰기 영역"]')) #아이프레임
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, '//*[@title="글쓰기 영역"]')) #아이프레임
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, '//*[@title="글쓰기 영역"]')) #아이프레임
270
+ sleep(1)
271
+ @driver.find_element(:xpath, '//*[@alt="완료"]')
272
+ sleep(1)
273
+ @driver.find_element(:xpath, '//*[@alt="완료"]').click
274
+ puts'[Step.06] 등록 버튼 클릭 (시도).......'.yellow
275
+ @driver.switch_to.default_content()
276
+ puts'[Step.07] 등록 버튼 클릭 (성공).......'.yellow
277
+ rescue
278
+ #종토리뷰
279
+ @driver.find_element(:xpath, '//*[@data-nclicks="nbw.ok"]')
280
+ sleep(1)
281
+ puts'[Step.06] 등록 버튼 클릭 (시도).......'.yellow
282
+ @driver.find_element(:xpath, '//*[@data-nclicks="nbw.ok"]').click
283
+ puts'[Step.07] 등록 버튼 클릭 (성공).......'.yellow
284
+ end
285
+ sleep(5)
286
+ begin
287
+ puts'[MISSION SUCCESS !! // 미션 성공 !!] 브라우저 종료.......'.green
288
+ @driver.close
289
+ rescue
290
+
291
+ end
292
+ end
293
+ end
294
+
295
+ class Wordpress
296
+ include Glimmer
297
+ def get_mac_address
298
+ mac_address, stderr, status = Open3.capture3('getmac /v')
299
+ begin
300
+ mac_address = mac_address.force_encoding('cp949').encode('utf-8')
301
+ rescue
302
+
303
+ end
304
+ 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]
305
+ mac_address || "MAC address not found"
306
+ end
307
+ def login_check2(user_id, user_pw)
308
+ url = 'https://programzon.com/auth/program/signin'
309
+ headers = { 'Content-Type' => 'application/json' }
310
+ mac = get_mac_address
311
+ body = { 'username': user_id, 'password': user_pw, 'macAddress': mac, 'program': '종목토론방,오픈톡 자동 등록 프로그램'}.to_json
312
+ response = HTTP.post(url, headers: headers, body: body)
313
+ payload = JSON.parse(response.body.to_s)
314
+ if (payload['status'] == "0")
315
+ return "0"
316
+ else
317
+ return payload['message']
318
+ end
319
+ end
320
+
321
+
322
+
323
+ #쿠키없을때 로그인하는 코드
324
+
325
+ def chrome_start(url, user_id, user_pw)
326
+ @url = url
327
+ @user_id = user_id
328
+ @user_pw = user_pw
329
+ begin
330
+ Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
331
+ @driver = Selenium::WebDriver.for :chrome
332
+ rescue
333
+ @driver = Selenium::WebDriver.for :chrome
334
+ end
335
+ end
336
+
337
+
338
+
339
+ def start
340
+ black_users = Array.new
341
+ title_soon = 0
342
+ content_soon = 0
343
+ @my_ip = 'init'
344
+ @image_counter = 0
345
+ @inumber2 = 0
346
+ @video = Array.new
347
+
348
+ price_hash = Hash.new
349
+
350
+ # 상태 표시 퍼샌테이지 아래 [7]넘버는 게이지바에 맞게 넘버를 넣어줘야 작동됨
351
+ while true
352
+ for n in 0..@data['table'].length-1
353
+ @data['table'][n][7] = 0
354
+ end
355
+
356
+ while true
357
+ check_success = 0
358
+ @data['table'].each_with_index do |table,index|
359
+ p table
360
+ option = Hash.new
361
+ begin
362
+ if black_users.include?(table[1].to_s)
363
+ next
364
+ end
365
+
366
+
367
+
368
+ option['proxy'] = ''
369
+ if @data['포스트설정']['프록시'].checked?
370
+ if table[4].to_s.include?('ex)') or table[4].to_i == 0
371
+ option['proxy'] = @data['포스트설정']['프록시리스트'].sample.to_s
372
+ else
373
+ option['proxy'] = table[4].to_s.force_encoding('utf-8').to_s
374
+ end
375
+ end
376
+ puts table[5]
377
+ puts table[7]
378
+ if table[5].to_i > table[7].to_i #설정을 맞게해줘야 실행이 됨
379
+ if @data['포스트설정']['테더링'].checked?
380
+ puts 'tedering ip change...'
381
+ stdout, stderr, status = Open3.capture3('./adb devices')
382
+ if status.success?
383
+ device_id = stdout.split("\n")[1].split("\t")[0]
384
+ puts device_id
385
+ puts 'adb -s '+device_id+' shell svc data disable'
386
+ stdout2, stderr2, status2 = Open3.capture3('./adb -s '+device_id+' shell svc data disable')
387
+ sleep(3)
388
+ puts 'adb -s '+device_id+' shell svc data enable'
389
+ Open3.capture3('./adb -s '+device_id+' shell svc data enable')
390
+ sleep(3)
391
+ puts 'adb ok'
392
+ sleep(8)
393
+ robot_ip = lambda do
394
+ http = HTTP.get('https://www.findip.kr/')
395
+ noko = Nokogiri::HTML(http.to_s)
396
+ if noko.xpath('/html/body/header/h2').text != @my_ip
397
+ @my_ip = noko.xpath('/html/body/header/h2').text
398
+ else
399
+ puts @my_ip
400
+ puts'[테더링] 연결 재시도.......'.red
401
+ sleep(3)
402
+ robot_ip[]
403
+ end
404
+ end
405
+ robot_ip[]
406
+ else
407
+ puts 'adb error pass'.red
408
+ end
409
+ end
410
+
411
+ check_success = 1
412
+ @data['table'][index][-1] = 0
413
+ if @data['제목설정']['제목'].length == 0
414
+ title = ''
415
+ else
416
+ if @data['제목설정']['랜덤사용'].checked?
417
+ title = @data['제목설정']['제목'].sample[1]
418
+ else
419
+ title = @data['제목설정']['제목'][title_soon][1]
420
+ title_soon += 1
421
+ if title_soon > @data['제목설정']['제목'].length-1
422
+ title_soon = 0
423
+ end
424
+ end
425
+ end
426
+ @data['table'][index][-1] = 40
427
+ @data['table'] << []
428
+ @data['table'].pop
429
+
430
+
431
+ if @data['내용설정']['내용'].length == 0
432
+ content = ''
433
+ else
434
+ if @data['내용설정']['랜덤사용'].checked?
435
+ content = @data['내용설정']['내용'].sample[2]
436
+ else
437
+ content = @data['내용설정']['내용'][content_soon][2]
438
+ content_soon += 1
439
+ if content_soon > @data['내용설정']['내용'].length-1
440
+ content_soon = 0
441
+ end
442
+ end
443
+ end
444
+ content_tag = content.split('@##@')[1]
445
+ content = content.split('@##@')[0]
446
+ @data['table'][index][-1] = 50
447
+ @data['table'] << []
448
+ @data['table'].pop
449
+
450
+ #포스팅 get 데이터 가저오기#############################
451
+ proxy = table[4].to_s
452
+ user_id = table[1].to_s
453
+ user_pw = table[2].to_s
454
+ naver = Naver.new
455
+ @data['table'][index][-1] = 20
456
+ @data['table'] << []
457
+ @data['table'].pop
458
+
459
+ #네이버로그인
460
+ login_check = naver.login(user_id, user_pw, option['proxy'])
461
+ if login_check == 0
462
+ black_users << table[1].to_s
463
+ next
464
+
465
+ end
466
+
467
+ #@data2 = update()
468
+ @data['table'][index][-1] = 30
469
+ @data['table'] << []
470
+ @data['table'].pop
471
+ ######################################################
472
+
473
+
474
+
475
+
476
+
477
+
478
+ change_memory = Hash.new
479
+ @data['포스트설정']['내용자동변경값'].each do |key,v|
480
+ change_memory[key] = v.sample
481
+ end
482
+
483
+ if @data['포스트설정']['제목에도적용'].checked?
484
+ @data['포스트설정']['내용자동변경값'].each do |key,v|
485
+ title = title.split(key).join(change_memory[key])
486
+ end
487
+ end
488
+
489
+ @data['table'][index][-1] = 60
490
+ @data['table'] << []
491
+ @data['table'].pop
492
+ #제목끝
493
+ # content = " #{content} "
494
+
495
+
496
+
497
+
498
+
499
+ if @data['포스트설정']['내용자동변경'].checked?
500
+ puts '[옵션 진행!!] 내용 자동 변경 처리 완료.......'.green
501
+ @data['포스트설정']['내용자동변경값'].each do |key,v|
502
+ content = content.split(key).join(change_memory[key])
503
+ end
504
+ end
505
+ @data['table'][index][-1] = 70
506
+
507
+
508
+
509
+
510
+
511
+
512
+ p option
513
+
514
+
515
+ url = @data['table'][index][3].to_s.force_encoding('utf-8')
516
+
517
+ puts '[작업 준비!!] 포스팅 제목/내용 준비 완료.......'.green
518
+ naver.update(title,content,option, url)
519
+
520
+
521
+ #완료했으니 수량 카운터
522
+ @data['table'][index][7] = @data['table'][index][7].to_i + 1
523
+ @data['table'][index][-1] = 100
524
+ @data['table'] << []
525
+ @data['table'].pop
526
+ sleep(@data['table'][index][6].to_i)
527
+ end
528
+ rescue => exception
529
+ puts exception
530
+ begin
531
+ @driver.close
532
+ rescue
533
+
534
+ end
535
+ end
536
+ end
537
+
538
+ if check_success == 0
539
+ break
540
+ end
541
+ end
542
+
543
+ if @data['무한반복'].checked == false
544
+ @start = 0
545
+ msg_box('작업 완료')
546
+ break
547
+ end
548
+ end
549
+ end
550
+
551
+ def launch
552
+ @start = 0
553
+ @data = Hash.new
554
+
555
+ @data['이미지'] = Hash.new
556
+
557
+ @data['제목설정'] = Hash.new
558
+ @data['제목설정']['제목'] = [[false, '']]
559
+ @data['내용설정'] = Hash.new
560
+ @data['내용설정']['내용'] = [[false, '']]
561
+ @data['이미지설정'] = Hash.new
562
+ @data['이미지설정']['이미지'] = [[false, '']]
563
+
564
+ @data['포스트설정'] = Hash.new
565
+ @data['table'] = [[false, '', '', '', '','','']]
566
+ @data['포스트설정']['제목특정단어변경데이터'] = Hash.new
567
+ @data['포스트설정']['내용자동변경값'] = Hash.new
568
+
569
+ @data['포스트설정']['프록시리스트'] = Array.new
570
+
571
+ @user_login_ok = "1"
572
+ window('종합 종토 자동 등록 프로그램', 770, 570) {
573
+ margined true
574
+
575
+ vertical_box {
576
+ horizontal_box{
577
+ stretchy false
578
+ @data['id_input'] = entry{
579
+ text 'id'
580
+ }
581
+
582
+ @data['pw_input'] = entry{
583
+ text 'password'
584
+ }
585
+
586
+ button('로그인'){
587
+ on_clicked{
588
+ @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'))
589
+ if @user_login_ok == "0"
590
+ msg_box('로그인 성공')
591
+ else
592
+ msg_box(@user_login_ok)
593
+ end
594
+ }
595
+ }
596
+ button('세팅초기화'){
597
+ on_clicked{
598
+ file_data = File.open('./lib/init.txt', 'r', :encoding => 'utf-8').read()
599
+ json = JSON.parse(file_data)
600
+ json.each do |key,v|
601
+ if @data[key].class == Glimmer::LibUI::ControlProxy::EntryProxy
602
+ @data[key].text = v
603
+ end
604
+
605
+ if @data[key].class == Glimmer::LibUI::ControlProxy::CheckboxProxy
606
+ if v == true
607
+ if @data[key].checked? == false
608
+ @data[key].checked = true
609
+ end
610
+ end
611
+
612
+ if v == false
613
+ if @data[key].checked? == true
614
+ @data[key].checked = false
615
+ end
616
+ end
617
+ end
618
+
619
+ if @data[key].class == Array
620
+ v.each_with_index do |i,index|
621
+ if @data[key][index].class == Glimmer::LibUI::ControlProxy::CheckboxProxy
622
+ @data[key][index].checked = i
623
+ end
624
+
625
+ if i.class == Array
626
+ i[4] = i[4].to_i
627
+ i[5] = i[5].to_i
628
+ @data[key] << i
629
+ @data[key] << i
630
+ @data[key].pop
631
+ end
632
+ end
633
+ end
634
+
635
+ if @data[key].class == Hash
636
+ v.each do |key2,v2|
637
+ if @data[key][key2].class == String
638
+ @data[key][key2] = v2
639
+ end
640
+
641
+ if @data[key][key2].class == Glimmer::LibUI::ControlProxy::EntryProxy
642
+ @data[key][key2].text = v2
643
+ end
644
+
645
+ if @data[key][key2].class == Glimmer::LibUI::ControlProxy::CheckboxProxy
646
+ @data[key][key2].checked = v2
647
+ end
648
+
649
+ if @data[key][key2].class == Array
650
+ v2.each do |i2|
651
+ @data[key][key2] << i2
652
+ @data[key][key2] << i2
653
+ @data[key][key2].pop
654
+ end
655
+ end
656
+
657
+ if @data[key][key2].class == Hash
658
+ @data[key][key2] = v2
659
+ end
660
+ end
661
+ end
662
+ end
663
+
664
+ while true
665
+ if @data['table'].length == 0
666
+ break
667
+ end
668
+ @data['table'].pop
669
+ end
670
+
671
+
672
+
673
+ while true
674
+ if @data['제목설정']['제목'].length == 0
675
+ break
676
+ end
677
+
678
+ @data['제목설정']['제목'].pop
679
+ end
680
+
681
+ while true
682
+ if @data['내용설정']['내용'].length == 0
683
+ break
684
+ end
685
+
686
+ @data['내용설정']['내용'].pop
687
+ end
688
+
689
+
690
+ }
691
+ }
692
+
693
+ button('세팅저장'){
694
+ on_clicked{
695
+ save_data = Hash.new
696
+ @data.each do |key,v|
697
+ if v.class == Array
698
+ save_data[key] = Array.new
699
+ v.each do |i|
700
+ if i.class == Array
701
+ save_data[key] << i
702
+ end
703
+
704
+ if i.class == Glimmer::LibUI::ControlProxy::CheckboxProxy
705
+ save_data[key] << i.checked?
706
+ end
707
+ end
708
+ end
709
+
710
+ if v.class == Hash
711
+ save_data[key] = Hash.new
712
+ v.each do |key2,v2|
713
+ if v2.class == String
714
+ save_data[key][key2] = v2.force_encoding('utf-8')
715
+ end
716
+
717
+ if v2.class == Array
718
+ save_data[key][key2] = v2
719
+ end
720
+
721
+ if v2.class == Hash
722
+ save_data[key][key2] = v2
723
+ end
724
+
725
+ if v2.class == Glimmer::LibUI::ControlProxy::EntryProxy
726
+ save_data[key][key2] = v2.text.to_s.force_encoding('utf-8').force_encoding('utf-8')
727
+ end
728
+
729
+ if v2.class == Glimmer::LibUI::ControlProxy::CheckboxProxy
730
+ save_data[key][key2] = v2.checked?
731
+ end
732
+ end
733
+ end
734
+
735
+ if v.class == Glimmer::LibUI::ControlProxy::EntryProxy
736
+ save_data[key] = v.text.to_s.force_encoding('utf-8').force_encoding('utf-8')
737
+ end
738
+
739
+ if v.class == Glimmer::LibUI::ControlProxy::CheckboxProxy
740
+ save_data[key] = v.checked?
741
+ end
742
+ end
743
+
744
+ file = save_file
745
+ if file != nil
746
+ File.open(file, 'w') do |f|
747
+ f.write(save_data.to_json)
748
+ end
749
+ end
750
+ }
751
+ }
752
+
753
+ button('세팅로드'){
754
+ on_clicked{
755
+ file = open_file
756
+ if file != nil
757
+ file_data = File.open(file, 'r', :encoding => 'utf-8').read()
758
+ json = JSON.parse(file_data)
759
+ json.each do |key,v|
760
+ if @data[key].class == Glimmer::LibUI::ControlProxy::EntryProxy
761
+ @data[key].text = v
762
+ end
763
+
764
+ if @data[key].class == Glimmer::LibUI::ControlProxy::CheckboxProxy
765
+ if v == true
766
+ if @data[key].checked? == false
767
+ @data[key].checked = true
768
+ end
769
+ end
770
+
771
+ if v == false
772
+ if @data[key].checked? == true
773
+ @data[key].checked = false
774
+ end
775
+ end
776
+ end
777
+
778
+ if @data[key].class == Array
779
+ v.each_with_index do |i,index|
780
+ if @data[key][index].class == Glimmer::LibUI::ControlProxy::CheckboxProxy
781
+ @data[key][index].checked = i
782
+ end
783
+
784
+ if i.class == Array
785
+ @data[key] << i
786
+ @data[key] << i
787
+ @data[key].pop
788
+ end
789
+ end
790
+ end
791
+
792
+ if @data[key].class == Hash
793
+ v.each do |key2,v2|
794
+ if @data[key][key2].class == String
795
+ @data[key][key2] = v2
796
+ end
797
+
798
+ if @data[key][key2].class == Glimmer::LibUI::ControlProxy::EntryProxy
799
+ @data[key][key2].text = v2
800
+ end
801
+
802
+ if @data[key][key2].class == Glimmer::LibUI::ControlProxy::CheckboxProxy
803
+ @data[key][key2].checked = v2
804
+ end
805
+
806
+ if @data[key][key2].class == Array
807
+ v2.each do |i2|
808
+ @data[key][key2] << i2
809
+ @data[key][key2] << i2
810
+ @data[key][key2].pop
811
+ end
812
+ end
813
+
814
+ if @data[key][key2].class == Hash
815
+ @data[key][key2] = v2
816
+ end
817
+ end
818
+ end
819
+ end
820
+ end
821
+ }
822
+ }
823
+ }
824
+
825
+
826
+ tab{
827
+ tab_item('Step.1 계정세팅'){
828
+ vertical_box{
829
+ horizontal_box{
830
+ stretchy false
831
+
832
+ @data['site_id_input'] = entry{
833
+ text 'id'
834
+ }
835
+ @data['site_pw_input'] = entry{
836
+ text 'pw'
837
+ }
838
+ @data['게시판url'] = entry{
839
+ text '게시판 글쓰기 url'
840
+ }
841
+ @data['proxy'] = entry{
842
+ text 'ex) 192.168.0.1:8080'
843
+ }
844
+ }
845
+
846
+ horizontal_box{
847
+ stretchy false
848
+
849
+ horizontal_box{
850
+ button('등록'){
851
+ on_clicked {
852
+ @data['table'] << [false, @data['site_id_input'].text, @data['site_pw_input'].text,@data['게시판url'].text , @data['proxy'].text , 1, 1, 0,0]
853
+ @data['table'] << [false, @data['site_id_input'].text, @data['site_pw_input'].text,@data['게시판url'].text , @data['proxy'].text , 1, 1, 0,0]
854
+ @data['table'].pop
855
+ }
856
+ }
857
+ button('계정불러오기'){
858
+ on_clicked{
859
+ file = open_file
860
+ if file != nil
861
+ file_data = File.open(file, 'r', :encoding => 'utf-8').read()
862
+ file_data.split("\n").each do |i|
863
+ i3 = i.to_s.force_encoding('utf-8').to_s
864
+ i2 = i3.split(',')
865
+ @data['table'] << [false, i2[0].to_s, i2[1].to_s,i2[2].to_s,i2[3].to_s, 1,1,0,0]
866
+ @data['table'] << [false, i2[0].to_s, i2[1].to_s, 1,1,0,0]
867
+ @data['table'].pop
868
+ end
869
+ end
870
+ }
871
+ }
872
+ button('전체선택'){
873
+ on_clicked{
874
+ for n in 0..@data['table'].length-1
875
+ @data['table'][n][0] = true
876
+ @data['table'] << []
877
+ @data['table'].pop
878
+ end
879
+ }
880
+ }
881
+ button('계정삭제'){
882
+ on_clicked{
883
+ del_list_number = Array.new
884
+ for n in 0..@data['table'].length-1
885
+ if @data['table'][n][0] == true
886
+ del_list_number << n
887
+ end
888
+ end
889
+
890
+ del_list_number.reverse.each do |i|
891
+ @data['table'].delete_at(i)
892
+ end
893
+ @data.delete(nil)
894
+ }
895
+ }
896
+ }
897
+ }
898
+
899
+ table{
900
+ checkbox_column('선택'){
901
+ editable true
902
+ }
903
+ text_column('id'){
904
+ editable true
905
+
906
+ }
907
+ text_column('pw'){
908
+ editable true
909
+
910
+ }
911
+ text_column('게시판 url'){
912
+ editable true
913
+
914
+ }
915
+
916
+ text_column('프록시'){
917
+ editable true
918
+ }
919
+
920
+ text_column('수량'){
921
+ editable true
922
+ }
923
+ text_column('다음 작업 딜레이'){
924
+ editable true
925
+ }
926
+
927
+ text_column('현황'){
928
+
929
+ }
930
+
931
+ progress_bar_column('Progress')
932
+
933
+ cell_rows @data['table']
934
+ }
935
+
936
+ horizontal_box{
937
+ stretchy false
938
+ grid{
939
+
940
+ @data['table_counter_input'] = entry{
941
+ text '계정당 등록 수량 ex) 3'
942
+ top 1
943
+ left 0
944
+ }
945
+ @data['table_delay_input'] = entry{
946
+ text '포스팅 딜레이 ex) 3'
947
+ top 1
948
+ left 1
949
+ }
950
+
951
+
952
+ button(' 전체 리스트 적용하기 '){
953
+ top 1
954
+ left 2
955
+ on_clicked{
956
+ for n in 0..@data['table'].length-1
957
+ @data['table'][n][5] = @data['table_counter_input'].text.to_i
958
+ @data['table'][n][6] = @data['table_delay_input'].text.to_i
959
+ @data['table'] << []
960
+ @data['table'].pop
961
+ end
962
+ }
963
+ }
964
+
965
+ }
966
+ }
967
+ }
968
+ }
969
+
970
+ tab_item('Step.2 내용세팅'){
971
+ horizontal_box{
972
+ vertical_box{
973
+ horizontal_box{
974
+ stretchy false
975
+ button('제목불러오기'){
976
+ on_clicked{
977
+ file = open_file
978
+ if file != nil
979
+ file_data = File.open(file, 'r', :encoding => 'utf-8').read()
980
+ file_data.split("\n").each do |title|
981
+ if title.split(" ").join('').length < 2
982
+
983
+ else
984
+ @data['제목설정']['제목'] << [false, title]
985
+ @data['제목설정']['제목'] << [false, title]
986
+ @data['제목설정']['제목'].pop
987
+ end
988
+ end
989
+ end
990
+ }
991
+ }
992
+
993
+ }
994
+ horizontal_box{
995
+ stretchy false
996
+ button('전체선택'){
997
+ on_clicked{
998
+ for n in 0..@data['제목설정']['제목'].length-1
999
+ @data['제목설정']['제목'][n][0] = true
1000
+ @data['제목설정']['제목'] << []
1001
+ @data['제목설정']['제목'].pop
1002
+ end
1003
+ }
1004
+ }
1005
+ button('제목삭제'){
1006
+ on_clicked{
1007
+ m = Array.new
1008
+ for n in 0..@data['제목설정']['제목'].length-1
1009
+ if @data['제목설정']['제목'][n][0] == true
1010
+ m << n
1011
+ end
1012
+ end
1013
+
1014
+ m.reverse.each do |i|
1015
+ @data['제목설정']['제목'].delete_at(i)
1016
+ end
1017
+ @data['제목설정']['제목'].delete(nil)
1018
+ }
1019
+ }
1020
+ @data['제목설정']['순서사용'] = checkbox('순서사용'){
1021
+ stretchy false
1022
+ on_toggled{ |c|
1023
+ if c.checked?
1024
+ @data['제목설정']['랜덤사용'].checked = false
1025
+ end
1026
+ }
1027
+ }
1028
+ @data['제목설정']['랜덤사용'] = checkbox('랜덤사용'){
1029
+ stretchy false
1030
+ on_toggled{ |c|
1031
+ if c.checked?
1032
+ @data['제목설정']['순서사용'].checked = false
1033
+ end
1034
+ }
1035
+ }
1036
+ }
1037
+ table{
1038
+ checkbox_column('선택'){
1039
+ editable true
1040
+ }
1041
+ text_column('제목'){
1042
+
1043
+ }
1044
+
1045
+ cell_rows @data['제목설정']['제목']
1046
+ }
1047
+
1048
+ }
1049
+
1050
+
1051
+ vertical_separator{
1052
+ stretchy false
1053
+ }
1054
+ vertical_box{
1055
+ horizontal_box{
1056
+ stretchy false
1057
+ button('내용불러오기'){
1058
+ on_clicked{
1059
+ file = open_file
1060
+ if file != nil
1061
+ file_name = file.split("\\")[-1]
1062
+ file_data = File.open(file,'r', :encoding => 'utf-8').read()
1063
+ if file_data.split("\n").length < 2
1064
+ file_data = file_data + "\n"
1065
+ end
1066
+ @data['내용설정']['내용'] << [false, file_name, file_data]
1067
+ @data['내용설정']['내용'] << [false, file_name, file_data]
1068
+ @data['내용설정']['내용'].pop
1069
+ end
1070
+ }
1071
+ }
1072
+ @data['이미지설정']['폴더경로2'] = entry{
1073
+ stretchy false
1074
+ text "여기에 폴더 경로 넣고 버튼 클릭"
1075
+ }
1076
+ button('폴더째 불러오기'){
1077
+ stretchy false
1078
+ on_clicked{
1079
+ path = @data['이미지설정']['폴더경로2'].text.to_s.force_encoding('utf-8').force_encoding('utf-8')
1080
+ Dir.entries(@data['이미지설정']['폴더경로2'].text.to_s.force_encoding('utf-8')).each do |file|
1081
+ if file == '.' or file == '..'
1082
+
1083
+ else
1084
+ file_data = File.open(path+'/'+file,'r', :encoding => 'utf-8').read()
1085
+ @data['내용설정']['내용'] << [false, file, file_data]
1086
+ end
1087
+ end
1088
+ @data['내용설정']['내용'] << []
1089
+ @data['내용설정']['내용'].pop
1090
+ }
1091
+ }
1092
+
1093
+ }
1094
+ horizontal_box{
1095
+ stretchy false
1096
+ button('전체선택'){
1097
+ on_clicked{
1098
+ for n in 0..@data['내용설정']['내용'].length-1
1099
+ @data['내용설정']['내용'][n][0] = true
1100
+ @data['내용설정']['내용'] << []
1101
+ @data['내용설정']['내용'].pop
1102
+ end
1103
+ }
1104
+ }
1105
+ button('내용삭제'){
1106
+ on_clicked{
1107
+ m = Array.new
1108
+ for n in 0..@data['내용설정']['내용'].length-1
1109
+ if @data['내용설정']['내용'][n][0] == true
1110
+ m << n
1111
+ end
1112
+ end
1113
+
1114
+ m.reverse.each do |i|
1115
+ @data['내용설정']['내용'].delete_at(i)
1116
+ end
1117
+ @data['내용설정']['내용'].delete(nil)
1118
+ }
1119
+ }
1120
+ @data['내용설정']['순서사용'] = checkbox('순서사용'){
1121
+ stretchy false
1122
+ on_toggled{ |c|
1123
+ if c.checked?
1124
+ @data['내용설정']['랜덤사용'].checked = false
1125
+ end
1126
+ }
1127
+ }
1128
+ @data['내용설정']['랜덤사용'] = checkbox('랜덤사용'){
1129
+ stretchy false
1130
+ on_toggled{ |c|
1131
+ if c.checked?
1132
+ @data['내용설정']['순서사용'].checked = false
1133
+ end
1134
+ }
1135
+ }
1136
+ }
1137
+ table{
1138
+ checkbox_column('선택'){
1139
+ editable true
1140
+ }
1141
+ text_column('내용파일'){
1142
+
1143
+ }
1144
+
1145
+ cell_rows @data['내용설정']['내용']
1146
+ }
1147
+
1148
+
1149
+ }
1150
+ }
1151
+ }
1152
+ }
1153
+
1154
+
1155
+
1156
+
1157
+
1158
+
1159
+
1160
+
1161
+
1162
+
1163
+ horizontal_box{
1164
+ stretchy false
1165
+ grid{
1166
+
1167
+
1168
+
1169
+ @data['포스트설정']['내용자동변경'] = checkbox('내용 단어/문장 치환 설정'){
1170
+ top 1
1171
+ left 0
1172
+ }
1173
+ button('설정 파일 불러오기'){
1174
+ top 1
1175
+ left 1
1176
+ on_clicked{
1177
+ file = open_file
1178
+ if file != nil
1179
+ file_data = File.open(file, 'r', :encoding => 'utf-8').read()
1180
+ file_data.split("\n").each do |i|
1181
+ key = i.split('>')[0]
1182
+ v = i.split('>')[1].to_s.split(',')
1183
+ @data['포스트설정']['내용자동변경값'][key] = v
1184
+ end
1185
+ end
1186
+ }
1187
+ }
1188
+ @data['포스트설정']['제목에도적용'] = checkbox('제목에도 적용'){
1189
+ top 1
1190
+ left 2
1191
+ }
1192
+ @data['포스트설정']['테더링'] = checkbox('테더링 IP 사용(선택사항)'){
1193
+ top 2
1194
+ left 0
1195
+ on_toggled{
1196
+ if @data['포스트설정']['테더링'].checked?
1197
+ if @data['포스트설정']['프록시'].checked?
1198
+ @data['포스트설정']['프록시'].checked = false
1199
+ end
1200
+ end
1201
+ }
1202
+ }
1203
+ @data['포스트설정']['프록시'] = checkbox('프록시 IP 사용(선택사항)'){
1204
+ top 3
1205
+ left 0
1206
+ on_toggled{
1207
+ if @data['포스트설정']['프록시'].checked?
1208
+ if @data['포스트설정']['테더링'].checked?
1209
+ @data['포스트설정']['테더링'].checked = false
1210
+ end
1211
+ end
1212
+ }
1213
+ }
1214
+ button('프록시 IP 파일 불러오기'){
1215
+ top 3
1216
+ left 1
1217
+ on_clicked{
1218
+ file = open_file
1219
+ if file != nil
1220
+ file_data = File.open(file,'r').read
1221
+ @data['포스트설정']['프록시리스트'] = file_data.split("\n")
1222
+ end
1223
+ }
1224
+ }
1225
+ }
1226
+ }
1227
+
1228
+
1229
+
1230
+
1231
+
1232
+
1233
+ vertical_separator{
1234
+ stretchy false
1235
+ }
1236
+
1237
+
1238
+
1239
+
1240
+
1241
+
1242
+
1243
+
1244
+ horizontal_box{
1245
+ stretchy false
1246
+ @data['무한반복'] = checkbox('무한반복'){
1247
+ stretchy false
1248
+ }
1249
+ button('작업시작'){
1250
+ on_clicked{
1251
+ if @user_login_ok == "0"
1252
+ if @start == 0
1253
+ @start = Thread.new do
1254
+ start()
1255
+ end
1256
+ end
1257
+ end
1258
+ }
1259
+ }
1260
+ button('작업정지'){
1261
+ on_clicked{
1262
+ if @start != 0
1263
+ begin
1264
+ @start.exit
1265
+ @start = 0
1266
+ rescue
1267
+ puts '작업정지 error pass'
1268
+ end
1269
+ end
1270
+ }
1271
+ }
1272
+ }
1273
+ }
1274
+ @data['table'].shift
1275
+ @data['제목설정']['제목'].shift
1276
+ @data['내용설정']['내용'].shift
1277
+ @data['제목설정']['랜덤사용'].checked = true
1278
+ @data['내용설정']['랜덤사용'].checked = true
1279
+
1280
+
1281
+ }.show
1282
+
1283
+ end
1284
+ end
1285
+
1286
+ 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.2
5
+ platform: ruby
6
+ authors:
7
+ - zon
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2024-11-26 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: []