Skip to content

Commit

Permalink
[PROCESS] Redesign
Browse files Browse the repository at this point in the history
  • Loading branch information
Stanislav WEB committed Jan 3, 2017
1 parent 5672459 commit 9a1dc27
Show file tree
Hide file tree
Showing 44 changed files with 238 additions and 107 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
*.pyc
*~
*.swp
Logs/
logs/
opendoor.egg-info/
/dist/
15 changes: 0 additions & 15 deletions Data/exclusions.dat

This file was deleted.

Binary file removed Exceptions/ArgumentParserError.pyc
Binary file not shown.
3 changes: 0 additions & 3 deletions Exceptions/__init__.py

This file was deleted.

Binary file removed Exceptions/__init__.pyc
Binary file not shown.
57 changes: 0 additions & 57 deletions Libraries/Command.py

This file was deleted.

Binary file removed Libraries/Command.pyc
Binary file not shown.
Binary file removed Libraries/FileReader.pyc
Binary file not shown.
Binary file removed Libraries/Filter.pyc
Binary file not shown.
Binary file removed Libraries/Http.pyc
Binary file not shown.
Binary file removed Libraries/Logger.pyc
Binary file not shown.
Binary file removed Libraries/Progress.pyc
Binary file not shown.
Binary file removed Libraries/__init__.pyc
Binary file not shown.
1 change: 0 additions & 1 deletion Reports/.coverage

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions opendoor.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@
Please run sudo pip install -r requirements.txt """)

if __name__ == "__main__":
from Libraries.Command import Command
from Libraries.Controller import Controller
from Libraries.Version import Version
from Libraries.Filter import Filter as FilterArgs
from src.Libraries.Command import Command
from src.Controller import Controller
from src.Version import Version
from src.Filter import Filter as FilterArgs

version = Version()
command = Command()
Expand Down
10 changes: 5 additions & 5 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ version = 2.7.96
description-file = README.md

[opendoor]
directories = Data/directories.dat
excludes = Data/exclusions.dat
proxy = Data/proxy.dat
subdomains = Data/subdomains.dat
useragents = Data/useragents.dat
directories = data/directories.dat
excludes = data/exclusions.dat
proxy = data/proxy.dat
subdomains = data/subdomains.dat
useragents = data/useragents.dat
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# Development Team: Stanislav Menshov (Stanislav WEB)

from setuptools import setup, find_packages
from Libraries.Version import Version
from src.Version import Version

setup(
name='opendoor',
Expand All @@ -44,6 +44,6 @@
'Intended Audience :: Developers',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Topic :: Software Development :: Libraries :: Python Modules',
'Topic :: Software Development :: src :: Python Modules',
],
)
97 changes: 97 additions & 0 deletions src/Configs/ArgumentsConfig.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# -*- coding: utf-8 -*-

"""ArgumentsConfig class"""

class ArgumentsConfig:
"""ArgumentsConfig class"""

arguments = [
{
"args": None,
"argl": "--port",
"default": 80,
"action": "store",
"help": "Custom port (Default 80)",
"type" : int
},
{
"args": "-t",
"argl": "--threads",
"default": 1,
"action": "store",
"help": "Allowed threads (limited by CPU cores)",
"type": int
},
{
"args": "-d",
"argl": "--delay",
"default": 0,
"action": "store",
"help": "Delay between requests",
"type": int
},
{
"args": None,
"argl": "--timeout",
"default": 0,
"action": "store",
"help": "Request timeout",
"type": int
},
{
"args": None,
"argl": "--debug",
"default": 0,
"action": "store",
"help": "Debug level 1 - 3",
"type": int
},
{
"args": "-p",
"argl": "--proxy",
"default": False,
"action": "store_true",
"help": "Using proxylist",
"type": bool
},
{
"args": "-s",
"argl": "--scan",
"default": "directories",
"action": "store",
"help": "Scan type scan=directories or scan=subdomains",
"type": str
},
{
"args": "-l",
"argl": "--log",
"default": False,
"action": "store_true",
"help": "Scan logging",
"type": bool
},
{
"args": None,
"argl": "--update",
"default" : False,
"action" : "store_true",
"help": "Update from CVS",
"type": bool
},
{
"args": "-v",
"argl": "--version",
"default": False,
"action": "store_true",
"help": "Get current version",
"type": bool
},
{
"args": None,
"argl": "--examples",
"default": False,
"action": "store_true",
"help": "Examples of usage",
"type": bool
}
]
7 changes: 7 additions & 0 deletions src/Configs/DebugConfig.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# -*- coding: utf-8 -*-

"""DebugConfig class"""


class DebugConfig:
"""DebugConfig class"""
File renamed without changes.
22 changes: 22 additions & 0 deletions src/Configs/MessagesConfig.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-

"""MessagesConfig class"""


class MessagesConfig:
"""MessagesConfig class"""

messages = {
'online': "Server {0} {1}:{2} is online",
'offline': "Oops Error occured, Server offline or invalid URL. Reason: {}",
'redirect': "Redirect {0} --> {1}",
'scanning': "Scanning {0} ...",
'abort': "Session canceled",
'timeout': "Connection timeout: {0} . Try to increase --delay between requests",
'excluded': "Excluded path: {0}",
'unresponsible': "Unresponsible path : {0}",
'use_log': "Use --log param to save scan result",
'max_threads': "Passed {0} threads max for your possibility",
'has_scanned': "You already have the results for {0} saved in logs directory.\nWould you like to rescan? Press [ENTER] to continue: ",
'file_detected': "Probably you found important filesource {0} {1}"
}
6 changes: 6 additions & 0 deletions src/Configs/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# -*- coding: utf-8 -*-

from .HttpConfig import HttpConfig
from .MessagesConfig import MessagesConfig
from .ArgumentsConfig import ArgumentsConfig
from .DebugConfig import DebugConfig
File renamed without changes.
File renamed without changes.
8 changes: 8 additions & 0 deletions src/Exceptions/HttpError.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
"""HttpError class"""

# -*- coding: utf-8 -*-
class HttpError(Exception):
"""HttpError class"""

def __init__(self, arg):
self.msg = arg
3 changes: 3 additions & 0 deletions src/Exceptions/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-
from .ArgumentParserError import *
from .HttpError import *
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions Libraries/Http.py → src/Http.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@
import multiprocessing
import re
import socket
import sys
import time
import urllib3
from urlparse import urlparse

import sys
import threadpool
import urllib3
import time

from src.Configs.HttpConfig import HttpConfig as config
from .FileReader import FileReader
from .Formatter import Formatter
from .HttpConfig import HttpConfig as config
from .Logger import Logger as Log
from .Message import Message
from .Progress import Progress
Expand Down
63 changes: 63 additions & 0 deletions src/Libraries/Command.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# -*- coding: utf-8 -*-

"""Command helper class"""

from argparse import RawDescriptionHelpFormatter

import sys

from src.Exceptions import ArgumentParserError, ThrowingArgumentParser
from src.Logger import Logger as Log
from src.Configs import ArgumentsConfig as config

class Command:
"""Command helper class"""

def __init__(self):

try:
parser = ThrowingArgumentParser(description=__doc__,
formatter_class=RawDescriptionHelpFormatter)
required_named = parser.add_argument_group('required named arguments')
required_named.add_argument('-u', '--url', help="URL or page to scan; -u http://example.com")

for i in range(len(config.arguments)):
arg = config.arguments[i]
if arg['args'] is None:
if bool == arg['type']:
parser.add_argument(arg['argl'], default=arg['default'], action=arg['action'], help=arg['help'])
else:
parser.add_argument(arg['argl'], default=arg['default'], action=arg['action'], help=arg['help'], type=arg['type'])
else:
if bool == arg['type']:
parser.add_argument(arg['args'], arg['argl'], default=arg['default'], action=arg['action'], help=arg['help'])
else:
parser.add_argument(arg['args'], arg['argl'], default=arg['default'], action=arg['action'], help=arg['help'], type=arg['type'])
parser.parse_args()
self.parser = parser
except ArgumentParserError as e:
sys.exit(Log.error(e.message))

def get_arg_values(self):
"""Get used input arguments"""

command_list = {}

try:
arguments = self.parser.parse_args()

if not arguments.url and not arguments.version and not arguments.update and not arguments.examples:
sys.exit(Log.error("argument -u/--url is required"))

for arg, value in vars(arguments).iteritems():

if value:
command_list[arg] = value

if not command_list:
self.parser.print_help()
else:
return command_list

except AttributeError as e:
sys.exit(Log.error(e.message))
Empty file added src/Libraries/__init__.py
Empty file.
Loading

0 comments on commit 9a1dc27

Please sign in to comment.