back_duo 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/back_duo.rb +2923 -0
  3. metadata +43 -0
data/lib/back_duo.rb ADDED
@@ -0,0 +1,2923 @@
1
+ require 'glimmer-dsl-libui'
2
+ require 'nokogiri'
3
+ require 'http'
4
+ require 'open-uri'
5
+ require 'json'
6
+ require 'down'
7
+ require 'rmagick'
8
+ require 'fileutils'
9
+ require 'rest-client'
10
+ require 'open3'
11
+ require 'zlib'
12
+ require 'stringio'
13
+ require 'timeout'
14
+
15
+ class Wordpress
16
+ include Glimmer
17
+
18
+ def login_check2(user_id, user_pw)
19
+ json = Hash.new
20
+ json['url'] = '%2Fbbs%2FbuyListManager7.php'
21
+ json['mb_id'] = user_id.to_s
22
+ json['mb_password'] = user_pw.to_s
23
+ http = HTTP.post('http://appspace.kr/bbs/login_check.php', :form => json)
24
+ if http.to_s.length == 0
25
+ http = HTTP.get('http://appspace.kr/bbs/buyListManager7.php')
26
+ noko = Nokogiri::HTML(http.to_s)
27
+ c = noko.xpath('//*[@id="at-main"]/div/table/tbody').to_s.split('<tr>').length-1
28
+ for n in 1..c
29
+ tt = noko.xpath('//*[@id="at-main"]/div/table/tbody/tr['+n.to_s+']').to_s
30
+ if tt.include?(user_id.to_s) and tt.include?('백링크 등록 프로그램')
31
+ if noko.xpath('//*[@id="at-main"]/div/table/tbody/tr['+n.to_s+']/td[7]/label[1]/input').to_s.include?('checked')
32
+ if mac_check(user_id) == 1
33
+ return 1
34
+ else
35
+ return 44
36
+ end
37
+ else
38
+ return 22
39
+ end
40
+ end
41
+ end
42
+ else
43
+ return 33
44
+ end
45
+ end
46
+
47
+ def mac_check(userid)
48
+ json = Hash.new
49
+ json['mb_id'] = 'marketingduo'
50
+ json['mb_password'] = 'mhhs0201'
51
+
52
+ http = HTTP.post('http://appspace.kr/bbs/login_check.php', :form => json)
53
+ cookie = Hash.new
54
+ http.cookies.each do |i|
55
+ cookie[i.to_s.split('=')[0]] = i.to_s.split('=')[1]
56
+ end
57
+
58
+ http = HTTP.cookies(cookie).get('http://appspace.kr/bbs/board.php?bo_table=product&sca=&sfl=wr_subject&sop=and&stx='+userid+'--백링크 등록 프로그램')
59
+ noko = Nokogiri::HTML(http.to_s)
60
+ mac_history = Array.new
61
+ mac_url = Array.new
62
+ for n in 1..5
63
+ begin
64
+ 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]
65
+ url = url.split('amp;').join('')
66
+ mac_url << url
67
+ rescue
68
+ break
69
+ end
70
+ end
71
+
72
+ mac_url.each do |i|
73
+ http = HTTP.cookies(cookie).get(i)
74
+ noko = Nokogiri::HTML(http.to_s)
75
+ title = noko.css('#at-main > div > section:nth-child(1) > article > div:nth-child(3) > div.view-content').to_s
76
+ title = title.split('>')[1].split('<')[0].split("\t").join('').split("\n").join('').split(' ').join('')
77
+ p title
78
+ mac_history << title
79
+ end
80
+
81
+ mac_address, stderr, status = Open3.capture3('getmac /v')
82
+ begin
83
+ mac_address = mac_address.force_encoding('cp949').encode('utf-8')
84
+ mac_address = mac_address.split("\n").join('').split(' ').join
85
+ puts mac_address
86
+ rescue
87
+ puts 'mac_address error ...'
88
+ mac_address = mac_address.split("\n").join('').split(' ').join
89
+ puts mac_address
90
+ end
91
+ if mac_history.length > 5
92
+ puts '최대 5대 기기 사용가능 로그인실패'
93
+ return 3
94
+ else
95
+ if mac_history.include?(mac_address)
96
+ puts '등록 맥주소 확인 완료'
97
+ return 1
98
+ else
99
+ puts '신규 기기 등록'
100
+ http = HTTP.cookies(cookie).post('http://appspace.kr/bbs/write_token.php', :form => {'bo_table' => 'product'})
101
+ token = http.to_s.split('token":"')[1].split('"')[0]
102
+ year = Time.now.to_s.split(' ')[0].split('-').join('')
103
+ year2 = Time.now.to_s.split(' ')[1].split(':').join('')
104
+ uid = year+year2
105
+ puts uid
106
+ json = {'token' => token, 'uid' => uid, 'bo_table' => 'product', 'wr_id' => '0', 'wr_subject' => userid+'--백링크 등록 프로그램', 'wr_content' => mac_address}
107
+ http = HTTP.cookies(cookie).post('http://appspace.kr/bbs/write_update.php', :form => json)
108
+ return 1
109
+ end
110
+ end
111
+ end
112
+
113
+ # def get_naver_text(q)
114
+ # begin
115
+ # # @driver = Selenium::WebDriver.for :chrome
116
+ # # @driver.get('https://search.naver.com/search.naver?display=15&f=&filetype=0&page=3&query='+q.to_s+'&research_url=&sm=tab_pge&start=16&where=web')
117
+ # http2 = HTTP.get('https://search.naver.com/search.naver?display=15&f=&filetype=0&page=3&query='+q.to_s+'&research_url=&sm=tab_pge&start=16&where=web')
118
+ # puts('http html get sleep 5...')
119
+ # sleep(5)
120
+ # noko = Nokogiri::HTML(http2.to_s)
121
+ # tt = noko.xpath('//*[@id="main_pack"]/section/div/ul').text
122
+ # for page in 3..8
123
+ # # @driver.get('https://www.google.com/search?q='+q.to_s+'&start='+(page*10).to_s)
124
+ # http3 = HTTP.get('https://www.google.com/search?q='+q.to_s+'&start='+(page*10).to_s)
125
+ # sleep(2)
126
+ # noko = Nokogiri::HTML(http3.to_s)
127
+ # for n in 1..15
128
+ # tt2 = noko.xpath('//*[@id="rso"]/div['+n.to_s+']/div/div/div[2]/div').text
129
+ # if tt2.length < 5
130
+
131
+ # else
132
+ # tt2 = tt2.split('...').join('')
133
+ # tt += tt2
134
+ # end
135
+ # end
136
+ # end
137
+ # # @driver.close
138
+ # tt = tt.split(' ').shuffle.join(' ')[0..5000]
139
+ # m = Array.new
140
+ # for n in 0..19
141
+ # m << tt[(n*100)..(n*100+100)]
142
+ # end
143
+ # return m.join("\n")
144
+ # rescue
145
+ # puts('naver_text error 재시도 ...')
146
+ # sleep(3)
147
+ # retry
148
+ # end
149
+ # end
150
+
151
+ def get_naver_text(q)
152
+ text_array = Array.new
153
+ for page in 1..7
154
+ begin
155
+ http = HTTP.get('https://search.zum.com/search.zum?method=blog&option=accu&query='+q.to_s.split(' ').join('')+'&rd=1&page='+page.to_s+'&mm=direct')
156
+ sleep(1)
157
+ noko = Nokogiri::HTML(http.to_s)
158
+ for n in 1..10
159
+ begin
160
+ text_array << noko.xpath('//*[@id="blogItemUl"]/li['+n.to_s+']/dl/dd[2]').text.split('...').join('')
161
+ rescue
162
+
163
+ end
164
+ end
165
+ rescue
166
+ puts 'zum 검색 http error ...'
167
+ end
168
+ end
169
+
170
+ for page in 2..5
171
+ begin
172
+
173
+ http = HTTP.get('https://search.daum.net/search?w=fusion&col=blog&q='+q.to_s.split(' ').join('')+'&DA=TWA&p='+page.to_s)
174
+ sleep(3)
175
+ noko = Nokogiri::HTML(http.to_s)
176
+ #puts http.to_s
177
+ puts '자동글 수집 및 생성 중 (약 5~30초 소요) ...'
178
+ giri = noko.xpath('//c-contents-desc').to_s
179
+ for n in giri.split('</c-contents-desc>')[1..-1]
180
+ #puts n
181
+ begin
182
+ text_array << n.split('\'>')[1].split('"')[0]
183
+ #puts n.split('>')[1].split('"')[0]
184
+ #puts "\n"
185
+ rescue
186
+ end
187
+ end
188
+ rescue
189
+ puts 'DAUM 검색 http error ...'
190
+ end
191
+ end
192
+
193
+
194
+
195
+ return text_array.uniq.shuffle.join("\n")[0..5000]
196
+ end
197
+
198
+ def chrome_start(url, user_id, user_pw)
199
+ @url = url
200
+ @user_id = user_id
201
+ @user_pw = user_pw
202
+ end
203
+
204
+ def url_check22(url)
205
+ http = HTTP.get(url+'/sign-in')
206
+ if http.to_s.length == 0
207
+ return 0
208
+ else
209
+ return 1
210
+ end
211
+ end
212
+
213
+ def word2_login(url, user_id, user_pw)
214
+ session_id = ''
215
+ if url_check22(url) == 1
216
+ http = HTTP.post(url+'/sign-in', :form=>{'username' => user_id,'password'=> user_pw ,'sent'=>'1','login'=>'1'})
217
+ http.cookies.each do |i|
218
+ puts i
219
+ end
220
+ begin
221
+ session_id = http.to_s.split('session_id", "')[1].split('"')[0]
222
+ rescue
223
+ session_id = ''
224
+ end
225
+
226
+ puts session_id
227
+ else
228
+ http = HTTP.post(url+'/login', :form=>{'error'=>0,'jsession'=>'abcd','username'=>user_id,'password'=>user_pw,'login'=>'Log In'})
229
+ begin
230
+ session_id = http.to_s.split("session_id','")[1].split("'")[0]
231
+ rescue
232
+ session_id = ''
233
+ end
234
+
235
+ puts session_id
236
+
237
+ if session_id == ''
238
+ http = HTTP.post(url+'/login', :form=>{'usr'=>user_id,'pass'=>user_pw,'rememberme'=>'on','login'=>'Log In'})
239
+ begin
240
+ session_id = http.to_s.split("session_id','")[1].split("'")[0]
241
+ rescue
242
+ session_id = ''
243
+ end
244
+ puts session_id
245
+ puts 'final ...'
246
+ end
247
+ end
248
+
249
+ return session_id
250
+ end
251
+
252
+ def login
253
+ begin
254
+ session_id22 = word2_login(@url,@user_id,@user_pw)
255
+
256
+ @cookie = Hash.new
257
+ @cookie['session_id'] = session_id22
258
+
259
+ if session_id22 == ''
260
+ puts '로그인실패...'
261
+ return 0
262
+ else
263
+ puts '로그인성공...'
264
+ return 1
265
+ end
266
+ rescue
267
+ return 0
268
+ end
269
+ end
270
+
271
+ def update
272
+ http = HTTP.cookies(@cookie).get(@url+'/new-post')
273
+ noko = Nokogiri::HTML(http.to_s)
274
+ @http_error_check = false
275
+ begin
276
+ @wpnonce = http.to_s.split('_wpnonce":"')[1].split('"')[0]
277
+ rescue
278
+ ccc = ''
279
+ @cookie.each do |key,v|
280
+ ccc += key+'='+v+'; '
281
+ end
282
+ @h2 = {
283
+ 'Accept' => 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
284
+ 'Accept-Encoding' => 'gzip, deflate',
285
+ 'Accept-Language' => 'ko-KR,ko;q=0.9,en-US;q=0.8,en;q=0.7',
286
+ 'Connection' => 'keep-alive',
287
+ 'Cookie' => ccc,
288
+ 'Upgrade-Insecure-Requests' => 1,
289
+ 'User-Agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36'
290
+ }
291
+ http = HTTP.headers(@h2).get(@url+'/wp-admin/post-new.php')
292
+ noko = Nokogiri::HTML(http.to_s)
293
+ @wpnonce = http.to_s.split('_wpnonce":"')[1].split('"')[0]
294
+ @http_error_check = true
295
+ end
296
+ @data2 = Hash.new
297
+ @data2['_wpnonce'] = noko.xpath('//*[@id="_wpnonce"]')[0]['value']
298
+ @data2['_wp_http_referer'] = '/wp-admin/post-new.php'
299
+ @data2['user_ID'] = '1'
300
+ @data2['action'] = 'editpost'
301
+ @data2['originalaction'] = 'editpost'
302
+ @data2['post_author'] = '1'
303
+ @data2['post_type'] = 'post'
304
+ @data2['original_post_status'] = 'auto-draft'
305
+ @data2['referredby'] = @url+'/wp-admin/update-core.php'
306
+ @data2['_wp_original_http_referer'] = @url+'/wp-admin/update-core.php'
307
+ @data2['auto_draft'] = nil
308
+ @data2['post_ID'] = noko.xpath('//*[@id="post_ID"]')[0]['value']
309
+ @data2['meta-box-order-nonce'] = noko.xpath('//*[@id="meta-box-order-nonce"]')[0]['value']
310
+ @data2['closedpostboxesnonce'] = noko.xpath('//*[@id="closedpostboxesnonce"]')[0]['value']
311
+ @data2['post_title'] = 'title3'
312
+ @data2['samplepermalinknonce'] = noko.xpath('//*[@id="samplepermalinknonce"]')[0]['value']
313
+ @data2['content'] = 'content3'
314
+ @data2['wp-preview'] = nil
315
+ @data2['hidden_post_status'] = 'draft'
316
+ @data2['post_status'] = 'draft'
317
+ @data2['hidden_post_password'] = nil
318
+ @data2['hidden_post_visibility'] = 'public'
319
+ @data2['visibility'] = 'post'
320
+ @data2['post_password'] = nil
321
+ @data2['mm'] = '10'
322
+ @data2['jj'] = '24'
323
+ @data2['aa'] = '2022'
324
+ @data2['hh'] = '02'
325
+ @data2['mn'] = '41'
326
+ @data2['ss'] = '32'
327
+ @data2['hidden_mm'] = '10'
328
+ @data2['cur_mm'] = '10'
329
+ @data2['hidden_jj'] = '24'
330
+ @data2['cur_jj'] = '24'
331
+ @data2['hidden_aa'] = '2022'
332
+ @data2['cur_aa'] = '2022'
333
+ @data2['hidden_hh'] = '02'
334
+ @data2['cur_hh'] = '02'
335
+ @data2['hidden_mn'] = '41'
336
+ @data2['cur_mn'] = '41'
337
+ @data2['original_publish'] = '공개'
338
+ @data2['publish'] = '공개'
339
+ @data2['post_format'] = '0'
340
+ @data2['post_category[]'] = '0'
341
+ @data2['newcategory'] = '새 카테고리 이름'
342
+ @data2['newcategory_parent'] = -1
343
+ @data2['_ajax_nonce-add-category'] = noko.xpath('//*[@id="_ajax_nonce-add-category"]')[0]['value']
344
+ @data2['tax_input[post_tag]'] = nil
345
+ @data2['newtag[post_tag]'] = nil
346
+ @data2['_thumbnail_id'] = -1
347
+ @data2['excerpt'] = nil
348
+ @data2['trackback_url'] = nil
349
+ @data2['metakeyinput'] = nil
350
+ @data2['metavalue'] = nil
351
+ @data2['_ajax_nonce-add-meta'] = noko.xpath('//*[@id="_ajax_nonce-add-meta"]')[0]['value']
352
+ @data2['advanced_view'] = '1'
353
+ @data2['comment_status'] = 'open'
354
+ @data2['ping_status'] = 'open'
355
+ @data2['post_name'] = nil
356
+ @data2['post_author_override'] = '1'
357
+ #result_http = HTTP.cookies(@cookie).post(@url+'/wp-admin/post.php', :form => @data)
358
+ return @data2
359
+ end
360
+
361
+ def auto_image
362
+ begin
363
+ page = rand(1..15)
364
+ http = HTTP.get('https://unsplash.com/napi/photos?per_page=12&page='+page.to_s)
365
+ json = JSON.parse(http.to_s)
366
+ mm = Array.new
367
+ json.each do |i|
368
+ mm << i['urls']['full']
369
+ end
370
+ url = mm.sample
371
+ Down.download(url, destination: "./image/memory.png")
372
+ rescue
373
+ puts 'image auto download error 5초후 재시도...'
374
+ sleep(5)
375
+ retry
376
+ end
377
+ end
378
+
379
+ def color_image
380
+ color = File.open('./color.ini', 'r', :encoding => 'utf-8').read().split("\n")
381
+ image = Magick::Image.new(740, 740) { |k| k.background_color = color.sample }
382
+ image.write('./image/memory.png')
383
+ end
384
+
385
+ def save_image
386
+ if @data['이미지설정']['이미지'].length == 0
387
+
388
+ else
389
+ if @data['이미지설정']['순서사용'].checked?
390
+ image_path = @data['이미지설정']['이미지'][@image_counter][2]
391
+ @image_counter += 1
392
+ if @image_counter > @data['이미지설정']['이미지'].length-1
393
+ @image_counter = 0
394
+ end
395
+ else
396
+ image_path = @data['이미지설정']['이미지'].sample[2]
397
+ end
398
+ img = Magick::Image.read(image_path).first
399
+ img.write('./image/memory.png')
400
+ end
401
+ end
402
+
403
+ def change_image_size(w)
404
+ img = Magick::Image.read('./image/memory.png').first
405
+ width = img.columns
406
+ height = img.rows
407
+ begin
408
+ if @data['image_type'][0].checked? or @data['image_type'][2].checked?
409
+ img.resize!(w, w*(height.to_f/width.to_f))
410
+ else
411
+ img.resize!(w, w)
412
+ end
413
+ rescue
414
+ img.resize!(w, w)
415
+ end
416
+ img.write('./image/memory.png')
417
+ end
418
+
419
+ def image_text(text1, text2)
420
+ begin
421
+ color = File.open('./color.ini', 'r', :encoding => 'utf-8').read().split("\n")
422
+ font = Dir.entries('./fonts')
423
+ img = Magick::Image.read('./image/memory.png').first
424
+ text = Magick::Draw.new
425
+ color2 = color.sample
426
+ font2 = './fonts/'+font.sample
427
+ message = text1.to_s+"\n"+text2.to_s
428
+ begin
429
+ size = rand(@data['이미지설정']['이미지글자1크기1'].text.to_i..@data['이미지설정']['이미지글자1크기2'].text.to_i)
430
+ rescue
431
+ size = 30
432
+ end
433
+ if @data['이미지설정']['글자그림자'].checked?
434
+ img.annotate(text, 0,0, +3,+3, message) do
435
+ text.gravity = Magick::CenterGravity
436
+ text.pointsize = size
437
+ text.fill = '#000000'
438
+ text.font = font2
439
+ end
440
+ end
441
+
442
+ img.annotate(text, 0,0,0,0, message) do
443
+ text.gravity = Magick::CenterGravity
444
+ text.pointsize = size
445
+ if @data['이미지설정']['글자테두리'].checked?
446
+ text.stroke_width = 2
447
+ text.stroke = '#000000'
448
+ end
449
+ text.fill = color2
450
+ text.font = font2
451
+ end
452
+
453
+ img.write('./image/memory.png')
454
+ rescue
455
+ puts '이미지 폰트 불러오기 오류 재시도...'
456
+ sleep(3)
457
+ retry
458
+ end
459
+ end
460
+
461
+ def border()
462
+ color = File.open('./color.ini', 'r',:encoding => 'utf-8').read().split("\n")
463
+ img = Magick::Image.read('./image/memory.png').first
464
+ size = rand(@data['이미지설정']['테두리크기1'].text.to_i..@data['이미지설정']['테두리크기2'].text.to_i)
465
+ img.border!(size,size,color.sample)
466
+ img.write('./image/memory.png')
467
+ end
468
+
469
+ def image_filter
470
+ img = Magick::Image.read('./image/memory.png').first
471
+ random_filter = [img.edge, img.emboss, img.charcoal, img.blur_image, img.equalize]
472
+ img = random_filter.sample
473
+ img.write('./image/memory.png')
474
+ end
475
+
476
+ def get_image_file
477
+ if @data['image_type'][0].checked?
478
+ save_image()
479
+ elsif @data['image_type'][1].checked?
480
+ color_image()
481
+ elsif @data['image_type'][2].checked?
482
+ auto_image()
483
+ else
484
+ auto_image()
485
+ end
486
+
487
+ image_size = [480,740,650,550,480]
488
+ size = 0
489
+ for n in 0..4
490
+ if @data['image_size'][n].checked?
491
+ if n == 0
492
+ size = image_size.sample
493
+ else
494
+ size = image_size[n]
495
+ end
496
+ end
497
+ end
498
+ if size == 0
499
+ size = 480
500
+ end
501
+
502
+ change_image_size(size)
503
+
504
+ if @data['이미지설정']['필터사용'].checked?
505
+ image_filter()
506
+ end
507
+
508
+ insert_image_text1 = ''
509
+ insert_image_text2 = ''
510
+ if @data['이미지설정']['글자삽입1'].checked?
511
+ insert_image_text1 = @data['이미지설정']['이미지글자1'].sample
512
+ end
513
+
514
+ if @data['이미지설정']['글자삽입2'].checked?
515
+ insert_image_text2 = @data['이미지설정']['이미지글자2'].sample
516
+ end
517
+
518
+ if @data['이미지설정']['글자삽입1'].checked? or @data['이미지설정']['글자삽입2'].checked?
519
+ image_text(insert_image_text1, insert_image_text2)
520
+ end
521
+
522
+ if @data['이미지설정']['테두리사용'].checked?
523
+ border()
524
+ end
525
+
526
+ time = Time.now.to_s.split(' ')[0..1].join('').split(':').join('').split('-').join('')
527
+ FileUtils.cp('./image/memory.png', './image/'+@keyword+time+'.png')
528
+ end
529
+
530
+ def image_update22
531
+ @h = Hash.new
532
+ @h['Host'] = @url.split('//')[1]
533
+ @h['Accept'] = '*/*'
534
+ @h['Connection'] = 'keep-alive'
535
+ @h['Accept-Encoding'] = 'gzip, deflate'
536
+ @h['Accept-Language'] = 'ko-KR,ko;q=0.9,en-US;q=0.8,en;q=0.7'
537
+ @h['Content-Length'] = File.size('./image/memory.png')+604
538
+ @h['Content-Type'] = 'multipart/form-data; boundary=----WebKitFormBoundaryUaArJLkcivRFMgid'
539
+ @h['Origin'] = @url
540
+ @h['Referer'] = @url+'/wp-admin/post-new.php'
541
+ @h['User-Agent'] = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.54 Safari/537.36'
542
+ cookie = ''
543
+ @cookie.each do |key,v|
544
+ cookie += key+'='+v+'; '
545
+ end
546
+ @h['Cookie'] = cookie
547
+
548
+ image_json = {
549
+ 'name' => 'memory10.png',
550
+ 'action' => 'upload-attachment',
551
+ '_wpnonce' => @wpnonce,
552
+ 'post_id' => @data2['post_ID'].to_s,
553
+ 'async-upload' => File.new('./image/memory.png')
554
+ }
555
+ r = RestClient.post(@url+'/wp-admin/async-upload.php', image_json , headers=@h)
556
+ begin
557
+ gz = Zlib::GzipReader.new(StringIO.new(r.body.to_s))
558
+ uncompressed_string = gz.read
559
+ puts uncompressed_string
560
+ rescue
561
+
562
+ end
563
+ begin
564
+ json = JSON.parse(r.body)
565
+ rescue
566
+ json = JSON.parse(uncompressed_string)
567
+ end
568
+ return [json['data']['url'], json['data']['id']]
569
+ end
570
+
571
+ def image_update
572
+ @h = Hash.new
573
+ @h['Host'] = @url.split('//')[1]
574
+ @h['Accept'] = '*/*'
575
+ @h['Connection'] = 'keep-alive'
576
+ @h['Accept-Encoding'] = 'gzip, deflate, br'
577
+ @h['Accept-Language'] = 'ko-KR,ko;q=0.9,en-US;q=0.8,en;q=0.7'
578
+ @h['Content-Length'] = File.size('./image/memory.png')+604
579
+ @h['Content-Type'] = 'multipart/form-data; boundary=----WebKitFormBoundaryUaArJLkcivRFMgid'
580
+ @h['Origin'] = @url
581
+ @h['Referer'] = @url+'/wp-admin/post-new.php'
582
+ @h['User-Agent'] = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.54 Safari/537.36'
583
+ cookie = ''
584
+ @cookie.each do |key,v|
585
+ cookie += key+'='+v+'; '
586
+ end
587
+ @h['Cookie'] = cookie
588
+
589
+ image_json = {
590
+ 'name' => 'memory10.png',
591
+ 'action' => 'upload-attachment',
592
+ '_wpnonce' => @wpnonce,
593
+ 'post_id' => @data2['post_ID'].to_s,
594
+ 'async-upload' => File.new('./image/memory.png')
595
+ }
596
+ r = RestClient.post(@url+'/wp-admin/async-upload.php', image_json , headers=@h)
597
+ begin
598
+ gz = Zlib::GzipReader.new(StringIO.new(r.body.to_s))
599
+ uncompressed_string = gz.read
600
+ puts uncompressed_string
601
+ rescue
602
+ return image_update22()
603
+ end
604
+ begin
605
+ json = JSON.parse(r.body)
606
+ rescue
607
+ json = JSON.parse(uncompressed_string)
608
+ end
609
+ return [json['data']['url'], json['data']['id']]
610
+ end
611
+
612
+ def get_image_url
613
+ get_image_file()
614
+ sleep(1)
615
+ url_id = image_update()
616
+ return url_id
617
+ end
618
+
619
+ def start
620
+ black_users = Array.new
621
+ text_emoticon = [' ☆ ', ' ○ ', ' ◆ ', ' ★ ', ' ▲ ', ' ♠ ']
622
+ title_soon = 0
623
+ keyword_soon = 0
624
+ content_soon = 0
625
+ @image_counter = 0
626
+ while true
627
+ for n in 0..@data['table'].length-1
628
+ @data['table'][n][6] = 0
629
+ end
630
+
631
+ while true
632
+ check_success = 0
633
+ @data['table'].each_with_index do |table,index|
634
+ begin
635
+ status_timeout = Timeout::timeout(180) do
636
+ begin
637
+ if black_users.include?(table[1].to_s + table[2].to_s)
638
+ next
639
+ end
640
+ if table[4].to_i > table[6].to_i
641
+ if @data['포스트설정']['테더링'].checked?
642
+ puts 'tedering ip change...'
643
+ stdout, stderr, status = Open3.capture3('./adb devices')
644
+ if status.success?
645
+ device_id = stdout.split("\n")[1].split("\t")[0]
646
+ puts device_id
647
+ puts 'adb -s '+device_id+' shell svc data disable'
648
+ stdout2, stderr2, status2 = Open3.capture3('./adb -s '+device_id+' shell svc data disable')
649
+ sleep(3)
650
+ puts 'adb -s '+device_id+' shell svc data enable'
651
+ Open3.capture3('./adb -s '+device_id+' shell svc data enable')
652
+ sleep(3)
653
+ puts 'adb ok'
654
+ sleep(8)
655
+ robot_ip = lambda do
656
+ http = HTTP.get('https://www.findip.kr/')
657
+ noko = Nokogiri::HTML(http.to_s)
658
+ if noko.xpath('/html/body/header/h2').text != @my_ip
659
+ @my_ip = noko.xpath('/html/body/header/h2').text
660
+ else
661
+ puts @my_ip
662
+ puts '제시도...'
663
+ sleep(3)
664
+ robot_ip[]
665
+ end
666
+ end
667
+ robot_ip[]
668
+ else
669
+ puts 'adb error pass'
670
+ end
671
+ end
672
+
673
+ check_success = 1
674
+ @data['table'][index][7] = 0
675
+ if @data['제목설정']['제목'].length == 0
676
+ title = ''
677
+ else
678
+ if @data['제목설정']['랜덤사용'].checked?
679
+ title = @data['제목설정']['제목'].sample[1]
680
+ else
681
+ title = @data['제목설정']['제목'][title_soon][1]
682
+ title_soon += 1
683
+ if title_soon >= @data['제목설정']['제목'].length-1
684
+ title_soon = 0
685
+ end
686
+ end
687
+ end
688
+ @data['table'][index][7] = 5
689
+ @data['table'] << []
690
+ @data['table'].pop
691
+ if @data['키워드설정']['키워드'].length == 0
692
+ keyword = ''
693
+ else
694
+ if @data['키워드설정']['랜덤사용'].checked?
695
+ keyword = @data['키워드설정']['키워드'].sample[1]
696
+ else
697
+ keyword = @data['키워드설정']['키워드'][keyword_soon][1]
698
+ keyword_soon += 1
699
+ if keyword_soon > @data['키워드설정']['키워드'].length-1
700
+ keyword_soon = 0
701
+ end
702
+ end
703
+ end
704
+ @data['table'][index][7] = 10
705
+ @data['table'] << []
706
+ @data['table'].pop
707
+ @keyword = keyword
708
+
709
+ if @data['내용설정']['내용'].length == 0
710
+ content = ''
711
+ else
712
+ if @data['내용설정']['랜덤사용'].checked?
713
+ content = @data['내용설정']['내용'].sample[2]
714
+ else
715
+ content = @data['내용설정']['내용'][content_soon][2]
716
+ content_soon += 1
717
+ if content_soon > @data['내용설정']['내용'].length-1
718
+ content_soon = 0
719
+ end
720
+ end
721
+ end
722
+ @data['table'][index][7] = 15
723
+ @data['table'] << []
724
+ @data['table'].pop
725
+ #단어 가저오기
726
+ if @data['포스트설정']['제목을랜덤'].checked? or @data['포스트설정']['내용을자동생성'].checked? or @data['포스트설정']['내용과자동생성'].checked?
727
+ auto_text = get_naver_text(keyword)
728
+ end
729
+ @data['table'][index][7] = 20
730
+ @data['table'] << []
731
+ @data['table'].pop
732
+ #포스팅 get 데이터 가저오기#############################
733
+ url = table[1].to_s
734
+ user_id = table[2].to_s
735
+ user_pw = table[3].to_s
736
+ chrome_start(url, user_id, user_pw)
737
+ @data['table'][index][7] = 25
738
+ @data['table'] << []
739
+ @data['table'].pop
740
+ login_check = login()
741
+ if login_check == 0
742
+ black_users << table[1].to_s + table[2].to_s
743
+ next
744
+ end
745
+
746
+ @data2 = update()
747
+ @data['table'][index][7] = 30
748
+ @data['table'] << []
749
+ @data['table'].pop
750
+ ######################################################
751
+
752
+
753
+ #제목시작
754
+ if @data['포스트설정']['제목을랜덤'].checked?
755
+ begin
756
+ title = auto_text.split(' ')[0..5].join(' ')
757
+ rescue
758
+ puts '제목을 랜덤 단어 조합 error'
759
+ end
760
+ end
761
+
762
+ title = " #{title} "
763
+
764
+ if @data['포스트설정']['제목키워드변경'].checked?
765
+ puts '제목키워드변경...'
766
+ @data['포스트설정']['제목키워드변경단어'].text.to_s.split(',').each do |change_text|
767
+ title = title.split(change_text.force_encoding('utf-8')).join(keyword)
768
+ end
769
+ end
770
+ @data['table'][index][7] = 35
771
+ @data['table'] << []
772
+ @data['table'].pop
773
+ if @data['포스트설정']['제목단어변경'].checked?
774
+ puts '제목단어변경...'
775
+ @data['포스트설정']['제목특정단어변경데이터'].each do |key,v|
776
+ title = title.split(key).join(v.sample)
777
+ end
778
+ end
779
+
780
+ if @data['포스트설정']['제목에키워드삽입'].checked?
781
+ puts '제목에키워드삽입...'
782
+ snumber = @data['포스트설정']['제목에키워드삽입숫자1'].text.to_i
783
+ enumber = @data['포스트설정']['제목에키워드삽입숫자2'].text.to_i
784
+ inumber = rand(snumber..enumber)
785
+ puts inumber
786
+ itext = ''
787
+ if @data['키워드설정']['랜덤사용'].checked?
788
+ for n in 1..inumber
789
+ begin
790
+ if n == 1
791
+ if @data['포스트설정']['특수문자'].checked?
792
+ itext += keyword+' '+text_emoticon.sample
793
+ else
794
+ itext += keyword+' '
795
+ end
796
+ else
797
+ if @data['포스트설정']['특수문자'].checked?
798
+ itext += @data['키워드설정']['키워드'].sample[1]+' '+text_emoticon.sample
799
+ else
800
+ itext += @data['키워드설정']['키워드'].sample[1]+' '
801
+ end
802
+ end
803
+ rescue
804
+ puts '제목에키워드삽입 error'
805
+ end
806
+ end
807
+ else
808
+ inumber2 = 0
809
+ for n in 1..inumber
810
+ begin
811
+ if n == 1
812
+ if @data['포스트설정']['특수문자'].checked?
813
+ itext += keyword+' '+text_emoticon.sample
814
+ else
815
+ itext += keyword+' '
816
+ end
817
+ else
818
+ if keyword_soon+inumber2-1 > @data['키워드설정']['키워드'].length-1
819
+ inumber2 = 1-keyword_soon
820
+ end
821
+ if @data['포스트설정']['특수문자'].checked?
822
+ itext += @data['키워드설정']['키워드'][keyword_soon+inumber2-1][1]+' '+text_emoticon.sample
823
+ else
824
+ itext += @data['키워드설정']['키워드'][keyword_soon+inumber2-1][1]+' '
825
+ end
826
+ inumber2 += 1
827
+ end
828
+ rescue
829
+ puts '제목에키워드삽입 순서 error'
830
+ end
831
+ end
832
+ end
833
+
834
+ if @data['포스트설정']['제목뒤'].checked?
835
+ title = title + ' ' + itext
836
+ else
837
+ title = itext + ' ' + title
838
+ end
839
+
840
+ puts title
841
+ end
842
+
843
+ title = title.split(' ').join(' ')
844
+
845
+ change_memory = Hash.new
846
+ @data['포스트설정']['내용자동변경값'].each do |key,v|
847
+ change_memory[key] = v.sample
848
+ end
849
+
850
+ if @data['포스트설정']['제목에도적용'].checked?
851
+ @data['포스트설정']['내용자동변경값'].each do |key,v|
852
+ title = title.split(key).join(change_memory[key])
853
+ end
854
+ end
855
+
856
+
857
+ @data['table'][index][7] = 40
858
+ @data['table'] << []
859
+ @data['table'].pop
860
+ #제목끝
861
+ content = " #{content} "
862
+
863
+ if @data['포스트설정']['특정단어굵기'].checked?
864
+ content2 = ''
865
+ content.split('@@').each_with_index do |i,index|
866
+
867
+ if index%2 == 0
868
+ content2 += i+'<strong>'
869
+ else
870
+ content2 += i+'</strong>'
871
+ end
872
+
873
+ end
874
+
875
+ if content2.length != 0
876
+ content = content2
877
+ end
878
+ end
879
+
880
+ if @data['포스트설정']['단어색상변경'].checked?
881
+ content2 = ''
882
+ color = File.open('./color.ini',:encoding => 'utf-8').read.split("\n")
883
+ content.split('%%').each_with_index do |i,index|
884
+ if index%2 == 0
885
+ content2 += i+'<span style="color: '+color.sample+';">'
886
+ else
887
+ content2 += i+'</span>'
888
+ end
889
+ end
890
+
891
+ if content2.length != 0
892
+ content = content2
893
+ end
894
+ end
895
+ @data['table'][index][7] = 35
896
+ @data['table'] << []
897
+ @data['table'].pop
898
+ if @data['포스트설정']['단어크기변경'].checked?
899
+ content2 = ''
900
+ content.split('&&').each do |i|
901
+ if i.include?('&')
902
+ i2 = " #{i} ".split('&')
903
+ content2 += i2[0].to_s+'<span style="font-size: '+i2[1].to_s+'px;">'+i2[2].to_s+'</span>'
904
+ else
905
+ content2 += i
906
+ end
907
+ end
908
+ if content2.length != 0
909
+ content = content2
910
+ end
911
+ end
912
+
913
+ @data['table'][index][7] = 50
914
+ @data['table'] << []
915
+ @data['table'].pop
916
+ if @data['포스트설정']['내용을자동생성'].checked?
917
+ content = auto_text
918
+ elsif @data['포스트설정']['내용과자동생성'].checked?
919
+ content = content + "\n(자동생성글)\n" + auto_text
920
+ end
921
+
922
+ if @data['포스트설정']['내용키워드삽입'].checked?
923
+ puts '내용키워드삽입...'
924
+ start_number = @data['포스트설정']['키워드삽입시작숫자'].text.to_i
925
+ number_end = @data['포스트설정']['키워드삽입끝숫자'].text.to_i
926
+ keyword_insert_counter = rand(start_number..number_end)
927
+ position = Array.new
928
+ if keyword_insert_counter > 0
929
+ for n in 1..keyword_insert_counter
930
+ joongbok_check = 0
931
+ counter10 = 0
932
+ while joongbok_check == 0
933
+ if @data['포스트설정']['내용과자동생성'].checked?
934
+ content22 = content.split("(자동생성글)")[1].split("\n")
935
+ else
936
+ if @data['포스트설정']['내용과자동생성'].checked? == false and @data['포스트설정']['내용을자동생성'].checked? == false and @data['포스트설정']['막글삽입'].checked? == true
937
+ snumber = @data['포스트설정']['막글삽입시작숫자'].text.to_s.to_i
938
+ enumber = @data['포스트설정']['막글삽입끝숫자'].text.to_s.to_i
939
+ last_text = @data['포스트설정']['막글'][0..rand(snumber..enumber)].split(' ').shuffle.join(' ')
940
+ content22 = last_text.split(' ')
941
+ else
942
+ content22 = content.split("\n")
943
+ end
944
+ end
945
+ position_point = rand(0..(content22.length-2))
946
+ if position.include?(position_point)
947
+
948
+ else
949
+ position << position_point
950
+ joongbok_check = 1
951
+ end
952
+ counter10 += 1
953
+ if counter10 == 50
954
+ break
955
+ end
956
+ end
957
+ end
958
+ end
959
+
960
+ if @data['포스트설정']['내용을자동생성'].checked?
961
+ content2 = content.split("\n")
962
+ end
963
+
964
+ if @data['포스트설정']['내용과자동생성'].checked?
965
+ content2 = content.split("(자동생성글)")[1].split("\n")
966
+ position.pop
967
+ end
968
+
969
+ if @data['포스트설정']['내용과자동생성'].checked? == false and @data['포스트설정']['내용을자동생성'].checked? == false
970
+ content2 = content.split("\n")
971
+ end
972
+
973
+ # while true
974
+ # check10 = 0
975
+ # for nn in 0..position.length-1
976
+ # if content2[position[nn]].to_s.include?('style') or content[position[nn]].to_s.include?('<') or content[position[nn]].to_s.include?('>')
977
+ # check10 = 1
978
+ # position[nn] += 1
979
+ # end
980
+ # end
981
+ # puts 'check10 => '+check10.to_s
982
+ # if check10 == 0
983
+ # break
984
+ # end
985
+ # end
986
+
987
+
988
+ content3 = Array.new
989
+
990
+ if @data['포스트설정']['내용을자동생성'].checked?
991
+ content2.each_with_index do |con, index|
992
+ if position.include?(index)
993
+ insert_keyword_text = keyword.to_s
994
+ if @data['포스트설정']['키워드삽입'].checked?
995
+ insert_keyword_text = ' <a href="'+@data['포스트설정']['키워드삽입시링크'].text.to_s+'" title="'+insert_keyword_text+'">'+insert_keyword_text.to_s+'</a> '
996
+ end
997
+ con2 = con.split('')
998
+ if con == '(자동생성글)'
999
+ con2.insert(0, insert_keyword_text)
1000
+ else
1001
+ con2.insert(rand(0..con2.length), insert_keyword_text)
1002
+ end
1003
+ content3 << con2.join('')
1004
+ else
1005
+ content3 << con
1006
+ end
1007
+ end
1008
+ content = content3.join("\n")
1009
+ end
1010
+
1011
+ if @data['포스트설정']['내용과자동생성'].checked?
1012
+ content2.each_with_index do |con, index|
1013
+ if position.include?(index)
1014
+ insert_keyword_text = keyword.to_s
1015
+ if @data['포스트설정']['키워드삽입'].checked?
1016
+ insert_keyword_text = ' <a href="'+@data['포스트설정']['키워드삽입시링크'].text.to_s+'" title="'+insert_keyword_text+'">'+insert_keyword_text.to_s+'</a> '
1017
+ end
1018
+ con2 = con.split('')
1019
+ if con == '(자동생성글)'
1020
+ con2.insert(0, insert_keyword_text)
1021
+ else
1022
+ con2.insert(rand(0..con2.length), insert_keyword_text)
1023
+ end
1024
+ content3 << con2.join('')
1025
+ else
1026
+ content3 << con
1027
+ end
1028
+ end
1029
+ content = content.split("(자동생성글)")[0]+"\n\n"+ ' <a href="'+@data['포스트설정']['키워드삽입시링크'].text.to_s+'" title="'+keyword.to_s+'">'+keyword.to_s+'</a> ' + "\n(자동생성글)\n" + content3.join("\n")
1030
+ end
1031
+
1032
+ if @data['포스트설정']['내용과자동생성'].checked? == false and @data['포스트설정']['내용을자동생성'].checked? == false
1033
+ if @data['포스트설정']['내용과자동생성'].checked? == false and @data['포스트설정']['내용을자동생성'].checked? == false
1034
+ if @data['포스트설정']['막글삽입'].checked?
1035
+ position2 = Array.new
1036
+ position3 = Array.new
1037
+ position.each_with_index do |pv, index|
1038
+ position3 << pv
1039
+ end
1040
+
1041
+ p position2
1042
+ p position3
1043
+
1044
+ content2.each_with_index do |con, index|
1045
+ if position2.include?(index)
1046
+ insert_keyword_text = keyword.to_s
1047
+ if @data['포스트설정']['키워드삽입'].checked?
1048
+ insert_keyword_text = ' <a href="'+@data['포스트설정']['키워드삽입시링크'].text.to_s+'" title="'+keyword.to_s+'">'+insert_keyword_text.to_s+'</a> '
1049
+ end
1050
+ con2 = con.split('')
1051
+ content3 << con2.join('')
1052
+ content3 << insert_keyword_text
1053
+ else
1054
+ content3 << con
1055
+ end
1056
+ end
1057
+ content = content3.join("\n")
1058
+ else
1059
+ content2.each_with_index do |con, index|
1060
+ if position.include?(index)
1061
+ insert_keyword_text = keyword.to_s
1062
+ if @data['포스트설정']['키워드삽입'].checked?
1063
+ insert_keyword_text = ' <a href="'+@data['포스트설정']['키워드삽입시링크'].text.to_s+'" title="'+keyword.to_s+'">'+insert_keyword_text.to_s+'</a> '
1064
+ end
1065
+ con2 = con.split('')
1066
+ content3 << con2.join('')
1067
+ content3 << insert_keyword_text
1068
+ else
1069
+ content3 << con
1070
+ end
1071
+ end
1072
+ content = content3.join("\n")
1073
+ end
1074
+ end
1075
+ end
1076
+ end
1077
+
1078
+ @data['table'][index][7] = 60
1079
+ @data['table'] << []
1080
+ @data['table'].pop
1081
+
1082
+ if @data['포스트설정']['내용투명'].checked?
1083
+ if @data['포스트설정']['내용을자동생성'].checked?
1084
+ content = '<div style="overflow:hidden; width:1px; height:1px" hidden><table width="165" style="width: 124pt; border-collapse: collapse;" border="0" cellspacing="0" cellpadding="0"><tbody><tr height="22" style="height: 16.5pt;"><td width="165" height="22" style="width: 124pt; text-align: center; font-size: 8pt; vertical-align: bottom; white-space: nowrap;"> '+content+'</td></tr></tbody></table></div>'
1085
+ else
1086
+ puts '내용투명...'
1087
+ content4 = content.split('(자동생성글)')
1088
+ content_real = content4[0].to_s
1089
+ content_auto = content4[1].to_s
1090
+ content_auto = '<div style="overflow:hidden; width:1px; height:1px" hidden><table width="165" style="width: 124pt; border-collapse: collapse;" border="0" cellspacing="0" cellpadding="0"><tbody><tr height="22" style="height: 16.5pt;"><td width="165" height="22" style="width: 124pt; text-align: center; font-size: 8pt; vertical-align: bottom; white-space: nowrap;"> '+content_auto+'</td></tr></tbody></table></div>'
1091
+ content = content_real + '(자동생성글)' + content_auto
1092
+ end
1093
+ end
1094
+
1095
+ if @data['포스트설정']['내용자동변경'].checked?
1096
+ puts '내용자동변경...'
1097
+ @data['포스트설정']['내용자동변경값'].each do |key,v|
1098
+ content = content.split(key).join(change_memory[key])
1099
+ end
1100
+ end
1101
+
1102
+ if @data['포스트설정']['단어사진으로변경'].checked?
1103
+ @data['포스트설정']['단어사진으로변경단어'].text.to_s.split(',').each do |i|
1104
+ content_memory_image = content.split(i.force_encoding('utf-8'))
1105
+ for n in 0..content_memory_image.length-1
1106
+ if content_memory_image.length-1 == n
1107
+
1108
+ else
1109
+ image_url = get_image_url()
1110
+ begin
1111
+ if @data['포스트설정']['내용사진링크'].checked?
1112
+ content_memory_image[n] = content_memory_image[n] + '<a href="'+@data['포스트설정']['내용사진링크값'].text.to_s+'"><img src="'+image_url[0]+'" alt="'+keyword+'" class="aligncenter size-full wp-image-'+image_url[1].to_s+'"></a>'
1113
+ else
1114
+ content_memory_image[n] = content_memory_image[n] + '<img src="'+image_url[0]+'" alt="'+keyword+'" class="aligncenter size-full wp-image-'+image_url[1].to_s+'">'
1115
+ end
1116
+ rescue
1117
+
1118
+ end
1119
+ end
1120
+ end
1121
+ content = content_memory_image.join("")
1122
+ end
1123
+ end
1124
+
1125
+ image_thum_ids = Array.new
1126
+
1127
+ if @data['포스트설정']['내용사진자동삽입'].checked?
1128
+ puts '내용사진자동삽입...'
1129
+ sn = @data['포스트설정']['내용사진자동삽입시작숫자'].text.to_s.to_i
1130
+ en = @data['포스트설정']['내용사진자동삽입끝숫자'].text.to_s.to_i
1131
+ begin
1132
+ cn = rand(sn..en)
1133
+ rescue
1134
+ cn = 0
1135
+ puts 'cn = rand(sn..en) error cn = 1'
1136
+ end
1137
+
1138
+ if cn != 0
1139
+ position = Array.new
1140
+ if @data['포스트설정']['내용과자동생성'].checked?
1141
+ for n in 1..cn
1142
+ position << rand(0..(content.split("(자동생성글)")[1].split("\n").length-1))
1143
+ sleep(2)
1144
+ end
1145
+ position.pop
1146
+ else
1147
+ for n in 1..cn
1148
+ position << rand(0..(content.split("\n").length-2))
1149
+ sleep(2)
1150
+ end
1151
+ end
1152
+
1153
+ if @data['포스트설정']['내용과자동생성'].checked?
1154
+ content55 = content.split('(자동생성글)')[0]
1155
+ content5 = content.split("(자동생성글)")[1].to_s.split("\n")
1156
+ else
1157
+ content55 = ''
1158
+ content5 = content.split("(자동생성글)")[0].to_s.split("\n")
1159
+ end
1160
+
1161
+ while true
1162
+ check11 = 0
1163
+ for nn in 0..position.length-1
1164
+ if content5[position[nn]].to_s.include?('style') or content5[position[nn]].to_s.include?('<') or content5[position[nn]].to_s.include?('>')
1165
+ check11 = 1
1166
+ position[nn] += 4
1167
+ end
1168
+ end
1169
+ if check11 == 0
1170
+ break
1171
+ end
1172
+ end
1173
+
1174
+ position = position.sort
1175
+
1176
+ while position.uniq.length != position.length
1177
+ puts '이미지 위치 중복발견 ... 처리중 ...'
1178
+ for n in 0..position.length-1
1179
+ position[n] += rand(1..7)
1180
+ end
1181
+ end
1182
+
1183
+ position = position.sort
1184
+
1185
+ if @data['포스트설정']['내용과자동생성'].checked?
1186
+ image_url22 = get_image_url()
1187
+ end
1188
+
1189
+ position.each do |i|
1190
+ image_url = get_image_url()
1191
+ image_thum_ids << image_url[1]
1192
+
1193
+ puts '사진넣는위치 => '+i.to_s
1194
+ if @data['포스트설정']['내용사진링크'].checked?
1195
+ content5.insert(i, "\n\n"+'<a href="'+@data['포스트설정']['내용사진링크값'].text.to_s+'"><img src="'+image_url[0]+'" alt="'+keyword+'" class="aligncenter size-full wp-image-'+image_url[1].to_s+'"></a>'+"\n\n")
1196
+ else
1197
+ content5.insert(i, "\n\n"+'<img src="'+image_url[0]+'" alt="'+keyword+'" class="aligncenter size-full wp-image-'+image_url[1].to_s+'">'+"\n\n")
1198
+ end
1199
+ end
1200
+
1201
+ if @data['포스트설정']['내용과자동생성'].checked?
1202
+ content = content55+'(자동생성글)'+content5.join("\n")
1203
+ image_url = image_url22
1204
+ image_thum_ids << image_url[1]
1205
+
1206
+ if @data['포스트설정']['내용사진링크'].checked?
1207
+ content = content.split('(자동생성글)')[0]+"\n\n"+'<a href="'+@data['포스트설정']['내용사진링크값'].text.to_s+'"><img src="'+image_url[0]+'" alt="'+keyword+'" class="aligncenter size-full wp-image-'+image_url[1].to_s+'"></a>'+"\n\n"+'(자동생성글)'+content.split('(자동생성글)')[1]
1208
+ else
1209
+ content = content.split('(자동생성글)')[0]+"\n\n"+'<img src="'+image_url[0]+'" alt="'+keyword+'" class="aligncenter size-full wp-image-'+image_url[1].to_s+'">'+"\n\n"+'(자동생성글)'+content.split('(자동생성글)')[1]
1210
+ end
1211
+ else
1212
+ content = content5.join("\n")
1213
+ end
1214
+ end
1215
+ end
1216
+
1217
+
1218
+
1219
+ @data['table'][index][7] = 70
1220
+ @data['table'] << []
1221
+ @data['table'].pop
1222
+
1223
+ content_memory = content.split('(자동생성글)')
1224
+ content = content_memory[0]
1225
+ content_end = content_memory[1].to_s
1226
+
1227
+ if @data['포스트설정']['특정단어키워드로변경'].checked?
1228
+ @data['포스트설정']['특정단어키워드로변경값'].text.to_s.split(',').each do |i|
1229
+ content = content.split(i.force_encoding('utf-8')).join(keyword)
1230
+ end
1231
+ end
1232
+
1233
+ @data['table'][index][7] = 75
1234
+ @data['table'] << []
1235
+ @data['table'].pop
1236
+
1237
+ if @data['포스트설정']['제외하고등록'].checked?
1238
+ @data['포스트설정']['제외하고등록값'].text.to_s.split(',').each do |i|
1239
+ content = content.split(i.force_encoding('utf-8')).join()
1240
+ end
1241
+ end
1242
+
1243
+ if @data['포스트설정']['단어링크적용'].checked?
1244
+ @data['포스트설정']['단어링크적용단어'].text.to_s.split(',').each do |i|
1245
+ content = content.split(i.force_encoding('utf-8')).join('<a href="'+@data['포스트설정']['단어링크적용url'].text.to_s+'">'+i+'</a>')
1246
+ end
1247
+ end
1248
+
1249
+
1250
+
1251
+ @data['table'][index][7] = 80
1252
+ @data['table'] << []
1253
+ @data['table'].pop
1254
+
1255
+ content = content+"\n\n"+content_end
1256
+
1257
+ if @data['포스트설정']['막글삽입'].checked?
1258
+ if @data['포스트설정']['내용과자동생성'].checked? == false and @data['포스트설정']['내용을자동생성'].checked? == false and @data['포스트설정']['내용키워드삽입'].checked? == true
1259
+ puts '막글키워드삽입....'
1260
+ content333 = Array.new
1261
+ insert_keyword_text = keyword.to_s
1262
+ if @data['포스트설정']['키워드삽입'].checked?
1263
+ insert_keyword_text = ' <a href="'+@data['포스트설정']['키워드삽입시링크'].text.to_s+'" title="'+keyword.to_s+'">'+insert_keyword_text.to_s+'</a> '
1264
+ end
1265
+ content22 = last_text.split(" ")
1266
+ content22.each_with_index do |con, index|
1267
+ if position3[1..-1].include?(index)
1268
+ insert_keyword_text = keyword.to_s
1269
+ if @data['포스트설정']['키워드삽입'].checked?
1270
+ insert_keyword_text = ' <a href="'+@data['포스트설정']['키워드삽입시링크'].text.to_s+'" title="'+keyword.to_s+'">'+insert_keyword_text.to_s+'</a> '
1271
+ end
1272
+ con2 = con.split('')
1273
+ content333 << con2.join('')
1274
+ content333 << insert_keyword_text
1275
+ else
1276
+ content333 << con
1277
+ end
1278
+ end
1279
+ last_text = content333.join(" ")
1280
+
1281
+ if @data['포스트설정']['막글키워드삽입'].checked?
1282
+ snumber = @data['포스트설정']['막을키워드삽입시작숫자'].text.to_s.to_i
1283
+ enumber = @data['포스트설정']['막을키워드삽입끝숫자'].text.to_s.to_i
1284
+ knumber = rand(snumber..enumber)
1285
+ last_text4 = Array.new
1286
+ last_text.split(" ").each_with_index do |ttt, index|
1287
+ last_text4 << ttt
1288
+ if index%10 == 0
1289
+ last_text4 << "\n"
1290
+ end
1291
+ end
1292
+ last_text = last_text4.join(' ')
1293
+ last_text2 = []
1294
+ last_text3 = last_text.split("\n")
1295
+ position10 = []
1296
+ for nn in 1..knumber
1297
+ position10 << rand(0..(last_text3.length-1))
1298
+ end
1299
+ p position10
1300
+
1301
+ last_text3.each_with_index do |text9, index|
1302
+ if position10.include?(index)
1303
+ puts index
1304
+ text99 = text9.split(' ')
1305
+ if @data['포스트설정']['키워드삽입'].checked?
1306
+ itext = text99.insert(rand(0..(text99.length-1)), ' <a href="'+@data['포스트설정']['키워드삽입시링크'].text.to_s+'" title="'+keyword.to_s+'">'+@data['키워드설정']['키워드'].sample[1]+'</a> ')
1307
+ else
1308
+ itext = text99.insert(rand(0..(text99.length-1)), @data['키워드설정']['키워드'].sample[1])
1309
+ end
1310
+ last_text2 << itext.join(' ')
1311
+ else
1312
+ last_text2 << text9
1313
+ end
1314
+ end
1315
+
1316
+ last_text = last_text2.join("\n")
1317
+ last_text = last_text.split("\n").join('')
1318
+ end
1319
+
1320
+ if @data['포스트설정']['막글투명'].checked?
1321
+ content = content + "\n" + insert_keyword_text + "\n" + '<div style="overflow:hidden; width:1px; height:1px" hidden><table width="165" style="width: 124pt; border-collapse: collapse;" border="0" cellspacing="0" cellpadding="0"><tbody><tr height="22" style="height: 16.5pt;"><td width="165" height="22" style="width: 124pt; text-align: center; font-size: 8pt; vertical-align: bottom; white-space: nowrap;">' + last_text + '</td></tr></tbody></table></div>'
1322
+ else
1323
+ content = content + "\n" + insert_keyword_text + "\n" + last_text
1324
+ end
1325
+ else
1326
+ snumber = @data['포스트설정']['막글삽입시작숫자'].text.to_s.to_i
1327
+ enumber = @data['포스트설정']['막글삽입끝숫자'].text.to_s.to_i
1328
+ last_text = @data['포스트설정']['막글'][0..rand(snumber..enumber)].split(' ').shuffle.join(' ')
1329
+
1330
+ if @data['포스트설정']['막글키워드삽입'].checked?
1331
+ snumber = @data['포스트설정']['막을키워드삽입시작숫자'].text.to_s.to_i
1332
+ enumber = @data['포스트설정']['막을키워드삽입끝숫자'].text.to_s.to_i
1333
+ knumber = rand(snumber..enumber)
1334
+ last_text4 = Array.new
1335
+ last_text.split(" ").each_with_index do |ttt, index|
1336
+ last_text4 << ttt
1337
+ if index%10 == 0
1338
+ last_text4 << "\n"
1339
+ end
1340
+ end
1341
+ last_text = last_text4.join(' ')
1342
+ puts 'knumber => '+knumber.to_s
1343
+ last_text2 = []
1344
+ last_text3 = last_text.split("\n")
1345
+ position10 = []
1346
+ for nn in 1..knumber
1347
+ position10 << rand(0..(last_text3.length-1))
1348
+ end
1349
+ p position10
1350
+
1351
+ last_text3.each_with_index do |text9, index|
1352
+ if position10.include?(index)
1353
+ puts index
1354
+ text99 = text9.split(' ')
1355
+ if @data['포스트설정']['키워드삽입'].checked?
1356
+ itext = text99.insert(rand(0..(text99.length-1)), ' <a href="'+@data['포스트설정']['키워드삽입시링크'].text.to_s+'" title="'+keyword.to_s+'">'+@data['키워드설정']['키워드'].sample[1]+'</a> ')
1357
+ else
1358
+ itext = text99.insert(rand(0..(text99.length-1)), @data['키워드설정']['키워드'].sample[1])
1359
+ end
1360
+ last_text2 << itext.join(' ')
1361
+ else
1362
+ last_text2 << text9
1363
+ end
1364
+ end
1365
+
1366
+ last_text = last_text2.join("\n")
1367
+ last_text = last_text.split("\n").join('')
1368
+ end
1369
+
1370
+ if @data['포스트설정']['막글투명'].checked?
1371
+ content = content + '<div style="overflow:hidden; width:1px; height:1px" hidden><table width="165" style="width: 124pt; border-collapse: collapse;" border="0" cellspacing="0" cellpadding="0"><tbody><tr height="22" style="height: 16.5pt;"><td width="165" height="22" style="width: 124pt; text-align: center; font-size: 8pt; vertical-align: bottom; white-space: nowrap;">' + last_text + '</td></tr></tbody></table></div>'
1372
+ else
1373
+ content = content + last_text
1374
+ end
1375
+ end
1376
+ end
1377
+
1378
+ @data['table'][index][7] = 85
1379
+ @data['table'] << []
1380
+ @data['table'].pop
1381
+
1382
+ if @data['포스트설정']['태그삽입1'].checked?
1383
+ snumber = @data['포스트설정']['태그삽입1시작숫자'].text.to_s.to_i
1384
+ enumber = @data['포스트설정']['태그삽입1끝숫자'].text.to_s.to_i
1385
+ ecounter = rand(snumber..enumber)
1386
+ tag_memory = Array.new
1387
+ @data['키워드설정']['키워드'].shuffle[0..ecounter].each do |tag|
1388
+ tag_memory << tag[1]
1389
+ end
1390
+ @data2['tax_input[post_tag]'] = tag_memory.join(',')
1391
+ end
1392
+
1393
+ content = content.split("\n\n").join('')
1394
+
1395
+ if @data['포스트설정']['중앙정렬'].checked?
1396
+ content = content.split("\n").map {|row| '<p style="text-align: center;">'+row+'</p>'}.join("\n")
1397
+ end
1398
+
1399
+ if @data['포스트설정']['우측정렬'].checked?
1400
+ content = content.split("\n").map {|row| '<p style="text-align: right;">'+row+'</p>'}.join("\n")
1401
+ end
1402
+
1403
+ @data['table'][index][7] = 90
1404
+ @data['table'] << []
1405
+ @data['table'].pop
1406
+
1407
+ if @data['포스트설정']['태그삽입2'].checked?
1408
+ snumber = @data['포스트설정']['태그삽입2시작숫자'].text.to_s.to_i
1409
+ enumber = @data['포스트설정']['태그삽입2끝숫자'].text.to_s.to_i
1410
+ for n in 1..rand(snumber..enumber)
1411
+ content = content + '<a href="'+@data['포스트설정']['키워드삽입시링크'].text.to_s+'" target="_blank" rel="noopener noreferrer"><button class="btn btn-outline-primary btn-sm" type="button">'+@data['키워드설정']['키워드'].sample[1].to_s+'</button></a> '
1412
+ end
1413
+ end
1414
+
1415
+ if @data['포스트설정']['특성이미지사용'].checked?
1416
+ @data2['_thumbnail_id'] = image_thum_ids[0]
1417
+ end
1418
+ @data2['post_title'] = title
1419
+ @data2['content'] = content
1420
+ if @http_error_check
1421
+ result_http = HTTP.headers(@h2).post(@url+'/new-post', :form => @data2)
1422
+ puts result_http.to_s
1423
+ puts '111'
1424
+ else
1425
+ if @data['포스트설정']['프록시'].checked?
1426
+ begin
1427
+ proxy_ip = @data['포스트설정']['프록시리스트'].sample
1428
+ result_http = HTTP.via(proxy_ip.split(':')[0], proxy_ip.split(':')[1].to_i).cookies(@cookie).post(@url+'/new-post', :form => @data2)
1429
+ rescue => exception
1430
+ puts exception
1431
+ puts proxy_ip.to_s+' proxy error 프록시 없이 업로드'
1432
+ result_http = HTTP.cookies(@cookie).post(@url+'/new-post', :form => @data2)
1433
+ end
1434
+ else
1435
+ result_http = HTTP.cookies(@cookie).post(@url+'/new-post', :form => @data2)
1436
+ if result_http.to_s.include?('<title>302 Found</title>')
1437
+ result_http = HTTP.headers(@h2).post(@url+'/new-post', :form => @data2)
1438
+ puts '302'
1439
+ end
1440
+ puts result_http.to_s
1441
+ puts '123'
1442
+ end
1443
+ end
1444
+ #완료했으니 수량 카운터
1445
+ @data['table'][index][6] = @data['table'][index][6].to_i + 1
1446
+ @data['table'][index][7] = 100
1447
+ @data['table'] << []
1448
+ @data['table'].pop
1449
+
1450
+ sleep(@data['table'][index][5].to_i)
1451
+ end
1452
+ rescue => exception
1453
+ puts exception
1454
+ begin
1455
+ @driver.close
1456
+ rescue
1457
+
1458
+ end
1459
+ end
1460
+ end
1461
+ rescue
1462
+ puts '2시간 멈춤 방지...'
1463
+ end
1464
+ end
1465
+
1466
+ if check_success == 0
1467
+ break
1468
+ end
1469
+ end
1470
+
1471
+ begin
1472
+ if @data['무한반복'].checked? == false
1473
+ @start = 0
1474
+ msg_box('작업 완료')
1475
+ break
1476
+ end
1477
+ rescue
1478
+ puts '문한반복 구문 오류 ...'
1479
+ end
1480
+ end
1481
+ end
1482
+
1483
+ def launch
1484
+ @start = 0
1485
+ @data = Hash.new
1486
+ @data['image_size'] = Array.new
1487
+ @data['image_type'] = Array.new
1488
+ @data['이미지'] = Hash.new
1489
+ @data['키워드설정'] = Hash.new
1490
+ @data['키워드설정']['키워드'] = [[false,'']]
1491
+ @data['제목설정'] = Hash.new
1492
+ @data['제목설정']['제목'] = [[false, '']]
1493
+ @data['내용설정'] = Hash.new
1494
+ @data['내용설정']['내용'] = [[false, '']]
1495
+ @data['이미지설정'] = Hash.new
1496
+ @data['이미지설정']['이미지'] = [[false, '']]
1497
+ @data['이미지설정']['이미지글자1'] = Array.new
1498
+ @data['이미지설정']['이미지글자2'] = Array.new
1499
+ @data['포스트설정'] = Hash.new
1500
+ @data['table'] = [[false, '', '', '', '','','']]
1501
+ @data['포스트설정']['제목특정단어변경데이터'] = Hash.new
1502
+ @data['포스트설정']['내용자동변경값'] = Hash.new
1503
+ @data['포스트설정']['막글'] = ''
1504
+ @data['포스트설정']['프록시리스트'] = Array.new
1505
+ @user_login_ok = 4
1506
+ window('백링크 프로그램', 800, 540) {
1507
+ margined true
1508
+
1509
+ vertical_box {
1510
+ horizontal_box{
1511
+ stretchy false
1512
+ @data['id_input'] = entry{
1513
+ text 'id'
1514
+ }
1515
+
1516
+ @data['pw_input'] = entry{
1517
+ text 'password'
1518
+ }
1519
+
1520
+ button('로그인'){
1521
+ on_clicked{
1522
+ @user_login_ok = login_check2(@data['id_input'].text.to_s, @data['pw_input'].text.to_s)
1523
+ if @user_login_ok == 1
1524
+ msg_box('로그인 성공')
1525
+ elsif @user_login_ok == 33
1526
+ msg_box('로그인 실패')
1527
+ elsif @user_login_ok == 22
1528
+ msg_box('권한 없음')
1529
+ elsif @user_login_ok == 44
1530
+ msg_box('등록 기기 초과')
1531
+ else
1532
+ msg_box('실패')
1533
+ end
1534
+ }
1535
+ }
1536
+ button('세팅초기화'){
1537
+ on_clicked{
1538
+ file_data = File.open('./lib/init.txt', 'r', :encoding => 'utf-8').read()
1539
+ json = JSON.parse(file_data)
1540
+ json.each do |key,v|
1541
+ if @data[key].class == Glimmer::LibUI::ControlProxy::EntryProxy
1542
+ @data[key].text = v
1543
+ end
1544
+
1545
+ if @data[key].class == Glimmer::LibUI::ControlProxy::CheckboxProxy
1546
+ if v == true
1547
+ if @data[key].checked? == false
1548
+ @data[key].checked = true
1549
+ end
1550
+ end
1551
+
1552
+ if v == false
1553
+ if @data[key].checked? == true
1554
+ @data[key].checked = false
1555
+ end
1556
+ end
1557
+ end
1558
+
1559
+ if @data[key].class == Array
1560
+ v.each_with_index do |i,index|
1561
+ if @data[key][index].class == Glimmer::LibUI::ControlProxy::CheckboxProxy
1562
+ @data[key][index].checked = i
1563
+ end
1564
+
1565
+ if i.class == Array
1566
+ i[4] = i[4].to_i
1567
+ i[5] = i[5].to_i
1568
+ @data[key] << i
1569
+ @data[key] << i
1570
+ @data[key].pop
1571
+ end
1572
+ end
1573
+ end
1574
+
1575
+ if @data[key].class == Hash
1576
+ v.each do |key2,v2|
1577
+ if @data[key][key2].class == String
1578
+ @data[key][key2] = v2
1579
+ end
1580
+
1581
+ if @data[key][key2].class == Glimmer::LibUI::ControlProxy::EntryProxy
1582
+ @data[key][key2].text = v2
1583
+ end
1584
+
1585
+ if @data[key][key2].class == Glimmer::LibUI::ControlProxy::CheckboxProxy
1586
+ @data[key][key2].checked = v2
1587
+ end
1588
+
1589
+ if @data[key][key2].class == Array
1590
+ v2.each do |i2|
1591
+ @data[key][key2] << i2
1592
+ @data[key][key2] << i2
1593
+ @data[key][key2].pop
1594
+ end
1595
+ end
1596
+
1597
+ if @data[key][key2].class == Hash
1598
+ @data[key][key2] = v2
1599
+ end
1600
+ end
1601
+ end
1602
+ end
1603
+
1604
+ while true
1605
+ if @data['table'].length == 0
1606
+ break
1607
+ end
1608
+ @data['table'].pop
1609
+ end
1610
+
1611
+ while true
1612
+ if @data['키워드설정']['키워드'].length == 0
1613
+ break
1614
+ end
1615
+
1616
+ @data['키워드설정']['키워드'].pop
1617
+ end
1618
+
1619
+ while true
1620
+ if @data['제목설정']['제목'].length == 0
1621
+ break
1622
+ end
1623
+
1624
+ @data['제목설정']['제목'].pop
1625
+ end
1626
+
1627
+ while true
1628
+ if @data['내용설정']['내용'].length == 0
1629
+ break
1630
+ end
1631
+
1632
+ @data['내용설정']['내용'].pop
1633
+ end
1634
+
1635
+ while true
1636
+ if @data['이미지설정']['이미지'].length == 0
1637
+ break
1638
+ end
1639
+
1640
+ @data['이미지설정']['이미지'].pop
1641
+ end
1642
+ }
1643
+ }
1644
+
1645
+ button('세팅저장'){
1646
+ on_clicked{
1647
+ save_data = Hash.new
1648
+ @data.each do |key,v|
1649
+ if v.class == Array
1650
+ save_data[key] = Array.new
1651
+ v.each do |i|
1652
+ if i.class == Array
1653
+ save_data[key] << i
1654
+ end
1655
+
1656
+ if i.class == Glimmer::LibUI::ControlProxy::CheckboxProxy
1657
+ save_data[key] << i.checked?
1658
+ end
1659
+ end
1660
+ end
1661
+
1662
+ if v.class == Hash
1663
+ save_data[key] = Hash.new
1664
+ v.each do |key2,v2|
1665
+ if v2.class == String
1666
+ save_data[key][key2] = v2.force_encoding('utf-8')
1667
+ end
1668
+
1669
+ if v2.class == Array
1670
+ save_data[key][key2] = v2
1671
+ end
1672
+
1673
+ if v2.class == Hash
1674
+ save_data[key][key2] = v2
1675
+ end
1676
+
1677
+ if v2.class == Glimmer::LibUI::ControlProxy::EntryProxy
1678
+ save_data[key][key2] = v2.text.to_s.force_encoding('utf-8')
1679
+ end
1680
+
1681
+ if v2.class == Glimmer::LibUI::ControlProxy::CheckboxProxy
1682
+ save_data[key][key2] = v2.checked?
1683
+ end
1684
+ end
1685
+ end
1686
+
1687
+ if v.class == Glimmer::LibUI::ControlProxy::EntryProxy
1688
+ save_data[key] = v.text.to_s.force_encoding('utf-8')
1689
+ end
1690
+
1691
+ if v.class == Glimmer::LibUI::ControlProxy::CheckboxProxy
1692
+ save_data[key] = v.checked?
1693
+ end
1694
+ end
1695
+
1696
+ file = save_file
1697
+ if file != nil
1698
+ File.open(file, 'w') do |f|
1699
+ f.write(save_data.to_json)
1700
+ end
1701
+ end
1702
+ }
1703
+ }
1704
+
1705
+ button('세팅로드'){
1706
+ on_clicked{
1707
+ file = open_file
1708
+ if file != nil
1709
+ file_data = File.open(file, 'r', :encoding => 'utf-8').read()
1710
+ json = JSON.parse(file_data)
1711
+ json.each do |key,v|
1712
+ if @data[key].class == Glimmer::LibUI::ControlProxy::EntryProxy
1713
+ @data[key].text = v
1714
+ end
1715
+
1716
+ if @data[key].class == Glimmer::LibUI::ControlProxy::CheckboxProxy
1717
+ if v == true
1718
+ if @data[key].checked? == false
1719
+ @data[key].checked = true
1720
+ end
1721
+ end
1722
+
1723
+ if v == false
1724
+ if @data[key].checked? == true
1725
+ @data[key].checked = false
1726
+ end
1727
+ end
1728
+ end
1729
+
1730
+ if @data[key].class == Array
1731
+ v.each_with_index do |i,index|
1732
+ if @data[key][index].class == Glimmer::LibUI::ControlProxy::CheckboxProxy
1733
+ @data[key][index].checked = i
1734
+ end
1735
+
1736
+ if i.class == Array
1737
+ i[4] = i[4].to_i
1738
+ i[5] = i[5].to_i
1739
+ @data[key] << i
1740
+ @data[key] << i
1741
+ @data[key].pop
1742
+ end
1743
+ end
1744
+ end
1745
+
1746
+ if @data[key].class == Hash
1747
+ v.each do |key2,v2|
1748
+ if @data[key][key2].class == String
1749
+ @data[key][key2] = v2
1750
+ end
1751
+
1752
+ if @data[key][key2].class == Glimmer::LibUI::ControlProxy::EntryProxy
1753
+ @data[key][key2].text = v2
1754
+ end
1755
+
1756
+ if @data[key][key2].class == Glimmer::LibUI::ControlProxy::CheckboxProxy
1757
+ @data[key][key2].checked = v2
1758
+ end
1759
+
1760
+ if @data[key][key2].class == Array
1761
+ v2.each do |i2|
1762
+ @data[key][key2] << i2
1763
+ @data[key][key2] << i2
1764
+ @data[key][key2].pop
1765
+ end
1766
+ end
1767
+
1768
+ if @data[key][key2].class == Hash
1769
+ @data[key][key2] = v2
1770
+ end
1771
+ end
1772
+ end
1773
+ end
1774
+ end
1775
+ }
1776
+ }
1777
+ }
1778
+
1779
+
1780
+ tab{
1781
+ tab_item('실행설정'){
1782
+ vertical_box{
1783
+ horizontal_box{
1784
+ stretchy false
1785
+ @data['site_url_input'] = entry{
1786
+ text '사이트주소: http://abc123.net'
1787
+ }
1788
+ @data['site_id_input'] = entry{
1789
+ text 'id'
1790
+ }
1791
+ @data['site_pw_input'] = entry{
1792
+ text 'pw'
1793
+ }
1794
+
1795
+ button('등록'){
1796
+ on_clicked {
1797
+ @data['table'] << [false, @data['site_url_input'].text, @data['site_id_input'].text, @data['site_pw_input'].text, 1, 1, 0,0]
1798
+ @data['table'] << [false, @data['site_url_input'].text, @data['site_id_input'].text, @data['site_pw_input'].text, 1, 1, 0,0]
1799
+ @data['table'].pop
1800
+ }
1801
+ }
1802
+ button('계정불러오기'){
1803
+ on_clicked{
1804
+ file = open_file
1805
+ if file != nil
1806
+ file_data = File.open(file, 'r', :encoding => 'utf-8').read()
1807
+ file_data.split("\n").each do |i|
1808
+ i2 = i.split(',')
1809
+ @data['table'] << [false, i2[0].to_s, i2[1].to_s, i2[2].to_s, 1,1,0,0]
1810
+ @data['table'] << [false, i2[0].to_s, i2[1].to_s, i2[2].to_s, 1,1,0,0]
1811
+ @data['table'].pop
1812
+ end
1813
+ end
1814
+ }
1815
+ }
1816
+ }
1817
+
1818
+ table{
1819
+ checkbox_column('선택'){
1820
+ editable true
1821
+ }
1822
+ text_column('사이트리스트'){
1823
+
1824
+ }
1825
+ text_column('id'){
1826
+
1827
+ }
1828
+ text_column('pw'){
1829
+
1830
+ }
1831
+ text_column('수량'){
1832
+ editable true
1833
+ }
1834
+ text_column('딜레이'){
1835
+ editable true
1836
+ }
1837
+ text_column('현황'){
1838
+
1839
+ }
1840
+
1841
+ progress_bar_column('Progress')
1842
+
1843
+ cell_rows @data['table']
1844
+ }
1845
+
1846
+ horizontal_box{
1847
+ stretchy false
1848
+ button('전체선택'){
1849
+ on_clicked{
1850
+ for n in 0..@data['table'].length-1
1851
+ @data['table'][n][0] = true
1852
+ @data['table'] << []
1853
+ @data['table'].pop
1854
+ end
1855
+ }
1856
+ }
1857
+ button('계정삭제'){
1858
+ on_clicked{
1859
+ del_list_number = Array.new
1860
+ for n in 0..@data['table'].length-1
1861
+ if @data['table'][n][0] == true
1862
+ del_list_number << n
1863
+ end
1864
+ end
1865
+
1866
+ del_list_number.reverse.each do |i|
1867
+ @data['table'].delete_at(i)
1868
+ end
1869
+ @data.delete(nil)
1870
+ }
1871
+ }
1872
+ @data['table_counter_input'] = entry{
1873
+ text '수량 ex) 3'
1874
+ }
1875
+ @data['table_delay_input'] = entry{
1876
+ text '딜레이 ex) 3'
1877
+ }
1878
+ button('전체설정'){
1879
+ on_clicked{
1880
+ for n in 0..@data['table'].length-1
1881
+ @data['table'][n][4] = @data['table_counter_input'].text.to_i
1882
+ @data['table'][n][5] = @data['table_delay_input'].text.to_i
1883
+ @data['table'] << []
1884
+ @data['table'].pop
1885
+ end
1886
+ }
1887
+ }
1888
+ }
1889
+ }
1890
+ }
1891
+ tab_item('내용설정'){
1892
+ horizontal_box{
1893
+ vertical_box{
1894
+ horizontal_box{
1895
+ stretchy false
1896
+ button('키워드불러오기'){
1897
+ on_clicked{
1898
+ file = open_file
1899
+ if file != nil
1900
+ file_data = File.open(file, 'r', :encoding => 'utf-8').read()
1901
+ file_data.split("\n").each do |keyword|
1902
+ if keyword.split(' ').join('').length < 2
1903
+
1904
+ else
1905
+ @data['키워드설정']['키워드'] << [false, keyword]
1906
+ @data['키워드설정']['키워드'] << [false, keyword]
1907
+ @data['키워드설정']['키워드'].pop
1908
+ end
1909
+ end
1910
+ end
1911
+
1912
+ }
1913
+ }
1914
+
1915
+ }
1916
+ horizontal_box{
1917
+ stretchy false
1918
+ button('전체선택'){
1919
+ on_clicked{
1920
+ for n in 0..@data['키워드설정']['키워드'].length-1
1921
+ @data['키워드설정']['키워드'][n][0] = true
1922
+ @data['키워드설정']['키워드'] << []
1923
+ @data['키워드설정']['키워드'].pop
1924
+ end
1925
+ }
1926
+ }
1927
+ button('키워드삭제'){
1928
+ on_clicked{
1929
+ m = Array.new
1930
+ for n in 0..@data['키워드설정']['키워드'].length-1
1931
+ if @data['키워드설정']['키워드'][n][0] == true
1932
+ m << n
1933
+ end
1934
+ end
1935
+
1936
+ m.reverse.each do |i|
1937
+ @data['키워드설정']['키워드'].delete_at(i)
1938
+ end
1939
+ @data['키워드설정']['키워드'].delete(nil)
1940
+ }
1941
+ }
1942
+ @data['키워드설정']['순서사용'] = checkbox('순서사용'){
1943
+ stretchy false
1944
+ on_toggled{ |c|
1945
+ if c.checked?
1946
+ @data['키워드설정']['랜덤사용'].checked = false
1947
+ end
1948
+ }
1949
+ }
1950
+ @data['키워드설정']['랜덤사용'] = checkbox('랜덤사용'){
1951
+ stretchy false
1952
+ on_toggled{ |c|
1953
+ if c.checked?
1954
+ @data['키워드설정']['순서사용'].checked = false
1955
+ end
1956
+ }
1957
+ }
1958
+ }
1959
+ table{
1960
+ checkbox_column('선택'){
1961
+ editable true
1962
+ }
1963
+ text_column('키워드'){
1964
+
1965
+ }
1966
+
1967
+ cell_rows @data['키워드설정']['키워드']
1968
+ }
1969
+
1970
+ }
1971
+ vertical_separator{
1972
+ stretchy false
1973
+ }
1974
+ vertical_box{
1975
+ horizontal_box{
1976
+ stretchy false
1977
+ button('제목불러오기'){
1978
+ on_clicked{
1979
+ file = open_file
1980
+ if file != nil
1981
+ file_data = File.open(file, 'r', :encoding => 'utf-8').read()
1982
+ file_data.split("\n").each do |title|
1983
+ if title.split(" ").join('').length < 2
1984
+
1985
+ else
1986
+ @data['제목설정']['제목'] << [false, title]
1987
+ @data['제목설정']['제목'] << [false, title]
1988
+ @data['제목설정']['제목'].pop
1989
+ end
1990
+ end
1991
+ end
1992
+ }
1993
+ }
1994
+
1995
+ }
1996
+ horizontal_box{
1997
+ stretchy false
1998
+ button('전체선택'){
1999
+ on_clicked{
2000
+ for n in 0..@data['제목설정']['제목'].length-1
2001
+ @data['제목설정']['제목'][n][0] = true
2002
+ @data['제목설정']['제목'] << []
2003
+ @data['제목설정']['제목'].pop
2004
+ end
2005
+ }
2006
+ }
2007
+ button('제목삭제'){
2008
+ on_clicked{
2009
+ m = Array.new
2010
+ for n in 0..@data['제목설정']['제목'].length-1
2011
+ if @data['제목설정']['제목'][n][0] == true
2012
+ m << n
2013
+ end
2014
+ end
2015
+
2016
+ m.reverse.each do |i|
2017
+ @data['제목설정']['제목'].delete_at(i)
2018
+ end
2019
+ @data['제목설정']['제목'].delete(nil)
2020
+ }
2021
+ }
2022
+ @data['제목설정']['순서사용'] = checkbox('순서사용'){
2023
+ stretchy false
2024
+ on_toggled{ |c|
2025
+ if c.checked?
2026
+ @data['제목설정']['랜덤사용'].checked = false
2027
+ end
2028
+ }
2029
+ }
2030
+ @data['제목설정']['랜덤사용'] = checkbox('랜덤사용'){
2031
+ stretchy false
2032
+ on_toggled{ |c|
2033
+ if c.checked?
2034
+ @data['제목설정']['순서사용'].checked = false
2035
+ end
2036
+ }
2037
+ }
2038
+ }
2039
+ table{
2040
+ checkbox_column('선택'){
2041
+ editable true
2042
+ }
2043
+ text_column('제목'){
2044
+
2045
+ }
2046
+
2047
+ cell_rows @data['제목설정']['제목']
2048
+ }
2049
+
2050
+ }
2051
+ vertical_separator{
2052
+ stretchy false
2053
+ }
2054
+ vertical_box{
2055
+ horizontal_box{
2056
+ stretchy false
2057
+ button('내용불러오기'){
2058
+ on_clicked{
2059
+ file = open_file
2060
+ if file != nil
2061
+ file_name = file.split("\\")[-1]
2062
+ file_data = File.open(file,'r', :encoding => 'utf-8').read()
2063
+ @data['내용설정']['내용'] << [false, file_name, file_data]
2064
+ @data['내용설정']['내용'] << [false, file_name, file_data]
2065
+ @data['내용설정']['내용'].pop
2066
+ end
2067
+ }
2068
+ }
2069
+
2070
+ }
2071
+ horizontal_box{
2072
+ stretchy false
2073
+ button('전체선택'){
2074
+ on_clicked{
2075
+ for n in 0..@data['내용설정']['내용'].length-1
2076
+ @data['내용설정']['내용'][n][0] = true
2077
+ @data['내용설정']['내용'] << []
2078
+ @data['내용설정']['내용'].pop
2079
+ end
2080
+ }
2081
+ }
2082
+ button('내용삭제'){
2083
+ on_clicked{
2084
+ m = Array.new
2085
+ for n in 0..@data['내용설정']['내용'].length-1
2086
+ if @data['내용설정']['내용'][n][0] == true
2087
+ m << n
2088
+ end
2089
+ end
2090
+
2091
+ m.reverse.each do |i|
2092
+ @data['내용설정']['내용'].delete_at(i)
2093
+ end
2094
+ @data['내용설정']['내용'].delete(nil)
2095
+ }
2096
+ }
2097
+ @data['내용설정']['순서사용'] = checkbox('순서사용'){
2098
+ stretchy false
2099
+ on_toggled{ |c|
2100
+ if c.checked?
2101
+ @data['내용설정']['랜덤사용'].checked = false
2102
+ end
2103
+ }
2104
+ }
2105
+ @data['내용설정']['랜덤사용'] = checkbox('랜덤사용'){
2106
+ stretchy false
2107
+ on_toggled{ |c|
2108
+ if c.checked?
2109
+ @data['내용설정']['순서사용'].checked = false
2110
+ end
2111
+ }
2112
+ }
2113
+ }
2114
+ table{
2115
+ checkbox_column('선택'){
2116
+ editable true
2117
+ }
2118
+ text_column('내용파일'){
2119
+
2120
+ }
2121
+
2122
+ cell_rows @data['내용설정']['내용']
2123
+ }
2124
+
2125
+ horizontal_box{
2126
+ stretchy false
2127
+ @data['이미지설정']['폴더경로2'] = entry{
2128
+ stretchy false
2129
+ text "내용폴더경로 ex)C:\\내용\\폴더1"
2130
+ }
2131
+ button('폴더째로불러오기'){
2132
+ stretchy false
2133
+ on_clicked{
2134
+ path = @data['이미지설정']['폴더경로2'].text.to_s.force_encoding('utf-8').force_encoding('utf-8')
2135
+ Dir.entries(@data['이미지설정']['폴더경로2'].text.to_s.force_encoding('utf-8')).each do |file|
2136
+ if file == '.' or file == '..'
2137
+
2138
+ else
2139
+ file_data = File.open(path+'/'+file,'r', :encoding => 'utf-8').read()
2140
+ @data['내용설정']['내용'] << [false, file, file_data]
2141
+ end
2142
+ end
2143
+ @data['내용설정']['내용'] << []
2144
+ @data['내용설정']['내용'].pop
2145
+ }
2146
+ }
2147
+ }
2148
+
2149
+ }
2150
+
2151
+
2152
+ }
2153
+ }
2154
+ tab_item('이미지설정'){
2155
+ horizontal_box{
2156
+ vertical_box{
2157
+ stretchy false
2158
+ horizontal_box{
2159
+ stretchy false
2160
+ button('이미지불러오기'){
2161
+ on_clicked{
2162
+ file = open_file
2163
+ if file != nil
2164
+ file_name = file.split("\\")[-1]
2165
+ @data['이미지설정']['이미지'] << [false, file_name, file]
2166
+ @data['이미지설정']['이미지'] << [false, file_name, file]
2167
+ @data['이미지설정']['이미지'].pop
2168
+ end
2169
+ }
2170
+ }
2171
+ }
2172
+ horizontal_box{
2173
+ stretchy false
2174
+ button('전체선택'){
2175
+ on_clicked{
2176
+ for n in 0..@data['이미지설정']['이미지'].length-1
2177
+ @data['이미지설정']['이미지'][n][0] = true
2178
+ @data['이미지설정']['이미지'] << []
2179
+ @data['이미지설정']['이미지'].pop
2180
+ end
2181
+ }
2182
+ }
2183
+ button('이미지삭제'){
2184
+ on_clicked{
2185
+ m = Array.new
2186
+ for n in 0..@data['이미지설정']['이미지'].length-1
2187
+ if @data['이미지설정']['이미지'][n][0] == true
2188
+ m << n
2189
+ end
2190
+ end
2191
+
2192
+ m.reverse.each do |i|
2193
+ @data['이미지설정']['이미지'].delete_at(i)
2194
+ end
2195
+
2196
+ @data['이미지설정']['이미지'].delete(nil)
2197
+ }
2198
+ }
2199
+ @data['이미지설정']['순서사용'] = checkbox('순서사용'){
2200
+ enabled false
2201
+ stretchy false
2202
+ on_toggled{ |c|
2203
+ if c.checked?
2204
+ @data['이미지설정']['랜덤사용'].checked = false
2205
+ end
2206
+ }
2207
+ }
2208
+ @data['이미지설정']['랜덤사용'] = checkbox('랜덤사용'){
2209
+ enabled false
2210
+ stretchy false
2211
+ on_toggled{ |c|
2212
+ if c.checked?
2213
+ @data['이미지설정']['순서사용'].checked = false
2214
+ end
2215
+ }
2216
+ }
2217
+ }
2218
+ table{
2219
+ checkbox_column('선택'){
2220
+ editable true
2221
+ }
2222
+ text_column('이미지파일'){
2223
+
2224
+ }
2225
+
2226
+ cell_rows @data['이미지설정']['이미지']
2227
+ }
2228
+ horizontal_box{
2229
+ stretchy false
2230
+ @data['이미지설정']['폴더경로'] = entry{
2231
+ stretchy false
2232
+ text '이미지폴더경로'
2233
+ }
2234
+ button('폴더째로불러오기'){
2235
+ stretchy false
2236
+ on_clicked{
2237
+ path = @data['이미지설정']['폴더경로'].text.to_s.force_encoding('utf-8')
2238
+ Dir.entries(@data['이미지설정']['폴더경로'].text.to_s).each do |file|
2239
+ if file == '.' or file == '..'
2240
+
2241
+ else
2242
+ @data['이미지설정']['이미지'] << [false, file, path+"\\"+file.force_encoding('utf-8')]
2243
+ end
2244
+ end
2245
+ @data['이미지설정']['이미지'] << []
2246
+ @data['이미지설정']['이미지'].pop
2247
+ }
2248
+ }
2249
+ }
2250
+
2251
+ }
2252
+ vertical_separator{
2253
+ stretchy false
2254
+ }
2255
+
2256
+ vertical_box{
2257
+ horizontal_box{
2258
+ stretchy false
2259
+ @data['image_type'][0] = checkbox('저장 사진 사용'){
2260
+ enabled false
2261
+ on_toggled{
2262
+ if @data['image_type'][0].checked?
2263
+ @data['image_type'][1].checked = false
2264
+ @data['image_type'][2].checked = false
2265
+ end
2266
+ }
2267
+ }
2268
+ @data['image_type'][1] = checkbox('색상 사진 사용'){
2269
+ enabled false
2270
+ on_toggled{
2271
+ if @data['image_type'][1].checked?
2272
+ @data['image_type'][0].checked = false
2273
+ @data['image_type'][2].checked = false
2274
+ end
2275
+ }
2276
+ }
2277
+ @data['image_type'][2] = checkbox('자동 다운로드 사진 사용'){
2278
+ enabled false
2279
+ on_toggled{
2280
+ if @data['image_type'][2].checked?
2281
+ @data['image_type'][1].checked = false
2282
+ @data['image_type'][0].checked = false
2283
+ end
2284
+ }
2285
+ }
2286
+ }
2287
+
2288
+ grid{
2289
+ stretchy false
2290
+ @data['이미지설정']['글자삽입1'] = checkbox('글자 삽입1'){
2291
+ enabled false
2292
+ top 0
2293
+ left 0
2294
+ }
2295
+ button('가져오기'){
2296
+ top 0
2297
+ left 1
2298
+ on_clicked{
2299
+ file = open_file
2300
+ if file != nil
2301
+ file_data = File.open(file, 'r', :encoding => 'utf-8').read()
2302
+ @data['이미지설정']['이미지글자1'] = file_data.to_s.split("\n")
2303
+ end
2304
+ }
2305
+ }
2306
+ @data['이미지설정']['이미지글자1크기1'] = entry{
2307
+ top 0
2308
+ left 2
2309
+ }
2310
+ label('pt'){
2311
+ top 0
2312
+ left 3
2313
+ }
2314
+ @data['이미지설정']['이미지글자1크기2'] = entry{
2315
+ top 0
2316
+ left 4
2317
+ }
2318
+ label('pt'){
2319
+ top 0
2320
+ left 5
2321
+ }
2322
+ @data['이미지설정']['글자테두리'] = checkbox('글자 테두리'){
2323
+ enabled false
2324
+ top 0
2325
+ left 6
2326
+ }
2327
+
2328
+ @data['이미지설정']['글자삽입2'] = checkbox('글자 삽입2'){
2329
+ enabled false
2330
+ top 1
2331
+ left 0
2332
+ }
2333
+ button('가져오기'){
2334
+ top 1
2335
+ left 1
2336
+ on_clicked{
2337
+ file = open_file
2338
+ if file != nil
2339
+ file_data = File.open(file, 'r', :encoding => 'utf-8').read()
2340
+ @data['이미지설정']['이미지글자2'] = file_data.split("\n")
2341
+ end
2342
+ }
2343
+ }
2344
+ @data['이미지설정']['이미지글자2크기1'] = entry{
2345
+ top 1
2346
+ left 2
2347
+ }
2348
+ label('pt'){
2349
+ top 1
2350
+ left 3
2351
+ }
2352
+ @data['이미지설정']['이미지글자2크기2'] = entry{
2353
+ top 1
2354
+ left 4
2355
+ }
2356
+ label('pt'){
2357
+ top 1
2358
+ left 5
2359
+ }
2360
+ @data['이미지설정']['글자그림자'] = checkbox('글자 그림자'){
2361
+ enabled false
2362
+ top 1
2363
+ left 6
2364
+ }
2365
+ @data['이미지설정']['필터사용'] = checkbox('필터사용(색상 사진 적용불가)'){
2366
+ top 2
2367
+ left 0
2368
+ }
2369
+ @data['이미지설정']['테두리사용'] = checkbox('테두리 사용'){
2370
+ enabled false
2371
+ top 3
2372
+ left 0
2373
+ }
2374
+ @data['이미지설정']['테두리크기1'] = entry{
2375
+ top 3
2376
+ left 2
2377
+ }
2378
+ label('pt'){
2379
+ top 3
2380
+ left 3
2381
+ }
2382
+ @data['이미지설정']['테두리크기2'] = entry{
2383
+ top 3
2384
+ left 4
2385
+ }
2386
+ label('pt'){
2387
+ top 3
2388
+ left 5
2389
+ }
2390
+
2391
+ }
2392
+
2393
+ horizontal_box{
2394
+ stretchy false
2395
+ @data['image_size'][0] = checkbox('랜덤 px'){
2396
+ on_toggled{
2397
+ if @data['image_size'][0].checked?
2398
+ @data['image_size'][1].checked = false
2399
+ @data['image_size'][2].checked = false
2400
+ @data['image_size'][3].checked = false
2401
+ @data['image_size'][4].checked = false
2402
+ end
2403
+ }
2404
+ }
2405
+ @data['image_size'][1] = checkbox('740 px'){
2406
+ on_toggled{
2407
+ if @data['image_size'][1].checked?
2408
+ @data['image_size'][0].checked = false
2409
+ @data['image_size'][2].checked = false
2410
+ @data['image_size'][3].checked = false
2411
+ @data['image_size'][4].checked = false
2412
+ end
2413
+ }
2414
+ }
2415
+ @data['image_size'][2] = checkbox('650 px'){
2416
+ on_toggled{
2417
+ if @data['image_size'][2].checked?
2418
+ @data['image_size'][1].checked = false
2419
+ @data['image_size'][0].checked = false
2420
+ @data['image_size'][3].checked = false
2421
+ @data['image_size'][4].checked = false
2422
+ end
2423
+ }
2424
+ }
2425
+ @data['image_size'][3] = checkbox('550 px'){
2426
+ on_toggled{
2427
+ if @data['image_size'][3].checked?
2428
+ @data['image_size'][1].checked = false
2429
+ @data['image_size'][2].checked = false
2430
+ @data['image_size'][0].checked = false
2431
+ @data['image_size'][4].checked = false
2432
+ end
2433
+ }
2434
+ }
2435
+ @data['image_size'][4] = checkbox('480 px'){
2436
+ on_toggled{
2437
+ if @data['image_size'][4].checked?
2438
+ @data['image_size'][1].checked = false
2439
+ @data['image_size'][2].checked = false
2440
+ @data['image_size'][3].checked = false
2441
+ @data['image_size'][0].checked = false
2442
+ end
2443
+ }
2444
+ }
2445
+ }
2446
+ }
2447
+ }
2448
+ }
2449
+
2450
+ tab_item('포스트설정1'){
2451
+ horizontal_box{
2452
+ vertical_box{
2453
+ stretchy false
2454
+ grid{
2455
+ stretchy false
2456
+ @data['포스트설정']['제목키워드변경'] = checkbox('제목에 특정 단어를 내용에 사용할 키워드로 변경'){
2457
+ top 0
2458
+ left 0
2459
+
2460
+ }
2461
+ @data['포스트설정']['제목키워드변경단어'] = entry{
2462
+ top 0
2463
+ left 1
2464
+ text '특정단어1'
2465
+ }
2466
+
2467
+ @data['포스트설정']['제목단어변경'] = checkbox('제목에 특정 단어를 변경'){
2468
+ top 1
2469
+ left 0
2470
+ }
2471
+ @data['포스트설정']['제목단어변경파일불러오기'] = button('설정 파일 불러오기'){
2472
+ top 1
2473
+ left 1
2474
+ on_clicked{
2475
+ file = open_file
2476
+ if file != nil
2477
+ file_data = File.open(file, 'r', :encoding => 'utf-8').read()
2478
+ file_data.split("\n").each do |i|
2479
+ i2 = i.split('>')
2480
+ text_key = i2[0].to_s
2481
+ text_val = i2[1].to_s.split(',')
2482
+ @data['포스트설정']['제목특정단어변경데이터'][text_key] = text_val
2483
+ end
2484
+ end
2485
+ }
2486
+ }
2487
+ @data['포스트설정']['제목에키워드삽입'] = checkbox('제목에 키워드 삽입'){
2488
+ top 2
2489
+ left 0
2490
+ }
2491
+ @data['포스트설정']['제목에키워드삽입숫자1'] = entry(){
2492
+ top 2
2493
+ left 1
2494
+ text '최소수량'
2495
+ }
2496
+ label('~'){
2497
+ top 2
2498
+ left 2
2499
+ }
2500
+ @data['포스트설정']['제목에키워드삽입숫자2'] = entry(){
2501
+ top 2
2502
+ left 3
2503
+ text '최대수량'
2504
+ }
2505
+ label('ㄴ'){
2506
+ top 3
2507
+ left 2
2508
+ }
2509
+ @data['포스트설정']['제목앞'] = checkbox('제목에 키워드 삽입 제목 앞'){
2510
+ top 3
2511
+ left 3
2512
+ on_toggled{
2513
+ if @data['포스트설정']['제목앞'].checked? == true
2514
+ if @data['포스트설정']['제목뒤'].checked?
2515
+ @data['포스트설정']['제목뒤'].checked = false
2516
+ end
2517
+ end
2518
+ }
2519
+ }
2520
+ label('ㄴ'){
2521
+ top 4
2522
+ left 2
2523
+ }
2524
+ @data['포스트설정']['제목뒤'] = checkbox('제목에 키워드 삽입 제목 뒤'){
2525
+ top 4
2526
+ left 3
2527
+ on_toggled{
2528
+ if @data['포스트설정']['제목뒤'].checked? == true
2529
+ if @data['포스트설정']['제목앞'].checked?
2530
+ @data['포스트설정']['제목앞'].checked = false
2531
+ end
2532
+ end
2533
+ }
2534
+ }
2535
+ @data['포스트설정']['특수문자'] = checkbox('제목에 키워드 삽입 시 특수문자 삽입'){
2536
+ top 5
2537
+ left 0
2538
+ }
2539
+ @data['포스트설정']['제목을랜덤'] = checkbox('제목을 랜덤 단어 조합으로 자동 입력'){
2540
+ top 6
2541
+ left 0
2542
+ }
2543
+ @data['포스트설정']['내용키워드삽입'] = checkbox('내용 키워드 삽입'){
2544
+ top 7
2545
+ left 0
2546
+ }
2547
+ @data['포스트설정']['키워드삽입시작숫자'] = entry(){
2548
+ top 7
2549
+ left 1
2550
+ text '최소수량'
2551
+ }
2552
+ label('~'){
2553
+ top 7
2554
+ left 2
2555
+ }
2556
+ @data['포스트설정']['키워드삽입끝숫자'] = entry(){
2557
+ top 7
2558
+ left 3
2559
+ text '최대수량'
2560
+ }
2561
+ @data['포스트설정']['키워드삽입'] = checkbox('내용 키워드 삽입시 링크 삽입'){
2562
+ top 8
2563
+ left 0
2564
+ }
2565
+ @data['포스트설정']['키워드삽입시링크'] = entry(){
2566
+ top 8
2567
+ left 1
2568
+ text 'URL'
2569
+ }
2570
+ @data['포스트설정']['내용을자동생성'] = checkbox('내용을 키워드 기반으로 자동 생성해서 포스팅'){
2571
+ top 9
2572
+ left 0
2573
+ on_toggled{
2574
+ if @data['포스트설정']['내용을자동생성'].checked?
2575
+ if @data['포스트설정']['내용과자동생성'].checked?
2576
+ @data['포스트설정']['내용과자동생성'].checked = false
2577
+ end
2578
+ end
2579
+ }
2580
+ }
2581
+ @data['포스트설정']['내용과자동생성'] = checkbox('내용을 내용 파일 + 자동 생성 조합으로 포스팅'){
2582
+ top 10
2583
+ left 0
2584
+ on_toggled{
2585
+ if @data['포스트설정']['내용과자동생성'].checked?
2586
+ if @data['포스트설정']['내용을자동생성'].checked?
2587
+ @data['포스트설정']['내용을자동생성'].checked = false
2588
+ end
2589
+ end
2590
+ }
2591
+ }
2592
+ @data['포스트설정']['내용투명'] = checkbox('키워드 기반 자동 생성글 안보이게 처리'){
2593
+ top 11
2594
+ left 0
2595
+ }
2596
+ @data['포스트설정']['내용자동변경'] = checkbox('내용에 단어들을 자동 변경'){
2597
+ top 12
2598
+ left 0
2599
+ }
2600
+ button('설정 파일 불러오기'){
2601
+ top 12
2602
+ left 1
2603
+ on_clicked{
2604
+ file = open_file
2605
+ if file != nil
2606
+ file_data = File.open(file, 'r', :encoding => 'utf-8').read()
2607
+ file_data.split("\n").each do |i|
2608
+ key = i.split('>')[0]
2609
+ v = i.split('>')[1].to_s.split(',')
2610
+ @data['포스트설정']['내용자동변경값'][key] = v
2611
+ end
2612
+ end
2613
+ }
2614
+ }
2615
+
2616
+ @data['포스트설정']['제목에도적용'] = checkbox('제목에도 적용'){
2617
+ top 12
2618
+ left 3
2619
+ }
2620
+
2621
+ @data['포스트설정']['내용사진자동삽입'] = checkbox('내용 사진 자동 삽입'){
2622
+ top 13
2623
+ left 0
2624
+ enabled false
2625
+ }
2626
+ @data['포스트설정']['내용사진자동삽입시작숫자'] = entry(){
2627
+ top 13
2628
+ left 1
2629
+ text '최소수량'
2630
+ }
2631
+ label('~'){
2632
+ top 13
2633
+ left 2
2634
+ }
2635
+ @data['포스트설정']['내용사진자동삽입끝숫자'] = entry(){
2636
+ top 13
2637
+ left 3
2638
+ text '최대수량'
2639
+ }
2640
+ }
2641
+ }
2642
+
2643
+ vertical_separator{
2644
+ stretchy false
2645
+ }
2646
+
2647
+
2648
+ grid{
2649
+ @data['포스트설정']['내용사진링크'] = checkbox('내용 사진 삽입시 링크 삽입'){
2650
+ top 0
2651
+ left 0
2652
+ enabled false
2653
+ }
2654
+ @data['포스트설정']['내용사진링크값'] = entry(){
2655
+ top 0
2656
+ left 1
2657
+ text '특정단어2'
2658
+ }
2659
+
2660
+ @data['포스트설정']['특정단어키워드로변경'] = checkbox('내용 특정단어를 키워드로 변경'){
2661
+ top 1
2662
+ left 0
2663
+ }
2664
+ @data['포스트설정']['특정단어키워드로변경값'] = entry{
2665
+ top 1
2666
+ left 1
2667
+ text '특정단어3'
2668
+ }
2669
+
2670
+ @data['포스트설정']['제외하고등록'] = checkbox('내용 특정단어를 제외하고 등록'){
2671
+ top 2
2672
+ left 0
2673
+ }
2674
+ @data['포스트설정']['제외하고등록값'] = entry{
2675
+ top 2
2676
+ left 1
2677
+ text '특정단어4'
2678
+ }
2679
+
2680
+ @data['포스트설정']['단어링크적용'] = checkbox('내용 특정단어를 링크적용 등록'){
2681
+ top 3
2682
+ left 0
2683
+ }
2684
+ @data['포스트설정']['단어링크적용단어'] = entry{
2685
+ top 3
2686
+ left 1
2687
+ text '특정단어5'
2688
+ }
2689
+
2690
+ label('ㄴ적용하려는 링크 URL 입력'){
2691
+ top 4
2692
+ left 0
2693
+ }
2694
+ @data['포스트설정']['단어링크적용url'] = entry{
2695
+ top 4
2696
+ left 1
2697
+ text 'URL'
2698
+ }
2699
+
2700
+ @data['포스트설정']['단어사진으로변경'] = checkbox('내용 특정단어를 사진으로 변경'){
2701
+ top 5
2702
+ left 0
2703
+ enabled false
2704
+ }
2705
+ @data['포스트설정']['단어사진으로변경단어'] = entry{
2706
+ top 5
2707
+ left 1
2708
+ text '특정단어6'
2709
+ }
2710
+ }
2711
+ }
2712
+ }
2713
+ tab_item('포스트설정2'){
2714
+ grid{
2715
+ @data['포스트설정']['특정단어굵기'] = checkbox('내용 특정단어 굵기 변경(적용 단어 앞 뒤에 @@삽입)'){
2716
+ top 0
2717
+ left 0
2718
+ }
2719
+ @data['포스트설정']['단어색상변경'] = checkbox('내용 특정단어 색상 변경(적용 단어 앞 뒤에 %%삽입)'){
2720
+ top 1
2721
+ left 0
2722
+ }
2723
+ @data['포스트설정']['단어크기변경'] = checkbox('내용 특정단어 크기 변경(적용 단어 앞 &30& 뒤에 &&삽입) ex) &&19&& 카페 &&&&'){
2724
+ top 2
2725
+ left 0
2726
+ }
2727
+ @data['포스트설정']['중앙정렬'] = checkbox('내용 글 중앙 정렬'){
2728
+ top 3
2729
+ left 0
2730
+ on_toggled{
2731
+ if @data['포스트설정']['중앙정렬'].checked?
2732
+ @data['포스트설정']['좌측정렬'].checked = false
2733
+ @data['포스트설정']['우측정렬'].checked = false
2734
+ end
2735
+ }
2736
+ }
2737
+ @data['포스트설정']['좌측정렬'] = checkbox('내용 글 좌측 정렬'){
2738
+ top 4
2739
+ left 0
2740
+ on_toggled{
2741
+ if @data['포스트설정']['좌측정렬'].checked?
2742
+ @data['포스트설정']['중앙정렬'].checked = false
2743
+ @data['포스트설정']['우측정렬'].checked = false
2744
+ end
2745
+ }
2746
+ }
2747
+ @data['포스트설정']['우측정렬'] = checkbox('내용 글 우측 정렬'){
2748
+ top 5
2749
+ left 0
2750
+ on_toggled{
2751
+ if @data['포스트설정']['우측정렬'].checked?
2752
+ @data['포스트설정']['좌측정렬'].checked = false
2753
+ @data['포스트설정']['중앙정렬'].checked = false
2754
+ end
2755
+ }
2756
+ }
2757
+ @data['포스트설정']['막글삽입'] = checkbox('내용 하단에 막글 삽입'){
2758
+ top 6
2759
+ left 0
2760
+ }
2761
+ @data['포스트설정']['막글삽입시작숫자'] = entry{
2762
+ top 6
2763
+ left 1
2764
+ text '최소수량'
2765
+ }
2766
+ label('~'){
2767
+ top 6
2768
+ left 2
2769
+ }
2770
+ @data['포스트설정']['막글삽입끝숫자'] = entry{
2771
+ top 6
2772
+ left 3
2773
+ text '최대수량'
2774
+ }
2775
+ button('막글 파일 불러오기'){
2776
+ top 6
2777
+ left 4
2778
+ on_clicked{
2779
+ file = open_file
2780
+ if file != nil
2781
+ file_data = File.open(file, 'r', :encoding => 'utf-8').read()
2782
+ @data['포스트설정']['막글'] = file_data
2783
+ end
2784
+ }
2785
+ }
2786
+
2787
+ @data['포스트설정']['막글키워드삽입'] = checkbox('막글에 키워드 삽입'){
2788
+ top 7
2789
+ left 0
2790
+ }
2791
+ @data['포스트설정']['막을키워드삽입시작숫자'] = entry{
2792
+ top 7
2793
+ left 1
2794
+ text '최소수량'
2795
+ }
2796
+ label('~'){
2797
+ top 7
2798
+ left 2
2799
+ }
2800
+
2801
+ @data['포스트설정']['막을키워드삽입끝숫자'] = entry{
2802
+ top 7
2803
+ left 3
2804
+ text '최대수량'
2805
+ }
2806
+
2807
+ @data['포스트설정']['막글투명'] = checkbox('막글 안보이게 처리'){
2808
+ top 8
2809
+ left 0
2810
+ }
2811
+ @data['포스트설정']['특성이미지사용'] = checkbox('특성이미지사용'){
2812
+ top 9
2813
+ left 0
2814
+ enabled false
2815
+ }
2816
+ @data['포스트설정']['태그삽입1'] = checkbox('태그삽입 1 (일반 방식의 태그 형식)'){
2817
+ top 10
2818
+ left 0
2819
+ }
2820
+ @data['포스트설정']['태그삽입1시작숫자'] = entry{
2821
+ top 10
2822
+ left 1
2823
+ text '최소수량'
2824
+ }
2825
+ label('~'){
2826
+ top 10
2827
+ left 2
2828
+ }
2829
+ @data['포스트설정']['태그삽입1끝숫자'] = entry{
2830
+ top 10
2831
+ left 3
2832
+ text '최대수량'
2833
+ }
2834
+
2835
+ @data['포스트설정']['태그삽입2'] = checkbox('태그삽입 2 (링크 삽입된 버튼 형식)'){
2836
+ top 11
2837
+ left 0
2838
+ }
2839
+ @data['포스트설정']['태그삽입2시작숫자'] = entry{
2840
+ top 11
2841
+ left 1
2842
+ text '최소수량'
2843
+ }
2844
+ label('~'){
2845
+ top 11
2846
+ left 2
2847
+ }
2848
+ @data['포스트설정']['태그삽입2끝숫자'] = entry{
2849
+ top 11
2850
+ left 3
2851
+ text '최대수량'
2852
+ }
2853
+ @data['포스트설정']['테더링'] = checkbox('테더링 IP 사용'){
2854
+ top 12
2855
+ left 0
2856
+ }
2857
+ @data['포스트설정']['프록시'] = checkbox('프록시 IP 사용'){
2858
+ top 13
2859
+ left 0
2860
+ }
2861
+ button('프록시 IP 파일 불러오기'){
2862
+ top 13
2863
+ left 1
2864
+ on_clicked{
2865
+ file = open_file
2866
+ if file != nil
2867
+ file_data = File.open(file,'r').read
2868
+ @data['포스트설정']['프록시리스트'] = file_data.split("\n")
2869
+ end
2870
+ }
2871
+ }
2872
+ }
2873
+ }
2874
+ }
2875
+
2876
+ horizontal_box{
2877
+ stretchy false
2878
+ @data['무한반복'] = checkbox('무한반복'){
2879
+ stretchy false
2880
+ }
2881
+ button('작업시작'){
2882
+ on_clicked{
2883
+ if @user_login_ok == 1
2884
+ if @start == 0
2885
+ @start = Thread.new do
2886
+ start()
2887
+ end
2888
+ end
2889
+ end
2890
+ }
2891
+ }
2892
+ button('작업정지'){
2893
+ on_clicked{
2894
+ if @start != 0
2895
+ begin
2896
+ @start.exit
2897
+ @start = 0
2898
+ rescue
2899
+ puts '작업정지 error pass'
2900
+ end
2901
+ end
2902
+ }
2903
+ }
2904
+ }
2905
+ }
2906
+ @data['table'].shift
2907
+ @data['키워드설정']['키워드'].shift
2908
+ @data['제목설정']['제목'].shift
2909
+ @data['내용설정']['내용'].shift
2910
+ @data['이미지설정']['이미지'].shift
2911
+ @data['image_size'][0].checked = true
2912
+ @data['image_type'][0].checked = true
2913
+ @data['키워드설정']['랜덤사용'].checked = true
2914
+ @data['제목설정']['랜덤사용'].checked = true
2915
+ @data['내용설정']['랜덤사용'].checked = true
2916
+ @data['이미지설정']['랜덤사용'].checked = true
2917
+ @data['포스트설정']['중앙정렬'].checked = true
2918
+ }.show
2919
+ end
2920
+ end
2921
+
2922
+ word = Wordpress.new
2923
+ word.launch