スパムがあふれかえってしまい、コメント投稿がまともに見られなくなってしまいました。
皆様にはご迷惑をおかけしました。
そこで、罪滅ぼしとして英文スパム除去ツールを作成しました。
ページ名、ページ番号などを変更すれば本WIKIサービスのほかのページでも使えると思います。
<追記2020/10/21>
スパム書き込みの手口が巧妙化してきて。前は日本語の含まれていないものを消していたのですが、対策されたようで。
どなたかが指摘されていたように、自動化ツールで書き込んでいるのでしょうか。それはともかく、新版を公開しておきます。
DelSpamV3.uws(2020/10/21)
fukidasi("Running")
threeOuts=0
repeat
if mainloop()
threeOuts=0
else
threeOuts=threeOuts+1
fukidasi("Passed")
endif
until threeOuts > 20
//<input id="sign_in_email" class="uk-form-large uk-form-width-large" name="email" value="" placeholder="登録したメールアドレス" type="text">
function mainloop()
result=false
powershell("ps iexplore|kill")
IE=createoleobj("InternetExplorer.Application")
IE.navigate("https://wiki3.jp/signIn")
IE.Visible=true
HasLoggedIn=false
repeat
try
if pos( "マイページ", IE.document.title )
HasLoggedIn=true
break
endif
username=IE.document.getElementById("sign_in_email")
username.value="管理人メアド"
except
sleep(0.1)
continue
endtry
if username.value<>"" then break
until false
if !HasLoggedIn
//<input id="sign_in_password" class="uk-form-large uk-form-width-large" name="password" value="" placeholder="パスワード" type="password">
password=IE.document.getElementById("sign_in_password")
password.value="管理人パスワード"
//<button class="uk-button uk-button-primary uk-button-large uk-width-1-2 uk-align-center">ログイン</button>
n=getoleitem( IE.document.getElementsByClassName("uk-button uk-button-primary uk-button-large uk-width-1-2 uk-align-center") )
all_ole_item[0].click()
endif
fukidasi("waiting")
sleep(2)
for line in split(getPageTitles(), "<#CR>")
url=token(",",line)
title=line
result=delSpamSinglePage( url, title )
next
fend
function delSpamSinglePage( url, title )
//<a href="/CSWU">CSWU~どうする UWSCなしの互換システム</a>
powershell("ps iexplore|kill")
IE=createoleobj("InternetExplorer.Application")
IE.Visible=true
IE.Navigate(url)
repeat
try
DocTitle=IE.document.title
except
endtry
until DocTitle=title
//JSをインジェクション
repeat
until getoleitem(IE.document.getElementsByTagName("body")) > 0
body=all_ole_item[0]
script=IE.document.createElement( "script" )
script.innerHTML=js
body.appendChild(script)
sleep(1)
getoleitem(IE.document.getElementsByTagName("pre"))
Comments=all_ole_item[length(all_ole_item)-1].innerText
RemovedCount=0
for Comment in split(Comments,"----------------------<#CR>")
ary=split(Comment,"........................<#CR>")
id=ary[0]
body=ary[1]
body=replace(body,title,"")
body=replace(body,"CSWU~どうする UWSCなしの互換システム","")
if !reg.ismatched( body,"[あ-んア-ンア-ン]" )
IE.Navigate( "https://wiki3.jp/CSWU/comment/delete/" + id )
RemovedCount=RemovedCount+1
fukidasi("UrlToDel="+url+"<#CR>Removed Items="+RemovedCount)
result=true
endif
sleep(1)
next
textblock js
{
var CommentData=''
var tags=document.querySelectorAll( 'a[data-comment-id]' )
for ( var i=0, len=tags.length; i<len; i++ ){
var tag=tags[i]
var id=tag.outerHTML.replace(/^.*data-comment-id="/,'').replace(/".*/,'')
var comment=tag.parentNode.previousElementSibling.innerText
CommentData+=id + '\r\n........................\r\n'
CommentData+=comment + '\r\n----------------------\r\n'
}
var AllComments=document.createElement('pre')
AllComments.appendChild( document.createTextNode(CommentData) )
var body=document.getElementsByTagName('body')[0]
body.appendChild(AllComments)
}
endtextblock
fend
function getPageTitles()
pageRoot="https://wiki3.jp/CSWU/page/"
branches=""
for i=5 to 19
branches=branches + pageRoot + i + "<#cr>"
next
result=trim(branches)
res2=""
powershell("ps iexplore|kill")
IE=createoleobj("InternetExplorer.Application")
for url in split( branches, "<#cr>" )
IE.navigate( url )
while IE.Busy or (IE.readystate<>4)
sleep(0.1)
wend
res2=res2 + url + "," + IE.document.title + "<#CR>"
next
result=trim(res2)
fend
module reg
dim obj
dim cols
procedure reg
obj =CreateOleObj( "VBScript.RegExp" )
fend
procedure setType( type )
if pos( "i", type )
obj.IgnoreCase =true
else
obj.IgnoreCase =false
endif
if pos( "g", type )
obj.Global =true
else
obj.Global =false
endif
if pos( "m", type )
obj.Multiline =true
else
obj..Multiline =false
endif
type =global.replace( type, "i", "" )
type =global.replace( type, "g", "" )
type =global.replace( type, "m", "" )
if length( type )
msgbox( "正規表現タイプ指定に誤りがあります" )
exitexit
endif
fend
function match( str, pat, type="" )
setType( type )
obj.Pattern =pat
cols =obj.Execute( str )
if cols.Count
result =cols.Item( 0 ).Value
else
result =""
endif
fend
function isMatch( str, pat, type="" )
match( str, pat, type )
result =( cols.Count > 0 )
fend
function isMatched( str, pat, type="" )
match( str, pat, type )
result =( cols.Count > 0 )
fend
function matches( str, pat, type="" )
match( str, pat, type + "g" )
result =safearray( 0, -1)
for i = 0 to cols.Count - 1
result[ resize( result, length( result ) ) ] =cols.Item( i ).Value
next
fend
function left( str, pat, type="" )
if isMatched( str, pat, type )
result =copy( str, 1, cols.Item( 0 ).FirstIndex )
else
result =""
endif
fend
function right( str, pat, type="" )
if isMatched( str, pat, type )
result =copy( str, cols.Item( 0 ).FirstIndex + length( cols.Item( 0 ).Value ) + 1 )
else
result =""
endif
fend
function replace( str, pat, chg, type="" )
setType( type )
obj.Pattern =pat
result =obj.Replace( str, chg )
fend
function subMatches( str, pat, type="" )
result =safearray( 0, -1)
match( str, pat, type )
if cols.Count
for sub in cols.Item( 0 ).SubMatches
result[ resize( result, length( result ) ) ] =sub
next
endif
fend
endmodule
DelSpam.uws
call "reg_module.uws"
fukidasi("Running")
threeOuts=0
repeat
if mainloop()
threeOuts=0
else
threeOuts=threeOuts+1
fukidasi("Passed")
endif
until threeOuts > 20
//<input id="sign_in_email" class="uk-form-large uk-form-width-large" name="email" value="" placeholder="登録したメールアドレス" type="text">
function mainloop()
result=false
powershell("ps iexplore|kill")
IE=createoleobj("InternetExplorer.Application")
IE.navigate("https://wiki3.jp/signIn")
IE.Visible=false
HasLoggedIn=false
repeat
try
if pos( "マイページ", IE.document.title )
HasLoggedIn=true
break
endif
username=IE.document.getElementById("sign_in_email")
username.value="管理のメアド"
except
sleep(0.1)
continue
endtry
if username.value<>"" then break
until false
if !HasLoggedIn
//<input id="sign_in_password" class="uk-form-large uk-form-width-large" name="password" value="" placeholder="パスワード" type="password">
password=IE.document.getElementById("sign_in_password")
password.value="管理人のパスワード"
//<button class="uk-button uk-button-primary uk-button-large uk-width-1-2 uk-align-center">ログイン</button>
n=getoleitem( IE.document.getElementsByClassName("uk-button uk-button-primary uk-button-large uk-width-1-2 uk-align-center") )
all_ole_item[0].click()
endif
//<a href="/CSWU">CSWU~どうする UWSCなしの互換システム</a>
IE.Navigate("https://wiki3.jp/CSWU/page/6")
repeat
try
title=IE.document.title
except
endtry
until title="UWSCサイトの現状 - CSWU~どうする UWSCなしの互換システム"
//JSをインジェクション
repeat
until getoleitem(IE.document.getElementsByTagName("body")) > 0
body=all_ole_item[0]
script=IE.document.createElement( "script" )
script.innerHTML=js
body.appendChild(script)
sleep(1)
getoleitem(IE.document.getElementsByTagName("pre"))
Comments=all_ole_item[length(all_ole_item)-1].innerText
RemovedCount=0
for Comment in split(Comments,"----------------------<#CR>")
ary=split(Comment,"........................<#CR>")
id=ary[0]
body=ary[1]
if reg.ismatched( body,"^[\0-~]+$" )
IE.Navigate( "https://wiki3.jp/CSWU/comment/delete/" + id )
RemovedCount=RemovedCount+1
fukidasi("Removed Items="+RemovedCount)
result=true
endif
sleep(1)
next
textblock js
{
var CommentData=''
var tags=document.querySelectorAll( 'a[data-comment-id]' )
for ( var i=0, len=tags.length; i<len; i++ ){
var tag=tags[i]
var id=tag.outerHTML.replace(/^.*data-comment-id="/,'').replace(/".*/,'')
var comment=tag.parentNode.previousElementSibling.innerText
CommentData+=id + '\r\n........................\r\n'
CommentData+=comment + '\r\n----------------------\r\n'
}
var AllComments=document.createElement('pre')
AllComments.appendChild( document.createTextNode(CommentData) )
var body=document.getElementsByTagName('body')[0]
body.appendChild(AllComments)
}
endtextblock
fend
regModule.uws
module reg
dim obj
dim cols
procedure reg
obj =CreateOleObj( "VBScript.RegExp" )
fend
procedure setType( type )
if pos( "i", type )
obj.IgnoreCase =true
else
obj.IgnoreCase =false
endif
if pos( "g", type )
obj.Global =true
else
obj.Global =false
endif
if pos( "m", type )
obj.Multiline =true
else
obj..Multiline =false
endif
type =global.replace( type, "i", "" )
type =global.replace( type, "g", "" )
type =global.replace( type, "m", "" )
if length( type )
msgbox( "正規表現タイプ指定に誤りがあります" )
exitexit
endif
fend
function match( str, pat, type="" )
setType( type )
obj.Pattern =pat
cols =obj.Execute( str )
if cols.Count
result =cols.Item( 0 ).Value
else
result =""
endif
fend
function isMatch( str, pat, type="" )
match( str, pat, type )
result =( cols.Count > 0 )
fend
function isMatched( str, pat, type="" )
match( str, pat, type )
result =( cols.Count > 0 )
fend
function matches( str, pat, type="" )
match( str, pat, type + "g" )
result =safearray( 0, -1)
for i = 0 to cols.Count - 1
result[ resize( result, length( result ) ) ] =cols.Item( i ).Value
next
fend
function left( str, pat, type="" )
if isMatched( str, pat, type )
result =copy( str, 1, cols.Item( 0 ).FirstIndex )
else
result =""
endif
fend
function right( str, pat, type="" )
if isMatched( str, pat, type )
result =copy( str, cols.Item( 0 ).FirstIndex + length( cols.Item( 0 ).Value ) + 1 )
else
result =""
endif
fend
function replace( str, pat, chg, type="" )
setType( type )
obj.Pattern =pat
result =obj.Replace( str, chg )
fend
function subMatches( str, pat, type="" )
result =safearray( 0, -1)
match( str, pat, type )
if cols.Count
for sub in cols.Item( 0 ).SubMatches
result[ resize( result, length( result ) ) ] =sub
next
endif
fend
endmodule
コメント
最新を表示する
NG表示方式
NGID一覧