Commands¶
These commands could be built by the end-user along with Controller.request()
but the faster way is to use the corresponding wrapper provided on the Controller.
Base command class¶
- class aiostem.command.Command[source]¶
Bases:
objectBase class for all commands.
-
ADAPTER:
ClassVar[TypeAdapter[Self] |None] = None¶ Cached adapter used while serializing the command.
-
command:
ClassVar[CommandWord]¶ Command word this command is for.
- classmethod adapter() TypeAdapter[Self][source]¶
Get a cached type adapter to serialize a command.
- Return type:
-
ADAPTER:
Authentication commands¶
- class aiostem.command.CommandAuthenticate[source]¶
Bases:
CommandCommand implementation for
AUTHENTICATE.This command is used to authenticate to the server.
See also
-
command:
ClassVar[CommandWord] = 'AUTHENTICATE'¶ Command word this command is for.
-
command:
- class aiostem.command.CommandAuthChallenge[source]¶
Bases:
CommandCommand implementation for
AUTHCHALLENGE.This command is used to begin the authentication routine for the
SAFECOOKIEauthentication method.-
command:
ClassVar[CommandWord] = 'AUTHCHALLENGE'¶ Command word this command is for.
-
command:
Configuration commands¶
- class aiostem.command.CommandGetConf[source]¶
Bases:
CommandCommand implementation for
GETCONF.Request the value of zero or more configuration variable(s).
-
command:
ClassVar[CommandWord] = 'GETCONF'¶ Command word this command is for.
-
keywords:
MutableSequence[str]¶ List of configuration keys to request (duplicates mean duplicate answers).
-
command:
- class aiostem.command.CommandLoadConf[source]¶
Bases:
CommandCommand implementation for
LOADCONF.This command allows a controller to upload the text of a config file to Tor over the control port. This config file is then loaded as if it had been read from disk.
-
command:
ClassVar[CommandWord] = 'LOADCONF'¶ Command word this command is for.
-
command:
- class aiostem.command.CommandResetConf[source]¶
Bases:
CommandSetConfCommand implementation for
RESETCONF.Remove all settings for a given configuration option entirely, assign its default value (if any), and then assign the value provided.
-
command:
ClassVar[CommandWord] = 'RESETCONF'¶ Command word this command is for.
-
command:
- class aiostem.command.CommandSaveConf[source]¶
Bases:
CommandCommand implementation for
SAVECONF.Instructs the server to write out its configuration options into
torrc.-
command:
ClassVar[CommandWord] = 'SAVECONF'¶ Command word this command is for.
-
force:
bool= False¶ If
%includeis used ontorrc,SAVECONFwill not write the configuration to disk. When set, the configuration will be overwritten even if %include is used. You can find out whether this flag is needed usingconfig-can-saveconfonCommandGetInfo.
-
command:
- class aiostem.command.CommandSetConf[source]¶
Bases:
CommandCommand implementation for
SETCONF.Change the value of one or more configuration variables.
-
command:
ClassVar[CommandWord] = 'SETCONF'¶ Command word this command is for.
-
values:
MutableMapping[str,MutableSequence[int|str] |int|str|None]¶ All the configuration values you want to set.
-
command:
Streams and circuits¶
- class aiostem.command.CommandAttachStream[source]¶
Bases:
CommandCommand implementation for
ATTACHSTREAM.This message informs the server that the specified
streamshould be associated with thecircuit.-
command:
ClassVar[CommandWord] = 'ATTACHSTREAM'¶ Command word this command is for.
-
command:
- class aiostem.command.CommandCloseCircuit[source]¶
Bases:
CommandCommand implementation for
CLOSECIRCUIT.Tells the server to close the specified circuit.
When
if_unusedisTrue, do not close the circuit unless it is unused.-
command:
ClassVar[CommandWord] = 'CLOSECIRCUIT'¶ Command word this command is for.
-
command:
- class aiostem.command.CommandCloseStream[source]¶
Bases:
CommandCommand implementation for
CLOSESTREAM.Tells the server to close the specified
stream.-
command:
ClassVar[CommandWord] = 'CLOSESTREAM'¶ Command word this command is for.
-
reason:
StreamCloseReasonInt¶ Provide a reason for the stream to be closed.
-
command:
- class aiostem.command.CommandDropGuards[source]¶
Bases:
CommandCommand implementation for
DROPGUARDS.Tells the server to drop all guard nodes.
Warning
Do not invoke this command lightly; it can increase vulnerability to tracking attacks over time.
-
command:
ClassVar[CommandWord] = 'DROPGUARDS'¶ Command word this command is for.
-
command:
- class aiostem.command.CommandExtendCircuit[source]¶
Bases:
CommandCommand implementation for
EXTENDCIRCUIT.This request takes one of two forms: either
circuitis zero, in which case it is a request for the server to build a new circuit, orcircuitis nonzero, in which case it is a request for the server to extend an existing circuit with that ID according to the specified path provided inservers.-
command:
ClassVar[CommandWord] = 'EXTENDCIRCUIT'¶ Command word this command is for.
-
servers:
Annotated[MutableSequence[LongServerName]]¶ List of servers to extend the circuit onto (or no server).
-
command:
- class aiostem.command.CommandRedirectStream[source]¶
Bases:
CommandCommand implementation for
REDIRECTSTREAM.Tells the server to change the exit address on the specified stream. If
portis specified, changes the destination port as well.No remapping is performed on the new provided address.
-
command:
ClassVar[CommandWord] = 'REDIRECTSTREAM'¶ Command word this command is for.
-
command:
- class aiostem.command.CommandSetCircuitPurpose[source]¶
Bases:
CommandCommand implementation for
SETCIRCUITPURPOSE.This changes the descriptor’s purpose.
- Hints:
See
CommandPostDescriptorfor more details onpurpose.
-
command:
ClassVar[CommandWord] = 'SETCIRCUITPURPOSE'¶ Command word this command is for.
Control commands¶
These commands have near to no side effect on the network but are used internally.
- class aiostem.command.CommandDropOwnership[source]¶
Bases:
CommandCommand implementation for
DROPOWNERSHIP.This command instructs Tor to relinquish ownership of its control connection. As such tor will not shut down when this control connection is closed.
-
command:
ClassVar[CommandWord] = 'DROPOWNERSHIP'¶ Command word this command is for.
-
command:
- class aiostem.command.CommandDropTimeouts[source]¶
Bases:
CommandCommand implementation for
DROPTIMEOUTS.Tells the server to drop all circuit build times.
Warning
Do not invoke this command lightly; it can increase vulnerability to tracking attacks over time.
-
command:
ClassVar[CommandWord] = 'DROPTIMEOUTS'¶ Command word this command is for.
-
command:
- class aiostem.command.CommandGetInfo[source]¶
Bases:
CommandCommand implementation for
GETINFO.Unlike
GETCONFthis message is used for data that are not stored in the Tor configuration file, and that may be longer than a single line.-
command:
ClassVar[CommandWord] = 'GETINFO'¶ Command word this command is for.
-
keywords:
MutableSequence[str]¶ List of keywords to request the value from. One or more must be provided.
-
command:
- class aiostem.command.CommandMapAddress[source]¶
Bases:
CommandCommand implementation for
MAPADDRESS.The client sends this message to the server in order to tell it that future SOCKS requests for connections to the original address should be replaced with connections to the specified replacement address.
-
command:
ClassVar[CommandWord] = 'MAPADDRESS'¶ Command word this command is for.
-
addresses:
MutableMapping[AnyHost,AnyHost]¶ Map of addresses to remap on socks requests.
-
command:
- class aiostem.command.CommandProtocolInfo[source]¶
Bases:
CommandCommand implementation for
PROTOCOLINFO.This command tells the controller what kinds of authentication are supported.
-
command:
ClassVar[CommandWord] = 'PROTOCOLINFO'¶ Command word this command is for.
-
command:
- class aiostem.command.CommandQuit[source]¶
Bases:
CommandCommand implementation for
QUIT.Tells the server to hang up on this controller connection.
-
command:
ClassVar[CommandWord] = 'QUIT'¶ Command word this command is for.
-
command:
- class aiostem.command.CommandResolve[source]¶
Bases:
CommandCommand implementation for
RESOLVE.This command launches a remote hostname lookup request for every specified request (or reverse lookup if
reverseis specified). Note that the request is done in the background: to see the answers, your controller will need to listen forEventWord.ADDRMAPevents.-
command:
ClassVar[CommandWord] = 'RESOLVE'¶ Command word this command is for.
-
addresses:
MutableSequence[AnyHost]¶ List of addresses get a resolution for.
-
command:
- class aiostem.command.CommandSetEvents[source]¶
Bases:
CommandCommand implementation for
SETEVENTS.Request the server to inform the client about interesting events.
See also
-
command:
ClassVar[CommandWord] = 'SETEVENTS'¶ Command word this command is for.
-
command:
- class aiostem.command.CommandSignal[source]¶
Bases:
CommandCommand implementation for
SIGNAL.Send a signal to Tor.
-
command:
ClassVar[CommandWord] = 'SIGNAL'¶ Command word this command is for.
-
command:
- class aiostem.command.CommandTakeOwnership[source]¶
Bases:
CommandCommand implementation for
TAKEOWNERSHIP.This command instructs Tor to shut down when this control connection is closed. It affects each control connection that sends it independently; if multiple control connections send the
TAKEOWNERSHIPcommand to a Tor instance, Tor will shut down when any of those connections closes.-
command:
ClassVar[CommandWord] = 'TAKEOWNERSHIP'¶ Command word this command is for.
-
command:
- class aiostem.command.CommandUseFeature[source]¶
Bases:
CommandCommand implementation for
USEFEATURE.Adding additional features to the control protocol sometimes will break backwards compatibility. Initially such features are added into Tor and disabled by default.
USEFEATUREcan enable these additional features.Note
To get a list of available features please use
features/nameswithCommandGetInfo.-
command:
ClassVar[CommandWord] = 'USEFEATURE'¶ Command word this command is for.
-
command:
Bridge commands¶
- class aiostem.command.CommandPostDescriptor[source]¶
Bases:
CommandCommand implementation for
POSTDESCRIPTOR.-
command:
ClassVar[CommandWord] = 'POSTDESCRIPTOR'¶ Command word this command is for.
-
purpose:
DescriptorPurpose|None= None¶ Purpose of the provided descriptor.
-
command:
Command serializer¶
- class aiostem.command.CommandSerializer[source]¶
Helper class used to serialize an existing command.
- __init__(name: CommandWord) None[source]¶
Create a new command serializer.
This is used internally by
Command.serialize().- Parameters:
name (
CommandWord) – The command name.
- serialize() str[source]¶
Serialize the arguments to a string.
- Returns:
str– Text that can be pushed to the server.
- property command: CommandWord¶
Get the command name for the underlying command.
- property arguments: MutableSequence[ArgumentKeyword | ArgumentString]¶
Get the list of command arguments.
Command names¶
- class aiostem.command.CommandWord[source]¶
Bases:
StrEnumAll handled command words.
- SETCONF = 'SETCONF'¶
Change the value of one or more configuration variables.
See also
Controller method:
Controller.set_conf()Command implementation:
CommandSetConfReply implementation:
ReplySetConf
- RESETCONF = 'RESETCONF'¶
Remove all settings for a given configuration option entirely.
See also
Controller method:
Controller.reset_conf()Command implementation:
CommandResetConfReply implementation:
ReplyResetConf
- GETCONF = 'GETCONF'¶
Request the value of zero or more configuration variable(s).
See also
Controller method:
Controller.get_conf()Command implementation:
CommandGetConfReply implementation:
ReplyGetConf
- SETEVENTS = 'SETEVENTS'¶
Request the server to inform the client about interesting events.
See also
Controller method:
Controller.set_events()Command implementation:
CommandSetEventsReply implementation:
ReplySetEvents
- AUTHENTICATE = 'AUTHENTICATE'¶
Used to authenticate to the server.
See also
Controller method:
Controller.authenticate()Command implementation:
CommandAuthenticateReply implementation:
ReplyAuthenticate
- SAVECONF = 'SAVECONF'¶
Instructs the server to write out its config options into its
torrc.See also
Controller method:
Controller.save_conf()Command implementation:
CommandSaveConfReply implementation:
ReplySaveConf
- SIGNAL = 'SIGNAL'¶
Send a signal to the server.
See also
Controller method:
Controller.signal()Command implementation:
CommandSignalReply implementation:
ReplySignal
- MAPADDRESS = 'MAPADDRESS'¶
Tell the server to replace addresses on future SOCKS requests.
See also
Controller method:
Controller.map_address()Command implementation:
CommandMapAddressReply implementation:
ReplyMapAddress
- GETINFO = 'GETINFO'¶
Get server information.
See also
Controller method:
Controller.get_info()Command implementation:
CommandGetInfoReply implementation:
ReplyGetInfo
- EXTENDCIRCUIT = 'EXTENDCIRCUIT'¶
Build a new or extend an existing circuit.
See also
Controller method:
Controller.extend_circuit()Command implementation:
CommandExtendCircuitReply implementation:
ReplyExtendCircuit
- SETCIRCUITPURPOSE = 'SETCIRCUITPURPOSE'¶
Change the purpose of a circuit.
See also
Controller method:
Controller.set_circuit_purpose()Command implementation:
CommandSetCircuitPurposeReply implementation:
ReplySetCircuitPurpose
- SETROUTERPURPOSE = 'SETROUTERPURPOSE'¶
Not implemented because it was marked as obsolete as of
Tor v0.2.0.8.
- ATTACHSTREAM = 'ATTACHSTREAM'¶
Request that the specified stream should be associated with the specified circuit.
See also
Controller method:
Controller.attach_stream()Command implementation:
CommandAttachStreamReply implementation:
ReplyAttachStream
- POSTDESCRIPTOR = 'POSTDESCRIPTOR'¶
This message informs the server about a new router descriptor.
See also
Controller method:
Controller.post_descriptor()Command implementation:
CommandPostDescriptorReply implementation:
ReplyPostDescriptor
- REDIRECTSTREAM = 'REDIRECTSTREAM'¶
Tells the server to change the exit address on the specified stream.
See also
Controller method:
Controller.redirect_stream()Command implementation:
CommandRedirectStreamReply implementation:
ReplyRedirectStream
- CLOSESTREAM = 'CLOSESTREAM'¶
Tells the server to close the specified stream.
See also
Controller method:
Controller.close_stream()Command implementation:
CommandCloseStreamReply implementation:
ReplyCloseStream
- CLOSECIRCUIT = 'CLOSECIRCUIT'¶
Tells the server to close the specified circuit.
See also
Controller method:
Controller.close_circuit()Command implementation:
CommandCloseCircuitReply implementation:
ReplyCloseCircuit
- QUIT = 'QUIT'¶
Tells the server to hang up on this controller connection.
See also
Controller method:
Controller.quit()Command implementation:
CommandQuitReply implementation:
ReplyQuit
- USEFEATURE = 'USEFEATURE'¶
Enable additional features.
See also
Command implementation:
CommandUseFeatureReply implementation:
ReplyUseFeature
- RESOLVE = 'RESOLVE'¶
This command launches a remote hostname lookup request for every specified request.
See also
Controller method:
Controller.resolve()Command implementation:
CommandResolveReply implementation:
ReplyResolve
- PROTOCOLINFO = 'PROTOCOLINFO'¶
This command tells the controller what kinds of authentication are supported.
See also
Controller method:
Controller.protocol_info()Command implementation:
CommandProtocolInfoReply implementation:
ReplyProtocolInfo
- LOADCONF = 'LOADCONF'¶
This command allows to upload the text of a config file to Tor over the control port.
See also
Controller method:
Controller.load_conf()Command implementation:
CommandLoadConfReply implementation:
ReplyLoadConf
- TAKEOWNERSHIP = 'TAKEOWNERSHIP'¶
Instructs Tor to shut down when this control connection is closed.
See also
Controller method:
Controller.take_ownership()Command implementation:
CommandTakeOwnershipReply implementation:
ReplyTakeOwnership
- AUTHCHALLENGE = 'AUTHCHALLENGE'¶
Begin the authentication routine for the SAFECOOKIE method.
See also
Controller method:
Controller.auth_challenge()Command implementation:
CommandAuthChallengeReply implementation:
ReplyAuthChallenge
- DROPGUARDS = 'DROPGUARDS'¶
Tells the server to drop all guard nodes.
See also
Controller method:
Controller.drop_guards()Command implementation:
CommandDropGuardsReply implementation:
ReplyDropGuards
- HSFETCH = 'HSFETCH'¶
Launches hidden service descriptor fetch(es).
See also
Controller method:
Controller.hs_fetch()Command implementation:
CommandHsFetchReply implementation:
ReplyHsFetch
- ADD_ONION = 'ADD_ONION'¶
Tells the server to create a new onion “hidden” service.
See also
Controller method:
Controller.add_onion()Command implementation:
CommandAddOnionReply implementation:
ReplyAddOnion
- DEL_ONION = 'DEL_ONION'¶
Tells the server to remove an onion “hidden” service.
See also
Controller method:
Controller.del_onion()Command implementation:
CommandDelOnionReply implementation:
ReplyDelOnion
- HSPOST = 'HSPOST'¶
This command launches a hidden service descriptor upload to the specified HSDirs.
See also
Controller method:
Controller.hs_post()Command implementation:
CommandHsPostReply implementation:
ReplyHsPost
- ONION_CLIENT_AUTH_ADD = 'ONION_CLIENT_AUTH_ADD'¶
Add client-side v3 client auth credentials for a onion service.
See also
Controller method:
Controller.onion_client_auth_add()Command implementation:
CommandOnionClientAuthAddReply implementation:
ReplyOnionClientAuthAdd
- ONION_CLIENT_AUTH_REMOVE = 'ONION_CLIENT_AUTH_REMOVE'¶
Remove client-side v3 client auth credentials for a onion service.
See also
Controller method:
Controller.onion_client_auth_remove()Command implementation:
CommandOnionClientAuthRemoveReply implementation:
ReplyOnionClientAuthRemove
- ONION_CLIENT_AUTH_VIEW = 'ONION_CLIENT_AUTH_VIEW'¶
List client-side v3 client auth credentials for a onion service.
See also
Controller method:
Controller.onion_client_auth_view()Command implementation:
CommandOnionClientAuthViewReply implementation:
ReplyOnionClientAuthView
- DROPOWNERSHIP = 'DROPOWNERSHIP'¶
This command instructs Tor to relinquish ownership of its control connection.
See also
Controller method:
Controller.drop_ownership()Command implementation:
CommandDropOwnershipReply implementation:
ReplyDropOwnership
- DROPTIMEOUTS = 'DROPTIMEOUTS'¶
Tells the server to drop all circuit build times.
See also
Controller method:
Controller.drop_timeouts()Command implementation:
CommandDropTimeoutsReply implementation:
ReplyDropTimeouts