soonje_3 4.0.3 → 4.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/soonje_3.rb +52 -168
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b1a5c065ec3964436cf8f73496e848d53532a3262d68d6a89a7210314f6f6286
4
- data.tar.gz: a0285d44073280741d5c61d958e9b895fab0148d42e3bc84e748afe7c452b8ec
3
+ metadata.gz: fc535267ce1e8a37c9452b2e563c0938836dc96e35b11b8159efbf8acd382a12
4
+ data.tar.gz: 8ae71a8969388084d7c8e1aeae39dd045fe2973a37e7823796f2cff42cb2702b
5
5
  SHA512:
6
- metadata.gz: 4ab7b3557d8a9ebb88e6c7746ef645a45ef2d75e9f9c7979af0c7ddd8cfcb9edc5bcf0a6cf29423c436996a0ac0dd070c2c5fa6b25ecec56068e49aa5d188ac8
7
- data.tar.gz: 5b3fde722d095aa65a11e532064aaca643bd0c753ef3d1f0f2d83deec43869e0bc3e39a45d2ce264e11500b1c892c8e2d94b549214b124de8afd964285465e5b
6
+ metadata.gz: c7b90d5400a7882b1dcbf162094b257e0bb204bc13bde97fad08b98d0470022801f5c6342d5fa042be5067dc1ef44fcd4dc5eb2233d2817dbfbe9d2091fc00c7
7
+ data.tar.gz: 5df724e40401eb92e7e01df42cdbb1513a712a617ecc3938c985c6a74ce2d0a45db78b903ce563e588f90e9789ff936009fc3ef0b17aadfdc931ec003910f7fd
data/lib/soonje_3.rb CHANGED
@@ -28,7 +28,7 @@ class Wordpress
28
28
  c = noko.xpath('//*[@id="at-main"]/div/table/tbody').to_s.split('<tr>').length-1
29
29
  for n in 1..c
30
30
  tt = noko.xpath('//*[@id="at-main"]/div/table/tbody/tr['+n.to_s+']').to_s
31
- if tt.include?(user_id.to_s) and tt.include?('백링크 등록 프로그램')
31
+ if tt.include?(user_id.to_s) and tt.include?('워드프레스 백링크 프로그램')
32
32
  if noko.xpath('//*[@id="at-main"]/div/table/tbody/tr['+n.to_s+']/td[7]/label[1]/input').to_s.include?('checked')
33
33
  if mac_check(user_id) == 1
34
34
  return 1
@@ -56,7 +56,7 @@ class Wordpress
56
56
  cookie[i.to_s.split('=')[0]] = i.to_s.split('=')[1]
57
57
  end
58
58
 
59
- http = HTTP.cookies(cookie).get('http://marketingduo.co.kr/bbs/board.php?bo_table=product&sca=&sfl=wr_subject&sop=and&stx='+userid+'--백링크 등록 프로그램')
59
+ http = HTTP.cookies(cookie).get('http://marketingduo.co.kr/bbs/board.php?bo_table=product&sca=&sfl=wr_subject&sop=and&stx='+userid+'--워드프레스 백링크 프로그램')
60
60
  noko = Nokogiri::HTML(http.to_s)
61
61
  mac_history = Array.new
62
62
  mac_url = Array.new
@@ -80,13 +80,9 @@ class Wordpress
80
80
  end
81
81
 
82
82
  mac_address, stderr, status = Open3.capture3('getmac /v')
83
- begin
84
- mac_address = mac_address.force_encoding('cp949').encode('utf-8')
85
- mac_address = mac_address.split("\n").join('').split(' ').join
86
- puts mac_address
87
- rescue
88
-
89
- end
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
90
86
  if mac_history.length >= 5
91
87
  puts '최대 5대 기기 사용가능 로그인실패'
92
88
  return 3
@@ -102,7 +98,7 @@ class Wordpress
102
98
  year2 = Time.now.to_s.split(' ')[1].split(':').join('')
103
99
  uid = year+year2
104
100
  puts uid
105
- json = {'token' => token, 'uid' => uid, 'bo_table' => 'product', 'wr_id' => '0', 'wr_subject' => userid+'--백링크 등록 프로그램', 'wr_content' => mac_address}
101
+ json = {'token' => token, 'uid' => uid, 'bo_table' => 'product', 'wr_id' => '0', 'wr_subject' => userid+'--워드프레스 백링크 프로그램', 'wr_content' => mac_address}
106
102
  http = HTTP.cookies(cookie).post('http://marketingduo.co.kr/bbs/write_update.php', :form => json)
107
103
  return 1
108
104
  end
@@ -140,77 +136,50 @@ class Wordpress
140
136
  @url = url
141
137
  @user_id = user_id
142
138
  @user_pw = user_pw
139
+ @driver = Selenium::WebDriver.for :chrome
143
140
  end
144
141
 
145
- def url_check22(url)
146
- http = HTTP.get(url+'/sign-in')
147
- if http.to_s.length == 0
148
- return 0
149
- else
150
- return 1
151
- end
152
- end
153
-
154
- def word2_login(url, user_id, user_pw)
155
- session_id = ''
156
- if url_check22(url) == 1
157
- http = HTTP.post(url+'/sign-in', :form=>{'username' => user_id,'password'=> user_pw ,'sent'=>'1','login'=>'1'})
158
- http.cookies.each do |i|
159
- puts i
160
- end
161
- begin
162
- session_id = http.to_s.split('session_id", "')[1].split('"')[0]
163
- rescue
164
- session_id = ''
165
- end
166
-
167
- puts session_id
168
- else
169
- http = HTTP.post(url+'/login', :form=>{'error'=>0,'jsession'=>'abcd','username'=>user_id,'password'=>user_pw,'login'=>'Log In'})
142
+ def login
143
+ begin
144
+ @driver.get(@url+'/wp-admin')
145
+ sleep(3)
146
+ @driver.find_element(:xpath , '//*[@id="user_login"]').send_keys(@user_id)
147
+ @driver.find_element(:xpath , '//*[@id="user_pass"]').send_keys(@user_pw)
148
+ sleep(3)
149
+ @driver.find_element(:xpath , '//*[@id="wp-submit"]').click
150
+ sleep(3)
151
+
170
152
  begin
171
- session_id = http.to_s.split("session_id','")[1].split("'")[0]
153
+ @driver.find_element(:xpath, '//*[@id="login"]/form/div/div[2]/a').click
172
154
  rescue
173
- session_id = ''
174
- end
175
-
176
- puts session_id
177
-
178
- if session_id == ''
179
- http = HTTP.post(url+'/login', :form=>{'usr'=>user_id,'pass'=>user_pw,'rememberme'=>'on','login'=>'Log In'})
180
- begin
181
- session_id = http.to_s.split("session_id','")[1].split("'")[0]
182
- rescue
183
- session_id = ''
184
- end
185
- puts session_id
186
- puts 'final ...'
187
- end
188
- end
189
-
190
- return session_id
191
- end
192
155
 
193
- def login
194
- begin
195
- session_id22 = word2_login(@url,@user_id,@user_pw)
156
+ end
196
157
 
197
158
  @cookie = Hash.new
198
- @cookie['session_id'] = session_id22
199
-
200
- if session_id22 == ''
201
- puts '로그인실패...'
159
+ @driver.manage.all_cookies.each do |i|
160
+ @cookie[i[:name]] = i[:value]
161
+ end
162
+ begin
163
+ puts hihi = @driver.find_element(:xpath , '//*[@id="wp-admin-bar-my-account"]/a').text
164
+ if hihi.to_s == ''
165
+ @driver.close
166
+ return 0
167
+ else
168
+ @driver.close
169
+ return 1
170
+ end
171
+ rescue
172
+ @driver.close
202
173
  return 0
203
- else
204
- puts '로그인성공...'
205
- return 1
206
174
  end
207
175
  rescue
176
+ @driver.close
208
177
  return 0
209
178
  end
210
179
  end
211
180
 
212
181
  def update
213
- http = HTTP.cookies(@cookie).get(@url+'/new-post')
182
+ http = HTTP.cookies(@cookie).get(@url+'/wp-admin/post-new.php')
214
183
  noko = Nokogiri::HTML(http.to_s)
215
184
  @http_error_check = false
216
185
  begin
@@ -579,31 +548,17 @@ class Wordpress
579
548
  if table[4].to_i > table[6].to_i
580
549
  if @data['포스트설정']['테더링'].checked?
581
550
  puts 'tedering ip change...'
582
- stdout, stderr, status = Open3.capture3('./adb devices')
551
+ stdout, stderr, status = Open3.capture3('adb devices')
583
552
  if status.success?
584
553
  device_id = stdout.split("\n")[1].split("\t")[0]
585
554
  puts device_id
586
555
  puts 'adb -s '+device_id+' shell svc data disable'
587
- stdout2, stderr2, status2 = Open3.capture3('./adb -s '+device_id+' shell svc data disable')
556
+ stdout2, stderr2, status2 = Open3.capture3('adb -s '+device_id+' shell svc data disable')
588
557
  sleep(3)
589
558
  puts 'adb -s '+device_id+' shell svc data enable'
590
- Open3.capture3('./adb -s '+device_id+' shell svc data enable')
559
+ Open3.capture3('adb -s '+device_id+' shell svc data enable')
591
560
  sleep(3)
592
561
  puts 'adb ok'
593
- sleep(8)
594
- robot_ip = lambda do
595
- http = HTTP.get('https://www.findip.kr/')
596
- noko = Nokogiri::HTML(http.to_s)
597
- if noko.xpath('/html/body/header/h2').text != @my_ip
598
- @my_ip = noko.xpath('/html/body/header/h2').text
599
- else
600
- puts @my_ip
601
- puts '제시도...'
602
- sleep(3)
603
- robot_ip[]
604
- end
605
- end
606
- robot_ip[]
607
562
  else
608
563
  puts 'adb error pass'
609
564
  end
@@ -778,21 +733,6 @@ class Wordpress
778
733
 
779
734
  puts title
780
735
  end
781
-
782
- title = title.split(' ').join(' ')
783
-
784
- change_memory = Hash.new
785
- @data['포스트설정']['내용자동변경값'].each do |key,v|
786
- change_memory[key] = v.sample
787
- end
788
-
789
- if @data['포스트설정']['제목에도적용'].checked?
790
- @data['포스트설정']['내용자동변경값'].each do |key,v|
791
- title = title.split(key).join(change_memory[key])
792
- end
793
- end
794
-
795
-
796
736
  @data['table'][index][7] = 40
797
737
  @data['table'] << []
798
738
  @data['table'].pop
@@ -999,7 +939,7 @@ class Wordpress
999
939
  if @data['포스트설정']['내용자동변경'].checked?
1000
940
  puts '내용자동변경...'
1001
941
  @data['포스트설정']['내용자동변경값'].each do |key,v|
1002
- content = content.split(key).join(change_memory[key])
942
+ content = content.split(key).join(v.sample)
1003
943
  end
1004
944
  end
1005
945
 
@@ -1162,9 +1102,9 @@ class Wordpress
1162
1102
  snumber = @data['포스트설정']['막글삽입시작숫자'].text.to_s.to_i
1163
1103
  enumber = @data['포스트설정']['막글삽입끝숫자'].text.to_s.to_i
1164
1104
  if @data['포스트설정']['막글투명'].checked?
1165
- 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;">' + @data['포스트설정']['막글'][0..rand(snumber..enumber)] + '</td></tr></tbody></table></div>'
1105
+ 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;">' + @data['포스트설정']['막글'][0..rand(snumber..enumber)].split(' ').shuffle.join(' ') + '</td></tr></tbody></table></div>'
1166
1106
  else
1167
- content = content + @data['포스트설정']['막글'][0..rand(snumber..enumber)]
1107
+ content = content + @data['포스트설정']['막글'][0..rand(snumber..enumber)].split(' ').shuffle.join(' ')
1168
1108
  end
1169
1109
  end
1170
1110
 
@@ -1209,27 +1149,19 @@ class Wordpress
1209
1149
  @data2['post_title'] = title
1210
1150
  @data2['content'] = content
1211
1151
  if @http_error_check
1212
- result_http = HTTP.headers(@h2).post(@url+'/new-post', :form => @data2)
1213
- puts result_http.to_s
1214
- puts '111'
1152
+ result_http = HTTP.headers(@h2).post(@url+'/wp-admin/post.php', :form => @data2)
1215
1153
  else
1216
1154
  if @data['포스트설정']['프록시'].checked?
1217
1155
  begin
1218
1156
  proxy_ip = @data['포스트설정']['프록시리스트'].sample
1219
- result_http = HTTP.via(proxy_ip.split(':')[0], proxy_ip.split(':')[1].to_i).cookies(@cookie).post(@url+'/new-post', :form => @data2)
1157
+ result_http = HTTP.via(proxy_ip.split(':')[0], proxy_ip.split(':')[1].to_i).cookies(@cookie).post(@url+'/wp-admin/post.php', :form => @data2)
1220
1158
  rescue => exception
1221
1159
  puts exception
1222
1160
  puts proxy_ip.to_s+' proxy error 프록시 없이 업로드'
1223
- result_http = HTTP.cookies(@cookie).post(@url+'/new-post', :form => @data2)
1161
+ result_http = HTTP.cookies(@cookie).post(@url+'/wp-admin/post.php', :form => @data2)
1224
1162
  end
1225
1163
  else
1226
- result_http = HTTP.cookies(@cookie).post(@url+'/new-post', :form => @data2)
1227
- if result_http.to_s.include?('<title>302 Found</title>')
1228
- result_http = HTTP.headers(@h2).post(@url+'/new-post', :form => @data2)
1229
- puts '302'
1230
- end
1231
- puts result_http.to_s
1232
- puts '123'
1164
+ result_http = HTTP.cookies(@cookie).post(@url+'/wp-admin/post.php', :form => @data2)
1233
1165
  end
1234
1166
  end
1235
1167
  #완료했으니 수량 카운터
@@ -1255,14 +1187,10 @@ class Wordpress
1255
1187
  end
1256
1188
  end
1257
1189
 
1258
- begin
1259
- if @data['무한반복'].checked? == false
1260
- @start = 0
1261
- msg_box('작업 완료')
1262
- break
1263
- end
1264
- rescue
1265
- puts '문한반복 구문 오류 ...'
1190
+ if @data['무한반복'].checked == false
1191
+ @start = 0
1192
+ msg_box('작업 완료')
1193
+ break
1266
1194
  end
1267
1195
  end
1268
1196
  end
@@ -1289,8 +1217,8 @@ class Wordpress
1289
1217
  @data['포스트설정']['내용자동변경값'] = Hash.new
1290
1218
  @data['포스트설정']['막글'] = ''
1291
1219
  @data['포스트설정']['프록시리스트'] = Array.new
1292
- @user_login_ok = 0
1293
- window('백링크 프로그램', 800, 540) {
1220
+ @user_login_ok = 1
1221
+ window('Wordpress', 800, 540) {
1294
1222
  margined true
1295
1223
 
1296
1224
  vertical_box {
@@ -1606,7 +1534,7 @@ class Wordpress
1606
1534
  checkbox_column('선택'){
1607
1535
  editable true
1608
1536
  }
1609
- text_column('사이트리스트'){
1537
+ text_column('블로그리스트'){
1610
1538
 
1611
1539
  }
1612
1540
  text_column('id'){
@@ -1908,30 +1836,6 @@ class Wordpress
1908
1836
 
1909
1837
  cell_rows @data['내용설정']['내용']
1910
1838
  }
1911
-
1912
- horizontal_box{
1913
- stretchy false
1914
- @data['이미지설정']['폴더경로2'] = entry{
1915
- stretchy false
1916
- text "내용폴더경로 ex)C:\\내용\\폴더1"
1917
- }
1918
- button('폴더째로불러오기'){
1919
- stretchy false
1920
- on_clicked{
1921
- path = @data['이미지설정']['폴더경로2'].text.to_s.force_encoding('utf-8').force_encoding('utf-8')
1922
- Dir.entries(@data['이미지설정']['폴더경로2'].text.to_s.force_encoding('utf-8')).each do |file|
1923
- if file == '.' or file == '..'
1924
-
1925
- else
1926
- file_data = File.open(path+'/'+file,'r', :encoding => 'utf-8').read()
1927
- @data['내용설정']['내용'] << [false, file, file_data]
1928
- end
1929
- end
1930
- @data['내용설정']['내용'] << []
1931
- @data['내용설정']['내용'].pop
1932
- }
1933
- }
1934
- }
1935
1839
 
1936
1840
  }
1937
1841
 
@@ -1984,7 +1888,6 @@ class Wordpress
1984
1888
  }
1985
1889
  }
1986
1890
  @data['이미지설정']['순서사용'] = checkbox('순서사용'){
1987
- enabled false
1988
1891
  stretchy false
1989
1892
  on_toggled{ |c|
1990
1893
  if c.checked?
@@ -1993,7 +1896,6 @@ class Wordpress
1993
1896
  }
1994
1897
  }
1995
1898
  @data['이미지설정']['랜덤사용'] = checkbox('랜덤사용'){
1996
- enabled false
1997
1899
  stretchy false
1998
1900
  on_toggled{ |c|
1999
1901
  if c.checked?
@@ -2044,7 +1946,6 @@ class Wordpress
2044
1946
  horizontal_box{
2045
1947
  stretchy false
2046
1948
  @data['image_type'][0] = checkbox('저장 사진 사용'){
2047
- enabled false
2048
1949
  on_toggled{
2049
1950
  if @data['image_type'][0].checked?
2050
1951
  @data['image_type'][1].checked = false
@@ -2053,7 +1954,6 @@ class Wordpress
2053
1954
  }
2054
1955
  }
2055
1956
  @data['image_type'][1] = checkbox('색상 사진 사용'){
2056
- enabled false
2057
1957
  on_toggled{
2058
1958
  if @data['image_type'][1].checked?
2059
1959
  @data['image_type'][0].checked = false
@@ -2062,7 +1962,6 @@ class Wordpress
2062
1962
  }
2063
1963
  }
2064
1964
  @data['image_type'][2] = checkbox('자동 다운로드 사진 사용'){
2065
- enabled false
2066
1965
  on_toggled{
2067
1966
  if @data['image_type'][2].checked?
2068
1967
  @data['image_type'][1].checked = false
@@ -2075,7 +1974,6 @@ class Wordpress
2075
1974
  grid{
2076
1975
  stretchy false
2077
1976
  @data['이미지설정']['글자삽입1'] = checkbox('글자 삽입1'){
2078
- enabled false
2079
1977
  top 0
2080
1978
  left 0
2081
1979
  }
@@ -2107,13 +2005,11 @@ class Wordpress
2107
2005
  left 5
2108
2006
  }
2109
2007
  @data['이미지설정']['글자테두리'] = checkbox('글자 테두리'){
2110
- enabled false
2111
2008
  top 0
2112
2009
  left 6
2113
2010
  }
2114
2011
 
2115
2012
  @data['이미지설정']['글자삽입2'] = checkbox('글자 삽입2'){
2116
- enabled false
2117
2013
  top 1
2118
2014
  left 0
2119
2015
  }
@@ -2145,7 +2041,6 @@ class Wordpress
2145
2041
  left 5
2146
2042
  }
2147
2043
  @data['이미지설정']['글자그림자'] = checkbox('글자 그림자'){
2148
- enabled false
2149
2044
  top 1
2150
2045
  left 6
2151
2046
  }
@@ -2154,7 +2049,6 @@ class Wordpress
2154
2049
  left 0
2155
2050
  }
2156
2051
  @data['이미지설정']['테두리사용'] = checkbox('테두리 사용'){
2157
- enabled false
2158
2052
  top 3
2159
2053
  left 0
2160
2054
  }
@@ -2399,16 +2293,9 @@ class Wordpress
2399
2293
  end
2400
2294
  }
2401
2295
  }
2402
-
2403
- @data['포스트설정']['제목에도적용'] = checkbox('제목에도 적용'){
2404
- top 12
2405
- left 3
2406
- }
2407
-
2408
2296
  @data['포스트설정']['내용사진자동삽입'] = checkbox('내용 사진 자동 삽입'){
2409
2297
  top 13
2410
2298
  left 0
2411
- enabled false
2412
2299
  }
2413
2300
  @data['포스트설정']['내용사진자동삽입시작숫자'] = entry(){
2414
2301
  top 13
@@ -2436,7 +2323,6 @@ class Wordpress
2436
2323
  @data['포스트설정']['내용사진링크'] = checkbox('내용 사진 삽입시 링크 삽입'){
2437
2324
  top 0
2438
2325
  left 0
2439
- enabled false
2440
2326
  }
2441
2327
  @data['포스트설정']['내용사진링크값'] = entry(){
2442
2328
  top 0
@@ -2487,7 +2373,6 @@ class Wordpress
2487
2373
  @data['포스트설정']['단어사진으로변경'] = checkbox('내용 특정단어를 사진으로 변경'){
2488
2374
  top 5
2489
2375
  left 0
2490
- enabled false
2491
2376
  }
2492
2377
  @data['포스트설정']['단어사진으로변경단어'] = entry{
2493
2378
  top 5
@@ -2577,7 +2462,6 @@ class Wordpress
2577
2462
  @data['포스트설정']['특성이미지사용'] = checkbox('특성이미지사용'){
2578
2463
  top 8
2579
2464
  left 0
2580
- enabled false
2581
2465
  }
2582
2466
  @data['포스트설정']['태그삽입1'] = checkbox('태그삽입 1 (일반 방식의 태그 형식)'){
2583
2467
  top 9
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: soonje_3
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.3
4
+ version: 4.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - soonje