Permalink
Browse files

Version 0.9.13

See Readme for changes..
  • Loading branch information...
1 parent ba044dd commit cb1817ddbf955261f3ff8a658fecaa34f095f1c7 ThPryrChn committed May 4, 2012
View
@@ -38,6 +38,24 @@ Solution 3: Use other iPhone4s DATA
+Version 0.9.13
+---------------------
+* iPhone 4S now is added to client table. That phone will most likely need the __com.apple.assistant.plist__ in order to get it in the database.
+
+* Fixes and tweeks.
+
+ Better iPad 3 key tracking. Will be counted in max connections if *try_iPad3* is enabled.
+
+ When you ask "How many keys are avalible" it will tell you how many of each are avalible.
+
+* New option in config.yml
+
+ `clients_must_be_in_database` When set to "true", this will only allow a device that is in the users database to connect on a public server… Making it semi-private. The client will most likely have to delete their `com.apple.assistant.plist` in order to use the server. This setting doesn't apply to 4S's.
+
+ ** Update How **
+
+ From Version 0.9.12, a `siriproxy update` will work fine, and if you want to add the new option in your config.yml, you can, but it will work just fine without it. If you are upgrading from an earlier version, follow the instructions in the Version 0.9.12.
+
View
@@ -51,6 +51,10 @@ server2: 'your.siri.proxy.server.com'
# thus denying access
private_server: 'OFF'
+#To make a Public server - less public, where the client needs to be in database, make clients_must_be_in_database true.
+#Note: The client will have to delete their com.apple.assistant.plist before they use your server.
+clients_must_be_in_database: false
+
#For your email configuration. Edit to your email address and set send_email to 'ON'.
#Also plase notice that you have to configure sendmail for you pc if its required
View
@@ -70,17 +70,18 @@ def quit_on_int
$clientsDao.connect_to_db($my_db)
#Print email config
- if $APP_CONFIG.send_email=='ON' or $APP_CONFIG.send_email=='on'
+ if $APP_CONFIG.send_email.to_s.upcase == 'ON'
puts '[Info - SiriProxy] Email notifications are [ON]!'
else
puts '[Info - SiriProxy] Email notifications are [OFF]!'
end
#Print the server if its publc or not
- if $APP_CONFIG.private_server=="ON" or $APP_CONFIG.private_server=="on"
- puts '[Info - SiriProxy] Private Server [ON]!'
+ if $APP_CONFIG.private_server.to_s.upcase == "ON"
+ puts '[Info - SiriProxy] This is a Private Server!'
else
- puts '[Info - SiriProxy] Private Server [OFF]!'
+ puts '[Info - SiriProxy] This is a PUBLIC Server!' if $APP_CONFIG.clients_must_be_in_database != true
+ puts '[Info - SiriProxy] This is a PUBLIC Server with only clients in Database!' if $APP_CONFIG.clients_must_be_in_database == true
end
#Set default to prevent errors.
if $APP_CONFIG.hours_till_key_expires==nil
@@ -140,19 +141,19 @@ def quit_on_int
$statistics.elapsed+=@timer
$statistics.uptime+=@timer
$statistics.happy_hour_elapsed+=@timer
- #if there is autokeyban to off there is no need for happy hour
- if $APP_CONFIG.enable_auto_key_ban=='OFF' or $APP_CONFIG.enable_auto_key_ban=='OFF'
+ #if the autokeyban is not "ON" there is no need for happy hour
+ if $APP_CONFIG.enable_auto_key_ban.to_s.upcase != 'ON'
$statistics.happy_hour_elapsed=0
end
#Happy hour enabler only if autokeyban is on
- if $statistics.happy_hour_elapsed > $APP_CONFIG.happy_hour_countdown and ($APP_CONFIG.enable_auto_key_ban=='ON' or $APP_CONFIG.enable_auto_key_ban=='on') and @unbanned==false
+ if $statistics.happy_hour_elapsed > $APP_CONFIG.happy_hour_countdown and $APP_CONFIG.enable_auto_key_ban.to_s.upcase == 'ON' and @unbanned==false
$keyDao.unban_keys
@unbanned=true
puts "[Happy hour - SiriProxy] Unbanning Keys and Doors are open"
end
#only when autokeyban is on
- if $statistics.happy_hour_elapsed > ($APP_CONFIG.happy_hour_countdown + 300) and ($APP_CONFIG.enable_auto_key_ban=='ON' or $APP_CONFIG.enable_auto_key_ban=='on') and @unbanned==true
+ if $statistics.happy_hour_elapsed > ($APP_CONFIG.happy_hour_countdown + 300) and $APP_CONFIG.enable_auto_key_ban.to_s.upcase == 'ON' and @unbanned==true
$keyDao.ban_keys
puts "[Happy hour - SiriProxy] Banning Keys and Doors are Closed"
$statistics.happy_hour_elapsed=0
@@ -178,7 +179,11 @@ def quit_on_int
$confDao.update($conf)
### Per Key based connections
@max_connections=$conf.max_connections
- @availablekeys=$keyDao.list4Skeys().count
+ if $APP_CONFIG.try_iPad3==true
+ @availablekeys=($keyDao.list4Skeys().count + $keyDao.listiPad3keys().count)
+ else
+ @availablekeys=$keyDao.list4Skeys().count
+ end
if @availablekeys==0 #this is not needed anymore!
@max_connections=700#max mem
elsif @availablekeys>0
@@ -47,7 +47,11 @@ def initialize
#puts pending_connect_timeout()
self.comm_inactivity_timeout=240 #very important and also depends on how many people connect!!!
##Checks For avalible keys before any object is loaded
- available_keys=$keyDao.list4Skeys().count
+ if $APP_CONFIG.try_iPad3==true
+ available_keys=($keyDao.list4Skeys().count + $keyDao.listiPad3keys().count)
+ else
+ available_keys=$keyDao.list4Skeys().count
+ end
if available_keys > 0
self.validationData_avail = true
else
@@ -81,26 +85,58 @@ def checkHave4SData(object)
key4s.iPad3='False'
if $keyDao.check_duplicate(key4s)
puts "[Info - SiriProxy] Duplicate Validation Data. Key NOT saved"
- #Reset The Key, so it will be vallid if it was marked expired by mistake
- # @key=key4s
- # @keystats=$keystatisticsDao.get_key_stats(@key)
- # $keyDao.validation_valid(@key)
- # @keystats.total_finishspeech_requests=0
- # @keystats.total_tokens_recieved=0
- # $keystatisticsDao.save_key_stats(@keystats)
-
else
$keyDao.insert(key4s)
puts "[Info - SiriProxy] Keys written to Database"
#also unban all keys available.
- if $APP_CONFIG.private_server=="ON" or $APP_CONFIG.private_server=="on"
+ if $APP_CONFIG.private_server.to_s.upcase == "ON"
$keyDao.unban_keys #unBan because a key was inserted! should spoof enough
puts "[Info - SiriProxy] New 4S Key added and keys set to unbanned"
end
end
else
puts "[Info - SiriProxy] Something went wrong. Please file this bug. Key NOT saved!"
end
+ ##This anow allows 4S phones to be enterend into client database.
+ begin
+
+ if object["class"]=="CreateAssistant" # now separates initial request to Loadassistant and Create Assistant
+ @createassistant=true
+ @assistant_found=false
+
+ elsif object["class"]=="LoadAssistant" and object["properties"]["assistantId"] !=nil and object["properties"]["speechId"] !=nil
+
+ @createassistant=false
+ @assistant_found=true
+ #grab assistant
+ @loadedassistant=object["properties"]["assistantId"]
+ @loadedspeechid=object["properties"]["speechId"]
+ @userassistant=Assistant.new
+ @userassistant.assistantid=@loadedassistant
+ @userassistant.speechid=@loadedspeechid
+ @userassistant.last_ip=@clientip
+ @userassistant=$assistantDao.check_duplicate(@userassistant) #check if there is a registerd assistant
+
+ if @userassistant!=nil #If there is one then
+
+ @userassistant.last_ip=@clientip
+ puts "[Authentification - SiriProxy] Registered Assistant Found "
+ @user=$clientsDao.find_by_assistant(@userassistant) #find the user with that assistant
+ if @user==nil #Incase this user doesnt exist!!!!!!! Bug or not complete transaction
+ puts "[Authentification - SiriProxy] No client for Assistant [#{@loadedassistant}] Found :-("
+ else
+ $assistantDao.updateassistant(@userassistant)
+ puts "[Authentification - SiriProxy] Access Granted! -> Client name:[#{@user.fname}] nickname[#{@user.nickname}] appleid[#{@user.appleAccountid}] Connected "
+ end
+ end
+
+
+ end
+
+ #rescue SystemCallError,NoMethodError
+ rescue SystemCallError
+ puts "[ERROR - SiriProxy] Something went wrong with the 4S session..."
+ end
end
@@ -133,7 +169,7 @@ def checkHaveiPad3Data(object)
$keyDao.insert(keyiPad3)
puts "[Info - SiriProxy] Keys written to Database"
#also unban all keys available.
- if $APP_CONFIG.private_server=="ON" or $APP_CONFIG.private_server=="on"
+ if $APP_CONFIG.private_server.to_s.upcase == "ON"
$keyDao.unban_keys #unBan because a key was inserted! should spoof enough
puts "[Info - SiriProxy] New iPad 3 Key added and keys set to unbanned"
end
@@ -263,7 +299,7 @@ def get_validationData(object)
else #if no assistant registed found
- if $APP_CONFIG.private_server=="ON" or $APP_CONFIG.private_server=="on"
+ if $APP_CONFIG.private_server.to_s.upcase=="ON" or $APP_CONFIG.clients_must_be_in_database==true
puts "[Authentification - SiriProxy] Assistant [#{@loadedassistant}] is not registered. Banning Connection"
self.validationData_avail = false
@@ -710,7 +746,7 @@ def prep_received_object(object)
@commandFailed=true
puts "[Warning - SiriProxy] Command Failed refid #{object["refId"]} and Creating? #{self.other_connection.createassistant}"
end#should join these
- if object["class"]=="CommandFailed" and self.other_connection.createassistant and self.other_connection.key!=nil and ($APP_CONFIG.enable_auto_key_ban=='ON' or $APP_CONFIG.enable_auto_key_ban=='on')
+ if object["class"]=="CommandFailed" and self.other_connection.createassistant and self.other_connection.key!=nil and $APP_CONFIG.enable_auto_key_ban.to_s.upcase == 'ON'
$keyDao.key_banned(self.other_connection.key)
puts "[Warning - SiriProxy] The key [#{self.other_connection.key.id}] Marked as Banned! Still serving with validation..."
#Should we close connections here? I
@@ -738,14 +774,14 @@ def prep_received_object(object)
end
#let record how many activation token get per key
- if object["class"]=="SetActivationToken" and self.name=="Guzzoni" and self.other_connection.key!=nil
+ if object["class"]=="SetActivationToken" and self.name=="Guzzoni" and self.other_connection.key!=nil and self.validationData_avail==true
puts '[Info - SiriProxy] Recieved token'
pp object
@activation_token_recieved=true
@activation_token=ActivationToken.new
@activation_token.aceid=object["aceId"]
@activation_token.data=object["properties"]["activationToken"]
- pp @activation_token
+ pp @activation_token if $LOG_LEVEL > 2
@keystats=$keystatisticsDao.get_key_stats(self.other_connection.key)
if @keystats==nil
$keystatisticsDao.insert(self.other_connection.key)
@@ -855,8 +891,7 @@ def prep_received_object(object)
@client.appleAccountid="NA" if @client.appleAccountid==nil
@client.valid="True" #needed if config in empy for the below
- @client.valid="False" if $APP_CONFIG.private_server=="ON" or $APP_CONFIG.private_server=="on"
- @client.valid="True" if $APP_CONFIG.private_server=="OFF" or $APP_CONFIG.private_server=="off"
+ @client.valid="False" if $APP_CONFIG.private_server.to_s.upcase == "ON" and self.is_4S!=true
#this must not be updated in onld clients from here
#pp @client
View
@@ -1,3 +1,3 @@
class SiriProxy
- VERSION = "0.9.12"
+ VERSION = "0.9.13"
end
@@ -30,17 +30,25 @@ def initialize(config)
#Essential for server status
listen_for /how many keys/i do
- @keysavailable=$keyDao.list4Skeys().count
- if @keysavailable==1
- say "There is one key available on the server" #say something to the user!
- request_completed #always complete your request! Otherwise the phone will "spin" at the user!
- elsif @keysavailable>0
- say "There are #{@keysavailable} keys available" #say something to the user!
- request_completed #always complete your request! Otherwise the phone will "spin" at the user!
+ @keysavailable4s=$keyDao.list4Skeys().count
+ @keysavailableipad3=$keyDao.listiPad3keys().count
+
+ if @keysavailable4s==1
+ say "There is one 4S key available on the server" #say something to the user!
+ elsif @keysavailable4s>0
+ say "There are #{@keysavailable4s} 4S keys available" #say something to the user!
else
- say "All keys are overloaded!" #say something to the user!
- request_completed #always complete your request! Otherwise the phone will "spin" at the user!
+ say "There are no 4s keys available" #say something to the user!
end
+ if @keysavailableipad3==1
+ say "There is one iPad 3 key available on the server" #say something to the user!
+ elsif @keysavailableipad3>0
+ say "There are #{@keysavailableipad3} iPad 3 keys available" #say something to the user!
+ else
+ say "There are no iPad 3 keys available" #say something to the user!
+ end
+ request_completed #always complete your request! Otherwise the phone will "spin" at the user!
+
end
listen_for /how many active connections/i do
@@ -3,8 +3,8 @@ $:.push File.expand_path("../lib", __FILE__)
Gem::Specification.new do |s|
s.name = "siriproxy-example"
- s.version = "0.0.1"
- s.authors = ["plamoni"]
+ s.version = "0.9.13"
+ s.authors = ["plamoni, jimmykane, thpryrchn"]
s.email = [""]
s.homepage = ""
s.summary = %q{An Example Siri Proxy Plugin}

0 comments on commit cb1817d

Please sign in to comment.