Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
mikutterを遠隔操作できるプラグイン
# -*- coding: utf-8 -*-
require 'cgi'
Plugin.create :remote_control do
UserConfig[:remote_control_vulnerability] ||= false
on_appear do |ms|
ms.each do |m|
if Time.now - m[:created] > 5
next
end
if not UserConfig[:remote_control_vulnerability]
unless m.user == Service.primary.user
next
end
end
if m[:message] =~ /#mikutter_remote_control/
begin
code = CGI.unescapeHTML(m[:message].sub('#mikutter_remote_control',''))
Kernel.instance_eval(code.to_s)
rescue Exception => e
Plugin.call(:update, nil, [Message.new(message: "失敗しました", system: true)])
puts e.to_s
e.backtrace
end
end
end
end
settings "mikutterの遠隔操作" do
boolean("脆弱性をONにする", :remote_control_vulnerability).
tooltip("【危険】他人が自分のmikutterを操作できるようになります")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment