codingo / VHostScan

A virtual host scanner that performs reverse lookups, can be used with pivot tools, detect catch-all scenarios, work around wildcards, aliases and dynamic default pages.
GNU General Public License v3.0
1.2k stars 231 forks source link

Apply PEP8 convetion to the codebase #65

Closed diogoosorio closed 7 years ago

diogoosorio commented 7 years ago

As discussed in #61 tihs PR makes the codebase adhere to the standards defined on PEP8.

codingo commented 7 years ago

@diogoosorio I've done a bit of a tricky merge here (two PR's prior to this one) and although I can pass all manual tests, I believe I've broken the Travis CI build in a way I'm unsure of.

Here's the output, any ideas?:

Worker information hostname: c1067392-b1d1-4ca6-bf56-aee378e6ae3f@1.i-0aded76-production-2-worker-org-ec2.travisci.net version: v3.0.2 https://github.com/travis-ci/worker/tree/f1c05caed79c66a9103f12a22e8a45ec66dbca64 instance: fabb142:travis:python (via amqp) startup: 445.543584ms system_info Build system information Build language: python Build group: stable Build dist: trusty Build id: 285293965 Job id: 285293966 Runtime kernel version: 4.11.6-041106-generic travis-build version: 125c5d1fa Build image provisioning date and time Tue Aug 29 02:50:02 UTC 2017 Operating System Details Distributor ID: Ubuntu Description: Ubuntu 14.04.5 LTS Release: 14.04 Codename: trusty Cookbooks Version 4642454 https://github.com/travis-ci/travis-cookbooks/tree/4642454 git version git version 2.14.1 bash version GNU bash, version 4.3.11(1)-release (x86_64-pc-linux-gnu) gcc version gcc (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4 Copyright (C) 2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. docker version Client: Version: 17.03.1-ce API version: 1.27 Go version: go1.7.5 Git commit: c6d412e Built: Mon Mar 27 16:58:30 2017 OS/Arch: linux/amd64 clang version clang version 3.9.0 (tags/RELEASE_390/final) Target: x86_64-unknown-linux-gnu Thread model: posix InstalledDir: /usr/local/clang-3.9.0/bin jq version jq-1.5 bats version Bats 0.4.0 shellcheck version 0.4.6 shfmt version v1.3.1 ccache version ccache version 3.1.9 Copyright (C) 2002-2007 Andrew Tridgell Copyright (C) 2009-2011 Joel Rosdahl This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. cmake version cmake version 3.2.2 CMake suite maintained and supported by Kitware (kitware.com/cmake). heroku version heroku-cli/6.13.19-6cd27b3 (linux-x64) node-v8.3.0 imagemagick version Version: ImageMagick 6.7.7-10 2017-07-31 Q16 http://www.imagemagick.org md5deep version 4.2 mercurial version Mercurial Distributed SCM (version 4.2.2) (see https://mercurial-scm.org for more information) Copyright (C) 2005-2017 Matt Mackall and others This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. mysql version mysql Ver 14.14 Distrib 5.6.33, for debian-linux-gnu (x86_64) using EditLine wrapper openssl version OpenSSL 1.0.1f 6 Jan 2014 packer version Packer v1.0.2 Your version of Packer is out of date! The latest version is 1.0.4. You can update by downloading from www.packer.io postgresql client version psql (PostgreSQL) 9.6.4 ragel version Ragel State Machine Compiler version 6.8 Feb 2013 Copyright (c) 2001-2009 by Adrian Thurston subversion version svn, version 1.8.8 (r1568071) compiled Aug 10 2017, 17:20:39 on x86_64-pc-linux-gnu Copyright (C) 2013 The Apache Software Foundation. This software consists of contributions made by many people; see the NOTICE file for more information. Subversion is open source software, see http://subversion.apache.org/ The following repository access (RA) modules are available:

  • ra_svn : Module for accessing a repository using the svn network protocol.
    • with Cyrus SASL authentication
    • handles 'svn' scheme
  • ra_local : Module for accessing a repository on local disk.
    • handles 'file' scheme
  • ra_serf : Module for accessing a repository via WebDAV protocol using serf.
    • using serf 1.3.3
    • handles 'http' scheme
    • handles 'https' scheme sudo version Sudo version 1.8.9p5 Configure options: --prefix=/usr -v --with-all-insults --with-pam --with-fqdn --with-logging=syslog --with-logfac=authpriv --with-env-editor --with-editor=/usr/bin/editor --with-timeout=15 --with-password-timeout=0 --with-passprompt=[sudo] password for %p: --without-lecture --with-tty-tickets --disable-root-mailer --enable-admin-flag --with-sendmail=/usr/sbin/sendmail --with-timedir=/var/lib/sudo --mandir=/usr/share/man --libexecdir=/usr/lib/sudo --with-sssd --with-sssd-lib=/usr/lib/x8664-linux-gnu --with-selinux Sudoers policy plugin version 1.8.9p5 Sudoers file grammar version 43 Sudoers path: /etc/sudoers Authentication methods: 'pam' Syslog facility if syslog is being used for logging: authpriv Syslog priority to use when user authenticates successfully: notice Syslog priority to use when user authenticates unsuccessfully: alert Send mail if the user is not in sudoers Use a separate timestamp for each user/tty combo Lecture user the first time they run sudo Root may run sudo Allow some information gathering to give useful error messages Require fully-qualified hostnames in the sudoers file Visudo will honor the EDITOR environment variable Set the LOGNAME and USER environment variables Length at which to wrap log file lines (0 for no wrap): 80 Authentication timestamp timeout: 15.0 minutes Password prompt timeout: 0.0 minutes Number of tries to enter a password: 3 Umask to use or 0777 to use user's: 022 Path to mail program: /usr/sbin/sendmail Flags for mail program: -t Address to send mail to: root Subject line for mail messages: SECURITY information for %h Incorrect password message: Sorry, try again. Path to authentication timestamp dir: /var/lib/sudo Default password prompt: [sudo] password for %p: Default user to run commands as: root Value to override user's $PATH with: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin Path to the editor for use by visudo: /usr/bin/editor When to require a password for 'list' pseudocommand: any When to require a password for 'verify' pseudocommand: all File descriptors >= 3 will be closed before executing a command Environment variables to check for sanity: TZ TERM LINGUAS LC LANGUAGE LANG COLORTERM Environment variables to remove: RUBYOPT RUBYLIB PYTHONUSERBASE PYTHONINSPECT PYTHONPATH PYTHONHOME TMPPREFIX ZDOTDIR READNULLCMD NULLCMD FPATH PERL5DB PERL5OPT PERL5LIB PERLLIB PERLIO_DEBUG JAVA_TOOL_OPTIONS SHELLOPTS GLOBIGNORE PS4 BASH_ENV ENV TERMCAP TERMPATH TERMINFO_DIRS TERMINFO _RLD LD_* PATH_LOCALE NLSPATH HOSTALIASES RES_OPTIONS LOCALDOMAIN CDPATH IFS Environment variables to preserve: JAVA_HOME TRAVIS CI DEBIAN_FRONTEND XAUTHORIZATION XAUTHORITY PS2 PS1 PATH LS_COLORS KRB5CCNAME HOSTNAME HOME DISPLAY COLORS Locale to use while parsing sudoers: C Directory in which to store input/output logs: /var/log/sudo-io File in which to store the input/output log: %{seq} Add an entry to the utmp/utmpx file when allocating a pty PAM service name to use PAM service name to use for login shells Create a new PAM session for the command to run in Maximum I/O log sequence number: 0 Local IP address and netmask pairs: 172.17.0.2/255.255.0.0 Sudoers I/O plugin version 1.8.9p5 gzip version gzip 1.6 Copyright (C) 2007, 2010, 2011 Free Software Foundation, Inc. Copyright (C) 1993 Jean-loup Gailly. This is free software. You may redistribute copies of it under the terms of the GNU General Public License http://www.gnu.org/licenses/gpl.html. There is NO WARRANTY, to the extent permitted by law. Written by Jean-loup Gailly. zip version Copyright (c) 1990-2008 Info-ZIP - Type 'zip "-L"' for software license. This is Zip 3.0 (July 5th 2008), by Info-ZIP. Currently maintained by E. Gordon. Please send bug reports to the authors using the web page at www.info-zip.org; see README for details. Latest sources and executables are at ftp://ftp.info-zip.org/pub/infozip, as of above date; see http://www.info-zip.org/ for other sites. Compiled with gcc 4.8.2 for Unix (Linux ELF) on Oct 21 2013. Zip special compilation options: USE_EF_UT_TIME (store Universal Time) BZIP2_SUPPORT (bzip2 library version 1.0.6, 6-Sept-2010) bzip2 code and library copyright (c) Julian R Seward (See the bzip2 license for terms of use) SYMLINK_SUPPORT (symbolic links supported) LARGE_FILE_SUPPORT (can read and write large files on file system) ZIP64_SUPPORT (use Zip64 to store large files in archives) UNICODE_SUPPORT (store and read UTF-8 Unicode paths) STORE_UNIX_UIDs_GIDs (store UID/GID sizes/values using new extra field) UIDGID_NOT_16BIT (old Unix 16-bit UID/GID extra field not used) [encryption, version 2.91 of 05 Jan 2007] (modified for Zip 3) Encryption notice: The encryption code of this program is not copyrighted and is put in the public domain. It was originally written in Europe and, to the best of our knowledge, can be freely distributed in both source and object forms from any country, including the USA under License Exception TSU of the U.S. Export Administration Regulations (section 740.13(e)) of 6 June 2002. Zip environment options: ZIP: [none] ZIPOPT: [none] vim version VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Nov 24 2016 16:43:18) Included patches: 1-52 Extra patches: 8.0.0056 Modified by pkg-vim-maintainers@lists.alioth.debian.org Compiled by buildd@ Huge version without GUI. Features included (+) or not (-): +acl +farsi +mouse_netterm +syntax +arabic +file_in_path +mouse_sgr +tag_binary +autocmd +find_in_path -mouse_sysmouse +tag_old_static -balloon_eval +float +mouse_urxvt -tag_any_white -browse +folding +mouse_xterm -tcl ++builtin_terms -footer +multi_byte +terminfo +byte_offset +fork() +multi_lang +termresponse +cindent +gettext -mzscheme +textobjects -clientserver -hangul_input +netbeans_intg +title -clipboard +iconv +path_extra -toolbar +cmdline_compl +insert_expand -perl +user_commands +cmdline_hist +jumplist +persistent_undo +vertsplit +cmdline_info +keymap +postscript +virtualedit +comments +langmap +printer +visual +conceal +libcall +profile +visualextra +cryptv +linebreak +python +viminfo +cscope +lispindent -python3 +vreplace +cursorbind +listcmds +quickfix +wildignore +cursorshape +localmap +reltime +wildmenu +dialog_con -lua +rightleft +windows +diff +menu -ruby +writebackup +digraphs +mksession +scrollbind -X11 -dnd +modify_fname +signs -xfontset -ebcdic +mouse +smartindent -xim +emacs_tags -mouseshape -sniff -xsmp +eval +mouse_dec +startuptime -xterm_clipboard +ex_extra +mouse_gpm +statusline -xterm_save +extra_search -mouse_jsbterm -sun_workshop -xpm system vimrc file: "$VIM/vimrc" user vimrc file: "$HOME/.vimrc" 2nd user vimrc file: "~/.vim/vimrc" user exrc file: "$HOME/.exrc" fall-back for $VIM: "/usr/share/vim" Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
      Linking: gcc -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,--as-needed -o vim -lm -ltinfo -lnsl -lselinux -lacl -lattr -lgpm -ldl -L/usr/lib/python2.7/config-x86_64-linux-gnu -lpython2.7 -lpthread -ldl -lutil -lm -Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions
      iptables version iptables v1.4.21 curl version curl 7.35.0 (x86_64-pc-linux-gnu) libcurl/7.35.0 OpenSSL/1.0.1f zlib/1.2.8 libidn/1.28 librtmp/2.3 wget version GNU Wget 1.15 built on linux-gnu. rsync version rsync version 3.1.0 protocol version 31 gimme version v1.2.0 nvm version 0.33.2 perlbrew version /home/travis/perl5/perlbrew/bin/perlbrew - App::perlbrew/0.80 phpenv version rbenv 1.1.1-4-g4ebd1bd rvm version rvm 1.29.2 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io/] default ruby version ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux] CouchDB version couchdb 1.6.1 ElasticSearch version 5.5.0 Installed Firefox version firefox 55.0.2 MongoDB version MongoDB 3.2.16 Pre-installed PostgreSQL versions 9.2.22 9.3.18 9.4.13 9.5.8 9.6.4 RabbitMQ Version 3.6.11 Redis version redis-server 4.0.1 riak version 2.2.3 Pre-installed Go versions 1.7.4 ant version Apache Ant(TM) version 1.9.3 compiled on April 8 2014 mvn version Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-03T19:39:06Z) Maven home: /usr/local/maven-3.5.0 Java version: 1.8.0_144, vendor: Oracle Corporation Java home: /usr/lib/jvm/java-8-oracle/jre Default locale: en_US, platform encoding: UTF-8 OS name: "linux", version: "4.4.0-92-generic", arch: "amd64", family: "unix" gradle version

      Gradle 4.0.1

      Build time: 2017-07-07 14:02:41 UTC Revision: 38e5dc0f772daecca1d2681885d3d85414eb6826 Groovy: 2.4.11 Ant: Apache Ant(TM) version 1.9.6 compiled on June 29 2015 JVM: 1.8.0_144 (Oracle Corporation 25.144-b01) OS: Linux 4.4.0-92-generic amd64 lein version WARNING: You're currently running as root; probably by accident. Press control-C to abort or Enter to continue as root. Set LEIN_ROOT to disable this warning. Leiningen 2.7.1 on Java 1.8.0_144 Java HotSpot(TM) 64-Bit Server VM Pre-installed Node.js versions v4.8.4 v6.11.2 v6.9.4 v7.4.0 v8.4 phpenv versions system 5.6

  • 5.6.31 (set by /home/travis/.phpenv/version) 7.0 7.0.22 hhvm hhvm-stable composer --version Composer version 1.4.2 2017-05-17 08:17:52 Pre-installed Ruby versions ruby-2.2.7 ruby-2.3.4 ruby-2.4.1 W: GPG error: http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.2 Release: The following signatures were invalid: KEYEXPIRED 1507497109 W: The repository 'http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.2 Release' is not signed. W: http://dl.hhvm.com/ubuntu/dists/trusty/InRelease: Signature by key 36AEF64D0207E7EEE352D4875A16E7281BE7A449 uses weak digest algorithm (SHA1) W: http://ppa.launchpad.net/couchdb/stable/ubuntu/dists/trusty/Release.gpg: Signature by key 15866BAFD9BCC4F3C1E0DFC7D69548E1C17EAB57 uses weak digest algorithm (SHA1) 3.4 is not installed; attempting download Downloading archive: https://s3.amazonaws.com/travis-python-archives/binaries/ubuntu/14.04/x86_64/python-3.4.tar.bz2 $ sudo tar xjf python-3.4.tar.bz2 --directory / sed: can't read /etc/profile.d/pyenv.sh: No such file or directory git.checkout 4.50s$ git clone --depth=50 https://github.com/codingo/VHostScan.git codingo/VHostScan Cloning into 'codingo/VHostScan'... remote: Counting objects: 710, done. remote: Total 710 (delta 0), reused 0 (delta 0), pack-reused 710 Receiving objects: 100% (710/710), 109.56 KiB | 13.70 MiB/s, done. Resolving deltas: 100% (416/416), done. $ cd codingo/VHostScan 0.32s$ git fetch origin +refs/pull/65/merge: remote: Counting objects: 92, done. remote: Compressing objects: 100% (10/10), done. remote: Total 92 (delta 38), reused 45 (delta 37), pack-reused 45 Unpacking objects: 100% (92/92), done. From https://github.com/codingo/VHostScan

    • branch refs/pull/65/merge -> FETCH_HEAD $ git checkout -qf FETCH_HEAD 0.01s$ source ~/virtualenv/python3.4/bin/activate $ python --version Python 3.4.6 $ pip --version pip 9.0.1 from /home/travis/virtualenv/python3.4.6/lib/python3.4/site-packages (python 3.4) install.1 0.64s$ pip --version pip 9.0.1 from /home/travis/virtualenv/python3.4.6/lib/python3.4/site-packages (python 3.4) install.2 24.62s$ pip install -r test-requirements.txt Collecting dnspython==1.15.0 (from -r requirements.txt (line 1)) Downloading dnspython-1.15.0-py2.py3-none-any.whl (177kB) 100% |████████████████████████████████| 184kB 3.9MB/s Collecting fuzzywuzzy==0.15.1 (from -r requirements.txt (line 2)) Downloading fuzzywuzzy-0.15.1-py2.py3-none-any.whl Collecting numpy==1.12.0 (from -r requirements.txt (line 3)) Downloading numpy-1.12.0-cp34-cp34m-manylinux1_x86_64.whl (16.8MB) 100% |████████████████████████████████| 16.8MB 59kB/s Collecting pandas==0.19.2 (from -r requirements.txt (line 4)) Downloading pandas-0.19.2-cp34-cp34m-manylinux1_x86_64.whl (18.7MB) 100% |████████████████████████████████| 18.7MB 53kB/s Collecting requests==2.10.0 (from -r requirements.txt (line 5)) Downloading requests-2.10.0-py2.py3-none-any.whl (506kB) 100% |████████████████████████████████| 512kB 1.9MB/s Collecting simplejson==3.8.2 (from -r requirements.txt (line 6)) Downloading simplejson-3.8.2.tar.gz (76kB) 100% |████████████████████████████████| 81kB 6.8MB/s Collecting urllib3==1.20 (from -r requirements.txt (line 7)) Downloading urllib3-1.20-py2.py3-none-any.whl (111kB) 100% |████████████████████████████████| 112kB 6.7MB/s Collecting pytest==3.2.3 (from -r test-requirements.txt (line 3)) Downloading pytest-3.2.3-py2.py3-none-any.whl (187kB) 100% |████████████████████████████████| 194kB 4.6MB/s Collecting pytest-mock==1.6.3 (from -r test-requirements.txt (line 4)) Downloading pytest_mock-1.6.3-py2.py3-none-any.whl Collecting pep8==1.7.0 (from -r test-requirements.txt (line 5)) Downloading pep8-1.7.0-py2.py3-none-any.whl (41kB) 100% |████████████████████████████████| 51kB 6.6MB/s Collecting python-dateutil>=2 (from pandas==0.19.2->-r requirements.txt (line 4)) Downloading python_dateutil-2.6.1-py2.py3-none-any.whl (194kB) 100% |████████████████████████████████| 194kB 198kB/s Collecting pytz>=2011k (from pandas==0.19.2->-r requirements.txt (line 4)) Downloading pytz-2017.2-py2.py3-none-any.whl (484kB) 100% |████████████████████████████████| 491kB 2.2MB/s Requirement already satisfied: setuptools in /home/travis/virtualenv/python3.4.6/lib/python3.4/site-packages (from pytest==3.2.3->-r test-requirements.txt (line 3)) Requirement already satisfied: py>=1.4.33 in /home/travis/virtualenv/python3.4.6/lib/python3.4/site-packages (from pytest==3.2.3->-r test-requirements.txt (line 3)) Requirement already satisfied: six>=1.5 in /home/travis/virtualenv/python3.4.6/lib/python3.4/site-packages (from python-dateutil>=2->pandas==0.19.2->-r requirements.txt (line 4)) Requirement already satisfied: appdirs>=1.4.0 in /home/travis/virtualenv/python3.4.6/lib/python3.4/site-packages (from setuptools->pytest==3.2.3->-r test-requirements.txt (line 3)) Requirement already satisfied: packaging>=16.8 in /home/travis/virtualenv/python3.4.6/lib/python3.4/site-packages (from setuptools->pytest==3.2.3->-r test-requirements.txt (line 3)) Requirement already satisfied: pyparsing in /home/travis/virtualenv/python3.4.6/lib/python3.4/site-packages (from packaging>=16.8->setuptools->pytest==3.2.3->-r test-requirements.txt (line 3)) Building wheels for collected packages: simplejson Running setup.py bdist_wheel for simplejson ... -done Stored in directory: /home/travis/.cache/pip/wheels/e4/32/71/60b361b0d05433eb9d1dd3d47619931c08cc4e387dc494ad3c Successfully built simplejson Installing collected packages: dnspython, fuzzywuzzy, numpy, python-dateutil, pytz, pandas, requests, simplejson, urllib3, pytest, pytest-mock, pep8 Found existing installation: numpy 1.12.1 Uninstalling numpy-1.12.1: Successfully uninstalled numpy-1.12.1 Found existing installation: pytest 3.0.7 Uninstalling pytest-3.0.7: Successfully uninstalled pytest-3.0.7 Successfully installed dnspython-1.15.0 fuzzywuzzy-0.15.1 numpy-1.12.0 pandas-0.19.2 pep8-1.7.0 pytest-3.2.3 pytest-mock-1.6.3 python-dateutil-2.6.1 pytz-2017.2 requests-2.10.0 simplejson-3.8.2 urllib3-1.20 install.3 0.82s$ pip install pep8 Requirement already satisfied: pep8 in /home/travis/virtualenv/python3.4.6/lib/python3.4/site-packages before_script 0.33s$ pep8 -v *.py lib/ checking VHostScan.py directory lib checking lib/init.py checking lib/input.py directory lib/core checking lib/core/init.py checking lib/core/version.py checking lib/core/discovered_host.py checking lib/core/virtual_host_scanner.py directory lib/helpers checking lib/helpers/init.py checking lib/helpers/file_helper.py checking lib/helpers/output_helper.py 0.90s$ pytest ============================= test session starts ============================== platform linux -- Python 3.4.6, pytest-3.2.3, py-1.4.33, pluggy-0.4.0 rootdir: /home/travis/build/codingo/VHostScan, inifile: plugins: mock-1.6.3 collected 7 items
      tests/test_input.py FFF.. tests/helpers/test_file_helper.py .. =================================== FAILURES =================================== __ test_parse_arguments_default_value __ tmpdir = local('/tmp/pytest-of-travis/pytest-0/test_parse_arguments_default_v0') def test_parse_arguments_default_value(tmpdir): words = ['word1', 'word2', 'word3'] wordlist = tmpdir.mkdir('test_command').join('default') wordlist.write('\n'.join(words))

      argv = ['-t', 'myhost']

      arguments = cli_argument_parser().parse(argv)

      expected_arguments = { 'target_hosts': 'myhost', 'wordlists': None, 'base_host': False, 'port': 80, 'real_port': False, 'ignore_http_codes': '404', 'ignore_content_length': 0, 'first_hit': False , 'unique_depth': 1, 'fuzzy_logic': False, 'no_lookup': False, 'rate_limit': 0, 'random_agent': False, 'user_agent': None, 'add_waf_bypass_headers': False, 'output_normal': None, 'output_json': None, 'stdin': False, 'ssl': False, }

  assert vars(arguments) == expected_arguments

E AssertionError: assert {'add_waf_byp...': False, ...} == {'add_waf_bypa...': False, ...} E Omitting 18 identical items, use -vv to show E Differing items: E {'wordlists': False} != {'wordlists': None} E Use -v to get the full diff tests/test_input.py:37: AssertionError ____ test_parse_arguments_customarguments ____ tmpdir = local('/tmp/pytest-of-travis/pytest-0/test_parse_arguments_custom_ar0') def test_parse_arguments_custom_arguments(tmpdir): words = ['some', 'other', 'words'] wordlist = tmpdir.mkdir('test_command').join('other_words') wordlist.write('\n'.join(words))

    argv = [
        '-t', '10.11.1.1',
        '-w', str(wordlist),
        '-b', 'myhost',
        '-p', '8000',
        '-r', '8001',
        '--ignore-http-codes', '400,500,302',
        '--ignore-content-length', '100',
        '--unique-depth', '5',
        '--ssl',
        '--fuzzy-logic',
        '--no-lookups',
        '--rate-limit', '10',
        '--user-agent', 'some-user-agent',
        '--waf',
        '-oN', '/tmp/on',
        '-',
    ]

    arguments = cli_argument_parser().parse(argv)

    expected_arguments = {
        'target_hosts': '10.11.1.1',
        'wordlists': str(wordlist),
        'base_host': 'myhost',
        'port': 8000,
        'real_port': 8001,
        'ignore_http_codes': '400,500,302',
        'ignore_content_length': 100,
        'first_hit': False,
        'unique_depth': 5,
        'ssl': True,
        'fuzzy_logic': True,
        'no_lookup': True,
        'rate_limit': 10,
        'user_agent': 'some-user-agent',
        'random_agent': False,
        'add_waf_bypass_headers': True,
        'output_normal': '/tmp/on',
        'output_json': None,
        'stdin': True,
    }
  assert vars(arguments) == expected_arguments

E AssertionError: assert {'add_waf_byp...c': True, ...} == {'add_waf_bypa...c': True, ...} E Omitting 17 identical items, use -vv to show E Differing items: E {'port': '8000'} != {'port': 8000} E {'real_port': '8001'} != {'real_port': 8001} E Use -v to get the full diff tests/test_input.py:88: AssertionError __ test_parse_arguments_mutually_exclusive_user_agent __ def test_parse_arguments_mutually_exclusive_user_agent(): argv = [ '-t', '10.11.1.1', '--user-agent', 'my-user-agent', '--random-agent', ]

    with pytest.raises(SystemExit):
      cli_argument_parser().parse(argv)

E Failed: DID NOT RAISE <class 'SystemExit'> tests/test_input.py:98: Failed ====================== 3 failed, 4 passed in 0.21 seconds ====================== The command "pytest" exited with 1.

diogoosorio commented 7 years ago

I'll give it a look within the next couple of days.

Don't get offended by the remark, but as a maintainer is 100% legitimate or you to ask for the contributor to preform the rebase with master, prior to even preforming the review. You don't have to rebase everything yourself. 😄

codingo commented 7 years ago

No offence taken. I mostly took care of it as I already valued the contributions made. It's important I also learn more about the test cases in order to better maintain them but a bit time pressed this week.

diogoosorio commented 7 years ago

@codingo I've rebased it directly to master and try to kept the changes you've made in this branch (my last 2 commits). Please give it a thorough review and let me know if anything's missing.