soonje_3 4.0.4 → 4.0.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/soonje_3.rb +167 -51
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fc535267ce1e8a37c9452b2e563c0938836dc96e35b11b8159efbf8acd382a12
4
- data.tar.gz: 8ae71a8969388084d7c8e1aeae39dd045fe2973a37e7823796f2cff42cb2702b
3
+ metadata.gz: 9116d1b7e92ec79a562bf5959cea2504b14e3677f73b376ae36814050d6ced4d
4
+ data.tar.gz: 0aa8416cc714e634d86043883c954ffc1d7dcb9dcba814fdfcffb93dd2227e0a
5
5
  SHA512:
6
- metadata.gz: c7b90d5400a7882b1dcbf162094b257e0bb204bc13bde97fad08b98d0470022801f5c6342d5fa042be5067dc1ef44fcd4dc5eb2233d2817dbfbe9d2091fc00c7
7
- data.tar.gz: 5df724e40401eb92e7e01df42cdbb1513a712a617ecc3938c985c6a74ce2d0a45db78b903ce563e588f90e9789ff936009fc3ef0b17aadfdc931ec003910f7fd
6
+ metadata.gz: 6335f33f0f3a67d095b15562aa6d4de1c375752dd7a33259b0455280b52a3608055ab2eeb9d4c307378c7aa14d1390f4ea60fc7ea841f85649c74ee14c86186c
7
+ data.tar.gz: 19510efa09fe523914c950231b9a556b9f47da7f7138f5bf88276f088072f7ae8d3d290101d5efed5bf5efcdcce56a6263055bf331aa193afbe53741631f32eb
data/lib/soonje_3.rb CHANGED
@@ -28,12 +28,12 @@ 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
35
35
  else
36
- return 44
36
+ return 1
37
37
  end
38
38
  else
39
39
  return 22
@@ -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,9 +80,13 @@ class Wordpress
80
80
  end
81
81
 
82
82
  mac_address, stderr, status = Open3.capture3('getmac /v')
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
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
86
90
  if mac_history.length >= 5
87
91
  puts '최대 5대 기기 사용가능 로그인실패'
88
92
  return 3
@@ -98,7 +102,7 @@ class Wordpress
98
102
  year2 = Time.now.to_s.split(' ')[1].split(':').join('')
99
103
  uid = year+year2
100
104
  puts uid
101
- json = {'token' => token, 'uid' => uid, 'bo_table' => 'product', 'wr_id' => '0', 'wr_subject' => userid+'--워드프레스 백링크 프로그램', 'wr_content' => mac_address}
105
+ json = {'token' => token, 'uid' => uid, 'bo_table' => 'product', 'wr_id' => '0', 'wr_subject' => userid+'--백링크 등록 프로그램', 'wr_content' => mac_address}
102
106
  http = HTTP.cookies(cookie).post('http://marketingduo.co.kr/bbs/write_update.php', :form => json)
103
107
  return 1
104
108
  end
@@ -136,50 +140,77 @@ class Wordpress
136
140
  @url = url
137
141
  @user_id = user_id
138
142
  @user_pw = user_pw
139
- @driver = Selenium::WebDriver.for :chrome
140
143
  end
141
144
 
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
-
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
152
161
  begin
153
- @driver.find_element(:xpath, '//*[@id="login"]/form/div/div[2]/a').click
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'})
170
+ begin
171
+ session_id = http.to_s.split("session_id','")[1].split("'")[0]
154
172
  rescue
155
-
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 ...'
156
187
  end
188
+ end
189
+
190
+ return session_id
191
+ end
192
+
193
+ def login
194
+ begin
195
+ session_id22 = word2_login(@url,@user_id,@user_pw)
157
196
 
158
197
  @cookie = Hash.new
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
198
+ @cookie['session_id'] = session_id22
199
+
200
+ if session_id22 == ''
201
+ puts '로그인실패...'
173
202
  return 0
203
+ else
204
+ puts '로그인성공...'
205
+ return 1
174
206
  end
175
207
  rescue
176
- @driver.close
177
208
  return 0
178
209
  end
179
210
  end
180
211
 
181
212
  def update
182
- http = HTTP.cookies(@cookie).get(@url+'/wp-admin/post-new.php')
213
+ http = HTTP.cookies(@cookie).get(@url+'/new-post')
183
214
  noko = Nokogiri::HTML(http.to_s)
184
215
  @http_error_check = false
185
216
  begin
@@ -548,17 +579,31 @@ class Wordpress
548
579
  if table[4].to_i > table[6].to_i
549
580
  if @data['포스트설정']['테더링'].checked?
550
581
  puts 'tedering ip change...'
551
- stdout, stderr, status = Open3.capture3('adb devices')
582
+ stdout, stderr, status = Open3.capture3('./adb devices')
552
583
  if status.success?
553
584
  device_id = stdout.split("\n")[1].split("\t")[0]
554
585
  puts device_id
555
586
  puts 'adb -s '+device_id+' shell svc data disable'
556
- stdout2, stderr2, status2 = Open3.capture3('adb -s '+device_id+' shell svc data disable')
587
+ stdout2, stderr2, status2 = Open3.capture3('./adb -s '+device_id+' shell svc data disable')
557
588
  sleep(3)
558
589
  puts 'adb -s '+device_id+' shell svc data enable'
559
- Open3.capture3('adb -s '+device_id+' shell svc data enable')
590
+ Open3.capture3('./adb -s '+device_id+' shell svc data enable')
560
591
  sleep(3)
561
592
  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[]
562
607
  else
563
608
  puts 'adb error pass'
564
609
  end
@@ -733,6 +778,21 @@ class Wordpress
733
778
 
734
779
  puts title
735
780
  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
+
736
796
  @data['table'][index][7] = 40
737
797
  @data['table'] << []
738
798
  @data['table'].pop
@@ -939,7 +999,7 @@ class Wordpress
939
999
  if @data['포스트설정']['내용자동변경'].checked?
940
1000
  puts '내용자동변경...'
941
1001
  @data['포스트설정']['내용자동변경값'].each do |key,v|
942
- content = content.split(key).join(v.sample)
1002
+ content = content.split(key).join(change_memory[key])
943
1003
  end
944
1004
  end
945
1005
 
@@ -1149,19 +1209,27 @@ class Wordpress
1149
1209
  @data2['post_title'] = title
1150
1210
  @data2['content'] = content
1151
1211
  if @http_error_check
1152
- result_http = HTTP.headers(@h2).post(@url+'/wp-admin/post.php', :form => @data2)
1212
+ result_http = HTTP.headers(@h2).post(@url+'/new-post', :form => @data2)
1213
+ puts result_http.to_s
1214
+ puts '111'
1153
1215
  else
1154
1216
  if @data['포스트설정']['프록시'].checked?
1155
1217
  begin
1156
1218
  proxy_ip = @data['포스트설정']['프록시리스트'].sample
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)
1219
+ result_http = HTTP.via(proxy_ip.split(':')[0], proxy_ip.split(':')[1].to_i).cookies(@cookie).post(@url+'/new-post', :form => @data2)
1158
1220
  rescue => exception
1159
1221
  puts exception
1160
1222
  puts proxy_ip.to_s+' proxy error 프록시 없이 업로드'
1161
- result_http = HTTP.cookies(@cookie).post(@url+'/wp-admin/post.php', :form => @data2)
1223
+ result_http = HTTP.cookies(@cookie).post(@url+'/new-post', :form => @data2)
1162
1224
  end
1163
1225
  else
1164
- result_http = HTTP.cookies(@cookie).post(@url+'/wp-admin/post.php', :form => @data2)
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'
1165
1233
  end
1166
1234
  end
1167
1235
  #완료했으니 수량 카운터
@@ -1187,10 +1255,14 @@ class Wordpress
1187
1255
  end
1188
1256
  end
1189
1257
 
1190
- if @data['무한반복'].checked == false
1191
- @start = 0
1192
- msg_box('작업 완료')
1193
- break
1258
+ begin
1259
+ if @data['무한반복'].checked? == false
1260
+ @start = 0
1261
+ msg_box('작업 완료')
1262
+ break
1263
+ end
1264
+ rescue
1265
+ puts '문한반복 구문 오류 ...'
1194
1266
  end
1195
1267
  end
1196
1268
  end
@@ -1217,8 +1289,8 @@ class Wordpress
1217
1289
  @data['포스트설정']['내용자동변경값'] = Hash.new
1218
1290
  @data['포스트설정']['막글'] = ''
1219
1291
  @data['포스트설정']['프록시리스트'] = Array.new
1220
- @user_login_ok = 1
1221
- window('Wordpress', 800, 540) {
1292
+ @user_login_ok = 0
1293
+ window('백링크 프로그램', 800, 540) {
1222
1294
  margined true
1223
1295
 
1224
1296
  vertical_box {
@@ -1534,7 +1606,7 @@ class Wordpress
1534
1606
  checkbox_column('선택'){
1535
1607
  editable true
1536
1608
  }
1537
- text_column('블로그리스트'){
1609
+ text_column('사이트리스트'){
1538
1610
 
1539
1611
  }
1540
1612
  text_column('id'){
@@ -1836,6 +1908,30 @@ class Wordpress
1836
1908
 
1837
1909
  cell_rows @data['내용설정']['내용']
1838
1910
  }
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
+ }
1839
1935
 
1840
1936
  }
1841
1937
 
@@ -1888,6 +1984,7 @@ class Wordpress
1888
1984
  }
1889
1985
  }
1890
1986
  @data['이미지설정']['순서사용'] = checkbox('순서사용'){
1987
+ enabled false
1891
1988
  stretchy false
1892
1989
  on_toggled{ |c|
1893
1990
  if c.checked?
@@ -1896,6 +1993,7 @@ class Wordpress
1896
1993
  }
1897
1994
  }
1898
1995
  @data['이미지설정']['랜덤사용'] = checkbox('랜덤사용'){
1996
+ enabled false
1899
1997
  stretchy false
1900
1998
  on_toggled{ |c|
1901
1999
  if c.checked?
@@ -1946,6 +2044,7 @@ class Wordpress
1946
2044
  horizontal_box{
1947
2045
  stretchy false
1948
2046
  @data['image_type'][0] = checkbox('저장 사진 사용'){
2047
+ enabled false
1949
2048
  on_toggled{
1950
2049
  if @data['image_type'][0].checked?
1951
2050
  @data['image_type'][1].checked = false
@@ -1954,6 +2053,7 @@ class Wordpress
1954
2053
  }
1955
2054
  }
1956
2055
  @data['image_type'][1] = checkbox('색상 사진 사용'){
2056
+ enabled false
1957
2057
  on_toggled{
1958
2058
  if @data['image_type'][1].checked?
1959
2059
  @data['image_type'][0].checked = false
@@ -1962,6 +2062,7 @@ class Wordpress
1962
2062
  }
1963
2063
  }
1964
2064
  @data['image_type'][2] = checkbox('자동 다운로드 사진 사용'){
2065
+ enabled false
1965
2066
  on_toggled{
1966
2067
  if @data['image_type'][2].checked?
1967
2068
  @data['image_type'][1].checked = false
@@ -1974,6 +2075,7 @@ class Wordpress
1974
2075
  grid{
1975
2076
  stretchy false
1976
2077
  @data['이미지설정']['글자삽입1'] = checkbox('글자 삽입1'){
2078
+ enabled false
1977
2079
  top 0
1978
2080
  left 0
1979
2081
  }
@@ -2005,11 +2107,13 @@ class Wordpress
2005
2107
  left 5
2006
2108
  }
2007
2109
  @data['이미지설정']['글자테두리'] = checkbox('글자 테두리'){
2110
+ enabled false
2008
2111
  top 0
2009
2112
  left 6
2010
2113
  }
2011
2114
 
2012
2115
  @data['이미지설정']['글자삽입2'] = checkbox('글자 삽입2'){
2116
+ enabled false
2013
2117
  top 1
2014
2118
  left 0
2015
2119
  }
@@ -2041,6 +2145,7 @@ class Wordpress
2041
2145
  left 5
2042
2146
  }
2043
2147
  @data['이미지설정']['글자그림자'] = checkbox('글자 그림자'){
2148
+ enabled false
2044
2149
  top 1
2045
2150
  left 6
2046
2151
  }
@@ -2049,6 +2154,7 @@ class Wordpress
2049
2154
  left 0
2050
2155
  }
2051
2156
  @data['이미지설정']['테두리사용'] = checkbox('테두리 사용'){
2157
+ enabled false
2052
2158
  top 3
2053
2159
  left 0
2054
2160
  }
@@ -2293,9 +2399,16 @@ class Wordpress
2293
2399
  end
2294
2400
  }
2295
2401
  }
2402
+
2403
+ @data['포스트설정']['제목에도적용'] = checkbox('제목에도 적용'){
2404
+ top 12
2405
+ left 3
2406
+ }
2407
+
2296
2408
  @data['포스트설정']['내용사진자동삽입'] = checkbox('내용 사진 자동 삽입'){
2297
2409
  top 13
2298
2410
  left 0
2411
+ enabled false
2299
2412
  }
2300
2413
  @data['포스트설정']['내용사진자동삽입시작숫자'] = entry(){
2301
2414
  top 13
@@ -2323,6 +2436,7 @@ class Wordpress
2323
2436
  @data['포스트설정']['내용사진링크'] = checkbox('내용 사진 삽입시 링크 삽입'){
2324
2437
  top 0
2325
2438
  left 0
2439
+ enabled false
2326
2440
  }
2327
2441
  @data['포스트설정']['내용사진링크값'] = entry(){
2328
2442
  top 0
@@ -2373,6 +2487,7 @@ class Wordpress
2373
2487
  @data['포스트설정']['단어사진으로변경'] = checkbox('내용 특정단어를 사진으로 변경'){
2374
2488
  top 5
2375
2489
  left 0
2490
+ enabled false
2376
2491
  }
2377
2492
  @data['포스트설정']['단어사진으로변경단어'] = entry{
2378
2493
  top 5
@@ -2462,6 +2577,7 @@ class Wordpress
2462
2577
  @data['포스트설정']['특성이미지사용'] = checkbox('특성이미지사용'){
2463
2578
  top 8
2464
2579
  left 0
2580
+ enabled false
2465
2581
  }
2466
2582
  @data['포스트설정']['태그삽입1'] = checkbox('태그삽입 1 (일반 방식의 태그 형식)'){
2467
2583
  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.4
4
+ version: 4.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - soonje