Skip to content

Instantly share code, notes, and snippets.

@penguin2716
Last active June 14, 2017 09:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save penguin2716/5214909 to your computer and use it in GitHub Desktop.
Save penguin2716/5214909 to your computer and use it in GitHub Desktop.
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