1.1.7. client_rpc
¶
This module facilitates communication with the server application over the RPC interface.
1.1.7.1. Data¶
1.1.7.2. Functions¶
-
vte_child_routine
(config)[source]¶ This is the method which is executed within the child process spawned by VTE. It expects additional values to be set in the config object so it can initialize a new
KingPhisherRPCClient
instance. It will then drop into an interpreter where the user may directly interact with the rpc object.Parameters: config (str) – A JSON encoded client configuration.
1.1.7.3. Classes¶
-
class
KingPhisherRPCClient
(*args, **kwargs)[source]¶ Bases:
advancedhttpserver.RPCClientCached
The main RPC object for communicating with the King Phisher Server over RPC.
-
geoip_lookup
(ip)[source]¶ Look up the geographic location information for the specified IP address in the server’s geoip database.
Parameters: ip ( ipaddress.IPv4Address
, str) – The IP address to lookup.Returns: The geographic location information for the specified IP address. Return type: GeoLocation
-
geoip_lookup_multi
(ips)[source]¶ Look up the geographic location information for the specified IP addresses in the server’s geoip database. Because results are cached for optimal performance, IP addresses to be queried should be grouped and sorted in a way that is unlikely to change, i.e. by a timestamp.
Parameters: ips (list, set, tuple) – The IP addresses to lookup. Returns: The geographic location information for the specified IP address. Return type: dict
-
get_tag_model
(tag_table, model=None)[source]¶ Load tag information from a remote table into a
Gtk.ListStore
instance. Tables compatible with the tag interface must have id, name and description fields. If no model is provided a new one will be created, else the current model will be cleared.Parameters: - tag_table (str) – The name of the table to load tag information from.
- model (
Gtk.ListStore
) – The model to place the information into.
Returns: The model with the loaded data from the server.
Return type:
-
graphql
(query, query_vars=None)[source]¶ Execute a GraphQL query on the server and return the results. This will raise
KingPhisherGraphQLQueryError
if the query fails.Parameters: - query (str) – The GraphQL query string to execute.
- query_vars – The variables for query.
Returns: The query results.
Return type:
-
graphql_file
(file_or_path, query_vars=None)[source]¶ This method wraps
graphql()
to provide a convenient way to execute GraphQL queries from files.Parameters: - file_or_path – The file object or path to the file from which to read.
- query_vars – The variables for query.
Returns: The query results.
Return type:
-
graphql_find_file
(query_file, **query_vars)[source]¶ This method is similar to
graphql_file()
. The first argument (query_file) is the name of a query file that will be located usingfind.data_file()
. Additional keyword arguments are passed as the variables to the query.Parameters: - query_file (str) – The name of the query file to locate.
- query_vars – These keyword arguments are passed as the variables to the query.
Returns: The query results.
Return type:
-
login
(username, password, otp=None)[source]¶ Authenticate to the remote server. This is required before calling RPC methods which require an authenticated session.
Parameters: Returns: The login result and an accompanying reason.
Return type:
-
ping
()[source]¶ Call the ping RPC method on the remote server to ensure that it is responsive. On success this method will always return True, otherwise an exception will be thrown.
Returns: True Return type: bool
-
remote_row_resolve
(row)[source]¶ Take a
RemoteRow
instance and load all fields which areUNRESOLVED
. If all fields are present, no modifications are made.Parameters: row – The row who’s data is to be resolved. Return type: RemoteRow
Returns: The row with all of it’s fields fully resolved. Return type: RemoteRow
-
remote_table
(table, query_filter=None)[source]¶ Iterate over a remote database table hosted on the server. Rows are yielded as named tuples whose fields are the columns of the specified table.
Parameters: table (str) – The table name to retrieve. Returns: A generator which yields rows of named tuples. Return type: tuple
-