Skip to content

Commit

Permalink
Cosmetic changes to comments:
Browse files Browse the repository at this point in the history
  * s/Anonymity Profile/Anonymity Profiles
  * s/AP/Anonymity Profiles
  * add "section-" to RFC section links
  • Loading branch information
juga0 committed Jul 17, 2017
1 parent 453d212 commit 3438760
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 28 deletions.
2 changes: 1 addition & 1 deletion dhcpcanon/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
__author__ = "juga"
__author_mail__ = "juga@riseup.net"
__description__ = "DHCP client disclosing less identifying information"
__long_description__ = "Python implmentation of the DHCP Anonymity Profile \
__long_description__ = "Python implmentation of the DHCP Anonymity Profiles \
(RFC7844) designed for users that \
wish to remain anonymous to the visited network \
minimizing disclosure of identifying information."
Expand Down
18 changes: 9 additions & 9 deletions dhcpcanon/dhcpcap.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,12 @@ def gen_udp(self):
def gen_bootp(self):
"""Generates BOOTP layer part of DHCP packet.
[ :rfc:`7844#3.4` ] ::
[ :rfc:`7844#section-3.4` ] ::
The presence of this address is necessary for the proper operation
of the DHCP service.
[:rfc:`7844#3.`] ::
[:rfc:`7844#section-3.`] ::
MAY contain the Client Identifier option,
"""
Expand All @@ -123,14 +123,14 @@ def gen_discover(self):
"""
Generate DHCP DISCOVER packet.
[:rfc:`7844#3.1`] ::
[:rfc:`7844#section-3.1`] ::
SHOULD randomize the ordering of options
If this can not be implemented
MAY order the options by option code number (lowest to highest).
[:rfc:`7844#3.`] ::
[:rfc:`7844#section-3.`] ::
MAY contain the Parameter Request List option.
"""
Expand All @@ -150,14 +150,14 @@ def gen_request(self):
"""
Generate DHCP REQUEST packet.
[:rfc:`7844#3.1`] ::
[:rfc:`7844#section-3.1`] ::
SHOULD randomize the ordering of options
If this can not be implemented
MAY order the options by option code number (lowest to highest).
[:rfc:`7844#3.`] ::
[:rfc:`7844#section-3.`] ::
MAY contain the Parameter Request List option.
If in response to a DHCPOFFER,::
Expand Down Expand Up @@ -204,7 +204,7 @@ def gen_decline(self):
"""
Generate DHCP decline packet (broadcast).
[:rfc:`7844#3.`] ::
[:rfc:`7844#section-3.`] ::
MUST contain the Message Type option,
MUST contain the Server Identifier option,
Expand All @@ -231,7 +231,7 @@ def gen_release(self):
"""
Generate DHCP release packet (broadcast?).
[:rfc:`7844#3.`] ::
[:rfc:`7844#section-3.`] ::
MUST contain the Message Type option and
MUST contain the Server Identifier option,
Expand All @@ -256,7 +256,7 @@ def gen_inform(self):
"""
Generate DHCP inform packet (unicast).
[:rfc:`7844#3.`] ::
[:rfc:`7844#section-3.`] ::
MUST contain the Message Type option,
Expand Down
18 changes: 9 additions & 9 deletions dhcpcanon/dhcpcapfsm.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# vim:ts=4:sw=4:expandtab
# Copyright 2016, 2017 juga (juga at riseup dot net), MIT license.
"""DCHP client implementation of the Anonymity Profile [:rfc:`7844`]."""
"""DCHP client implementation of the Anonymity Profiles [:rfc:`7844`]."""
from __future__ import absolute_import, unicode_literals

import logging
Expand Down Expand Up @@ -79,7 +79,7 @@ def __init__(self, iface=None, server_port=None,
debug_level=5, *args, **kargs):
"""Overwrites Automaton __init__ method.
[ :rfc:`7844#3.4` ] ::
[ :rfc:`7844#section-3.4` ] ::
If the hardware address is reset to a new
randomized value, the DHCP client SHOULD use the new randomized
value in the DHCP messages
Expand Down Expand Up @@ -168,12 +168,12 @@ def send_discover(self):
def select_offer(self):
"""Select an offer from the offers received.
[:rfc:`2131#4.2`]::
[:rfc:`2131#section-4.2`]::
DHCP clients are free to use any strategy in selecting a DHCP
server among those from which the client receives a DHCPOFFER.
[:rfc:`2131#4.4.1`]::
[:rfc:`2131#section-4.4.1`]::
The time
over which the client collects messages and the mechanism used to
Expand Down Expand Up @@ -239,7 +239,7 @@ def set_timers(self):
def process_received_ack(self, pkt):
"""Process a received ACK packet.
Not specifiyed in[:rfc:`7844`], [:rfc:`2131#2.2.`]::
Not specifiyed in[:rfc:`7844`], [:rfc:`2131#section-2.2.`]::
the allocating
server SHOULD probe the reused address before allocating the
Expand Down Expand Up @@ -283,7 +283,7 @@ def INIT(self):
if self.current_state is not STATE_PREINIT:
self.reset()
self.current_state = STATE_INIT
# [:rfc:`2131#4.4.1`]::
# [:rfc:`2131#section-4.4.1`]::
# The client SHOULD wait a random time between one and ten
# seconds to desynchronize the use of DHCP at startup
if self.delay_selecting is None:
Expand Down Expand Up @@ -337,7 +337,7 @@ def on_select_offer(self):
def timeout_selecting(self):
"""Timeout of selecting on SELECTING state.
Not specifiyed in [:rfc:`7844#`].See comments in
Not specifiyed in [:rfc:`7844#section-`].See comments in
:func:`dhcpcapfsm.DHCPCAPFSM.timeout_request`.
"""
Expand Down Expand Up @@ -406,7 +406,7 @@ def timeout_requesting(self):
Not specifiyed in [:rfc:`7844`]
[:rfc:`2131#3.1`]::
[:rfc:`2131#section-3.1`]::
might retransmit the
DHCPREQUEST message four times, for a total delay of 60 seconds
Expand Down Expand Up @@ -526,7 +526,7 @@ def lease_expires(self):
"""Timeout of lease on REBINDING state.
Not sending DHCPRELEASE to minimize deanonymization
[:rfc:`2131#4.4.6`]::
[:rfc:`2131#section-4.4.6`]::
Note that the correct operation
of DHCP does not depend on the transmission of DHCPRELEASE.
Expand Down
2 changes: 1 addition & 1 deletion dhcpcanon/dhcpcaplease.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def set_times(self, sent_dt):
"""
Set timers for the lease given the time in which the request was sent.
[:rfc:`2131#4.4.1`]::
[:rfc:`2131#section-4.4.1`]::
The client records the lease expiration time
as the sum of the time at which the original request was
Expand Down
18 changes: 11 additions & 7 deletions dhcpcanon/timers.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def nowutc():
def gen_delay_selecting():
"""Generate the delay in seconds in which the DISCOVER will be sent.
[:rfc:`2131#4.4.1`]::
[:rfc:`2131#section-4.4.1`]::
The client SHOULD wait a random time between one and ten seconds to
desynchronize the use of DHCP at startup.
Expand All @@ -50,12 +50,12 @@ def gen_delay_selecting():
def gen_timeout_resend(attempts):
"""Generate the time in seconds in which DHCPDISCOVER wil be retransmited.
[:rfc:`2131#3.1`]::
[:rfc:`2131#section-3.1`]::
might retransmit the
DHCPREQUEST message four times, for a total delay of 60 seconds
[:rfc:`2131#4.1`]::
[:rfc:`2131#section-4.1`]::
For example, in a 10Mb/sec Ethernet
internetwork, the delay before the first retransmission SHOULD be 4
Expand All @@ -77,7 +77,7 @@ def gen_timeout_resend(attempts):
def gen_timeout_request_renew(lease):
"""Generate time in seconds to retransmit DHCPREQUEST.
[:rfc:`2131#4..4.5`]::
[:rfc:`2131#section-4..4.5`]::
In both RENEWING and REBINDING states,
if the client receives no response to its DHCPREQUEST
Expand Down Expand Up @@ -109,7 +109,7 @@ def gen_timeout_request_rebind(lease):
def gen_renewing_time(lease_time, elapsed=0):
"""Generate RENEWING time.
[:rfc:`2131#4.4.5`]::
[:rfc:`2131#section-4.4.5`]::
T1
defaults to (0.5 * duration_of_lease). T2 defaults to (0.875 *
Expand All @@ -119,7 +119,9 @@ def gen_renewing_time(lease_time, elapsed=0):
"""
renewing_time = int(lease_time) * RENEW_PERC - elapsed
# FIXME:80 the random intervals here could deanonymize
# FIXME:80 [:rfc:`2131#section-4.4.5`]: the chosen "fuzz" could fingerprint
# the implementation
# NOTE: here using same "fuzz" as systemd?
range_fuzz = int(lease_time) * REBIND_PERC - renewing_time
logger.debug('rebinding fuzz range %s', range_fuzz)
fuzz = random.uniform(-(range_fuzz),
Expand All @@ -132,7 +134,9 @@ def gen_renewing_time(lease_time, elapsed=0):
def gen_rebinding_time(lease_time, elapsed=0):
"""."""
rebinding_time = int(lease_time) * REBIND_PERC - elapsed
# FIXME:90 the random intervals here could deanonymize
# FIXME:90 [:rfc:`2131#section-4.4.5`]: the chosen "fuzz" could fingerprint
# the implementation
# NOTE: here using same "fuzz" as systemd?
range_fuzz = int(lease_time) - rebinding_time
logger.debug('rebinding fuzz range %s', range_fuzz)
fuzz = random.uniform(-(range_fuzz),
Expand Down
2 changes: 1 addition & 1 deletion man/dhcpcanon.8
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ dhcpcanon \- DHCP Client Anonymity profile
.SH SYNOPSIS
dhcpcanon [-h] [-d] [-l LEASE] [-v] [interface]
.SH DESCRIPTION
dhcpcanon is a DCHP client implementation of the DHCP Anonymity Profile (RFC7844).
dhcpcanon is a DCHP client implementation of the DHCP Anonymity Profiles (RFC7844).
using Scapy Automaton.
.SH OPTIONS
The options which apply to the dhcpcanon command are:
Expand Down

0 comments on commit 3438760

Please sign in to comment.