soonje_3 4.0.4 → 4.0.14

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 +174 -55
  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: 798086da057d3beae2742b8580bb90363286df1d55d49a1d4ff9392db54bf4c9
4
+ data.tar.gz: d6ccc5aef79fb7a700f244ce4fd5d7c91e21de6c82edc322bf63d69ec4ffd161
5
5
  SHA512:
6
- metadata.gz: c7b90d5400a7882b1dcbf162094b257e0bb204bc13bde97fad08b98d0470022801f5c6342d5fa042be5067dc1ef44fcd4dc5eb2233d2817dbfbe9d2091fc00c7
7
- data.tar.gz: 5df724e40401eb92e7e01df42cdbb1513a712a617ecc3938c985c6a74ce2d0a45db78b903ce563e588f90e9789ff936009fc3ef0b17aadfdc931ec003910f7fd
6
+ metadata.gz: caa2b7263a7f024011598f586e2606b605b7779e3ce6968fe16d90ec278a6b06247d6ec84aac2515f033a33291ecd4ff18ca66d39b3ecf2d001168b1d5eb3bfc
7
+ data.tar.gz: 9697ae2eb43d0a99c1b82a98382feea8ae933a969d0402f206e2fa12def72fcc38a1739b16c4f86c699b0fce376a6a70e99051c7b431faef7608751a816146b1
data/lib/soonje_3.rb CHANGED
@@ -12,6 +12,7 @@ require 'rest-client'
12
12
  require 'open3'
13
13
  require 'zlib'
14
14
  require 'stringio'
15
+ require 'timeout'
15
16
 
16
17
  class Wordpress
17
18
  include Glimmer
@@ -28,12 +29,12 @@ class Wordpress
28
29
  c = noko.xpath('//*[@id="at-main"]/div/table/tbody').to_s.split('<tr>').length-1
29
30
  for n in 1..c
30
31
  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?('워드프레스 백링크 프로그램')
32
+ if tt.include?(user_id.to_s) and tt.include?('백링크 등록 프로그램')
32
33
  if noko.xpath('//*[@id="at-main"]/div/table/tbody/tr['+n.to_s+']/td[7]/label[1]/input').to_s.include?('checked')
33
34
  if mac_check(user_id) == 1
34
35
  return 1
35
36
  else
36
- return 44
37
+ return 1
37
38
  end
38
39
  else
39
40
  return 22
@@ -56,7 +57,7 @@ class Wordpress
56
57
  cookie[i.to_s.split('=')[0]] = i.to_s.split('=')[1]
57
58
  end
58
59
 
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
+ http = HTTP.cookies(cookie).get('http://marketingduo.co.kr/bbs/board.php?bo_table=product&sca=&sfl=wr_subject&sop=and&stx='+userid+'--백링크 등록 프로그램')
60
61
  noko = Nokogiri::HTML(http.to_s)
61
62
  mac_history = Array.new
62
63
  mac_url = Array.new
@@ -80,9 +81,13 @@ class Wordpress
80
81
  end
81
82
 
82
83
  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
84
+ begin
85
+ mac_address = mac_address.force_encoding('cp949').encode('utf-8')
86
+ mac_address = mac_address.split("\n").join('').split(' ').join
87
+ puts mac_address
88
+ rescue
89
+
90
+ end
86
91
  if mac_history.length >= 5
87
92
  puts '최대 5대 기기 사용가능 로그인실패'
88
93
  return 3
@@ -98,7 +103,7 @@ class Wordpress
98
103
  year2 = Time.now.to_s.split(' ')[1].split(':').join('')
99
104
  uid = year+year2
100
105
  puts uid
101
- json = {'token' => token, 'uid' => uid, 'bo_table' => 'product', 'wr_id' => '0', 'wr_subject' => userid+'--워드프레스 백링크 프로그램', 'wr_content' => mac_address}
106
+ json = {'token' => token, 'uid' => uid, 'bo_table' => 'product', 'wr_id' => '0', 'wr_subject' => userid+'--백링크 등록 프로그램', 'wr_content' => mac_address}
102
107
  http = HTTP.cookies(cookie).post('http://marketingduo.co.kr/bbs/write_update.php', :form => json)
103
108
  return 1
104
109
  end
@@ -136,50 +141,77 @@ class Wordpress
136
141
  @url = url
137
142
  @user_id = user_id
138
143
  @user_pw = user_pw
139
- @driver = Selenium::WebDriver.for :chrome
140
144
  end
141
145
 
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
-
146
+ def url_check22(url)
147
+ http = HTTP.get(url+'/sign-in')
148
+ if http.to_s.length == 0
149
+ return 0
150
+ else
151
+ return 1
152
+ end
153
+ end
154
+
155
+ def word2_login(url, user_id, user_pw)
156
+ session_id = ''
157
+ if url_check22(url) == 1
158
+ http = HTTP.post(url+'/sign-in', :form=>{'username' => user_id,'password'=> user_pw ,'sent'=>'1','login'=>'1'})
159
+ http.cookies.each do |i|
160
+ puts i
161
+ end
162
+ begin
163
+ session_id = http.to_s.split('session_id", "')[1].split('"')[0]
164
+ rescue
165
+ session_id = ''
166
+ end
167
+
168
+ puts session_id
169
+ else
170
+ http = HTTP.post(url+'/login', :form=>{'error'=>0,'jsession'=>'abcd','username'=>user_id,'password'=>user_pw,'login'=>'Log In'})
152
171
  begin
153
- @driver.find_element(:xpath, '//*[@id="login"]/form/div/div[2]/a').click
172
+ session_id = http.to_s.split("session_id','")[1].split("'")[0]
154
173
  rescue
155
-
174
+ session_id = ''
156
175
  end
176
+
177
+ puts session_id
178
+
179
+ if session_id == ''
180
+ http = HTTP.post(url+'/login', :form=>{'usr'=>user_id,'pass'=>user_pw,'rememberme'=>'on','login'=>'Log In'})
181
+ begin
182
+ session_id = http.to_s.split("session_id','")[1].split("'")[0]
183
+ rescue
184
+ session_id = ''
185
+ end
186
+ puts session_id
187
+ puts 'final ...'
188
+ end
189
+ end
190
+
191
+ return session_id
192
+ end
193
+
194
+ def login
195
+ begin
196
+ session_id22 = word2_login(@url,@user_id,@user_pw)
157
197
 
158
198
  @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
199
+ @cookie['session_id'] = session_id22
200
+
201
+ if session_id22 == ''
202
+ puts '로그인실패...'
173
203
  return 0
204
+ else
205
+ puts '로그인성공...'
206
+ return 1
174
207
  end
175
208
  rescue
176
- @driver.close
177
209
  return 0
178
210
  end
179
211
  end
180
212
 
181
213
  def update
182
- http = HTTP.cookies(@cookie).get(@url+'/wp-admin/post-new.php')
214
+ http = HTTP.cookies(@cookie).get(@url+'/new-post')
183
215
  noko = Nokogiri::HTML(http.to_s)
184
216
  @http_error_check = false
185
217
  begin
@@ -541,24 +573,39 @@ class Wordpress
541
573
  while true
542
574
  check_success = 0
543
575
  @data['table'].each_with_index do |table,index|
576
+ status_timeout = Timeout::timeout(180) do
544
577
  begin
545
- # if black_users.include?(table[1].to_s)
546
- # next
547
- # end
578
+ if black_users.include?(table[2].to_s)
579
+ next
580
+ end
548
581
  if table[4].to_i > table[6].to_i
549
582
  if @data['포스트설정']['테더링'].checked?
550
583
  puts 'tedering ip change...'
551
- stdout, stderr, status = Open3.capture3('adb devices')
584
+ stdout, stderr, status = Open3.capture3('./adb devices')
552
585
  if status.success?
553
586
  device_id = stdout.split("\n")[1].split("\t")[0]
554
587
  puts device_id
555
588
  puts 'adb -s '+device_id+' shell svc data disable'
556
- stdout2, stderr2, status2 = Open3.capture3('adb -s '+device_id+' shell svc data disable')
589
+ stdout2, stderr2, status2 = Open3.capture3('./adb -s '+device_id+' shell svc data disable')
557
590
  sleep(3)
558
591
  puts 'adb -s '+device_id+' shell svc data enable'
559
- Open3.capture3('adb -s '+device_id+' shell svc data enable')
592
+ Open3.capture3('./adb -s '+device_id+' shell svc data enable')
560
593
  sleep(3)
561
594
  puts 'adb ok'
595
+ sleep(8)
596
+ robot_ip = lambda do
597
+ http = HTTP.get('https://www.findip.kr/')
598
+ noko = Nokogiri::HTML(http.to_s)
599
+ if noko.xpath('/html/body/header/h2').text != @my_ip
600
+ @my_ip = noko.xpath('/html/body/header/h2').text
601
+ else
602
+ puts @my_ip
603
+ puts '제시도...'
604
+ sleep(3)
605
+ robot_ip[]
606
+ end
607
+ end
608
+ robot_ip[]
562
609
  else
563
610
  puts 'adb error pass'
564
611
  end
@@ -633,7 +680,7 @@ class Wordpress
633
680
  @data['table'].pop
634
681
  login_check = login()
635
682
  if login_check == 0
636
- black_users << table[1].to_s
683
+ black_users << table[2].to_s
637
684
  next
638
685
  end
639
686
 
@@ -733,6 +780,21 @@ class Wordpress
733
780
 
734
781
  puts title
735
782
  end
783
+
784
+ title = title.split(' ').join(' ')
785
+
786
+ change_memory = Hash.new
787
+ @data['포스트설정']['내용자동변경값'].each do |key,v|
788
+ change_memory[key] = v.sample
789
+ end
790
+
791
+ if @data['포스트설정']['제목에도적용'].checked?
792
+ @data['포스트설정']['내용자동변경값'].each do |key,v|
793
+ title = title.split(key).join(change_memory[key])
794
+ end
795
+ end
796
+
797
+
736
798
  @data['table'][index][7] = 40
737
799
  @data['table'] << []
738
800
  @data['table'].pop
@@ -939,7 +1001,7 @@ class Wordpress
939
1001
  if @data['포스트설정']['내용자동변경'].checked?
940
1002
  puts '내용자동변경...'
941
1003
  @data['포스트설정']['내용자동변경값'].each do |key,v|
942
- content = content.split(key).join(v.sample)
1004
+ content = content.split(key).join(change_memory[key])
943
1005
  end
944
1006
  end
945
1007
 
@@ -1149,19 +1211,27 @@ class Wordpress
1149
1211
  @data2['post_title'] = title
1150
1212
  @data2['content'] = content
1151
1213
  if @http_error_check
1152
- result_http = HTTP.headers(@h2).post(@url+'/wp-admin/post.php', :form => @data2)
1214
+ result_http = HTTP.headers(@h2).post(@url+'/new-post', :form => @data2)
1215
+ puts result_http.to_s
1216
+ puts '111'
1153
1217
  else
1154
1218
  if @data['포스트설정']['프록시'].checked?
1155
1219
  begin
1156
1220
  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)
1221
+ result_http = HTTP.via(proxy_ip.split(':')[0], proxy_ip.split(':')[1].to_i).cookies(@cookie).post(@url+'/new-post', :form => @data2)
1158
1222
  rescue => exception
1159
1223
  puts exception
1160
1224
  puts proxy_ip.to_s+' proxy error 프록시 없이 업로드'
1161
- result_http = HTTP.cookies(@cookie).post(@url+'/wp-admin/post.php', :form => @data2)
1225
+ result_http = HTTP.cookies(@cookie).post(@url+'/new-post', :form => @data2)
1162
1226
  end
1163
1227
  else
1164
- result_http = HTTP.cookies(@cookie).post(@url+'/wp-admin/post.php', :form => @data2)
1228
+ result_http = HTTP.cookies(@cookie).post(@url+'/new-post', :form => @data2)
1229
+ if result_http.to_s.include?('<title>302 Found</title>')
1230
+ result_http = HTTP.headers(@h2).post(@url+'/new-post', :form => @data2)
1231
+ puts '302'
1232
+ end
1233
+ puts result_http.to_s
1234
+ puts '123'
1165
1235
  end
1166
1236
  end
1167
1237
  #완료했으니 수량 카운터
@@ -1180,6 +1250,7 @@ class Wordpress
1180
1250
 
1181
1251
  end
1182
1252
  end
1253
+ end
1183
1254
  end
1184
1255
 
1185
1256
  if check_success == 0
@@ -1187,10 +1258,14 @@ class Wordpress
1187
1258
  end
1188
1259
  end
1189
1260
 
1190
- if @data['무한반복'].checked == false
1191
- @start = 0
1192
- msg_box('작업 완료')
1193
- break
1261
+ begin
1262
+ if @data['무한반복'].checked? == false
1263
+ @start = 0
1264
+ msg_box('작업 완료')
1265
+ break
1266
+ end
1267
+ rescue
1268
+ puts '문한반복 구문 오류 ...'
1194
1269
  end
1195
1270
  end
1196
1271
  end
@@ -1217,8 +1292,8 @@ class Wordpress
1217
1292
  @data['포스트설정']['내용자동변경값'] = Hash.new
1218
1293
  @data['포스트설정']['막글'] = ''
1219
1294
  @data['포스트설정']['프록시리스트'] = Array.new
1220
- @user_login_ok = 1
1221
- window('Wordpress', 800, 540) {
1295
+ @user_login_ok = 0
1296
+ window('백링크 프로그램', 800, 540) {
1222
1297
  margined true
1223
1298
 
1224
1299
  vertical_box {
@@ -1534,7 +1609,7 @@ class Wordpress
1534
1609
  checkbox_column('선택'){
1535
1610
  editable true
1536
1611
  }
1537
- text_column('블로그리스트'){
1612
+ text_column('사이트리스트'){
1538
1613
 
1539
1614
  }
1540
1615
  text_column('id'){
@@ -1836,6 +1911,30 @@ class Wordpress
1836
1911
 
1837
1912
  cell_rows @data['내용설정']['내용']
1838
1913
  }
1914
+
1915
+ horizontal_box{
1916
+ stretchy false
1917
+ @data['이미지설정']['폴더경로2'] = entry{
1918
+ stretchy false
1919
+ text "내용폴더경로 ex)C:\\내용\\폴더1"
1920
+ }
1921
+ button('폴더째로불러오기'){
1922
+ stretchy false
1923
+ on_clicked{
1924
+ path = @data['이미지설정']['폴더경로2'].text.to_s.force_encoding('utf-8').force_encoding('utf-8')
1925
+ Dir.entries(@data['이미지설정']['폴더경로2'].text.to_s.force_encoding('utf-8')).each do |file|
1926
+ if file == '.' or file == '..'
1927
+
1928
+ else
1929
+ file_data = File.open(path+'/'+file,'r', :encoding => 'utf-8').read()
1930
+ @data['내용설정']['내용'] << [false, file, file_data]
1931
+ end
1932
+ end
1933
+ @data['내용설정']['내용'] << []
1934
+ @data['내용설정']['내용'].pop
1935
+ }
1936
+ }
1937
+ }
1839
1938
 
1840
1939
  }
1841
1940
 
@@ -1888,6 +1987,7 @@ class Wordpress
1888
1987
  }
1889
1988
  }
1890
1989
  @data['이미지설정']['순서사용'] = checkbox('순서사용'){
1990
+ enabled false
1891
1991
  stretchy false
1892
1992
  on_toggled{ |c|
1893
1993
  if c.checked?
@@ -1896,6 +1996,7 @@ class Wordpress
1896
1996
  }
1897
1997
  }
1898
1998
  @data['이미지설정']['랜덤사용'] = checkbox('랜덤사용'){
1999
+ enabled false
1899
2000
  stretchy false
1900
2001
  on_toggled{ |c|
1901
2002
  if c.checked?
@@ -1946,6 +2047,7 @@ class Wordpress
1946
2047
  horizontal_box{
1947
2048
  stretchy false
1948
2049
  @data['image_type'][0] = checkbox('저장 사진 사용'){
2050
+ enabled false
1949
2051
  on_toggled{
1950
2052
  if @data['image_type'][0].checked?
1951
2053
  @data['image_type'][1].checked = false
@@ -1954,6 +2056,7 @@ class Wordpress
1954
2056
  }
1955
2057
  }
1956
2058
  @data['image_type'][1] = checkbox('색상 사진 사용'){
2059
+ enabled false
1957
2060
  on_toggled{
1958
2061
  if @data['image_type'][1].checked?
1959
2062
  @data['image_type'][0].checked = false
@@ -1962,6 +2065,7 @@ class Wordpress
1962
2065
  }
1963
2066
  }
1964
2067
  @data['image_type'][2] = checkbox('자동 다운로드 사진 사용'){
2068
+ enabled false
1965
2069
  on_toggled{
1966
2070
  if @data['image_type'][2].checked?
1967
2071
  @data['image_type'][1].checked = false
@@ -1974,6 +2078,7 @@ class Wordpress
1974
2078
  grid{
1975
2079
  stretchy false
1976
2080
  @data['이미지설정']['글자삽입1'] = checkbox('글자 삽입1'){
2081
+ enabled false
1977
2082
  top 0
1978
2083
  left 0
1979
2084
  }
@@ -2005,11 +2110,13 @@ class Wordpress
2005
2110
  left 5
2006
2111
  }
2007
2112
  @data['이미지설정']['글자테두리'] = checkbox('글자 테두리'){
2113
+ enabled false
2008
2114
  top 0
2009
2115
  left 6
2010
2116
  }
2011
2117
 
2012
2118
  @data['이미지설정']['글자삽입2'] = checkbox('글자 삽입2'){
2119
+ enabled false
2013
2120
  top 1
2014
2121
  left 0
2015
2122
  }
@@ -2041,6 +2148,7 @@ class Wordpress
2041
2148
  left 5
2042
2149
  }
2043
2150
  @data['이미지설정']['글자그림자'] = checkbox('글자 그림자'){
2151
+ enabled false
2044
2152
  top 1
2045
2153
  left 6
2046
2154
  }
@@ -2049,6 +2157,7 @@ class Wordpress
2049
2157
  left 0
2050
2158
  }
2051
2159
  @data['이미지설정']['테두리사용'] = checkbox('테두리 사용'){
2160
+ enabled false
2052
2161
  top 3
2053
2162
  left 0
2054
2163
  }
@@ -2293,9 +2402,16 @@ class Wordpress
2293
2402
  end
2294
2403
  }
2295
2404
  }
2405
+
2406
+ @data['포스트설정']['제목에도적용'] = checkbox('제목에도 적용'){
2407
+ top 12
2408
+ left 3
2409
+ }
2410
+
2296
2411
  @data['포스트설정']['내용사진자동삽입'] = checkbox('내용 사진 자동 삽입'){
2297
2412
  top 13
2298
2413
  left 0
2414
+ enabled false
2299
2415
  }
2300
2416
  @data['포스트설정']['내용사진자동삽입시작숫자'] = entry(){
2301
2417
  top 13
@@ -2323,6 +2439,7 @@ class Wordpress
2323
2439
  @data['포스트설정']['내용사진링크'] = checkbox('내용 사진 삽입시 링크 삽입'){
2324
2440
  top 0
2325
2441
  left 0
2442
+ enabled false
2326
2443
  }
2327
2444
  @data['포스트설정']['내용사진링크값'] = entry(){
2328
2445
  top 0
@@ -2373,6 +2490,7 @@ class Wordpress
2373
2490
  @data['포스트설정']['단어사진으로변경'] = checkbox('내용 특정단어를 사진으로 변경'){
2374
2491
  top 5
2375
2492
  left 0
2493
+ enabled false
2376
2494
  }
2377
2495
  @data['포스트설정']['단어사진으로변경단어'] = entry{
2378
2496
  top 5
@@ -2462,6 +2580,7 @@ class Wordpress
2462
2580
  @data['포스트설정']['특성이미지사용'] = checkbox('특성이미지사용'){
2463
2581
  top 8
2464
2582
  left 0
2583
+ enabled false
2465
2584
  }
2466
2585
  @data['포스트설정']['태그삽입1'] = checkbox('태그삽입 1 (일반 방식의 태그 형식)'){
2467
2586
  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.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - soonje