#!usr/bin/env ruby require 'pokeplot' require 'json' default_config = %{ { "_info": "Enter your accounts here, as many as you want", "accounts": [ { "username": "account1", "password": "password1", "provider": "ptc" }, { "username": "account2@gmail.com", "password": "password2", "provider": "google" } ], "_info": "Enter the origin scan coordinates below [lat, lng]", "location": [ 40.7829, -73.9654 ], "_info": "settings for API", "api": { "encryption_path": "/path/to/encryption/file", "log": true }, "_info": "settings for mongoDB (default host is already set)", "mongo": { "host": "127.0.0.1:27017" }, "_info": "settings for the data miner", "miner": { "enabled": true, "threaded": true, "range": 40, "interval": 900, "pokemon": true, "forts": true, "log": true }, "_info": "Pushbullet settings - see the wiki for easy set-up guide", "pushbullet": { "enabled": false, "api_key": "apiKey", "pokemon": [ "SNORLAX", "DRATINI", "DRAGONITE", "MEWTWO" ] }, "_info": "settings for socket for real time webpage updates RECOMENDED YOU DONT CHANGE THIS", "socket": { "enabled": true, "host": "0.0.0.0", "port": "9090", "log": true }, "_info": "Web server settings", "webserver": { "enabled": true, "host": "0.0.0.0", "port": 5001 }, "_info": "optional ptc account combo list", "combos": [ "SToCQSyJuVXj:BGyoYefXjQQZ", "hdOMuITMabLF:kscSpsGGzBxu", "vMpPCulIYkcT:GBbUdGlstxeW", "FZmcNpLdbxha:CurAriesqPFZ", "wVkKQBGmYJXK:XmZoKXLfvNvU", "vgsqGbfVeawM:QhzXnffDjgAt", "dJdUmaNsvuMC:HsHytSfNyvnS", "UPmlEpbNFGYk:tZJMwBeDRAMs", "xcxcPjUKRPal:iFCBrsSjHFRF", "dldjzYhsQbLz:oaQaggnrVIjK", "gZEekjgrBQCK:vUWhIaEHAclX", "wLOToXHcLJBZ:RNIoYdwvDFTH", "tBOjNYBHIJIo:CTqmQaCWaRRT", "pbAGNZsvGnMC:TVWLsmdRRJjG", "cneIEKBIGevh:CnFKUkBDJECj", "WworruNrwycr:gYzkXQnHyPxy", "YtbiVCtnYCIQ:jiBNmgTBWTBw", "rwmUhrHCbWGW:gKdPdvUzbXEB", "kdgqEBIsKMhO:rvESvQkNQtGs", "PssVOTYjurWz:gSMXWHoFkvPq", "kHlinSczQEim:rqFePFPryvUe", "AIAVmolzTbQJ:mxvWoSJNrNRC", "iBESkcpbrIdY:KQnQTqClDykQ", "AXwyjTgvYIfn:vINTlbsjdtCx", "yuHRAgIfVWTZ:VTTnyPBZSojM", "nFrgKgQLzrRe:ooplsOvhQNFQ", "iRFsCpCMUlte:koKrBewFLMxo", "pOqWlFdPGYEl:gkhKikkcwpmh", "NByvaUQkNchO:nPmVzbMPtXWY", "RftfDbyWXmSe:wYLELjKLjkIJ", "gLJMMYXGJibG:AnHNRvNmSkuA", "zBCKrZlciUiV:SZJdvkMSkgRT", "TyqcusJxatgm:EqKtdTEybJpz", "fDDaoMvaOMOs:bmcEVoNcKyJC", "dEgUOTTPOQpQ:elCgIExqkWOp", "ZjZZftPIHKVj:gHzweZzDICAA", "XuinqBhqynbE:PDfXbdSBkoJV", "eYPkNTSSRngF:EShbqUEutCqQ", "PvmFqqXdRnwG:IhDzJDSknest", "CvbgGcNdKumE:gzmlCjYgybpZ", "FiHNyzzpKmOs:tbIXrdCecmlB", "dUsdcfxGJAlf:NTWKivTOeABd", "BvVqSybVGuoD:xhCgeXTtsFST", "GamYBkRElCCY:CFRHRROHlsrY", "zeGrfdhyrtfY:AwSFrczizYsZ", "bivTEnLISOyR:DQLoKikEWJON", "FWMGCfVJcJjV:IJFxXGDqhDRK", "yqDulLursWuk:CKieNAUmgcZM", "TeXIZDsXBEJJ:gQSevIHOVxrd", "iYgqvHkNlGjJ:WbSYJNhlJxbZ" ] } } if ARGV[0] == 'config' File.open('config.json', 'w+') do |f| f.puts default_config puts "[+] config.json made, you can now edit it" exit end end begin $conf = JSON.parse(File.read("config.json")) rescue Exception puts "[-] Something went wrong loading your config.json file" exit end #Make ctrl+c exit whole script trap "INT" do Thread.list.each do |thread| thread.exit unless thread == Thread.current end exit end #get rid of annoying messages ouput_manager = StringIO.new $stdout = ouput_manager $stderr = ouput_manager module Kernel def puts(msg) #if msg[0] == "[" ::STDOUT.printf(msg + "\n") #end end end module Pokeplot include Database Database.mongo_host = $conf["mongo"]["host"] #Socket and notifications must come before miner to capture its database requests if $conf["socket"]["enabled"] s = Socket.new($conf["socket"]["host"], $conf["socket"]["port"], $conf["socket"]["log"]) Database.mongo_monitor(s) end if $conf["pushbullet"]["enabled"] pb = Pushbullet.new($conf["pushbullet"]["api_key"], $conf["pushbullet"]["pokemon"]) Database.mongo_monitor(pb) end if $conf['combos'].is_a?(Array) && $conf['combos'].count > 0 $conf['combos'].each do |c| c = c.split(':') $conf['accounts'] << {'username' => c[0], 'password' => c[1], 'provider' => 'ptc'} end end if $conf["miner"]["enabled"] miner = Miner.new($conf['accounts'], $conf['location'][0], $conf['location'][1], $conf['miner']['range'], $conf['miner']['interval'], $conf['miner']['pokemon'], $conf['miner']['forts'], $conf['miner']['threaded'], $conf['api']['encryption_path'], $conf['miner']['log'], $conf['api']['log']) miner.start end if $conf["webserver"]["enabled"] web = Thread.new do Web.config($conf["webserver"]["host"], $conf["webserver"]["port"]) Web.run! end end # Join thread so it doesnt exit script if miner.is_a?(Miner) && miner.miner.is_a?(Thread) puts "[+] Joining thread" miner.miner.join end if web && web.is_a?(Thread) puts "[+] Joining thread" web.join end end