require 'Gelo'
Tor = {}
Tor.executable = 'tor.exe'
Tor.server = '127.0.0.1'
Tor.port = '9050'
Tor.level = '5'
Tor.proxyserver = 'socks='..Tor.server..':'..Tor.port
Tor.msgenabled = 'Tor Proxy Enabled.\n\nChromium plugin support disabled for greater anonymity.'
Tor.msgdisabled = 'Tor Proxy Disabled.\n\nChromium plugin support re-enabled.'
Tor.msgpartialanon = 'Warning: Tor Proxy is disabled for web browsing.\n\nThe request will be sent via Tor network, but the response will be rendered using your normal connection.'
function Tor:AddButton(state)
browser.addhtml_navbar([[
Proxy Switcher
Send request via Tor
Are you using Tor?
Help
Tor
]])
end
function Tor:ViewRequestEditor()
if str_beginswith(tab.url,'http') then
if browser.proxy_getserver() ~= self.proxyserver then
app.showmessage(self.msgpartialanon)
end
Syhunt:ViewRequestEditor()
extbar.setval('button[name="viator"]','True')
else
app.showmessage('No URL loaded.')
end
end
function Tor:SetProxy(proxy)
if proxy == 'Tor' then
browser.plugins_enable(false)
browser.proxy_enable(true,self.proxyserver)
app.showmessage(self.msgenabled)
else
browser.plugins_enable(true)
browser.proxy_enable(false)
app.showmessage(self.msgdisabled)
end
end
function Tor:IsRunning()
return task_isrunning(self.executable)
end
function Tor:Run()
if task_isrunning(self.executable) == false then
file_exechide(ProgDir..self.executable)
end
end
function Tor:Startup()
if browser.proxy_getserver() == self.proxyserver then
Tor:Run()
Tor:AddButton('enabled')
else
Tor:AddButton('disabled')
end
end
function Tor:Shutdown()
if task_isrunning(self.executable) == true then
task_kill(self.executable)
end
end