| Commit message (Collapse) | Author | Age |
| ... | |
| |\ \ \
| |/ / |
|
| | | |
| | |
| | |
| | |
| | |
| | | |
* FIXES a bug where bridgedb.Bridges.parseStatusFile() doesn't handle the
(None, None) for (ip, portlist) which is returned whenever
bridgedb.parse.networkstatus.parseALine() couldn't parse the line.
|
| | | | |
|
| |/ /
| |
| |
| |
| |
| |
| | |
The removed bridgedb.Bridges.parseORAddressLine() function was able to take a
networkstatus line which started with 'a' or didn't. It's a mess to change all
the code, so for now just log a warning when we recieve a line in
bridgedb.parse.networkstatus.parseALine() which doesn't start with 'a'.
|
| |\ \ |
|
| | | | |
|
| | | | |
|
| | | | |
|
| | | | |
|
| | | | |
|
| | | | |
|
| | | | |
|
| | | |
| | |
| | |
| | |
| | | |
We now use a CAPTCHA to weed out (most) scrapers. Also, improve
description of how bridges are selected based on filters and rings.
|
| | | | |
|
| | | |
| | |
| | |
| | |
| | | |
Bring the description inline with how the the implementation
handles the descriptors and bridges.
|
| | | |
| | |
| | |
| | |
| | |
| | | |
The "a" line in the network status is checked and signed by the
bridge authority, so we prefer this over the "or-address" line in
the bridge descriptor.
|
| | | |
| | |
| | |
| | |
| | |
| | | |
BridgeDB supports parsing extra-info documents which allows it to
retrieve information regarding the pluggable transports a bridge
accepts.
|
| | | | |
|
| |/ /
| |
| |
| |
| |
| | |
If we receive a descriptor for a bridge which was not listed in the
network status, then we should not use it. We do not use it, but
this is not obvious without some investigation. Make this obvious.
|
| |\ \ |
|
| |/ / |
|
| |\ \ |
|
| | | | |
|
| | | |
| | |
| | |
| | |
| | |
| | | |
Store the pre-base64-encoded value so that the checks are clearer if they
fail. Also, remove a str() around a couple `nick` values, they do not make a
difference now that the proper __future__ imports are in place.
|
| | | |
| | |
| | |
| | |
| | |
| | | |
This logic is not specific to parsing networkstatus descriptors, so for now
I've placed it in parse.parseUnpaddedBase64() ― though it could live somewhere
else later.
|
| | | |
| | |
| | |
| | |
| | | |
* CHANGE parse.padBase64() to only return a value if no exceptions were
raised during parsing.
|
| | | | |
|
| | |\ \
| | | |
| | | |
| | | | |
fix/9462-refactor-netstatus-parsers_r9462C_r2
|
| | | | | |
|
| | | | | |
|
| | | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
* FIXES two unittests which erroneously passed before the previous commit
which fixed #10333, and then erroneously failed after the fix. They should
now correctly test indexing the portlist.
|
| | |\ \ \
| | |/ /
| | | |
| | | | |
fix/9462-refactor-netstatus-parsers_r9462C_r2
|
| | |/ /
| | |
| | |
| | |
| | |
| | | |
The `long` in #10333 should index the PortList as a string, not an integer.
* FIXES #10333
|
| | | |
| | |
| | |
| | |
| | | |
In real `@type bridge-networkstatus` documents, the base64 fields are 27
characters in length, not 29 characters.
|
| | | | |
|
| | | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Because of the bug fixed in the last commit, two unittests in
`test_parse_networkstatus.ParseNetworkStatusRLineTests` now FAIL. They
are:
ø test_invalidDescriptorDigest_missingBase64padding
ø test_invalidIPAddress
|
| | | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
The trailing '='s in the "descriptor digest" field of an
`@type-bridge-networkstatus` descriptor are removed before placing them
in the descriptor. Therefore, before un-base64-encoding this field, we
must re-add the trailing '='s character padding back in, the same as we
already to for the "identity digest" field on that same descriptor line.
* FIXES a bug in function `bridgedb.parse.networkstatus.parseRLine()`
which resulted in the "descriptor digest" field (and all fields after
it on the 'r'-line) being set to `None`, due to a base64 decoding
error from missing '=' character padding.
|
| | | | |
|
| | | |
| | |
| | |
| | | |
* FIXES part of #9377
|
| | | | |
|
| | | | |
|
| | | | |
|
| | | |
| | |
| | |
| | |
| | |
| | | |
In the initialisor of Dist.IPBasedDistributor, the `ipCatagories` and
`answerParameters` both default to `None` and then they are immediately
iterated over.
|
| | | |
| | |
| | |
| | |
| | | |
General exceptions here are never raised, and all exceptions which are
raised are handled by the calling function, parseRLine().
|
| | | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
There were some cases raised within the unittests where, when the IP
address had failed to parse, `networkstatus.parseALine()` would return
an `addr.PortList` and `None` (for the IP). Having a PortList without an
IP address is useless, so instead we should deal with parsing the IP
first, and checking its validity. Then, if we have the IP, we should
parse and check the ports, then create the PortList.
* CHANGE logic of the bridgedb.parse.networkstatus.parseALine()
function so that all of the parsing takes place in one `try:`
block, and the `except`s catch any and all raised errors, logging
messages and reseting variables to None as appropriate.
* ADD a FutureWarning if we ever see a networkstatus document with a
valid IPc4 address as one of its `ORAddress`es, because this means
that tor/torspec and the descriptors have changed format.
* CHANGE networkstatus.parseALine() to only return a PortList if an IP
address was successfully parsed.
|
| | | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Rather than raising exceptions during parsing, we should try to log
appropriate messages. If the error had a known cause, i.e. one that is
due to a badly formatted descriptor, then we should make note of the
relevant information from the bad descriptor, and reset any affected
variables to None.
If the error is possibly do to a newly implemented change in the
descriptor format in tor, we should likewise log the event, generate a
loud warning about a possible descriptor format change, and continue as
before. In networkstatus documents and [bridge-]server-descriptors, it
is possible that the `ORAddress` lines may soon change (#9729):
1. to allow more than one ORAddress line, and
2. to allow extra IPv4 addresses in the ORAddress lines.
Additionally, remove exception and handlers which are never raised in
parseRLine().
1. The catch for `IndexError`s in networkstatus.parseRLine() is
removed:
At the beginning of `parseRLine()`, a `NetworkstatusParsingError` is
raised if there are less than eight fields in the descriptor, so
there is no way that an `IndexError` would ever get raised. Coverage
branch reports also show that this `except:` block is never touched.
2. Remove the `InvalidNetworkstatusDescriptorDigest` exception class:
…as well as all corresponding code for raising and handling it. The
way it was used, there is no possible way that these lines will get
executed, because the descriptor digest will either be a str or
None. If None, then an error is raised earlier for having too few
fields in the 'r'-line. If a str, then `binascii.a2b_base64() will
always produce some kind of string, and its exceptions are handled
separate. Therefore, there is no way for the descriptor digest to be
0, None, or False.
In `bridgedb.parse.networkstatus.parseRLine()` function:
* CHANGE to catch and handle all `InvalidNetworkstatusRouterIdentity`,
and `NetworkstatusParsingErrors`, exceptions raised during parsing.
* REMOVE unnecessary `except IndexError` block.
* REMOVE `InvalidNetworkstatusDescriptorDigest` exception class.
* CHANGE logging of caught exceptions to use `exc`, not
`exc.message`. The later has been deprecated since Python2.6.
|
| | | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
The lines following this one (i.e. ``stable = 'Stable' in flags``)
ensure that if a particular flags isn't present in the flags, then the
variable is false; there is no need to set each variable twice.
* REMOVE duplicate variable instantiation/setting from
bridgedb.parse.networkstatus.parseSLine() function.
|
| | | |
| | |
| | |
| | |
| | |
| | |
| | | |
Before, it was only printing whatever was originally found in the
networkstatus line, *not* which flags we had successfully parsed. Since
we only actually care that we are correctly able to parse relevant
flags, that is what the log message should contain.
|
| | | | |
|
| | | |
| | |
| | |
| | |
| | | |
It isn't used anywhere else, and it would be silly to import it from
here, so there is no reason to have it at the module level.
|