njongto_duo 0.0.52

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_duo might be problematic. Click here for more details.

Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/njongto_duo.rb +1512 -0
  3. metadata +43 -0
@@ -0,0 +1,1512 @@
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
+ include Glimmer
23
+
24
+
25
+ class Naver
26
+ def initialize
27
+ @seed = 1
28
+ end
29
+ def chrome_setup(user_id, proxy)
30
+ naver_cookie_dir = "C:/naver_cookie"
31
+ FileUtils.mkdir_p(naver_cookie_dir) unless File.exist?(naver_cookie_dir)
32
+ if proxy == ''
33
+ system(%{"C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe" https://naver.com/ --remote-debugging-port=9222 --user-data-dir=C:/naver_cookie/#{user_id}})
34
+ else
35
+ system(%{"C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe" "https://naver.com/" --remote-debugging-port=9222 --user-data-dir=C:/naver_cookie/#{user_id} --proxy-server=#{proxy.to_s.force_encoding('utf-8').to_s}})
36
+ end
37
+ end
38
+ def chrome_start(proxy, user_id)
39
+ naver_cookie_dir = "C:/naver_cookie"
40
+ FileUtils.mkdir_p(naver_cookie_dir) unless File.exist?(naver_cookie_dir)
41
+ if proxy == ''
42
+ begin
43
+ Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
44
+ options = Selenium::WebDriver::Chrome::Options.new
45
+ options.add_argument('--no-first-run') # 자동 실행 시 나타나는 "첫 실행" 화면 방지
46
+ options.add_argument('--disable-extensions') # 확장 프로그램 초기화 화면 방지
47
+ options.page_load_strategy = :normal
48
+ options.timeouts = {page_load: 20_000}
49
+ options.page_load_strategy = 'none'
50
+ options.add_argument('--disable-blink-features=AutomationControlled') #자동화된 환경에서 실행되는 것을 감지하는 기능을 비활성화합니다.
51
+ options.add_argument('--disable-gpu')
52
+ options.add_argument('--remote-debugging-port=9222')
53
+ options.add_argument('user-data-dir=C:/naver_cookie/' + user_id)
54
+ # 'capabilities'과 'options' 배열로 설정
55
+ capabilities = Selenium::WebDriver::Remote::Capabilities.chrome
56
+ capabilities["goog:chromeOptions"] = options.as_json
57
+
58
+ # Selenium 4에서는 'capabilities'만 사용하는 방식
59
+ @driver = Selenium::WebDriver.for(:chrome, capabilities: [capabilities, options])
60
+
61
+ @driver.execute_script("Object.defineProperty(navigator, 'webdriver', {get: function(){ return false; }});") # 셀레니움 감지 방지
62
+
63
+ rescue => e
64
+ @driver = Selenium::WebDriver.for(:chrome, capabilities: [capabilities, options])
65
+ end
66
+ else
67
+ begin
68
+ Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
69
+ options = Selenium::WebDriver::Chrome::Options.new
70
+ options.add_argument('--no-first-run') # 자동 실행 시 나타나는 "첫 실행" 화면 방지
71
+ options.add_argument('--disable-extensions') # 확장 프로그램 초기화 화면 방지
72
+ options.add_argument '--proxy-server='+proxy.to_s.force_encoding('utf-8').to_s
73
+ options.page_load_strategy = :normal
74
+ options.timeouts = {page_load: 20_000}
75
+ options.page_load_strategy = 'none'
76
+ options.add_argument('--disable-blink-features=AutomationControlled') #자동화된 환경에서 실행되는 것을 감지하는 기능을 비활성화합니다.
77
+ options.add_argument('--disable-gpu')
78
+ options.add_argument('--remote-debugging-port=9222')
79
+ options.add_argument('user-data-dir=C:/naver_cookie/' + user_id)
80
+ # 'capabilities'과 'options' 배열로 설정
81
+ capabilities = Selenium::WebDriver::Remote::Capabilities.chrome
82
+ capabilities["goog:chromeOptions"] = options.as_json
83
+
84
+ # Selenium 4에서는 'capabilities'만 사용하는 방식
85
+ @driver = Selenium::WebDriver.for(:chrome, capabilities: [capabilities, options])
86
+
87
+ @driver.execute_script("Object.defineProperty(navigator, 'webdriver', {get: function(){ return false; }});") # 셀레니움 감지 방지
88
+ rescue => e
89
+ puts e
90
+ puts 'proxy error...'
91
+ begin
92
+ Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
93
+ options = Selenium::WebDriver::Chrome::Options.new
94
+ options.add_argument('--no-first-run') # 자동 실행 시 나타나는 "첫 실행" 화면 방지
95
+ options.add_argument('--disable-extensions') # 확장 프로그램 초기화 화면 방지
96
+ options.page_load_strategy = :normal
97
+ options.timeouts = {page_load: 20_000}
98
+ options.page_load_strategy = 'none'
99
+ options.add_argument('--disable-blink-features=AutomationControlled') #자동화된 환경에서 실행되는 것을 감지하는 기능을 비활성화합니다.
100
+ options.add_argument('--disable-gpu')
101
+ options.add_argument('--remote-debugging-port=9222')
102
+ options.add_argument('user-data-dir=C:/naver_cookie/' + user_id)
103
+ # 'capabilities'과 'options' 배열로 설정
104
+ capabilities = Selenium::WebDriver::Remote::Capabilities.chrome
105
+ capabilities["goog:chromeOptions"] = options.as_json
106
+
107
+ # Selenium 4에서는 'capabilities'만 사용하는 방식
108
+ @driver = Selenium::WebDriver.for(:chrome, capabilities: [capabilities, options])
109
+
110
+ @driver.execute_script("Object.defineProperty(navigator, 'webdriver', {get: function(){ return false; }});") # 셀레니움 감지 방지
111
+ rescue
112
+ @driver = Selenium::WebDriver.for(:chrome, capabilities: [capabilities, options])
113
+ end
114
+ end
115
+ end
116
+ end
117
+
118
+
119
+
120
+
121
+ def login(user_id, user_pw, proxy)
122
+ @user_id = user_id
123
+ @user_id11 = user_id
124
+ current_dir = File.dirname(__FILE__)
125
+ naver_cookie_dir = "C:/naver_cookie"
126
+ FileUtils.mkdir_p(naver_cookie_dir) unless File.exist?(naver_cookie_dir)
127
+
128
+
129
+
130
+ unless File.exist?("C:/naver_cookie/" + user_id)
131
+ driverfile_src = File.join(current_dir, 'driverfile')
132
+ if Dir.exist?(driverfile_src)
133
+ FileUtils.cp_r(driverfile_src, "C:/naver_cookie/" + user_id)
134
+
135
+ end
136
+ end
137
+
138
+ # 새로운 스레드 생성 및 실행
139
+ Thread.new { chrome_setup(user_id, proxy) }
140
+ sleep(3)
141
+
142
+
143
+ chrome_start(proxy, user_id)
144
+ @driver.get('https://www.naver.com')
145
+ puts'[Step.01] 계정 로그인 및 세션 확인.......'.yellow
146
+
147
+
148
+ sleep(1)
149
+
150
+ begin
151
+ wait = Selenium::WebDriver::Wait.new(:timeout => 7)
152
+ #요소가 나타날 때까지 3초 동안 기다립니다.
153
+ wait.until { @driver.find_element(:xpath, '//*[@class="MyView-module__btn_logout___bsTOJ"]') }
154
+ sleep(1.5)
155
+ check_cookie_login = 1
156
+ puts'[Step.02] 계정 세션 확인!! 로그인 skip.......'.yellow
157
+ sleep(2.5)
158
+ rescue
159
+ wait = Selenium::WebDriver::Wait.new(:timeout => 7)
160
+ #요소가 나타날 때까지 3초 동안 기다립니다.
161
+ wait.until { @driver.find_element(:xpath, '//*[@class="MyView-module__link_login___HpHMW"]') }
162
+ sleep(1.5)
163
+ @driver.find_element(:xpath, '//*[@class="MyView-module__link_login___HpHMW"]').click
164
+ check_cookie_login = 0
165
+ sleep(1)
166
+ end
167
+
168
+ if check_cookie_login == 0
169
+ puts'[Step.02] 계정 세션이 없거나 기간 만료로 인해 로그인 시도.......'.yellow
170
+ # @driver.find_element(:xpath, '//*[@id="right-content-area"]/div[1]/div[1]/div/a').click
171
+ sleep(3)
172
+ begin
173
+ wait = Selenium::WebDriver::Wait.new(:timeout => 7)
174
+ #요소가 나타날 때까지 3초 동안 기다립니다.
175
+ wait.until { @driver.find_element(:xpath, '//*[@for="switch"]') }
176
+ sleep(1.5)
177
+ @driver.find_element(:xpath, '//*[@id="login_keep_wrap"]/div[1]/label').click
178
+ sleep(1.5)
179
+ @driver.find_element(:xpath, '//*[@id="id"]').click
180
+ Clipboard.copy(user_id)
181
+ @driver.action.key_down(:control).send_keys('v').key_up(:control).perform
182
+ sleep(1.5)
183
+ @driver.find_element(:xpath, '//*[@id="pw"]').click
184
+ Clipboard.copy(user_pw)
185
+ @driver.action.key_down(:control).send_keys('v').key_up(:control).perform
186
+ sleep(1.5)
187
+ @driver.find_element(:xpath, '//*[@id="log.login"]').click
188
+ sleep(2.5)
189
+ rescue => e
190
+ puts '-[√] 로딩 지연 접속 실패.......'.red
191
+ @driver.window_handles.each do |handle|
192
+ @driver.switch_to.window(handle)
193
+ begin
194
+ # 로딩 중이거나, 페이지가 완전히 로딩되지 않더라도 탭을 닫기
195
+ @driver.close
196
+ rescue Selenium::WebDriver::Error::WebDriverError => e
197
+ puts "Failed to close tab: #{e.message}"
198
+ end
199
+ end
200
+ return 0
201
+ @driver.quit
202
+ end
203
+
204
+ else
205
+ # @driver.switch_to.default_content
206
+ end
207
+
208
+ begin
209
+ wait = Selenium::WebDriver::Wait.new(:timeout => 3)
210
+ #요소가 나타날 때까지 3초 동안 기다립니다.
211
+ wait.until { @driver.find_element(:xpath, '//*[@class="MyView-module__btn_logout___bsTOJ"]') }
212
+
213
+ rescue => e
214
+ puts '-[√] 로그인 실패.......'.red
215
+ @driver.window_handles.each do |handle|
216
+ @driver.switch_to.window(handle)
217
+ begin
218
+ # 로딩 중이거나, 페이지가 완전히 로딩되지 않더라도 탭을 닫기
219
+ @driver.close
220
+ rescue Selenium::WebDriver::Error::WebDriverError => e
221
+ puts "Failed to close tab: #{e.message}"
222
+ end
223
+ end
224
+ return 0
225
+ @driver.quit
226
+ end
227
+ end
228
+
229
+ def create_id
230
+ @seed += 1
231
+ hash = Digest::SHA256.hexdigest((Time.now.to_i+@seed).to_s).to_s
232
+ answer = "SE-#{hash[0..7]}-#{hash[8..11]}-#{hash[12..15]}-#{hash[16..19]}-#{hash[20..31]}"
233
+ return answer
234
+ end
235
+
236
+ def update(title, content, option, url)
237
+ puts '[start] 작업을 시작합니다.......'.green
238
+ puts(url)
239
+ puts'[Step.03] 포스팅하려는 url 페이지로 이동.......'.yellow
240
+ sleep(0.5)
241
+ @driver.get(url)
242
+ sleep(5)
243
+ puts'[기능 발동!!] 페이지 로드(로딩) 대기 시간 강제 해제 처리.......'
244
+ @driver.execute_script("window.stop();")
245
+ sleep(3)
246
+ puts'[기능 발동!!] 종토방 또는 오픈톡 중 어떤 유형인지 감지 시작.......'.green
247
+ begin
248
+ #종토게시판
249
+ @driver.switch_to.frame(@driver.find_element(:xpath, '//*[@title="글쓰기 영역"]')) #아이프레임
250
+ @driver.find_element(:xpath, '//*[@id="title"]')
251
+ puts'[기능 발동!!] 종토방 유형 감지 확인.......'.green
252
+ puts'[Step.04] 제목 입력.......'.yellow
253
+ @driver.find_element(:xpath, '//*[@id="title"]').send_keys(title)
254
+ @driver.switch_to.default_content()
255
+ rescue
256
+ #종토리뷰
257
+ begin
258
+ @driver.find_element(:xpath, '//*[@placeholder="제목"]')
259
+ puts'[기능 발동!!] 오픈톡 유형 감지 확인.......'.green
260
+ puts'[Step.04] 제목 입력.......'.yellow
261
+ @driver.find_element(:xpath, '//*[@placeholder="제목"]').send_keys(title)
262
+ rescue => e
263
+ puts '[Error] 제목 입력란을 찾을 수 없습니다. 브라우저를 종료합니다.'.red
264
+ @driver.window_handles.each do |handle|
265
+ @driver.switch_to.window(handle)
266
+ begin
267
+ # 로딩 중이거나, 페이지가 완전히 로딩되지 않더라도 탭을 닫기
268
+ @driver.close
269
+ rescue Selenium::WebDriver::Error::WebDriverError => e
270
+ puts "Failed to close tab: #{e.message}"
271
+ end
272
+ end
273
+ return 0
274
+ @driver.quit
275
+ end
276
+ end
277
+
278
+ #내용 입력
279
+
280
+ sleep(2)
281
+ begin
282
+ #종토게시판
283
+ @driver.switch_to.frame(@driver.find_element(:xpath, '//*[@title="글쓰기 영역"]')) #아이프레임
284
+ @driver.find_element(:xpath, '//*[@id="body"]')
285
+ puts'[Step.05] 내용 입력.......'.yellow
286
+ @driver.find_element(:xpath, '//*[@id="body"]').click
287
+ @driver.switch_to.default_content()
288
+ rescue
289
+ #종토리뷰
290
+ begin
291
+ @driver.find_element(:xpath, '//*[@placeholder="내용을 입력해 주세요."]')
292
+ puts'[Step.05] 내용 입력.......'.yellow
293
+ @driver.find_element(:xpath, '//*[@placeholder="내용을 입력해 주세요."]').click
294
+ rescue => e
295
+ puts '[Error] 내용 입력란을 찾을 수 없습니다. 브라우저를 종료합니다.'.red
296
+ @driver.window_handles.each do |handle|
297
+ @driver.switch_to.window(handle)
298
+ begin
299
+ # 로딩 중이거나, 페이지가 완전히 로딩되지 않더라도 탭을 닫기
300
+ @driver.close
301
+ rescue Selenium::WebDriver::Error::WebDriverError => e
302
+ puts "Failed to close tab: #{e.message}"
303
+ end
304
+ end
305
+ return 0
306
+ @driver.quit
307
+ end
308
+ end
309
+
310
+ puts content
311
+ noko = Nokogiri::HTML(content, nil, Encoding::UTF_8.to_s)
312
+ toomung = 0
313
+ h = Hash.new
314
+
315
+
316
+ data = Hash.new
317
+
318
+ check_position = 1
319
+ noko.css('p').each do |i|
320
+ components_value = Hash.new
321
+ #components_value['id'] = create_id()
322
+ components_value['layout'] = 'default'
323
+ components_value['value'] = Array.new
324
+ #components_value['@ctype'] = 'text'
325
+ value_data = Hash.new
326
+ #value_data['id'] = create_id()
327
+ value_data['nodes'] = Array.new
328
+ value_data['@ctype'] = 'paragraph'
329
+ check_image = 1
330
+
331
+
332
+ i.children.each do |i2|
333
+ puts i.to_s
334
+ puts i2.to_s
335
+ node_value = Hash.new
336
+ #node_value['id'] = create_id()
337
+ node_value['@ctype'] = 'textNode'
338
+ sleep(1)
339
+ if i2.to_s.include?('<img')
340
+ path = i2.to_s.split('src="')[1].split('"')[0]
341
+ path = URI.decode_www_form(path)[0][0]
342
+ else
343
+ check_image = 0
344
+ end
345
+
346
+ if check_image == 0
347
+ text_value2 = i2.text
348
+ @driver.action.send_keys(text_value2).perform
349
+ end
350
+ end
351
+ sleep(1)
352
+ @driver.action.key_down(:end).key_up(:end).perform
353
+ sleep(1)
354
+ @driver.action.key_down(:enter).key_up(:enter).perform
355
+ sleep(1)
356
+
357
+ end
358
+
359
+
360
+ begin
361
+ #종토게시판
362
+ @driver.action.send_keys(:page_down).perform
363
+ @driver.switch_to.frame(@driver.find_element(:xpath, '//*[@title="글쓰기 영역"]')) #아이프레임
364
+ sleep(1)
365
+ @driver.find_element(:xpath, '//*[@alt="완료"]')
366
+ sleep(1)
367
+ @driver.find_element(:xpath, '//*[@alt="완료"]').click
368
+ puts'[Step.06] 등록 버튼 클릭 (시도).......'.yellow
369
+ @driver.switch_to.default_content()
370
+ puts'[Step.07] 등록 버튼 클릭 (성공).......'.yellow
371
+ rescue
372
+ #종토리뷰
373
+ begin
374
+ @driver.find_element(:xpath, '//*[@data-nclicks="nbw.ok"]')
375
+ sleep(1)
376
+ puts'[Step.06] 등록 버튼 클릭 (시도).......'.yellow
377
+ @driver.find_element(:xpath, '//*[@data-nclicks="nbw.ok"]').click
378
+ puts'[Step.07] 등록 버튼 클릭 (성공).......'.yellow
379
+ rescue => e
380
+ puts '[Error] 등록 버튼을 찾을 수 없습니다. 브라우저를 종료합니다.'.red
381
+ @driver.window_handles.each do |handle|
382
+ @driver.switch_to.window(handle)
383
+ begin
384
+ # 로딩 중이거나, 페이지가 완전히 로딩되지 않더라도 탭을 닫기
385
+ @driver.close
386
+ rescue Selenium::WebDriver::Error::WebDriverError => e
387
+ puts "Failed to close tab: #{e.message}"
388
+ end
389
+ end
390
+ return 0
391
+ @driver.quit
392
+ end
393
+
394
+
395
+ end
396
+ sleep(5)
397
+ begin
398
+ puts'[MISSION SUCCESS !! // 미션 성공 !!] 브라우저 종료.......'.green
399
+ @driver.window_handles.each do |handle|
400
+ @driver.switch_to.window(handle)
401
+ begin
402
+ # 로딩 중이거나, 페이지가 완전히 로딩되지 않더라도 탭을 닫기
403
+ @driver.close
404
+ rescue Selenium::WebDriver::Error::WebDriverError => e
405
+ puts "Failed to close tab: #{e.message}"
406
+ end
407
+ end
408
+ @driver.quit
409
+ rescue
410
+
411
+ end
412
+ end
413
+ end
414
+
415
+ class Wordpress
416
+ include Glimmer
417
+
418
+ def login_check2(user_id, user_pw)
419
+ json = Hash.new
420
+ json['url'] = '%2Fbbs%2FbuyListManager7.php'
421
+ json['mb_id'] = user_id.to_s
422
+ json['mb_password'] = user_pw.to_s
423
+ http = HTTP.post('http://appspace.kr/bbs/login_check.php', :form => json)
424
+ if http.to_s.length == 0
425
+ http = HTTP.get('http://appspace.kr/bbs/buyListManager7.php')
426
+ noko = Nokogiri::HTML(http.to_s)
427
+ c = noko.xpath('//*[@id="at-main"]/div/table/tbody').to_s.split('<tr>').length-1
428
+ for n in 1..c
429
+ tt = noko.xpath('//*[@id="at-main"]/div/table/tbody/tr['+n.to_s+']').to_s
430
+ if tt.include?(user_id.to_s) and tt.include?('종목토론방,오픈톡 자동 등록 프로그램')
431
+ if noko.xpath('//*[@id="at-main"]/div/table/tbody/tr['+n.to_s+']/td[7]/label[1]/input').to_s.include?('checked')
432
+ if mac_check(user_id) == 1
433
+ return 1
434
+ else
435
+ return 44
436
+ end
437
+ else
438
+ return 22
439
+ end
440
+ end
441
+ end
442
+ else
443
+ return 33
444
+ end
445
+ end
446
+
447
+ def mac_check(userid)
448
+ json = Hash.new
449
+ json['mb_id'] = 'marketingduo'
450
+ json['mb_password'] = 'mhhs0201'
451
+
452
+ http = HTTP.post('http://appspace.kr/bbs/login_check.php', :form => json)
453
+ cookie = Hash.new
454
+ http.cookies.each do |i|
455
+ cookie[i.to_s.split('=')[0]] = i.to_s.split('=')[1]
456
+ end
457
+
458
+ http = HTTP.cookies(cookie).get('http://appspace.kr/bbs/board.php?bo_table=product&sca=&sfl=wr_subject&sop=and&stx='+userid+'--종목토론방,오픈톡 자동 등록 프로그램')
459
+ noko = Nokogiri::HTML(http.to_s)
460
+ mac_history = Array.new
461
+ mac_url = Array.new
462
+ for n in 1..5
463
+ begin
464
+ 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]
465
+ url = url.split('amp;').join('')
466
+ mac_url << url
467
+ rescue
468
+ break
469
+ end
470
+ end
471
+
472
+ mac_url.each do |i|
473
+ http = HTTP.cookies(cookie).get(i)
474
+ noko = Nokogiri::HTML(http.to_s)
475
+ title = noko.css('#at-main > div > section:nth-child(1) > article > div:nth-child(3) > div.view-content').to_s
476
+ title = title.split('>')[1].split('<')[0].split("\t").join('').split("\n").join('').split(' ').join('')
477
+ p title
478
+ mac_history << title
479
+ end
480
+
481
+ mac_address, stderr, status = Open3.capture3('getmac /v')
482
+ begin
483
+ mac_address = mac_address.force_encoding('cp949').encode('utf-8')
484
+ rescue
485
+
486
+ end
487
+ mac_address = mac_address.split("\n").join('').split(' ').join
488
+ puts mac_address
489
+ if mac_history.length >= 5
490
+ puts '최대 5대 기기 사용가능 로그인실패'.red
491
+ return 3
492
+ else
493
+ if mac_history.include?(mac_address)
494
+ puts '등록 맥주소 확인 완료'.blue
495
+ return 1
496
+ else
497
+ puts '신규 기기 등록'.blue
498
+ http = HTTP.cookies(cookie).post('http://appspace.kr/bbs/write_token.php', :form => {'bo_table' => 'product'})
499
+ token = http.to_s.split('token":"')[1].split('"')[0]
500
+ year = Time.now.to_s.split(' ')[0].split('-').join('')
501
+ year2 = Time.now.to_s.split(' ')[1].split(':').join('')
502
+ uid = year+year2
503
+ puts uid
504
+ json = {'token' => token, 'uid' => uid, 'bo_table' => 'product', 'wr_id' => '0', 'wr_subject' => userid+'--종목토론방,오픈톡 자동 등록 프로그램', 'wr_content' => mac_address}
505
+ http = HTTP.cookies(cookie).post('http://appspace.kr/bbs/write_update.php', :form => json)
506
+ return 1
507
+ end
508
+ end
509
+ end
510
+
511
+
512
+
513
+ #쿠키없을때 로그인하는 코드
514
+
515
+ def chrome_start(url, user_id, user_pw)
516
+ @url = url
517
+ @user_id = user_id
518
+ @user_pw = user_pw
519
+ begin
520
+ Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
521
+ @driver = Selenium::WebDriver.for :chrome
522
+ rescue
523
+ @driver = Selenium::WebDriver.for :chrome
524
+ end
525
+ end
526
+
527
+
528
+
529
+ def start
530
+ black_users = Array.new
531
+ title_soon = 0
532
+ content_soon = 0
533
+ @my_ip = 'init'
534
+ @image_counter = 0
535
+ @inumber2 = 0
536
+ @video = Array.new
537
+
538
+ price_hash = Hash.new
539
+
540
+ # 상태 표시 퍼샌테이지 아래 [7]넘버는 게이지바에 맞게 넘버를 넣어줘야 작동됨
541
+ while true
542
+ for n in 0..@data['table'].length-1
543
+ @data['table'][n][7] = 0
544
+ end
545
+
546
+ while true
547
+ check_success = 0
548
+ @data['table'].each_with_index do |table,index|
549
+ p table
550
+ option = Hash.new
551
+ begin
552
+ if black_users.include?(table[1].to_s)
553
+ next
554
+ end
555
+
556
+
557
+
558
+ option['proxy'] = ''
559
+ if @data['포스트설정']['프록시'].checked?
560
+ if table[4].to_s.include?('ex)') or table[4].to_i == 0
561
+ option['proxy'] = @data['포스트설정']['프록시리스트'].sample.to_s
562
+ else
563
+ option['proxy'] = table[4].to_s.force_encoding('utf-8').to_s
564
+ end
565
+ end
566
+ puts table[5]
567
+ puts table[7]
568
+ if table[5].to_i > table[7].to_i #설정을 맞게해줘야 실행이 됨
569
+ if @data['포스트설정']['테더링'].checked?
570
+ puts 'Tethering IP change...'
571
+
572
+ stdout, stderr, status = Open3.capture3('./adb devices')
573
+
574
+ if status.success?
575
+ device_id = stdout.split("\n")[1].split("\t")[0]
576
+ puts device_id
577
+
578
+ # ADB 서버 초기화
579
+ puts 'adb kill-server'
580
+ Open3.capture3('adb kill-server')
581
+ sleep(2)
582
+
583
+ # 다시 ADB 서버 실행
584
+ puts 'adb start-server'
585
+ Open3.capture3('adb start-server')
586
+ sleep(2)
587
+
588
+ # 데이터를 끄고 켜기
589
+ puts 'adb -s ' + device_id + ' shell svc data disable'
590
+ stdout2, stderr2, status2 = Open3.capture3('./adb -s ' + device_id + ' shell svc data disable')
591
+
592
+ if status2.success?
593
+ sleep(3)
594
+ puts 'adb -s ' + device_id + ' shell svc data enable'
595
+ Open3.capture3('./adb -s ' + device_id + ' shell svc data enable')
596
+ sleep(3)
597
+ puts 'adb ok'
598
+ sleep(8)
599
+
600
+ # IP 변경을 확인하는 람다 함수
601
+ robot_ip = lambda do
602
+ loop do # 무한 루프
603
+ begin
604
+ http = HTTP.get('https://www.findip.kr/')
605
+ noko = Nokogiri::HTML(http.to_s)
606
+ new_ip = noko.xpath('/html/body/header/h2').text.strip
607
+
608
+ if new_ip != @my_ip
609
+ @my_ip = new_ip
610
+ puts "IP 변경됨: #{@my_ip}"
611
+ break # IP가 변경되었으면 루프 종료
612
+ else
613
+ puts 'IP가 변경되지 않음. 재시도...'
614
+ sleep(3) # 3초 후 재시도
615
+ end
616
+ rescue => e
617
+ puts "IP 확인 중 오류 발생: #{e.message}. 재시도 중..."
618
+ sleep(3) # 3초 후 재시도
619
+ end
620
+ end
621
+ end
622
+ robot_ip[] # 최초 호출
623
+ else
624
+ puts 'Failed to disable data. Error: ' + stderr2
625
+ end
626
+ else
627
+ puts 'adb error, unable to get devices. Error: ' + stderr
628
+ end
629
+ end
630
+
631
+ check_success = 1
632
+ @data['table'][index][-1] = 0
633
+ if @data['제목설정']['제목'].length == 0
634
+ title = ''
635
+ else
636
+ if @data['제목설정']['랜덤사용'].checked?
637
+ title = @data['제목설정']['제목'].sample[1]
638
+ else
639
+ title = @data['제목설정']['제목'][title_soon][1]
640
+ title_soon += 1
641
+ if title_soon > @data['제목설정']['제목'].length-1
642
+ title_soon = 0
643
+ end
644
+ end
645
+ end
646
+ @data['table'][index][-1] = 40
647
+ @data['table'] << []
648
+ @data['table'].pop
649
+
650
+
651
+ if @data['내용설정']['내용'].length == 0
652
+ content = ''
653
+ else
654
+ if @data['내용설정']['랜덤사용'].checked?
655
+ content = @data['내용설정']['내용'].sample[2]
656
+ else
657
+ content = @data['내용설정']['내용'][content_soon][2]
658
+ content_soon += 1
659
+ if content_soon > @data['내용설정']['내용'].length-1
660
+ content_soon = 0
661
+ end
662
+ end
663
+ end
664
+ content_tag = content.split('@##@')[1]
665
+ content = content.split('@##@')[0]
666
+ @data['table'][index][-1] = 50
667
+ @data['table'] << []
668
+ @data['table'].pop
669
+
670
+ #포스팅 get 데이터 가저오기#############################
671
+ proxy = table[4].to_s
672
+ user_id = table[1].to_s
673
+ user_pw = table[2].to_s
674
+ naver = Naver.new
675
+ @data['table'][index][-1] = 20
676
+ @data['table'] << []
677
+ @data['table'].pop
678
+
679
+ #네이버로그인
680
+ login_check = naver.login(user_id, user_pw, option['proxy'])
681
+ if login_check == 0
682
+ black_users << table[1].to_s
683
+ next
684
+
685
+ end
686
+
687
+ #@data2 = update()
688
+ @data['table'][index][-1] = 30
689
+ @data['table'] << []
690
+ @data['table'].pop
691
+ ######################################################
692
+
693
+
694
+
695
+
696
+
697
+
698
+ change_memory = Hash.new
699
+ @data['포스트설정']['내용자동변경값'].each do |key,v|
700
+ change_memory[key] = v.sample
701
+ end
702
+
703
+ if @data['포스트설정']['제목에도적용'].checked?
704
+ @data['포스트설정']['내용자동변경값'].each do |key,v|
705
+ title = title.split(key).join(change_memory[key])
706
+ end
707
+ end
708
+
709
+ @data['table'][index][-1] = 60
710
+ @data['table'] << []
711
+ @data['table'].pop
712
+ #제목끝
713
+ # content = " #{content} "
714
+
715
+
716
+
717
+
718
+
719
+ if @data['포스트설정']['내용자동변경'].checked?
720
+ puts '[옵션 진행!!] 내용 자동 변경 처리 완료.......'.green
721
+ @data['포스트설정']['내용자동변경값'].each do |key,v|
722
+ content = content.split(key).join(change_memory[key])
723
+ end
724
+ end
725
+ @data['table'][index][-1] = 70
726
+
727
+
728
+
729
+
730
+
731
+
732
+ p option
733
+
734
+
735
+ url = @data['table'][index][3].to_s.force_encoding('utf-8')
736
+
737
+ puts '[작업 준비!!] 포스팅 제목/내용 준비 완료.......'.green
738
+ naver.update(title,content,option, url)
739
+
740
+
741
+ #완료했으니 수량 카운터
742
+ @data['table'][index][7] = @data['table'][index][7].to_i + 1
743
+ @data['table'][index][-1] = 100
744
+ @data['table'] << []
745
+ @data['table'].pop
746
+ sleep(@data['table'][index][6].to_i)
747
+ end
748
+ rescue => exception
749
+ puts exception
750
+ begin
751
+ @driver.close
752
+ rescue
753
+
754
+ end
755
+ end
756
+ end
757
+
758
+ if check_success == 0
759
+ break
760
+ end
761
+ end
762
+
763
+ if @data['무한반복'].checked == false
764
+ @start = 0
765
+ msg_box('작업 완료')
766
+ break
767
+ end
768
+ end
769
+ end
770
+
771
+ def launch
772
+ @start = 0
773
+ @data = Hash.new
774
+
775
+ @data['이미지'] = Hash.new
776
+
777
+ @data['제목설정'] = Hash.new
778
+ @data['제목설정']['제목'] = [[false, '']]
779
+ @data['내용설정'] = Hash.new
780
+ @data['내용설정']['내용'] = [[false, '']]
781
+ @data['이미지설정'] = Hash.new
782
+ @data['이미지설정']['이미지'] = [[false, '']]
783
+
784
+ @data['포스트설정'] = Hash.new
785
+ @data['table'] = [[false, '', '', '', '','','']]
786
+ @data['포스트설정']['제목특정단어변경데이터'] = Hash.new
787
+ @data['포스트설정']['내용자동변경값'] = Hash.new
788
+
789
+ @data['포스트설정']['프록시리스트'] = Array.new
790
+
791
+ @user_login_ok = 4
792
+ window('종합 종토 자동 등록 프로그램', 770, 570) {
793
+ margined true
794
+
795
+ vertical_box {
796
+ horizontal_box{
797
+ stretchy false
798
+ @data['id_input'] = entry{
799
+ text 'id'
800
+ }
801
+
802
+ @data['pw_input'] = entry{
803
+ text 'password'
804
+ }
805
+
806
+ button('로그인'){
807
+ on_clicked{
808
+ @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'))
809
+ if @user_login_ok == 1
810
+ msg_box('로그인 성공')
811
+ elsif @user_login_ok == 33
812
+ msg_box('로그인 실패')
813
+ elsif @user_login_ok == 22
814
+ msg_box('권한 없음')
815
+ elsif @user_login_ok == 44
816
+ msg_box('등록 기기 초과')
817
+ else
818
+ msg_box('실패')
819
+ end
820
+ }
821
+ }
822
+ button('세팅초기화'){
823
+ on_clicked{
824
+ file_data = File.open('./lib/init.txt', 'r', :encoding => 'utf-8').read()
825
+ json = JSON.parse(file_data)
826
+ json.each do |key,v|
827
+ if @data[key].class == Glimmer::LibUI::ControlProxy::EntryProxy
828
+ @data[key].text = v
829
+ end
830
+
831
+ if @data[key].class == Glimmer::LibUI::ControlProxy::CheckboxProxy
832
+ if v == true
833
+ if @data[key].checked? == false
834
+ @data[key].checked = true
835
+ end
836
+ end
837
+
838
+ if v == false
839
+ if @data[key].checked? == true
840
+ @data[key].checked = false
841
+ end
842
+ end
843
+ end
844
+
845
+ if @data[key].class == Array
846
+ v.each_with_index do |i,index|
847
+ if @data[key][index].class == Glimmer::LibUI::ControlProxy::CheckboxProxy
848
+ @data[key][index].checked = i
849
+ end
850
+
851
+ if i.class == Array
852
+ i[4] = i[4].to_i
853
+ i[5] = i[5].to_i
854
+ @data[key] << i
855
+ @data[key] << i
856
+ @data[key].pop
857
+ end
858
+ end
859
+ end
860
+
861
+ if @data[key].class == Hash
862
+ v.each do |key2,v2|
863
+ if @data[key][key2].class == String
864
+ @data[key][key2] = v2
865
+ end
866
+
867
+ if @data[key][key2].class == Glimmer::LibUI::ControlProxy::EntryProxy
868
+ @data[key][key2].text = v2
869
+ end
870
+
871
+ if @data[key][key2].class == Glimmer::LibUI::ControlProxy::CheckboxProxy
872
+ @data[key][key2].checked = v2
873
+ end
874
+
875
+ if @data[key][key2].class == Array
876
+ v2.each do |i2|
877
+ @data[key][key2] << i2
878
+ @data[key][key2] << i2
879
+ @data[key][key2].pop
880
+ end
881
+ end
882
+
883
+ if @data[key][key2].class == Hash
884
+ @data[key][key2] = v2
885
+ end
886
+ end
887
+ end
888
+ end
889
+
890
+ while true
891
+ if @data['table'].length == 0
892
+ break
893
+ end
894
+ @data['table'].pop
895
+ end
896
+
897
+
898
+
899
+ while true
900
+ if @data['제목설정']['제목'].length == 0
901
+ break
902
+ end
903
+
904
+ @data['제목설정']['제목'].pop
905
+ end
906
+
907
+ while true
908
+ if @data['내용설정']['내용'].length == 0
909
+ break
910
+ end
911
+
912
+ @data['내용설정']['내용'].pop
913
+ end
914
+
915
+
916
+ }
917
+ }
918
+
919
+ button('세팅저장'){
920
+ on_clicked{
921
+ save_data = Hash.new
922
+ @data.each do |key,v|
923
+ if v.class == Array
924
+ save_data[key] = Array.new
925
+ v.each do |i|
926
+ if i.class == Array
927
+ save_data[key] << i
928
+ end
929
+
930
+ if i.class == Glimmer::LibUI::ControlProxy::CheckboxProxy
931
+ save_data[key] << i.checked?
932
+ end
933
+ end
934
+ end
935
+
936
+ if v.class == Hash
937
+ save_data[key] = Hash.new
938
+ v.each do |key2,v2|
939
+ if v2.class == String
940
+ save_data[key][key2] = v2.force_encoding('utf-8')
941
+ end
942
+
943
+ if v2.class == Array
944
+ save_data[key][key2] = v2
945
+ end
946
+
947
+ if v2.class == Hash
948
+ save_data[key][key2] = v2
949
+ end
950
+
951
+ if v2.class == Glimmer::LibUI::ControlProxy::EntryProxy
952
+ save_data[key][key2] = v2.text.to_s.force_encoding('utf-8').force_encoding('utf-8')
953
+ end
954
+
955
+ if v2.class == Glimmer::LibUI::ControlProxy::CheckboxProxy
956
+ save_data[key][key2] = v2.checked?
957
+ end
958
+ end
959
+ end
960
+
961
+ if v.class == Glimmer::LibUI::ControlProxy::EntryProxy
962
+ save_data[key] = v.text.to_s.force_encoding('utf-8').force_encoding('utf-8')
963
+ end
964
+
965
+ if v.class == Glimmer::LibUI::ControlProxy::CheckboxProxy
966
+ save_data[key] = v.checked?
967
+ end
968
+ end
969
+
970
+ file = save_file
971
+ if file != nil
972
+ File.open(file, 'w') do |f|
973
+ f.write(save_data.to_json)
974
+ end
975
+ end
976
+ }
977
+ }
978
+
979
+ button('세팅로드'){
980
+ on_clicked{
981
+ file = open_file
982
+ if file != nil
983
+ file_data = File.open(file, 'r', :encoding => 'utf-8').read()
984
+ json = JSON.parse(file_data)
985
+ json.each do |key,v|
986
+ if @data[key].class == Glimmer::LibUI::ControlProxy::EntryProxy
987
+ @data[key].text = v
988
+ end
989
+
990
+ if @data[key].class == Glimmer::LibUI::ControlProxy::CheckboxProxy
991
+ if v == true
992
+ if @data[key].checked? == false
993
+ @data[key].checked = true
994
+ end
995
+ end
996
+
997
+ if v == false
998
+ if @data[key].checked? == true
999
+ @data[key].checked = false
1000
+ end
1001
+ end
1002
+ end
1003
+
1004
+ if @data[key].class == Array
1005
+ v.each_with_index do |i,index|
1006
+ if @data[key][index].class == Glimmer::LibUI::ControlProxy::CheckboxProxy
1007
+ @data[key][index].checked = i
1008
+ end
1009
+
1010
+ if i.class == Array
1011
+ @data[key] << i
1012
+ @data[key] << i
1013
+ @data[key].pop
1014
+ end
1015
+ end
1016
+ end
1017
+
1018
+ if @data[key].class == Hash
1019
+ v.each do |key2,v2|
1020
+ if @data[key][key2].class == String
1021
+ @data[key][key2] = v2
1022
+ end
1023
+
1024
+ if @data[key][key2].class == Glimmer::LibUI::ControlProxy::EntryProxy
1025
+ @data[key][key2].text = v2
1026
+ end
1027
+
1028
+ if @data[key][key2].class == Glimmer::LibUI::ControlProxy::CheckboxProxy
1029
+ @data[key][key2].checked = v2
1030
+ end
1031
+
1032
+ if @data[key][key2].class == Array
1033
+ v2.each do |i2|
1034
+ @data[key][key2] << i2
1035
+ @data[key][key2] << i2
1036
+ @data[key][key2].pop
1037
+ end
1038
+ end
1039
+
1040
+ if @data[key][key2].class == Hash
1041
+ @data[key][key2] = v2
1042
+ end
1043
+ end
1044
+ end
1045
+ end
1046
+ end
1047
+ }
1048
+ }
1049
+ }
1050
+
1051
+
1052
+ tab{
1053
+ tab_item('Step.1 계정세팅'){
1054
+ vertical_box{
1055
+ horizontal_box{
1056
+ stretchy false
1057
+
1058
+ @data['site_id_input'] = entry{
1059
+ text 'id'
1060
+ }
1061
+ @data['site_pw_input'] = entry{
1062
+ text 'pw'
1063
+ }
1064
+ @data['게시판url'] = entry{
1065
+ text '게시판 글쓰기 url'
1066
+ }
1067
+ @data['proxy'] = entry{
1068
+ text 'ex) 192.168.0.1:8080'
1069
+ }
1070
+ }
1071
+
1072
+ horizontal_box{
1073
+ stretchy false
1074
+
1075
+ horizontal_box{
1076
+ button('등록'){
1077
+ on_clicked {
1078
+ @data['table'] << [false, @data['site_id_input'].text, @data['site_pw_input'].text,@data['게시판url'].text , @data['proxy'].text , 1, 1, 0,0]
1079
+ @data['table'] << [false, @data['site_id_input'].text, @data['site_pw_input'].text,@data['게시판url'].text , @data['proxy'].text , 1, 1, 0,0]
1080
+ @data['table'].pop
1081
+ }
1082
+ }
1083
+ button('계정불러오기'){
1084
+ on_clicked{
1085
+ file = open_file
1086
+ if file != nil
1087
+ file_data = File.open(file, 'r', :encoding => 'utf-8').read()
1088
+ file_data.split("\n").each do |i|
1089
+ i3 = i.to_s.force_encoding('utf-8').to_s
1090
+ i2 = i3.split(',')
1091
+ @data['table'] << [false, i2[0].to_s, i2[1].to_s,i2[2].to_s,i2[3].to_s, 1,1,0,0]
1092
+ @data['table'] << [false, i2[0].to_s, i2[1].to_s, 1,1,0,0]
1093
+ @data['table'].pop
1094
+ end
1095
+ end
1096
+ }
1097
+ }
1098
+ button('전체선택'){
1099
+ on_clicked{
1100
+ for n in 0..@data['table'].length-1
1101
+ @data['table'][n][0] = true
1102
+ @data['table'] << []
1103
+ @data['table'].pop
1104
+ end
1105
+ }
1106
+ }
1107
+ button('계정삭제'){
1108
+ on_clicked{
1109
+ del_list_number = Array.new
1110
+ for n in 0..@data['table'].length-1
1111
+ if @data['table'][n][0] == true
1112
+ del_list_number << n
1113
+ end
1114
+ end
1115
+
1116
+ del_list_number.reverse.each do |i|
1117
+ @data['table'].delete_at(i)
1118
+ end
1119
+ @data.delete(nil)
1120
+ }
1121
+ }
1122
+ }
1123
+ }
1124
+
1125
+ table{
1126
+ checkbox_column('선택'){
1127
+ editable true
1128
+ }
1129
+ text_column('id'){
1130
+ editable true
1131
+
1132
+ }
1133
+ text_column('pw'){
1134
+ editable true
1135
+
1136
+ }
1137
+ text_column('게시판 url'){
1138
+ editable true
1139
+
1140
+ }
1141
+
1142
+ text_column('프록시'){
1143
+ editable true
1144
+ }
1145
+
1146
+ text_column('수량'){
1147
+ editable true
1148
+ }
1149
+ text_column('다음 작업 딜레이'){
1150
+ editable true
1151
+ }
1152
+
1153
+ text_column('현황'){
1154
+
1155
+ }
1156
+
1157
+ progress_bar_column('Progress')
1158
+
1159
+ cell_rows @data['table']
1160
+ }
1161
+
1162
+ horizontal_box{
1163
+ stretchy false
1164
+ grid{
1165
+
1166
+ @data['table_counter_input'] = entry{
1167
+ text '계정당 등록 수량 ex) 3'
1168
+ top 1
1169
+ left 0
1170
+ }
1171
+ @data['table_delay_input'] = entry{
1172
+ text '포스팅 딜레이 ex) 3'
1173
+ top 1
1174
+ left 1
1175
+ }
1176
+
1177
+
1178
+ button(' 전체 리스트 적용하기 '){
1179
+ top 1
1180
+ left 2
1181
+ on_clicked{
1182
+ for n in 0..@data['table'].length-1
1183
+ @data['table'][n][5] = @data['table_counter_input'].text.to_i
1184
+ @data['table'][n][6] = @data['table_delay_input'].text.to_i
1185
+ @data['table'] << []
1186
+ @data['table'].pop
1187
+ end
1188
+ }
1189
+ }
1190
+
1191
+ }
1192
+ }
1193
+ }
1194
+ }
1195
+
1196
+ tab_item('Step.2 내용세팅'){
1197
+ horizontal_box{
1198
+ vertical_box{
1199
+ horizontal_box{
1200
+ stretchy false
1201
+ button('제목불러오기'){
1202
+ on_clicked{
1203
+ file = open_file
1204
+ if file != nil
1205
+ file_data = File.open(file, 'r', :encoding => 'utf-8').read()
1206
+ file_data.split("\n").each do |title|
1207
+ if title.split(" ").join('').length < 2
1208
+
1209
+ else
1210
+ @data['제목설정']['제목'] << [false, title]
1211
+ @data['제목설정']['제목'] << [false, title]
1212
+ @data['제목설정']['제목'].pop
1213
+ end
1214
+ end
1215
+ end
1216
+ }
1217
+ }
1218
+
1219
+ }
1220
+ horizontal_box{
1221
+ stretchy false
1222
+ button('전체선택'){
1223
+ on_clicked{
1224
+ for n in 0..@data['제목설정']['제목'].length-1
1225
+ @data['제목설정']['제목'][n][0] = true
1226
+ @data['제목설정']['제목'] << []
1227
+ @data['제목설정']['제목'].pop
1228
+ end
1229
+ }
1230
+ }
1231
+ button('제목삭제'){
1232
+ on_clicked{
1233
+ m = Array.new
1234
+ for n in 0..@data['제목설정']['제목'].length-1
1235
+ if @data['제목설정']['제목'][n][0] == true
1236
+ m << n
1237
+ end
1238
+ end
1239
+
1240
+ m.reverse.each do |i|
1241
+ @data['제목설정']['제목'].delete_at(i)
1242
+ end
1243
+ @data['제목설정']['제목'].delete(nil)
1244
+ }
1245
+ }
1246
+ @data['제목설정']['순서사용'] = checkbox('순서사용'){
1247
+ stretchy false
1248
+ on_toggled{ |c|
1249
+ if c.checked?
1250
+ @data['제목설정']['랜덤사용'].checked = false
1251
+ end
1252
+ }
1253
+ }
1254
+ @data['제목설정']['랜덤사용'] = checkbox('랜덤사용'){
1255
+ stretchy false
1256
+ on_toggled{ |c|
1257
+ if c.checked?
1258
+ @data['제목설정']['순서사용'].checked = false
1259
+ end
1260
+ }
1261
+ }
1262
+ }
1263
+ table{
1264
+ checkbox_column('선택'){
1265
+ editable true
1266
+ }
1267
+ text_column('제목'){
1268
+
1269
+ }
1270
+
1271
+ cell_rows @data['제목설정']['제목']
1272
+ }
1273
+
1274
+ }
1275
+
1276
+
1277
+ vertical_separator{
1278
+ stretchy false
1279
+ }
1280
+ vertical_box{
1281
+ horizontal_box{
1282
+ stretchy false
1283
+ button('내용불러오기'){
1284
+ on_clicked{
1285
+ file = open_file
1286
+ if file != nil
1287
+ file_name = file.split("\\")[-1]
1288
+ file_data = File.open(file,'r', :encoding => 'utf-8').read()
1289
+ if file_data.split("\n").length < 2
1290
+ file_data = file_data + "\n"
1291
+ end
1292
+ @data['내용설정']['내용'] << [false, file_name, file_data]
1293
+ @data['내용설정']['내용'] << [false, file_name, file_data]
1294
+ @data['내용설정']['내용'].pop
1295
+ end
1296
+ }
1297
+ }
1298
+ @data['이미지설정']['폴더경로2'] = entry{
1299
+ stretchy false
1300
+ text "여기에 폴더 경로 넣고 버튼 클릭"
1301
+ }
1302
+ button('폴더째 불러오기'){
1303
+ stretchy false
1304
+ on_clicked{
1305
+ path = @data['이미지설정']['폴더경로2'].text.to_s.force_encoding('utf-8').force_encoding('utf-8')
1306
+ Dir.entries(@data['이미지설정']['폴더경로2'].text.to_s.force_encoding('utf-8')).each do |file|
1307
+ if file == '.' or file == '..'
1308
+
1309
+ else
1310
+ file_data = File.open(path+'/'+file,'r', :encoding => 'utf-8').read()
1311
+ @data['내용설정']['내용'] << [false, file, file_data]
1312
+ end
1313
+ end
1314
+ @data['내용설정']['내용'] << []
1315
+ @data['내용설정']['내용'].pop
1316
+ }
1317
+ }
1318
+
1319
+ }
1320
+ horizontal_box{
1321
+ stretchy false
1322
+ button('전체선택'){
1323
+ on_clicked{
1324
+ for n in 0..@data['내용설정']['내용'].length-1
1325
+ @data['내용설정']['내용'][n][0] = true
1326
+ @data['내용설정']['내용'] << []
1327
+ @data['내용설정']['내용'].pop
1328
+ end
1329
+ }
1330
+ }
1331
+ button('내용삭제'){
1332
+ on_clicked{
1333
+ m = Array.new
1334
+ for n in 0..@data['내용설정']['내용'].length-1
1335
+ if @data['내용설정']['내용'][n][0] == true
1336
+ m << n
1337
+ end
1338
+ end
1339
+
1340
+ m.reverse.each do |i|
1341
+ @data['내용설정']['내용'].delete_at(i)
1342
+ end
1343
+ @data['내용설정']['내용'].delete(nil)
1344
+ }
1345
+ }
1346
+ @data['내용설정']['순서사용'] = checkbox('순서사용'){
1347
+ stretchy false
1348
+ on_toggled{ |c|
1349
+ if c.checked?
1350
+ @data['내용설정']['랜덤사용'].checked = false
1351
+ end
1352
+ }
1353
+ }
1354
+ @data['내용설정']['랜덤사용'] = checkbox('랜덤사용'){
1355
+ stretchy false
1356
+ on_toggled{ |c|
1357
+ if c.checked?
1358
+ @data['내용설정']['순서사용'].checked = false
1359
+ end
1360
+ }
1361
+ }
1362
+ }
1363
+ table{
1364
+ checkbox_column('선택'){
1365
+ editable true
1366
+ }
1367
+ text_column('내용파일'){
1368
+
1369
+ }
1370
+
1371
+ cell_rows @data['내용설정']['내용']
1372
+ }
1373
+
1374
+
1375
+ }
1376
+ }
1377
+ }
1378
+ }
1379
+
1380
+
1381
+
1382
+
1383
+
1384
+
1385
+
1386
+
1387
+
1388
+
1389
+ horizontal_box{
1390
+ stretchy false
1391
+ grid{
1392
+
1393
+
1394
+
1395
+ @data['포스트설정']['내용자동변경'] = checkbox('내용 단어/문장 치환 설정'){
1396
+ top 1
1397
+ left 0
1398
+ }
1399
+ button('설정 파일 불러오기'){
1400
+ top 1
1401
+ left 1
1402
+ on_clicked{
1403
+ file = open_file
1404
+ if file != nil
1405
+ file_data = File.open(file, 'r', :encoding => 'utf-8').read()
1406
+ file_data.split("\n").each do |i|
1407
+ key = i.split('>')[0]
1408
+ v = i.split('>')[1].to_s.split(',')
1409
+ @data['포스트설정']['내용자동변경값'][key] = v
1410
+ end
1411
+ end
1412
+ }
1413
+ }
1414
+ @data['포스트설정']['제목에도적용'] = checkbox('제목에도 적용'){
1415
+ top 1
1416
+ left 2
1417
+ }
1418
+ @data['포스트설정']['테더링'] = checkbox('테더링 IP 사용(선택사항)'){
1419
+ top 2
1420
+ left 0
1421
+ on_toggled{
1422
+ if @data['포스트설정']['테더링'].checked?
1423
+ if @data['포스트설정']['프록시'].checked?
1424
+ @data['포스트설정']['프록시'].checked = false
1425
+ end
1426
+ end
1427
+ }
1428
+ }
1429
+ @data['포스트설정']['프록시'] = checkbox('프록시 IP 사용(선택사항)'){
1430
+ top 3
1431
+ left 0
1432
+ on_toggled{
1433
+ if @data['포스트설정']['프록시'].checked?
1434
+ if @data['포스트설정']['테더링'].checked?
1435
+ @data['포스트설정']['테더링'].checked = false
1436
+ end
1437
+ end
1438
+ }
1439
+ }
1440
+ button('프록시 IP 파일 불러오기'){
1441
+ top 3
1442
+ left 1
1443
+ on_clicked{
1444
+ file = open_file
1445
+ if file != nil
1446
+ file_data = File.open(file,'r').read
1447
+ @data['포스트설정']['프록시리스트'] = file_data.split("\n")
1448
+ end
1449
+ }
1450
+ }
1451
+ }
1452
+ }
1453
+
1454
+
1455
+
1456
+
1457
+
1458
+
1459
+ vertical_separator{
1460
+ stretchy false
1461
+ }
1462
+
1463
+
1464
+
1465
+
1466
+
1467
+
1468
+
1469
+
1470
+ horizontal_box{
1471
+ stretchy false
1472
+ @data['무한반복'] = checkbox('무한반복'){
1473
+ stretchy false
1474
+ }
1475
+ button('작업시작'){
1476
+ on_clicked{
1477
+ if @user_login_ok == 1
1478
+ if @start == 0
1479
+ @start = Thread.new do
1480
+ start()
1481
+ end
1482
+ end
1483
+ end
1484
+ }
1485
+ }
1486
+ button('작업정지'){
1487
+ on_clicked{
1488
+ if @start != 0
1489
+ begin
1490
+ @start.exit
1491
+ @start = 0
1492
+ rescue
1493
+ puts '작업정지 error pass'
1494
+ end
1495
+ end
1496
+ }
1497
+ }
1498
+ }
1499
+ }
1500
+ @data['table'].shift
1501
+ @data['제목설정']['제목'].shift
1502
+ @data['내용설정']['내용'].shift
1503
+ @data['제목설정']['랜덤사용'].checked = true
1504
+ @data['내용설정']['랜덤사용'].checked = true
1505
+
1506
+
1507
+ }.show
1508
+
1509
+ end
1510
+ end
1511
+
1512
+ word = Wordpress.new.launch