Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
T
tor-check
  • Project overview
    • Project overview
    • Details
    • Activity
  • Issues 8
    • Issues 8
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Value Stream
  • Wiki
    • Wiki
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Create a new issue
  • Jobs
  • Issue Boards

GitLab is used only for code review, issue tracking and project management. Canonical locations for source code are still https://gitweb.torproject.org/ https://git.torproject.org/ and git-rw.torproject.org.

  • The Tor Project
  • Web
  • tor-check
  • Issues
  • #9007

Closed
Open
Opened Jun 01, 2013 by Trac@tracbot

TorBulkExitList.py doesn't support all ports (patch included)

https://svn.torproject.org/svn/check/trunk/cgi-bin/TorBulkExitList.py

has this block:

    # Verify that the port is a number between 1 and 65535
    # Otherwise return a sane default of 80
    search = re.compile("^(?:[1-9]{1,4}|[1-5][0-9]{4}|6[0-4][0-9]{3}|"+\
                            "65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])$")

The comment is wrong; unfortunately; the regex fails for 4-digit-or-less numbers that contain 0, such as 8000, 102, or even 80. The only reason it supports port 80 at all is because it's the default. It declares port 80 invalid and uses the default of port 80 instead.

The least invasive fix would be to replace the third line with:

    search = re.compile("^(?:[1-9][0-9]{0,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|"+\

Which makes the regex do what the comment suggests.

A better solution would be to use something other than a regex to determine if a number is in a range, but I'll leave that as an exercise for the reader. :P

Trac:
Username: Zarel

Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: tpo/web/tor-check#9007