├── CodeSmell ├── _root_bin_PoorOpsSec_indicators_py.html ├── _root_bin_PoorOpsSec_pooropssec_py.html ├── _usr_local_lib_python2_7_dist-packages_certstream___init___py.html ├── _usr_local_lib_python2_7_dist-packages_certstream_core_py.html ├── _usr_local_lib_python2_7_dist-packages_requests___init___py.html ├── _usr_local_lib_python2_7_dist-packages_requests_adapters_py.html ├── _usr_local_lib_python2_7_dist-packages_requests_api_py.html ├── _usr_local_lib_python2_7_dist-packages_requests_auth_py.html ├── _usr_local_lib_python2_7_dist-packages_requests_certs_py.html ├── _usr_local_lib_python2_7_dist-packages_requests_compat_py.html ├── _usr_local_lib_python2_7_dist-packages_requests_cookies_py.html ├── _usr_local_lib_python2_7_dist-packages_requests_exceptions_py.html ├── _usr_local_lib_python2_7_dist-packages_requests_hooks_py.html ├── _usr_local_lib_python2_7_dist-packages_requests_models_py.html ├── _usr_local_lib_python2_7_dist-packages_requests_packages___init___py.html ├── _usr_local_lib_python2_7_dist-packages_requests_packages_chardet___init___py.html ├── _usr_local_lib_python2_7_dist-packages_requests_packages_urllib3___init___py.html ├── _usr_local_lib_python2_7_dist-packages_requests_packages_urllib3__collections_py.html ├── _usr_local_lib_python2_7_dist-packages_requests_packages_urllib3_connection_py.html ├── _usr_local_lib_python2_7_dist-packages_requests_packages_urllib3_connectionpool_py.html ├── _usr_local_lib_python2_7_dist-packages_requests_packages_urllib3_contrib___init___py.html ├── _usr_local_lib_python2_7_dist-packages_requests_packages_urllib3_contrib_pyopenssl_py.html ├── _usr_local_lib_python2_7_dist-packages_requests_packages_urllib3_contrib_socks_py.html ├── _usr_local_lib_python2_7_dist-packages_requests_packages_urllib3_exceptions_py.html ├── _usr_local_lib_python2_7_dist-packages_requests_packages_urllib3_fields_py.html ├── _usr_local_lib_python2_7_dist-packages_requests_packages_urllib3_filepost_py.html ├── _usr_local_lib_python2_7_dist-packages_requests_packages_urllib3_packages___init___py.html ├── _usr_local_lib_python2_7_dist-packages_requests_packages_urllib3_packages_ordered_dict_py.html ├── _usr_local_lib_python2_7_dist-packages_requests_packages_urllib3_packages_six_py.html ├── _usr_local_lib_python2_7_dist-packages_requests_packages_urllib3_packages_ssl_match_hostname___init___py.html ├── _usr_local_lib_python2_7_dist-packages_requests_packages_urllib3_poolmanager_py.html ├── _usr_local_lib_python2_7_dist-packages_requests_packages_urllib3_request_py.html ├── _usr_local_lib_python2_7_dist-packages_requests_packages_urllib3_response_py.html ├── _usr_local_lib_python2_7_dist-packages_requests_packages_urllib3_util___init___py.html ├── _usr_local_lib_python2_7_dist-packages_requests_packages_urllib3_util_connection_py.html ├── _usr_local_lib_python2_7_dist-packages_requests_packages_urllib3_util_request_py.html ├── _usr_local_lib_python2_7_dist-packages_requests_packages_urllib3_util_response_py.html ├── _usr_local_lib_python2_7_dist-packages_requests_packages_urllib3_util_retry_py.html ├── _usr_local_lib_python2_7_dist-packages_requests_packages_urllib3_util_ssl__py.html ├── _usr_local_lib_python2_7_dist-packages_requests_packages_urllib3_util_timeout_py.html ├── _usr_local_lib_python2_7_dist-packages_requests_packages_urllib3_util_url_py.html ├── _usr_local_lib_python2_7_dist-packages_requests_sessions_py.html ├── _usr_local_lib_python2_7_dist-packages_requests_status_codes_py.html ├── _usr_local_lib_python2_7_dist-packages_requests_structures_py.html ├── _usr_local_lib_python2_7_dist-packages_requests_utils_py.html ├── _usr_local_lib_python2_7_dist-packages_six_py.html ├── _usr_local_lib_python2_7_dist-packages_tld___init___py.html ├── _usr_local_lib_python2_7_dist-packages_tld_conf_py.html ├── _usr_local_lib_python2_7_dist-packages_tld_defaults_py.html ├── _usr_local_lib_python2_7_dist-packages_tld_exceptions_py.html ├── _usr_local_lib_python2_7_dist-packages_tld_helpers_py.html ├── _usr_local_lib_python2_7_dist-packages_tld_utils_py.html ├── _usr_local_lib_python2_7_dist-packages_tqdm___init___py.html ├── _usr_local_lib_python2_7_dist-packages_tqdm__main_py.html ├── _usr_local_lib_python2_7_dist-packages_tqdm__tqdm_gui_py.html ├── _usr_local_lib_python2_7_dist-packages_tqdm__tqdm_pandas_py.html ├── _usr_local_lib_python2_7_dist-packages_tqdm__tqdm_py.html ├── _usr_local_lib_python2_7_dist-packages_tqdm__utils_py.html ├── _usr_local_lib_python2_7_dist-packages_tqdm__version_py.html ├── _usr_local_lib_python2_7_dist-packages_websocket___init___py.html ├── _usr_local_lib_python2_7_dist-packages_websocket__abnf_py.html ├── _usr_local_lib_python2_7_dist-packages_websocket__app_py.html ├── _usr_local_lib_python2_7_dist-packages_websocket__cookiejar_py.html ├── _usr_local_lib_python2_7_dist-packages_websocket__core_py.html ├── _usr_local_lib_python2_7_dist-packages_websocket__exceptions_py.html ├── _usr_local_lib_python2_7_dist-packages_websocket__handshake_py.html ├── _usr_local_lib_python2_7_dist-packages_websocket__http_py.html ├── _usr_local_lib_python2_7_dist-packages_websocket__logging_py.html ├── _usr_local_lib_python2_7_dist-packages_websocket__socket_py.html ├── _usr_local_lib_python2_7_dist-packages_websocket__ssl_compat_py.html ├── _usr_local_lib_python2_7_dist-packages_websocket__url_py.html ├── _usr_local_lib_python2_7_dist-packages_websocket__utils_py.html ├── coverage_html.js ├── index.html ├── jquery.debounce.min.js ├── jquery.hotkeys.js ├── jquery.isonscreen.js ├── jquery.min.js ├── jquery.tablesorter.min.js ├── keybd_closed.png ├── keybd_open.png ├── lint_results.txt ├── status.json └── style.css ├── Dockerfile ├── NeedSpecialAttention.log ├── README.md ├── VERSION ├── Vagrantfile ├── docker-compose.yml ├── indicators.py ├── pooropssec.py ├── requirements.txt ├── setup.py └── test └── scoring.py /CodeSmell/_usr_local_lib_python2_7_dist-packages_certstream___init___py.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Coverage for /usr/local/lib/python2.7/dist-packages/certstream/__init__.py: 100% 12 | 13 | 14 | 15 | 16 | 17 | 18 | 21 | 22 | 23 | 24 | 42 | 43 |
44 | Hide keyboard shortcuts 45 |

Hot-keys on this page

46 |
47 |

48 | r 49 | m 50 | x 51 | p   toggle line displays 52 |

53 |

54 | j 55 | k   next/prev highlighted chunk 56 |

57 |

58 | 0   (zero) top of page 59 |

60 |

61 | 1   (one) first highlighted chunk 62 |

63 |
64 |
65 | 66 |
67 | 68 | 69 | 73 | 77 | 78 |
70 |

1

71 | 72 |
74 |

from .core import listen_for_events 

75 | 76 |
79 |
80 | 81 | 89 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /CodeSmell/_usr_local_lib_python2_7_dist-packages_requests_certs_py.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Coverage for /usr/local/lib/python2.7/dist-packages/requests/certs.py: 56% 12 | 13 | 14 | 15 | 16 | 17 | 18 | 21 | 22 | 23 | 24 | 42 | 43 |
44 | Hide keyboard shortcuts 45 |

Hot-keys on this page

46 |
47 |

48 | r 49 | m 50 | x 51 | p   toggle line displays 52 |

53 |

54 | j 55 | k   next/prev highlighted chunk 56 |

57 |

58 | 0   (zero) top of page 59 |

60 |

61 | 1   (one) first highlighted chunk 62 |

63 |
64 |
65 | 66 |
67 | 68 | 69 | 97 | 125 | 126 |
70 |

1

71 |

2

72 |

3

73 |

4

74 |

5

75 |

6

76 |

7

77 |

8

78 |

9

79 |

10

80 |

11

81 |

12

82 |

13

83 |

14

84 |

15

85 |

16

86 |

17

87 |

18

88 |

19

89 |

20

90 |

21

91 |

22

92 |

23

93 |

24

94 |

25

95 | 96 |
98 |

#!/usr/bin/env python 

99 |

# -*- coding: utf-8 -*- 

100 |

 

101 |

""" 

102 |

requests.certs 

103 |

~~~~~~~~~~~~~~ 

104 |

 

105 |

This module returns the preferred default CA certificate bundle. 

106 |

 

107 |

If you are packaging Requests, e.g., for a Linux distribution or a managed 

108 |

environment, you can change the definition of where() to return a separately 

109 |

packaged CA bundle. 

110 |

""" 

111 |

import os.path 

112 |

 

113 |

try: 

114 |

from certifi import where 

115 |

except ImportError: 

116 |

def where(): 

117 |

"""Return the preferred certificate bundle.""" 

118 |

# vendored bundle inside Requests 

119 |

return os.path.join(os.path.dirname(__file__), 'cacert.pem') 

120 |

 

121 |

if __name__ == '__main__': 

122 |

print(where()) 

123 | 124 |
127 |
128 | 129 | 137 | 138 | 139 | 140 | -------------------------------------------------------------------------------- /CodeSmell/_usr_local_lib_python2_7_dist-packages_requests_hooks_py.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Coverage for /usr/local/lib/python2.7/dist-packages/requests/hooks.py: 60% 12 | 13 | 14 | 15 | 16 | 17 | 18 | 21 | 22 | 23 | 24 | 42 | 43 |
44 | Hide keyboard shortcuts 45 |

Hot-keys on this page

46 |
47 |

48 | r 49 | m 50 | x 51 | p   toggle line displays 52 |

53 |

54 | j 55 | k   next/prev highlighted chunk 56 |

57 |

58 | 0   (zero) top of page 59 |

60 |

61 | 1   (one) first highlighted chunk 62 |

63 |
64 |
65 | 66 |
67 | 68 | 69 | 106 | 143 | 144 |
70 |

1

71 |

2

72 |

3

73 |

4

74 |

5

75 |

6

76 |

7

77 |

8

78 |

9

79 |

10

80 |

11

81 |

12

82 |

13

83 |

14

84 |

15

85 |

16

86 |

17

87 |

18

88 |

19

89 |

20

90 |

21

91 |

22

92 |

23

93 |

24

94 |

25

95 |

26

96 |

27

97 |

28

98 |

29

99 |

30

100 |

31

101 |

32

102 |

33

103 |

34

104 | 105 |
107 |

# -*- coding: utf-8 -*- 

108 |

 

109 |

""" 

110 |

requests.hooks 

111 |

~~~~~~~~~~~~~~ 

112 |

 

113 |

This module provides the capabilities for the Requests hooks system. 

114 |

 

115 |

Available hooks: 

116 |

 

117 |

``response``: 

118 |

The response generated from a Request. 

119 |

""" 

120 |

HOOKS = ['response'] 

121 |

 

122 |

 

123 |

def default_hooks(): 

124 |

return dict((event, []) for event in HOOKS) 

125 |

 

126 |

# TODO: response is the only one 

127 |

 

128 |

 

129 |

def dispatch_hook(key, hooks, hook_data, **kwargs): 

130 |

"""Dispatches a hook dictionary on a given piece of data.""" 

131 |

hooks = hooks or dict() 

132 |

hooks = hooks.get(key) 

133 |

if hooks: 

134 |

if hasattr(hooks, '__call__'): 

135 |

hooks = [hooks] 

136 |

for hook in hooks: 

137 |

_hook_data = hook(hook_data, **kwargs) 

138 |

if _hook_data is not None: 

139 |

hook_data = _hook_data 

140 |

return hook_data 

141 | 142 |
145 |
146 | 147 | 155 | 156 | 157 | 158 | -------------------------------------------------------------------------------- /CodeSmell/_usr_local_lib_python2_7_dist-packages_requests_packages___init___py.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Coverage for /usr/local/lib/python2.7/dist-packages/requests/packages/__init__.py: 50% 12 | 13 | 14 | 15 | 16 | 17 | 18 | 21 | 22 | 23 | 24 | 42 | 43 |
44 | Hide keyboard shortcuts 45 |

Hot-keys on this page

46 |
47 |

48 | r 49 | m 50 | x 51 | p   toggle line displays 52 |

53 |

54 | j 55 | k   next/prev highlighted chunk 56 |

57 |

58 | 0   (zero) top of page 59 |

60 |

61 | 1   (one) first highlighted chunk 62 |

63 |
64 |
65 | 66 |
67 | 68 | 69 | 108 | 147 | 148 |
70 |

1

71 |

2

72 |

3

73 |

4

74 |

5

75 |

6

76 |

7

77 |

8

78 |

9

79 |

10

80 |

11

81 |

12

82 |

13

83 |

14

84 |

15

85 |

16

86 |

17

87 |

18

88 |

19

89 |

20

90 |

21

91 |

22

92 |

23

93 |

24

94 |

25

95 |

26

96 |

27

97 |

28

98 |

29

99 |

30

100 |

31

101 |

32

102 |

33

103 |

34

104 |

35

105 |

36

106 | 107 |
109 |

''' 

110 |

Debian and other distributions "unbundle" requests' vendored dependencies, and 

111 |

rewrite all imports to use the global versions of ``urllib3`` and ``chardet``. 

112 |

The problem with this is that not only requests itself imports those 

113 |

dependencies, but third-party code outside of the distros' control too. 

114 |

 

115 |

In reaction to these problems, the distro maintainers replaced 

116 |

``requests.packages`` with a magical "stub module" that imports the correct 

117 |

modules. The implementations were varying in quality and all had severe 

118 |

problems. For example, a symlink (or hardlink) that links the correct modules 

119 |

into place introduces problems regarding object identity, since you now have 

120 |

two modules in `sys.modules` with the same API, but different identities:: 

121 |

 

122 |

requests.packages.urllib3 is not urllib3 

123 |

 

124 |

With version ``2.5.2``, requests started to maintain its own stub, so that 

125 |

distro-specific breakage would be reduced to a minimum, even though the whole 

126 |

issue is not requests' fault in the first place. See 

127 |

https://github.com/kennethreitz/requests/pull/2375 for the corresponding pull 

128 |

request. 

129 |

''' 

130 |

 

131 |

from __future__ import absolute_import 

132 |

import sys 

133 |

 

134 |

try: 

135 |

from . import urllib3 

136 |

except ImportError: 

137 |

import urllib3 

138 |

sys.modules['%s.urllib3' % __name__] = urllib3 

139 |

 

140 |

try: 

141 |

from . import chardet 

142 |

except ImportError: 

143 |

import chardet 

144 |

sys.modules['%s.chardet' % __name__] = chardet 

145 | 146 |
149 |
150 | 151 | 159 | 160 | 161 | 162 | -------------------------------------------------------------------------------- /CodeSmell/_usr_local_lib_python2_7_dist-packages_requests_packages_chardet___init___py.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Coverage for /usr/local/lib/python2.7/dist-packages/requests/packages/chardet/__init__.py: 27% 12 | 13 | 14 | 15 | 16 | 17 | 18 | 21 | 22 | 23 | 24 | 42 | 43 |
44 | Hide keyboard shortcuts 45 |

Hot-keys on this page

46 |
47 |

48 | r 49 | m 50 | x 51 | p   toggle line displays 52 |

53 |

54 | j 55 | k   next/prev highlighted chunk 56 |

57 |

58 | 0   (zero) top of page 59 |

60 |

61 | 1   (one) first highlighted chunk 62 |

63 |
64 |
65 | 66 |
67 | 68 | 69 | 104 | 139 | 140 |
70 |

1

71 |

2

72 |

3

73 |

4

74 |

5

75 |

6

76 |

7

77 |

8

78 |

9

79 |

10

80 |

11

81 |

12

82 |

13

83 |

14

84 |

15

85 |

16

86 |

17

87 |

18

88 |

19

89 |

20

90 |

21

91 |

22

92 |

23

93 |

24

94 |

25

95 |

26

96 |

27

97 |

28

98 |

29

99 |

30

100 |

31

101 |

32

102 | 103 |
105 |

######################## BEGIN LICENSE BLOCK ######################## 

106 |

# This library is free software; you can redistribute it and/or 

107 |

# modify it under the terms of the GNU Lesser General Public 

108 |

# License as published by the Free Software Foundation; either 

109 |

# version 2.1 of the License, or (at your option) any later version. 

110 |

# 

111 |

# This library is distributed in the hope that it will be useful, 

112 |

# but WITHOUT ANY WARRANTY; without even the implied warranty of 

113 |

# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 

114 |

# Lesser General Public License for more details. 

115 |

# 

116 |

# You should have received a copy of the GNU Lesser General Public 

117 |

# License along with this library; if not, write to the Free Software 

118 |

# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 

119 |

# 02110-1301 USA 

120 |

######################### END LICENSE BLOCK ######################### 

121 |

 

122 |

__version__ = "2.3.0" 

123 |

from sys import version_info 

124 |

 

125 |

 

126 |

def detect(aBuf): 

127 |

if ((version_info < (3, 0) and isinstance(aBuf, unicode)) or 

128 |

(version_info >= (3, 0) and not isinstance(aBuf, bytes))): 

129 |

raise ValueError('Expected a bytes object, not a unicode object') 

130 |

 

131 |

from . import universaldetector 

132 |

u = universaldetector.UniversalDetector() 

133 |

u.reset() 

134 |

u.feed(aBuf) 

135 |

u.close() 

136 |

return u.result 

137 | 138 |
141 |
142 | 143 | 151 | 152 | 153 | 154 | -------------------------------------------------------------------------------- /CodeSmell/_usr_local_lib_python2_7_dist-packages_requests_packages_urllib3_contrib___init___py.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Coverage for /usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/contrib/__init__.py: 100% 12 | 13 | 14 | 15 | 16 | 17 | 18 | 21 | 22 | 23 | 24 | 42 | 43 |
44 | Hide keyboard shortcuts 45 |

Hot-keys on this page

46 |
47 |

48 | r 49 | m 50 | x 51 | p   toggle line displays 52 |

53 |

54 | j 55 | k   next/prev highlighted chunk 56 |

57 |

58 | 0   (zero) top of page 59 |

60 |

61 | 1   (one) first highlighted chunk 62 |

63 |
64 |
65 | 66 |
67 | 68 | 69 | 72 | 75 | 76 |
70 | 71 | 73 | 74 |
77 |
78 | 79 | 87 | 88 | 89 | 90 | -------------------------------------------------------------------------------- /CodeSmell/_usr_local_lib_python2_7_dist-packages_requests_packages_urllib3_packages___init___py.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Coverage for /usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/packages/__init__.py: 100% 12 | 13 | 14 | 15 | 16 | 17 | 18 | 21 | 22 | 23 | 24 | 42 | 43 |
44 | Hide keyboard shortcuts 45 |

Hot-keys on this page

46 |
47 |

48 | r 49 | m 50 | x 51 | p   toggle line displays 52 |

53 |

54 | j 55 | k   next/prev highlighted chunk 56 |

57 |

58 | 0   (zero) top of page 59 |

60 |

61 | 1   (one) first highlighted chunk 62 |

63 |
64 |
65 | 66 |
67 | 68 | 69 | 77 | 85 | 86 |
70 |

1

71 |

2

72 |

3

73 |

4

74 |

5

75 | 76 |
78 |

from __future__ import absolute_import 

79 |

 

80 |

from . import ssl_match_hostname 

81 |

 

82 |

__all__ = ('ssl_match_hostname', ) 

83 | 84 |
87 |
88 | 89 | 97 | 98 | 99 | 100 | -------------------------------------------------------------------------------- /CodeSmell/_usr_local_lib_python2_7_dist-packages_requests_packages_urllib3_packages_ssl_match_hostname___init___py.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Coverage for /usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/packages/ssl_match_hostname/__init__.py: 38% 12 | 13 | 14 | 15 | 16 | 17 | 18 | 21 | 22 | 23 | 24 | 42 | 43 |
44 | Hide keyboard shortcuts 45 |

Hot-keys on this page

46 |
47 |

48 | r 49 | m 50 | x 51 | p   toggle line displays 52 |

53 |

54 | j 55 | k   next/prev highlighted chunk 56 |

57 |

58 | 0   (zero) top of page 59 |

60 |

61 | 1   (one) first highlighted chunk 62 |

63 |
64 |
65 | 66 |
67 | 68 | 69 | 85 | 101 | 102 |
70 |

1

71 |

2

72 |

3

73 |

4

74 |

5

75 |

6

76 |

7

77 |

8

78 |

9

79 |

10

80 |

11

81 |

12

82 |

13

83 | 84 |
86 |

try: 

87 |

# Python 3.2+ 

88 |

from ssl import CertificateError, match_hostname 

89 |

except ImportError: 

90 |

try: 

91 |

# Backport of the function from a pypi module 

92 |

from backports.ssl_match_hostname import CertificateError, match_hostname 

93 |

except ImportError: 

94 |

# Our vendored copy 

95 |

from ._implementation import CertificateError, match_hostname 

96 |

 

97 |

# Not needed, but documenting what we provide. 

98 |

__all__ = ('CertificateError', 'match_hostname') 

99 | 100 |
103 |
104 | 105 | 113 | 114 | 115 | 116 | -------------------------------------------------------------------------------- /CodeSmell/_usr_local_lib_python2_7_dist-packages_requests_packages_urllib3_util___init___py.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Coverage for /usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/util/__init__.py: 100% 12 | 13 | 14 | 15 | 16 | 17 | 18 | 21 | 22 | 23 | 24 | 42 | 43 |
44 | Hide keyboard shortcuts 45 |

Hot-keys on this page

46 |
47 |

48 | r 49 | m 50 | x 51 | p   toggle line displays 52 |

53 |

54 | j 55 | k   next/prev highlighted chunk 56 |

57 |

58 | 0   (zero) top of page 59 |

60 |

61 | 1   (one) first highlighted chunk 62 |

63 |
64 |
65 | 66 |
67 | 68 | 69 | 118 | 167 | 168 |
70 |

1

71 |

2

72 |

3

73 |

4

74 |

5

75 |

6

76 |

7

77 |

8

78 |

9

79 |

10

80 |

11

81 |

12

82 |

13

83 |

14

84 |

15

85 |

16

86 |

17

87 |

18

88 |

19

89 |

20

90 |

21

91 |

22

92 |

23

93 |

24

94 |

25

95 |

26

96 |

27

97 |

28

98 |

29

99 |

30

100 |

31

101 |

32

102 |

33

103 |

34

104 |

35

105 |

36

106 |

37

107 |

38

108 |

39

109 |

40

110 |

41

111 |

42

112 |

43

113 |

44

114 |

45

115 |

46

116 | 117 |
119 |

from __future__ import absolute_import 

120 |

# For backwards compatibility, provide imports that used to be here. 

121 |

from .connection import is_connection_dropped 

122 |

from .request import make_headers 

123 |

from .response import is_fp_closed 

124 |

from .ssl_ import ( 

125 |

SSLContext, 

126 |

HAS_SNI, 

127 |

IS_PYOPENSSL, 

128 |

assert_fingerprint, 

129 |

resolve_cert_reqs, 

130 |

resolve_ssl_version, 

131 |

ssl_wrap_socket, 

132 |

) 

133 |

from .timeout import ( 

134 |

current_time, 

135 |

Timeout, 

136 |

) 

137 |

 

138 |

from .retry import Retry 

139 |

from .url import ( 

140 |

get_host, 

141 |

parse_url, 

142 |

split_first, 

143 |

Url, 

144 |

) 

145 |

 

146 |

__all__ = ( 

147 |

'HAS_SNI', 

148 |

'IS_PYOPENSSL', 

149 |

'SSLContext', 

150 |

'Retry', 

151 |

'Timeout', 

152 |

'Url', 

153 |

'assert_fingerprint', 

154 |

'current_time', 

155 |

'is_connection_dropped', 

156 |

'is_fp_closed', 

157 |

'get_host', 

158 |

'parse_url', 

159 |

'make_headers', 

160 |

'resolve_cert_reqs', 

161 |

'resolve_ssl_version', 

162 |

'split_first', 

163 |

'ssl_wrap_socket', 

164 |

) 

165 | 166 |
169 |
170 | 171 | 179 | 180 | 181 | 182 | -------------------------------------------------------------------------------- /CodeSmell/_usr_local_lib_python2_7_dist-packages_tld___init___py.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Coverage for /usr/local/lib/python2.7/dist-packages/tld/__init__.py: 100% 12 | 13 | 14 | 15 | 16 | 17 | 18 | 21 | 22 | 23 | 24 | 42 | 43 |
44 | Hide keyboard shortcuts 45 |

Hot-keys on this page

46 |
47 |

48 | r 49 | m 50 | x 51 | p   toggle line displays 52 |

53 |

54 | j 55 | k   next/prev highlighted chunk 56 |

57 |

58 | 0   (zero) top of page 59 |

60 |

61 | 1   (one) first highlighted chunk 62 |

63 |
64 |
65 | 66 |
67 | 68 | 69 | 91 | 113 | 114 |
70 |

1

71 |

2

72 |

3

73 |

4

74 |

5

75 |

6

76 |

7

77 |

8

78 |

9

79 |

10

80 |

11

81 |

12

82 |

13

83 |

14

84 |

15

85 |

16

86 |

17

87 |

18

88 |

19

89 | 90 |
92 |

from .utils import ( 

93 |

get_tld, 

94 |

get_tld_names, 

95 |

Result, 

96 |

update_tld_names, 

97 |

) 

98 |

 

99 |

__title__ = 'tld' 

100 |

__version__ = '0.7.9' 

101 |

__build__ = 0x000013 

102 |

__author__ = 'Artur Barseghyan' 

103 |

__copyright__ = '2013-2017 Artur Barseghyan' 

104 |

__license__ = 'GPL 2.0/LGPL 2.1' 

105 |

__all__ = ( 

106 |

'get_tld', 

107 |

'get_tld_names', 

108 |

'Result', 

109 |

'update_tld_names', 

110 |

) 

111 | 112 |
115 |
116 | 117 | 125 | 126 | 127 | 128 | -------------------------------------------------------------------------------- /CodeSmell/_usr_local_lib_python2_7_dist-packages_tld_conf_py.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Coverage for /usr/local/lib/python2.7/dist-packages/tld/conf.py: 85% 12 | 13 | 14 | 15 | 16 | 17 | 18 | 21 | 22 | 23 | 24 | 42 | 43 |
44 | Hide keyboard shortcuts 45 |

Hot-keys on this page

46 |
47 |

48 | r 49 | m 50 | x 51 | p   toggle line displays 52 |

53 |

54 | j 55 | k   next/prev highlighted chunk 56 |

57 |

58 | 0   (zero) top of page 59 |

60 |

61 | 1   (one) first highlighted chunk 62 |

63 |
64 |
65 | 66 |
67 | 68 | 69 | 121 | 173 | 174 |
70 |

1

71 |

2

72 |

3

73 |

4

74 |

5

75 |

6

76 |

7

77 |

8

78 |

9

79 |

10

80 |

11

81 |

12

82 |

13

83 |

14

84 |

15

85 |

16

86 |

17

87 |

18

88 |

19

89 |

20

90 |

21

91 |

22

92 |

23

93 |

24

94 |

25

95 |

26

96 |

27

97 |

28

98 |

29

99 |

30

100 |

31

101 |

32

102 |

33

103 |

34

104 |

35

105 |

36

106 |

37

107 |

38

108 |

39

109 |

40

110 |

41

111 |

42

112 |

43

113 |

44

114 |

45

115 |

46

116 |

47

117 |

48

118 |

49

119 | 120 |
122 |

from . import defaults 

123 |

 

124 |

__title__ = 'tld.conf' 

125 |

__author__ = 'Artur Barseghyan' 

126 |

__copyright__ = '2013-2017 Artur Barseghyan' 

127 |

__license__ = 'GPL 2.0/LGPL 2.1' 

128 |

__all__ = ( 

129 |

'get_setting', 

130 |

'set_setting', 

131 |

'settings', 

132 |

) 

133 |

 

134 |

 

135 |

class Settings(object): 

136 |

"""Settings registry.""" 

137 |

 

138 |

def __init__(self): 

139 |

self._settings = {} 

140 |

 

141 |

def set(self, name, value): 

142 |

""" 

143 |

Override default settings. 

144 |

 

145 |

:param str name: 

146 |

:param mixed value: 

147 |

""" 

148 |

self._settings[name] = value 

149 |

 

150 |

def get(self, name, default=None): 

151 |

""" 

152 |

Gets a variable from local settings. 

153 |

 

154 |

:param str name: 

155 |

:param mixed default: Default value. 

156 |

:return mixed: 

157 |

""" 

158 |

if name in self._settings: 

159 |

return self._settings.get(name, default) 

160 |

elif hasattr(defaults, name): 

161 |

return getattr(defaults, name, default) 

162 |

else: 

163 |

return default 

164 |

 

165 |

 

166 |

settings = Settings() 

167 |

 

168 |

get_setting = settings.get 

169 |

 

170 |

set_setting = settings.set 

171 | 172 |
175 |
176 | 177 | 185 | 186 | 187 | 188 | -------------------------------------------------------------------------------- /CodeSmell/_usr_local_lib_python2_7_dist-packages_tld_defaults_py.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Coverage for /usr/local/lib/python2.7/dist-packages/tld/defaults.py: 100% 12 | 13 | 14 | 15 | 16 | 17 | 18 | 21 | 22 | 23 | 24 | 42 | 43 |
44 | Hide keyboard shortcuts 45 |

Hot-keys on this page

46 |
47 |

48 | r 49 | m 50 | x 51 | p   toggle line displays 52 |

53 |

54 | j 55 | k   next/prev highlighted chunk 56 |

57 |

58 | 0   (zero) top of page 59 |

60 |

61 | 1   (one) first highlighted chunk 62 |

63 |
64 |
65 | 66 |
67 | 68 | 69 | 96 | 123 | 124 |
70 |

1

71 |

2

72 |

3

73 |

4

74 |

5

75 |

6

76 |

7

77 |

8

78 |

9

79 |

10

80 |

11

81 |

12

82 |

13

83 |

14

84 |

15

85 |

16

86 |

17

87 |

18

88 |

19

89 |

20

90 |

21

91 |

22

92 |

23

93 |

24

94 | 95 |
97 |

import os 

98 |

 

99 |

__title__ = 'tld.defaults' 

100 |

__author__ = 'Artur Barseghyan' 

101 |

__copyright__ = '2013-2017 Artur Barseghyan' 

102 |

__license__ = 'GPL 2.0/LGPL 2.1' 

103 |

__all__ = ( 

104 |

'NAMES_SOURCE_URL', 

105 |

'NAMES_LOCAL_PATH', 

106 |

'NAMES_LOCAL_PATH_PARENT', 

107 |

'DEBUG' 

108 |

) 

109 |

 

110 |

# Source path of Mozilla's effective TLD names file. 

111 |

NAMES_SOURCE_URL = 'http://mxr.mozilla.org/mozilla/source/netwerk/dns/src/' \ 

112 |

'effective_tld_names.dat?raw=1' 

113 |

 

114 |

# Relative path to store the local copy of Mozilla's effective TLD names file. 

115 |

NAMES_LOCAL_PATH = 'res/effective_tld_names.dat.txt' 

116 |

 

117 |

# Absolute base path that is prepended to NAMES_LOCAL_PATH 

118 |

NAMES_LOCAL_PATH_PARENT = os.path.dirname(__file__) 

119 |

 

120 |

DEBUG = False 

121 | 122 |
125 |
126 | 127 | 135 | 136 | 137 | 138 | -------------------------------------------------------------------------------- /CodeSmell/_usr_local_lib_python2_7_dist-packages_tld_exceptions_py.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Coverage for /usr/local/lib/python2.7/dist-packages/tld/exceptions.py: 67% 12 | 13 | 14 | 15 | 16 | 17 | 18 | 21 | 22 | 23 | 24 | 42 | 43 |
44 | Hide keyboard shortcuts 45 |

Hot-keys on this page

46 |
47 |

48 | r 49 | m 50 | x 51 | p   toggle line displays 52 |

53 |

54 | j 55 | k   next/prev highlighted chunk 56 |

57 |

58 | 0   (zero) top of page 59 |

60 |

61 | 1   (one) first highlighted chunk 62 |

63 |
64 |
65 | 66 |
67 | 68 | 69 | 116 | 163 | 164 |
70 |

1

71 |

2

72 |

3

73 |

4

74 |

5

75 |

6

76 |

7

77 |

8

78 |

9

79 |

10

80 |

11

81 |

12

82 |

13

83 |

14

84 |

15

85 |

16

86 |

17

87 |

18

88 |

19

89 |

20

90 |

21

91 |

22

92 |

23

93 |

24

94 |

25

95 |

26

96 |

27

97 |

28

98 |

29

99 |

30

100 |

31

101 |

32

102 |

33

103 |

34

104 |

35

105 |

36

106 |

37

107 |

38

108 |

39

109 |

40

110 |

41

111 |

42

112 |

43

113 |

44

114 | 115 |
117 |

from .conf import get_setting 

118 |

 

119 |

__title__ = 'tld.exceptions' 

120 |

__author__ = 'Artur Barseghyan' 

121 |

__copyright__ = '2013-2017 Artur Barseghyan' 

122 |

__license__ = 'GPL 2.0/LGPL 2.1' 

123 |

__all__ = ( 

124 |

'TldIOError', 

125 |

'TldDomainNotFound', 

126 |

'TldBadUrl' 

127 |

) 

128 |

 

129 |

 

130 |

class TldIOError(IOError): 

131 |

"""TldIOError. 

132 |

 

133 |

Supposed to be thrown when problems with reading/writing occur.""" 

134 |

def __init__(self, msg=None): 

135 |

TLD_NAMES_LOCAL_PATH = get_setting('NAMES_LOCAL_PATH') 

136 |

if msg is None: 

137 |

msg = "Can't read from or write to the %s " \ 

138 |

"file!" % TLD_NAMES_LOCAL_PATH 

139 |

super(TldIOError, self).__init__(msg) 

140 |

 

141 |

 

142 |

class TldDomainNotFound(ValueError): 

143 |

"""TldDomainNotFound. 

144 |

 

145 |

Supposed to be thrown when domain name is not found (didn't match) the 

146 |

local TLD policy. 

147 |

""" 

148 |

def __init__(self, domain_name): 

149 |

super(TldDomainNotFound, self).__init__( 

150 |

"Domain %s didn't match any existing TLD name!" % domain_name 

151 |

) 

152 |

 

153 |

 

154 |

class TldBadUrl(ValueError): 

155 |

"""TldBadUrl. 

156 |

 

157 |

Supposed to be thrown when bad URL is given. 

158 |

""" 

159 |

def __init__(self, url): 

160 |

super(TldBadUrl, self).__init__("Is not a valid URL %s!" % url) 

161 | 162 |
165 |
166 | 167 | 175 | 176 | 177 | 178 | -------------------------------------------------------------------------------- /CodeSmell/_usr_local_lib_python2_7_dist-packages_tld_helpers_py.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Coverage for /usr/local/lib/python2.7/dist-packages/tld/helpers.py: 100% 12 | 13 | 14 | 15 | 16 | 17 | 18 | 21 | 22 | 23 | 24 | 42 | 43 |
44 | Hide keyboard shortcuts 45 |

Hot-keys on this page

46 |
47 |

48 | r 49 | m 50 | x 51 | p   toggle line displays 52 |

53 |

54 | j 55 | k   next/prev highlighted chunk 56 |

57 |

58 | 0   (zero) top of page 59 |

60 |

61 | 1   (one) first highlighted chunk 62 |

63 |
64 |
65 | 66 |
67 | 68 | 69 | 95 | 121 | 122 |
70 |

1

71 |

2

72 |

3

73 |

4

74 |

5

75 |

6

76 |

7

77 |

8

78 |

9

79 |

10

80 |

11

81 |

12

82 |

13

83 |

14

84 |

15

85 |

16

86 |

17

87 |

18

88 |

19

89 |

20

90 |

21

91 |

22

92 |

23

93 | 94 |
96 |

import os 

97 |

 

98 |

from .conf import get_setting 

99 |

 

100 |

__title__ = 'tld.helpers' 

101 |

__author__ = 'Artur Barseghyan' 

102 |

__copyright__ = '2013-2017 Artur Barseghyan' 

103 |

__license__ = 'GPL 2.0/LGPL 2.1' 

104 |

__all__ = ( 

105 |

'project_dir', 

106 |

'PROJECT_DIR', 

107 |

) 

108 |

 

109 |

 

110 |

def project_dir(base): 

111 |

"""Project dir.""" 

112 |

TLD_NAMES_LOCAL_PATH_PARENT = get_setting('NAMES_LOCAL_PATH_PARENT') 

113 |

return os.path.abspath( 

114 |

os.path.join(TLD_NAMES_LOCAL_PATH_PARENT, base).replace('\\', '/') 

115 |

) 

116 |

 

117 |

 

118 |

PROJECT_DIR = project_dir 

119 | 120 |
123 |
124 | 125 | 133 | 134 | 135 | 136 | -------------------------------------------------------------------------------- /CodeSmell/_usr_local_lib_python2_7_dist-packages_tqdm___init___py.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Coverage for /usr/local/lib/python2.7/dist-packages/tqdm/__init__.py: 100% 12 | 13 | 14 | 15 | 16 | 17 | 18 | 21 | 22 | 23 | 24 | 42 | 43 |
44 | Hide keyboard shortcuts 45 |

Hot-keys on this page

46 |
47 |

48 | r 49 | m 50 | x 51 | p   toggle line displays 52 |

53 |

54 | j 55 | k   next/prev highlighted chunk 56 |

57 |

58 | 0   (zero) top of page 59 |

60 |

61 | 1   (one) first highlighted chunk 62 |

63 |
64 |
65 | 66 |
67 | 68 | 69 | 100 | 131 | 132 |
70 |

1

71 |

2

72 |

3

73 |

4

74 |

5

75 |

6

76 |

7

77 |

8

78 |

9

79 |

10

80 |

11

81 |

12

82 |

13

83 |

14

84 |

15

85 |

16

86 |

17

87 |

18

88 |

19

89 |

20

90 |

21

91 |

22

92 |

23

93 |

24

94 |

25

95 |

26

96 |

27

97 |

28

98 | 99 |
101 |

from ._tqdm import tqdm 

102 |

from ._tqdm import trange 

103 |

from ._tqdm_gui import tqdm_gui 

104 |

from ._tqdm_gui import tgrange 

105 |

from ._tqdm_pandas import tqdm_pandas 

106 |

from ._main import main 

107 |

from ._version import __version__ # NOQA 

108 |

from ._tqdm import TqdmTypeError, TqdmKeyError, TqdmDeprecationWarning 

109 |

 

110 |

__all__ = ['tqdm', 'tqdm_gui', 'trange', 'tgrange', 'tqdm_pandas', 

111 |

'tqdm_notebook', 'tnrange', 'main', 

112 |

'TqdmTypeError', 'TqdmKeyError', 'TqdmDeprecationWarning', 

113 |

'__version__'] 

114 |

 

115 |

 

116 |

def tqdm_notebook(*args, **kwargs): # pragma: no cover 

117 |

"""See tqdm._tqdm_notebook.tqdm_notebook for full documentation""" 

118 |

from ._tqdm_notebook import tqdm_notebook as _tqdm_notebook 

119 |

return _tqdm_notebook(*args, **kwargs) 

120 |

 

121 |

 

122 |

def tnrange(*args, **kwargs): # pragma: no cover 

123 |

""" 

124 |

A shortcut for tqdm_notebook(xrange(*args), **kwargs). 

125 |

On Python3+ range is used instead of xrange. 

126 |

""" 

127 |

from ._tqdm_notebook import tnrange as _tnrange 

128 |

return _tnrange(*args, **kwargs) 

129 | 130 |
133 |
134 | 135 | 143 | 144 | 145 | 146 | -------------------------------------------------------------------------------- /CodeSmell/_usr_local_lib_python2_7_dist-packages_tqdm__tqdm_pandas_py.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Coverage for /usr/local/lib/python2.7/dist-packages/tqdm/_tqdm_pandas.py: 40% 12 | 13 | 14 | 15 | 16 | 17 | 18 | 21 | 22 | 23 | 24 | 42 | 43 |
44 | Hide keyboard shortcuts 45 |

Hot-keys on this page

46 |
47 |

48 | r 49 | m 50 | x 51 | p   toggle line displays 52 |

53 |

54 | j 55 | k   next/prev highlighted chunk 56 |

57 |

58 | 0   (zero) top of page 59 |

60 |

61 | 1   (one) first highlighted chunk 62 |

63 |
64 |
65 | 66 |
67 | 68 | 69 | 118 | 167 | 168 |
70 |

1

71 |

2

72 |

3

73 |

4

74 |

5

75 |

6

76 |

7

77 |

8

78 |

9

79 |

10

80 |

11

81 |

12

82 |

13

83 |

14

84 |

15

85 |

16

86 |

17

87 |

18

88 |

19

89 |

20

90 |

21

91 |

22

92 |

23

93 |

24

94 |

25

95 |

26

96 |

27

97 |

28

98 |

29

99 |

30

100 |

31

101 |

32

102 |

33

103 |

34

104 |

35

105 |

36

106 |

37

107 |

38

108 |

39

109 |

40

110 |

41

111 |

42

112 |

43

113 |

44

114 |

45

115 |

46

116 | 117 |
119 |

import sys 

120 |

 

121 |

__author__ = "github.com/casperdcl" 

122 |

__all__ = ['tqdm_pandas'] 

123 |

 

124 |

 

125 |

def tqdm_pandas(tclass, *targs, **tkwargs): 

126 |

""" 

127 |

Registers the given `tqdm` instance with 

128 |

`pandas.core.groupby.DataFrameGroupBy.progress_apply`. 

129 |

It will even close() the `tqdm` instance upon completion. 

130 |

 

131 |

Parameters 

132 |

---------- 

133 |

tclass : tqdm class you want to use (eg, tqdm, tqdm_notebook, etc) 

134 |

targs and tkwargs : arguments for the tqdm instance 

135 |

 

136 |

Examples 

137 |

-------- 

138 |

>>> import pandas as pd 

139 |

>>> import numpy as np 

140 |

>>> from tqdm import tqdm, tqdm_pandas 

141 |

>>> 

142 |

>>> df = pd.DataFrame(np.random.randint(0, 100, (100000, 6))) 

143 |

>>> tqdm_pandas(tqdm, leave=True) # can use tqdm_gui, optional kwargs, etc 

144 |

>>> # Now you can use `progress_apply` instead of `apply` 

145 |

>>> df.groupby(0).progress_apply(lambda x: x**2) 

146 |

 

147 |

References 

148 |

---------- 

149 |

https://stackoverflow.com/questions/18603270/ 

150 |

progress-indicator-during-pandas-operations-python 

151 |

""" 

152 |

from tqdm import TqdmDeprecationWarning 

153 |

 

154 |

if isinstance(tclass, type) or (getattr(tclass, '__name__', '').startswith( 

155 |

'tqdm_')): # delayed adapter case 

156 |

TqdmDeprecationWarning("""\ 

157 |

Please use `tqdm.pandas(...)` instead of `tqdm_pandas(tqdm, ...)`. 

158 |

""", fp_write=getattr(tkwargs.get('file', None), 'write', sys.stderr.write)) 

159 |

tclass.pandas(*targs, **tkwargs) 

160 |

else: 

161 |

TqdmDeprecationWarning("""\ 

162 |

Please use `tqdm.pandas(...)` instead of `tqdm_pandas(tqdm(...))`. 

163 |

""", fp_write=getattr(tclass.fp, 'write', sys.stderr.write)) 

164 |

type(tclass).pandas(deprecated_t=tclass) 

165 | 166 |
169 |
170 | 171 | 179 | 180 | 181 | 182 | -------------------------------------------------------------------------------- /CodeSmell/_usr_local_lib_python2_7_dist-packages_websocket___init___py.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Coverage for /usr/local/lib/python2.7/dist-packages/websocket/__init__.py: 100% 12 | 13 | 14 | 15 | 16 | 17 | 18 | 21 | 22 | 23 | 24 | 42 | 43 |
44 | Hide keyboard shortcuts 45 |

Hot-keys on this page

46 |
47 |

48 | r 49 | m 50 | x 51 | p   toggle line displays 52 |

53 |

54 | j 55 | k   next/prev highlighted chunk 56 |

57 |

58 | 0   (zero) top of page 59 |

60 |

61 | 1   (one) first highlighted chunk 62 |

63 |
64 |
65 | 66 |
67 | 68 | 69 | 101 | 133 | 134 |
70 |

1

71 |

2

72 |

3

73 |

4

74 |

5

75 |

6

76 |

7

77 |

8

78 |

9

79 |

10

80 |

11

81 |

12

82 |

13

83 |

14

84 |

15

85 |

16

86 |

17

87 |

18

88 |

19

89 |

20

90 |

21

91 |

22

92 |

23

93 |

24

94 |

25

95 |

26

96 |

27

97 |

28

98 |

29

99 | 100 |
102 |

""" 

103 |

websocket - WebSocket client library for Python 

104 |

 

105 |

Copyright (C) 2010 Hiroki Ohtani(liris) 

106 |

 

107 |

This library is free software; you can redistribute it and/or 

108 |

modify it under the terms of the GNU Lesser General Public 

109 |

License as published by the Free Software Foundation; either 

110 |

version 2.1 of the License, or (at your option) any later version. 

111 |

 

112 |

This library is distributed in the hope that it will be useful, 

113 |

but WITHOUT ANY WARRANTY; without even the implied warranty of 

114 |

MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 

115 |

Lesser General Public License for more details. 

116 |

 

117 |

You should have received a copy of the GNU Lesser General Public 

118 |

License along with this library; if not, write to the Free Software 

119 |

Foundation, Inc., 51 Franklin Street, Fifth Floor, 

120 |

Boston, MA 02110-1335 USA 

121 |

 

122 |

""" 

123 |

from ._abnf import * 

124 |

from ._app import WebSocketApp 

125 |

from ._core import * 

126 |

from ._exceptions import * 

127 |

from ._logging import * 

128 |

from ._socket import * 

129 |

 

130 |

__version__ = "0.44.0" 

131 | 132 |
135 |
136 | 137 | 145 | 146 | 147 | 148 | -------------------------------------------------------------------------------- /CodeSmell/_usr_local_lib_python2_7_dist-packages_websocket__exceptions_py.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Coverage for /usr/local/lib/python2.7/dist-packages/websocket/_exceptions.py: 88% 12 | 13 | 14 | 15 | 16 | 17 | 18 | 21 | 22 | 23 | 24 | 42 | 43 |
44 | Hide keyboard shortcuts 45 |

Hot-keys on this page

46 |
47 |

48 | r 49 | m 50 | x 51 | p   toggle line displays 52 |

53 |

54 | j 55 | k   next/prev highlighted chunk 56 |

57 |

58 | 0   (zero) top of page 59 |

60 |

61 | 1   (one) first highlighted chunk 62 |

63 |
64 |
65 | 66 |
67 | 68 | 69 | 152 | 235 | 236 |
70 |

1

71 |

2

72 |

3

73 |

4

74 |

5

75 |

6

76 |

7

77 |

8

78 |

9

79 |

10

80 |

11

81 |

12

82 |

13

83 |

14

84 |

15

85 |

16

86 |

17

87 |

18

88 |

19

89 |

20

90 |

21

91 |

22

92 |

23

93 |

24

94 |

25

95 |

26

96 |

27

97 |

28

98 |

29

99 |

30

100 |

31

101 |

32

102 |

33

103 |

34

104 |

35

105 |

36

106 |

37

107 |

38

108 |

39

109 |

40

110 |

41

111 |

42

112 |

43

113 |

44

114 |

45

115 |

46

116 |

47

117 |

48

118 |

49

119 |

50

120 |

51

121 |

52

122 |

53

123 |

54

124 |

55

125 |

56

126 |

57

127 |

58

128 |

59

129 |

60

130 |

61

131 |

62

132 |

63

133 |

64

134 |

65

135 |

66

136 |

67

137 |

68

138 |

69

139 |

70

140 |

71

141 |

72

142 |

73

143 |

74

144 |

75

145 |

76

146 |

77

147 |

78

148 |

79

149 |

80

150 | 151 |
153 |

""" 

154 |

websocket - WebSocket client library for Python 

155 |

 

156 |

Copyright (C) 2010 Hiroki Ohtani(liris) 

157 |

 

158 |

This library is free software; you can redistribute it and/or 

159 |

modify it under the terms of the GNU Lesser General Public 

160 |

License as published by the Free Software Foundation; either 

161 |

version 2.1 of the License, or (at your option) any later version. 

162 |

 

163 |

This library is distributed in the hope that it will be useful, 

164 |

but WITHOUT ANY WARRANTY; without even the implied warranty of 

165 |

MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 

166 |

Lesser General Public License for more details. 

167 |

 

168 |

You should have received a copy of the GNU Lesser General Public 

169 |

License along with this library; if not, write to the Free Software 

170 |

Foundation, Inc., 51 Franklin Street, Fifth Floor, 

171 |

Boston, MA 02110-1335 USA 

172 |

 

173 |

""" 

174 |

 

175 |

 

176 |

""" 

177 |

define websocket exceptions 

178 |

""" 

179 |

 

180 |

 

181 |

class WebSocketException(Exception): 

182 |

""" 

183 |

websocket exception class. 

184 |

""" 

185 |

pass 

186 |

 

187 |

 

188 |

class WebSocketProtocolException(WebSocketException): 

189 |

""" 

190 |

If the websocket protocol is invalid, this exception will be raised. 

191 |

""" 

192 |

pass 

193 |

 

194 |

 

195 |

class WebSocketPayloadException(WebSocketException): 

196 |

""" 

197 |

If the websocket payload is invalid, this exception will be raised. 

198 |

""" 

199 |

pass 

200 |

 

201 |

 

202 |

class WebSocketConnectionClosedException(WebSocketException): 

203 |

""" 

204 |

If remote host closed the connection or some network error happened, 

205 |

this exception will be raised. 

206 |

""" 

207 |

pass 

208 |

 

209 |

 

210 |

class WebSocketTimeoutException(WebSocketException): 

211 |

""" 

212 |

WebSocketTimeoutException will be raised at socket timeout during read/write data. 

213 |

""" 

214 |

pass 

215 |

 

216 |

 

217 |

class WebSocketProxyException(WebSocketException): 

218 |

""" 

219 |

WebSocketProxyException will be raised when proxy error occurred. 

220 |

""" 

221 |

pass 

222 |

 

223 |

 

224 |

class WebSocketBadStatusException(WebSocketException): 

225 |

""" 

226 |

WebSocketBadStatusException will be raised when we get bad handshake status code. 

227 |

""" 

228 |

 

229 |

def __init__(self, message, status_code): 

230 |

super(WebSocketBadStatusException, self).__init__( 

231 |

message % status_code) 

232 |

self.status_code = status_code 

233 | 234 |
237 |
238 | 239 | 247 | 248 | 249 | 250 | -------------------------------------------------------------------------------- /CodeSmell/_usr_local_lib_python2_7_dist-packages_websocket__ssl_compat_py.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Coverage for /usr/local/lib/python2.7/dist-packages/websocket/_ssl_compat.py: 47% 12 | 13 | 14 | 15 | 16 | 17 | 18 | 21 | 22 | 23 | 24 | 42 | 43 |
44 | Hide keyboard shortcuts 45 |

Hot-keys on this page

46 |
47 |

48 | r 49 | m 50 | x 51 | p   toggle line displays 52 |

53 |

54 | j 55 | k   next/prev highlighted chunk 56 |

57 |

58 | 0   (zero) top of page 59 |

60 |

61 | 1   (one) first highlighted chunk 62 |

63 |
64 |
65 | 66 |
67 | 68 | 69 | 116 | 163 | 164 |
70 |

1

71 |

2

72 |

3

73 |

4

74 |

5

75 |

6

76 |

7

77 |

8

78 |

9

79 |

10

80 |

11

81 |

12

82 |

13

83 |

14

84 |

15

85 |

16

86 |

17

87 |

18

88 |

19

89 |

20

90 |

21

91 |

22

92 |

23

93 |

24

94 |

25

95 |

26

96 |

27

97 |

28

98 |

29

99 |

30

100 |

31

101 |

32

102 |

33

103 |

34

104 |

35

105 |

36

106 |

37

107 |

38

108 |

39

109 |

40

110 |

41

111 |

42

112 |

43

113 |

44

114 | 115 |
117 |

""" 

118 |

websocket - WebSocket client library for Python 

119 |

 

120 |

Copyright (C) 2010 Hiroki Ohtani(liris) 

121 |

 

122 |

This library is free software; you can redistribute it and/or 

123 |

modify it under the terms of the GNU Lesser General Public 

124 |

License as published by the Free Software Foundation; either 

125 |

version 2.1 of the License, or (at your option) any later version. 

126 |

 

127 |

This library is distributed in the hope that it will be useful, 

128 |

but WITHOUT ANY WARRANTY; without even the implied warranty of 

129 |

MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 

130 |

Lesser General Public License for more details. 

131 |

 

132 |

You should have received a copy of the GNU Lesser General Public 

133 |

License along with this library; if not, write to the Free Software 

134 |

Foundation, Inc., 51 Franklin Street, Fifth Floor, 

135 |

Boston, MA 02110-1335 USA 

136 |

 

137 |

""" 

138 |

__all__ = ["HAVE_SSL", "ssl", "SSLError"] 

139 |

 

140 |

try: 

141 |

import ssl 

142 |

from ssl import SSLError 

143 |

if hasattr(ssl, 'SSLContext') and hasattr(ssl.SSLContext, 'check_hostname'): 

144 |

HAVE_CONTEXT_CHECK_HOSTNAME = True 

145 |

else: 

146 |

HAVE_CONTEXT_CHECK_HOSTNAME = False 

147 |

if hasattr(ssl, "match_hostname"): 

148 |

from ssl import match_hostname 

149 |

else: 

150 |

from backports.ssl_match_hostname import match_hostname 

151 |

__all__.append("match_hostname") 

152 |

__all__.append("HAVE_CONTEXT_CHECK_HOSTNAME") 

153 |

 

154 |

HAVE_SSL = True 

155 |

except ImportError: 

156 |

# dummy class of SSLError for ssl none-support environment. 

157 |

class SSLError(Exception): 

158 |

pass 

159 |

 

160 |

HAVE_SSL = False 

161 | 162 |
165 |
166 | 167 | 175 | 176 | 177 | 178 | -------------------------------------------------------------------------------- /CodeSmell/jquery.debounce.min.js: -------------------------------------------------------------------------------- 1 | /* 2 | * jQuery throttle / debounce - v1.1 - 3/7/2010 3 | * http://benalman.com/projects/jquery-throttle-debounce-plugin/ 4 | * 5 | * Copyright (c) 2010 "Cowboy" Ben Alman 6 | * Dual licensed under the MIT and GPL licenses. 7 | * http://benalman.com/about/license/ 8 | */ 9 | (function(b,c){var $=b.jQuery||b.Cowboy||(b.Cowboy={}),a;$.throttle=a=function(e,f,j,i){var h,d=0;if(typeof f!=="boolean"){i=j;j=f;f=c}function g(){var o=this,m=+new Date()-d,n=arguments;function l(){d=+new Date();j.apply(o,n)}function k(){h=c}if(i&&!h){l()}h&&clearTimeout(h);if(i===c&&m>e){l()}else{if(f!==true){h=setTimeout(i?k:l,i===c?e-m:e)}}}if($.guid){g.guid=j.guid=j.guid||$.guid++}return g};$.debounce=function(d,e,f){return f===c?a(d,e,false):a(d,f,e!==false)}})(this); 10 | -------------------------------------------------------------------------------- /CodeSmell/jquery.hotkeys.js: -------------------------------------------------------------------------------- 1 | /* 2 | * jQuery Hotkeys Plugin 3 | * Copyright 2010, John Resig 4 | * Dual licensed under the MIT or GPL Version 2 licenses. 5 | * 6 | * Based upon the plugin by Tzury Bar Yochay: 7 | * http://github.com/tzuryby/hotkeys 8 | * 9 | * Original idea by: 10 | * Binny V A, http://www.openjs.com/scripts/events/keyboard_shortcuts/ 11 | */ 12 | 13 | (function(jQuery){ 14 | 15 | jQuery.hotkeys = { 16 | version: "0.8", 17 | 18 | specialKeys: { 19 | 8: "backspace", 9: "tab", 13: "return", 16: "shift", 17: "ctrl", 18: "alt", 19: "pause", 20 | 20: "capslock", 27: "esc", 32: "space", 33: "pageup", 34: "pagedown", 35: "end", 36: "home", 21 | 37: "left", 38: "up", 39: "right", 40: "down", 45: "insert", 46: "del", 22 | 96: "0", 97: "1", 98: "2", 99: "3", 100: "4", 101: "5", 102: "6", 103: "7", 23 | 104: "8", 105: "9", 106: "*", 107: "+", 109: "-", 110: ".", 111 : "/", 24 | 112: "f1", 113: "f2", 114: "f3", 115: "f4", 116: "f5", 117: "f6", 118: "f7", 119: "f8", 25 | 120: "f9", 121: "f10", 122: "f11", 123: "f12", 144: "numlock", 145: "scroll", 191: "/", 224: "meta" 26 | }, 27 | 28 | shiftNums: { 29 | "`": "~", "1": "!", "2": "@", "3": "#", "4": "$", "5": "%", "6": "^", "7": "&", 30 | "8": "*", "9": "(", "0": ")", "-": "_", "=": "+", ";": ": ", "'": "\"", ",": "<", 31 | ".": ">", "/": "?", "\\": "|" 32 | } 33 | }; 34 | 35 | function keyHandler( handleObj ) { 36 | // Only care when a possible input has been specified 37 | if ( typeof handleObj.data !== "string" ) { 38 | return; 39 | } 40 | 41 | var origHandler = handleObj.handler, 42 | keys = handleObj.data.toLowerCase().split(" "); 43 | 44 | handleObj.handler = function( event ) { 45 | // Don't fire in text-accepting inputs that we didn't directly bind to 46 | if ( this !== event.target && (/textarea|select/i.test( event.target.nodeName ) || 47 | event.target.type === "text") ) { 48 | return; 49 | } 50 | 51 | // Keypress represents characters, not special keys 52 | var special = event.type !== "keypress" && jQuery.hotkeys.specialKeys[ event.which ], 53 | character = String.fromCharCode( event.which ).toLowerCase(), 54 | key, modif = "", possible = {}; 55 | 56 | // check combinations (alt|ctrl|shift+anything) 57 | if ( event.altKey && special !== "alt" ) { 58 | modif += "alt+"; 59 | } 60 | 61 | if ( event.ctrlKey && special !== "ctrl" ) { 62 | modif += "ctrl+"; 63 | } 64 | 65 | // TODO: Need to make sure this works consistently across platforms 66 | if ( event.metaKey && !event.ctrlKey && special !== "meta" ) { 67 | modif += "meta+"; 68 | } 69 | 70 | if ( event.shiftKey && special !== "shift" ) { 71 | modif += "shift+"; 72 | } 73 | 74 | if ( special ) { 75 | possible[ modif + special ] = true; 76 | 77 | } else { 78 | possible[ modif + character ] = true; 79 | possible[ modif + jQuery.hotkeys.shiftNums[ character ] ] = true; 80 | 81 | // "$" can be triggered as "Shift+4" or "Shift+$" or just "$" 82 | if ( modif === "shift+" ) { 83 | possible[ jQuery.hotkeys.shiftNums[ character ] ] = true; 84 | } 85 | } 86 | 87 | for ( var i = 0, l = keys.length; i < l; i++ ) { 88 | if ( possible[ keys[i] ] ) { 89 | return origHandler.apply( this, arguments ); 90 | } 91 | } 92 | }; 93 | } 94 | 95 | jQuery.each([ "keydown", "keyup", "keypress" ], function() { 96 | jQuery.event.special[ this ] = { add: keyHandler }; 97 | }); 98 | 99 | })( jQuery ); 100 | -------------------------------------------------------------------------------- /CodeSmell/jquery.isonscreen.js: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2010 2 | * @author Laurence Wheway 3 | * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) 4 | * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. 5 | * 6 | * @version 1.2.0 7 | */ 8 | (function($) { 9 | jQuery.extend({ 10 | isOnScreen: function(box, container) { 11 | //ensure numbers come in as intgers (not strings) and remove 'px' is it's there 12 | for(var i in box){box[i] = parseFloat(box[i])}; 13 | for(var i in container){container[i] = parseFloat(container[i])}; 14 | 15 | if(!container){ 16 | container = { 17 | left: $(window).scrollLeft(), 18 | top: $(window).scrollTop(), 19 | width: $(window).width(), 20 | height: $(window).height() 21 | } 22 | } 23 | 24 | if( box.left+box.width-container.left > 0 && 25 | box.left < container.width+container.left && 26 | box.top+box.height-container.top > 0 && 27 | box.top < container.height+container.top 28 | ) return true; 29 | return false; 30 | } 31 | }) 32 | 33 | 34 | jQuery.fn.isOnScreen = function (container) { 35 | for(var i in container){container[i] = parseFloat(container[i])}; 36 | 37 | if(!container){ 38 | container = { 39 | left: $(window).scrollLeft(), 40 | top: $(window).scrollTop(), 41 | width: $(window).width(), 42 | height: $(window).height() 43 | } 44 | } 45 | 46 | if( $(this).offset().left+$(this).width()-container.left > 0 && 47 | $(this).offset().left < container.width+container.left && 48 | $(this).offset().top+$(this).height()-container.top > 0 && 49 | $(this).offset().top < container.height+container.top 50 | ) return true; 51 | return false; 52 | } 53 | })(jQuery); 54 | -------------------------------------------------------------------------------- /CodeSmell/jquery.tablesorter.min.js: -------------------------------------------------------------------------------- 1 | 2 | (function($){$.extend({tablesorter:new function(){var parsers=[],widgets=[];this.defaults={cssHeader:"header",cssAsc:"headerSortUp",cssDesc:"headerSortDown",sortInitialOrder:"asc",sortMultiSortKey:"shiftKey",sortForce:null,sortAppend:null,textExtraction:"simple",parsers:{},widgets:[],widgetZebra:{css:["even","odd"]},headers:{},widthFixed:false,cancelSelection:true,sortList:[],headerList:[],dateFormat:"us",decimal:'.',debug:false};function benchmark(s,d){log(s+","+(new Date().getTime()-d.getTime())+"ms");}this.benchmark=benchmark;function log(s){if(typeof console!="undefined"&&typeof console.debug!="undefined"){console.log(s);}else{alert(s);}}function buildParserCache(table,$headers){if(table.config.debug){var parsersDebug="";}var rows=table.tBodies[0].rows;if(table.tBodies[0].rows[0]){var list=[],cells=rows[0].cells,l=cells.length;for(var i=0;i1){arr=arr.concat(checkCellColSpan(table,headerArr,row++));}else{if(table.tHead.length==1||(cell.rowSpan>1||!r[row+1])){arr.push(cell);}}}return arr;};function checkHeaderMetadata(cell){if(($.metadata)&&($(cell).metadata().sorter===false)){return true;};return false;}function checkHeaderOptions(table,i){if((table.config.headers[i])&&(table.config.headers[i].sorter===false)){return true;};return false;}function applyWidget(table){var c=table.config.widgets;var l=c.length;for(var i=0;i');$("tr:first td",table.tBodies[0]).each(function(){colgroup.append($('').css('width',$(this).width()));});$(table).prepend(colgroup);};}function updateHeaderSortCount(table,sortList){var c=table.config,l=sortList.length;for(var i=0;ib)?1:0));};function sortTextDesc(a,b){return((ba)?1:0));};function sortNumeric(a,b){return a-b;};function sortNumericDesc(a,b){return b-a;};function getCachedSortType(parsers,i){return parsers[i].type;};this.construct=function(settings){return this.each(function(){if(!this.tHead||!this.tBodies)return;var $this,$document,$headers,cache,config,shiftDown=0,sortOrder;this.config={};config=$.extend(this.config,$.tablesorter.defaults,settings);$this=$(this);$headers=buildHeaders(this);this.config.parsers=buildParserCache(this,$headers);cache=buildCache(this);var sortCSS=[config.cssDesc,config.cssAsc];fixColumnWidth(this);$headers.click(function(e){$this.trigger("sortStart");var totalRows=($this[0].tBodies[0]&&$this[0].tBodies[0].rows.length)||0;if(!this.sortDisabled&&totalRows>0){var $cell=$(this);var i=this.column;this.order=this.count++%2;if(!e[config.sortMultiSortKey]){config.sortList=[];if(config.sortForce!=null){var a=config.sortForce;for(var j=0;j0){$this.trigger("sorton",[config.sortList]);}applyWidget(this);});};this.addParser=function(parser){var l=parsers.length,a=true;for(var i=0;ibody { 26 | font-size: 16px; 27 | } 28 | 29 | /* Set base font size to 12/16 */ 30 | p { 31 | font-size: .75em; /* 12/16 */ 32 | line-height: 1.33333333em; /* 16/12 */ 33 | } 34 | 35 | table { 36 | border-collapse: collapse; 37 | } 38 | td { 39 | vertical-align: top; 40 | } 41 | table tr.hidden { 42 | display: none !important; 43 | } 44 | 45 | p#no_rows { 46 | display: none; 47 | font-size: 1.2em; 48 | } 49 | 50 | a.nav { 51 | text-decoration: none; 52 | color: inherit; 53 | } 54 | a.nav:hover { 55 | text-decoration: underline; 56 | color: inherit; 57 | } 58 | 59 | /* Page structure */ 60 | #header { 61 | background: #f8f8f8; 62 | width: 100%; 63 | border-bottom: 1px solid #eee; 64 | } 65 | 66 | #source { 67 | padding: 1em; 68 | font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; 69 | } 70 | 71 | .indexfile #footer { 72 | margin: 1em 3em; 73 | } 74 | 75 | .pyfile #footer { 76 | margin: 1em 1em; 77 | } 78 | 79 | #footer .content { 80 | padding: 0; 81 | font-size: 85%; 82 | font-family: verdana, sans-serif; 83 | color: #666666; 84 | font-style: italic; 85 | } 86 | 87 | #index { 88 | margin: 1em 0 0 3em; 89 | } 90 | 91 | /* Header styles */ 92 | #header .content { 93 | padding: 1em 3em; 94 | } 95 | 96 | h1 { 97 | font-size: 1.25em; 98 | display: inline-block; 99 | } 100 | 101 | #filter_container { 102 | display: inline-block; 103 | float: right; 104 | margin: 0 2em 0 0; 105 | } 106 | #filter_container input { 107 | width: 10em; 108 | } 109 | 110 | h2.stats { 111 | margin-top: .5em; 112 | font-size: 1em; 113 | } 114 | .stats span { 115 | border: 1px solid; 116 | padding: .1em .25em; 117 | margin: 0 .1em; 118 | cursor: pointer; 119 | border-color: #999 #ccc #ccc #999; 120 | } 121 | .stats span.hide_run, .stats span.hide_exc, 122 | .stats span.hide_mis, .stats span.hide_par, 123 | .stats span.par.hide_run.hide_par { 124 | border-color: #ccc #999 #999 #ccc; 125 | } 126 | .stats span.par.hide_run { 127 | border-color: #999 #ccc #ccc #999; 128 | } 129 | 130 | .stats span.run { 131 | background: #ddffdd; 132 | } 133 | .stats span.exc { 134 | background: #eeeeee; 135 | } 136 | .stats span.mis { 137 | background: #ffdddd; 138 | } 139 | .stats span.hide_run { 140 | background: #eeffee; 141 | } 142 | .stats span.hide_exc { 143 | background: #f5f5f5; 144 | } 145 | .stats span.hide_mis { 146 | background: #ffeeee; 147 | } 148 | .stats span.par { 149 | background: #ffffaa; 150 | } 151 | .stats span.hide_par { 152 | background: #ffffcc; 153 | } 154 | 155 | /* Help panel */ 156 | #keyboard_icon { 157 | float: right; 158 | margin: 5px; 159 | cursor: pointer; 160 | } 161 | 162 | .help_panel { 163 | position: absolute; 164 | background: #ffffcc; 165 | padding: .5em; 166 | border: 1px solid #883; 167 | display: none; 168 | } 169 | 170 | .indexfile .help_panel { 171 | width: 20em; height: 4em; 172 | } 173 | 174 | .pyfile .help_panel { 175 | width: 16em; height: 8em; 176 | } 177 | 178 | .help_panel .legend { 179 | font-style: italic; 180 | margin-bottom: 1em; 181 | } 182 | 183 | #panel_icon { 184 | float: right; 185 | cursor: pointer; 186 | } 187 | 188 | .keyhelp { 189 | margin: .75em; 190 | } 191 | 192 | .keyhelp .key { 193 | border: 1px solid black; 194 | border-color: #888 #333 #333 #888; 195 | padding: .1em .35em; 196 | font-family: monospace; 197 | font-weight: bold; 198 | background: #eee; 199 | } 200 | 201 | /* Source file styles */ 202 | .linenos p { 203 | text-align: right; 204 | margin: 0; 205 | padding: 0 .5em; 206 | color: #999999; 207 | font-family: verdana, sans-serif; 208 | font-size: .625em; /* 10/16 */ 209 | line-height: 1.6em; /* 16/10 */ 210 | } 211 | .linenos p.highlight { 212 | background: #ffdd00; 213 | } 214 | .linenos p a { 215 | text-decoration: none; 216 | color: #999999; 217 | } 218 | .linenos p a:hover { 219 | text-decoration: underline; 220 | color: #999999; 221 | } 222 | 223 | td.text { 224 | width: 100%; 225 | } 226 | .text p { 227 | margin: 0; 228 | padding: 0 0 0 .5em; 229 | border-left: 2px solid #ffffff; 230 | white-space: pre; 231 | position: relative; 232 | } 233 | 234 | .text p.mis { 235 | background: #ffdddd; 236 | border-left: 2px solid #ff0000; 237 | } 238 | .text p.run, .text p.run.hide_par { 239 | background: #ddffdd; 240 | border-left: 2px solid #00ff00; 241 | } 242 | .text p.exc { 243 | background: #eeeeee; 244 | border-left: 2px solid #808080; 245 | } 246 | .text p.par, .text p.par.hide_run { 247 | background: #ffffaa; 248 | border-left: 2px solid #eeee99; 249 | } 250 | .text p.hide_run, .text p.hide_exc, .text p.hide_mis, .text p.hide_par, 251 | .text p.hide_run.hide_par { 252 | background: inherit; 253 | } 254 | 255 | .text span.annotate { 256 | font-family: georgia; 257 | color: #666; 258 | float: right; 259 | padding-right: .5em; 260 | } 261 | .text p.hide_par span.annotate { 262 | display: none; 263 | } 264 | .text span.annotate.long { 265 | display: none; 266 | } 267 | .text p:hover span.annotate.long { 268 | display: block; 269 | max-width: 50%; 270 | white-space: normal; 271 | float: right; 272 | position: absolute; 273 | top: 1.75em; 274 | right: 1em; 275 | width: 30em; 276 | height: auto; 277 | color: #333; 278 | background: #ffffcc; 279 | border: 1px solid #888; 280 | padding: .25em .5em; 281 | z-index: 999; 282 | border-radius: .2em; 283 | box-shadow: #cccccc .2em .2em .2em; 284 | } 285 | 286 | /* Syntax coloring */ 287 | .text .com { 288 | color: green; 289 | font-style: italic; 290 | line-height: 1px; 291 | } 292 | .text .key { 293 | font-weight: bold; 294 | line-height: 1px; 295 | } 296 | .text .str { 297 | color: #000080; 298 | } 299 | 300 | /* index styles */ 301 | #index td, #index th { 302 | text-align: right; 303 | width: 5em; 304 | padding: .25em .5em; 305 | border-bottom: 1px solid #eee; 306 | } 307 | #index th { 308 | font-style: italic; 309 | color: #333; 310 | border-bottom: 1px solid #ccc; 311 | cursor: pointer; 312 | } 313 | #index th:hover { 314 | background: #eee; 315 | border-bottom: 1px solid #999; 316 | } 317 | #index td.left, #index th.left { 318 | padding-left: 0; 319 | } 320 | #index td.right, #index th.right { 321 | padding-right: 0; 322 | } 323 | #index th.headerSortDown, #index th.headerSortUp { 324 | border-bottom: 1px solid #000; 325 | white-space: nowrap; 326 | background: #eee; 327 | } 328 | #index th.headerSortDown:after { 329 | content: " ↓"; 330 | } 331 | #index th.headerSortUp:after { 332 | content: " ↑"; 333 | } 334 | #index td.name, #index th.name { 335 | text-align: left; 336 | width: auto; 337 | } 338 | #index td.name a { 339 | text-decoration: none; 340 | color: #000; 341 | } 342 | #index tr.total, 343 | #index tr.total_dynamic { 344 | } 345 | #index tr.total td, 346 | #index tr.total_dynamic td { 347 | font-weight: bold; 348 | border-top: 1px solid #ccc; 349 | border-bottom: none; 350 | } 351 | #index tr.file:hover { 352 | background: #eeeeee; 353 | } 354 | #index tr.file:hover td.name { 355 | text-decoration: underline; 356 | color: #000; 357 | } 358 | 359 | /* scroll marker styles */ 360 | #scroll_marker { 361 | position: fixed; 362 | right: 0; 363 | top: 0; 364 | width: 16px; 365 | height: 100%; 366 | background: white; 367 | border-left: 1px solid #eee; 368 | } 369 | 370 | #scroll_marker .marker { 371 | background: #eedddd; 372 | position: absolute; 373 | min-height: 3px; 374 | width: 100%; 375 | } 376 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu 2 | 3 | MAINTAINER JohnMenerick version .9 4 | ##John Menerick https://securesql.info 5 | 6 | ADD VERSION . 7 | RUN apt-get update && apt-get install -y --no-install-recommends git python-pip && apt-get autoremove && apt-get autoclean && rm -rf /var/lib/apt/lists/* 8 | RUN git clone https://github.com/w8mej/PoorOperationalSecurityPractices 9 | RUN cd PoorOperationalSecurityPractices && pip install -r requirements.txt && python pooropssec.py 10 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

Poor Operational Security

2 | 3 |
4 | :steam_locomotive::train::train::train::train::train: 5 |
6 |
7 | Poor offensive security techniques in use in the wild 8 |
9 | 10 |
11 | 12 |
13 | 14 | 15 | API stability 17 | 18 | 19 | 20 | Standard 22 | 23 |
24 | 25 |
26 | The little script that could and would. Built with creativity, observations, and facepalm-inducing moments 27 | John Menerick 28 | 29 |
30 | 31 | ![picture alt](http://www.brightlightpictures.com/assets/images/portfolio/thethaw_header.jpg "Never Alone") 32 | 33 | ## Features 34 | - __Certificate Logs:__ finding those who are creating public ssl / tls certificates without understanding the consequences 35 | - __Multiple output formats:__ STIX, Snort, Suricata, PAN, Syslog, Twitter, etc... 36 | - __very cute:__ all about the fail train! 37 | 38 | 39 | ## TODO 40 | * Add additional techniques from Red Team playbooks and IR playbooks on the funny ways hackers, crackers, and red teamers have been caught 41 | * Add Chef files 42 | 43 | ## Usage 44 | ```bash 45 | python pooropssec.py 46 | ``` 47 | 48 | ## Philosophy 49 | Organizations may improve their information security posture by rethinking it 50 | from the perspective of an attacker trying to gain access to their most 51 | critical assets (data, people and systems). Typically this is accomplished with 52 | experience from the front lines to simulate the tools, tactices, and procedures (TTPs) 53 | of real hackers and crackers. However, everyone makes mistakes. Or Red Teams are one trick 54 | ponies who only know how to perform two to three different techniques. Then it is VERY easy for a Red Teamer 55 | to fall into practicing poor operational security behaviors. We take advantage of these lazy behaviors, TTPs, and 56 | related business operating expense saving techniques. In short, anything to move higher up the KillChain to 57 | reduce the time to respond to events and incidents before they happen is a ++ . We are faced with excessive amounts of data, of various noise to signal ratios, where questions 58 | and answers are easily hidden. But available to those who know how to ask the right questions and dig deep. 59 | 60 | 61 | * Mature beyond the traditional hunting methods - WHOIS and name server monitoring, passive DNS, Malware / Implant tracking, Honeypots, etc... 62 | * Enhance your security team's ability to prevent, detect, and respond to real-world incidents 63 | * Identify and mitigate complex security vulnerabilities before an attack exploits them 64 | * Still able to create diamond models to quickly pivot to patient zero and hero 65 | * To cause pain and suffering for those who do not follow proper operational security, IE https://github.com/bluscreenofjeff/Red-Team-Infrastructure-Wiki 66 | 67 | Deceptive tradecraft should be fun and light, not stern and stressful. It is cool to be cute. 68 | 69 | 70 | ## Installation 71 | There are a multitude of options 72 | Optional 73 | Customize the weights in indicators.py to your risk profile. 74 | 75 | Source 76 | ```sh 77 | $ pip install -r requirements.txt 78 | $ python ./pooropssec.py 79 | ``` 80 | 81 | Vagrant 82 | * Adjust the private ssh key to one of your liking. Otherwise user vagrant / password vagrant will suffice. 83 | ```sh 84 | $ vagrant init pwn/PoorOperationalSec 85 | $ vagrant up 86 | ``` 87 | 88 | Docker 89 | * Adjust the private ssh key to one of your liking. Otherwise user vagrant / password vagrant will suffice. 90 | ```sh 91 | $ docker pull 92 | ``` 93 | 94 | 95 | ![picture alt](https://i.imgur.com/V9evk9u.jpg "Setting Sail for Fail") 96 | -------------------------------------------------------------------------------- /VERSION: -------------------------------------------------------------------------------- 1 | 0.0.3 2 | -------------------------------------------------------------------------------- /Vagrantfile: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | 4 | # All Vagrant configuration is done below. The "2" in Vagrant.configure 5 | # configures the configuration version (we support older styles for 6 | # backwards compatibility). Please don't change it unless you know what 7 | # you're doing. 8 | Vagrant.configure("2") do |config| 9 | config.vm.box = "pwn/PoorOperationalSec" 10 | config.ssh.private_key_path="~/.ssh/id_rsa_vagrant" 11 | config.vm.box_version = "1.0.1" 12 | config.vm.provision :shell, inline: "cd ~/PoorOperationalSecurityPractices && python ./pooropssec.py", run: 'always', privileged: false 13 | end 14 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3.2' 2 | services: 3 | api: 4 | image: ubuntu 5 | build: . 6 | 7 | -------------------------------------------------------------------------------- /pooropssec.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | """Poor Opssec 3 | A collection of techniques and methods to capture not terribly intelligent / hidden 4 | entities who do not practice proper Operational Security or are using these techniques 5 | to cause the blue team to spend time spinning their tires in the mud. Best case, this 6 | allows one to transition earlier in the killchain. For instance, instead of black-holing 7 | the afflicted domains, point them to a deceptive honeypot and infrastructure meant 8 | for deception and offensive security time-wasting. 9 | """ 10 | import entropy 11 | import logging 12 | import re 13 | from Levenshtein import ratio 14 | from time import time 15 | 16 | import certstream 17 | import requests 18 | import tqdm 19 | from tld import get_tld 20 | 21 | from indicators import phrases, prefixes 22 | 23 | '''setup logging for syslog and other eventual event communication services.''' 24 | logging.basicConfig(level=logging.INFO) 25 | LOGGER = logging.getLogger(__name__) 26 | HANDLER = logging.FileHandler('./NeedSpecialAttention.log') 27 | HANDLER.setLevel(logging.INFO) 28 | FORMATTER = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') 29 | HANDLER.setFormatter(FORMATTER) 30 | LOGGER.addHandler(HANDLER) 31 | STATUSCLI = tqdm.tqdm(desc='certificate_update', unit='cert') 32 | 33 | 34 | def live_status_check(phishy): 35 | """Is the evil domain alive or some other state? 36 | input: 37 | phishy - the domain (str) 38 | 39 | returns - status_code (int) The HTTP status code. -1 means timeout or unable to connect. 40 | """ 41 | try: 42 | _status_response = requests.get('http://' + phishy, timeout=2.2) 43 | _status_code = _status_response.status_code 44 | except Exception as exc: 45 | _status_code = -1 46 | finally: 47 | return _status_code 48 | 49 | 50 | def tweet_finding(tweet_content): 51 | """Tweet the finding 52 | input: 53 | tweet_content - the content to put into the tweet to public announce or DM (str) 54 | 55 | returns - N/A in public version 56 | """ 57 | 58 | ##Nothing here in the public version 59 | 60 | return 1 61 | 62 | 63 | 64 | def stix_export(stix_content): 65 | """Publish to a STIX-enabled service for threat and vuln mgt. 66 | input: 67 | stix_content - the base content used to create the STIX message / event 68 | 69 | returns - N/A in public version 70 | """ 71 | 72 | ##Nothing here in the public version 73 | 74 | return 1 75 | 76 | 77 | def alleged_domain(phishy): 78 | """How sketchy is the domain in question? Performs statistical, symantic, and other reasoning techniques to 79 | separate the wheat from the chaff 80 | input: 81 | phishy - the domain (str) 82 | 83 | returns - score (int or float depending on the quant. techniques 84 | """ 85 | 86 | score = 0 87 | for _tld in prefixes: 88 | if phishy.endswith(_tld): 89 | score += 20 90 | 91 | if phishy.startswith('*.'): 92 | phishy = phishy[2:] 93 | 94 | # https://arstechnica.com/information-technology/2017/06/phishing-attacks-target-mobile-browsers-with-dash-padded-urls/ 95 | try: 96 | res = get_tld(phishy, as_object=True, fail_silently=True, fix_protocol=True) 97 | phishy = '.'.join([res.subdomain, res.domain]) 98 | except Exception as exc: 99 | pass 100 | 101 | words_in_domain = re.split("\W+", phishy) 102 | 103 | # How fun are wildcards? Not fun with language parsers 104 | if phishy.startswith('*.'): 105 | phishy = phishy[2:] 106 | if words_in_domain[0] in ['com', 'net', 'org']: 107 | score += 10 108 | 109 | # Testing keywords 110 | for word, val in phrases.iteritems(): 111 | if word in phishy: 112 | score += phrases[word] 113 | 114 | # Too random? 115 | score += int(round(entropy.shannon_entropy(phishy) * 50.2)) 116 | 117 | # How likely is this like others? 118 | for key in [k for (k, s) in phrases.items() if s >= 70]: 119 | # Massaging dataset massaging with normalization 120 | for word in [w for w in words_in_domain if w not in ['cloud', 'mail', 'email']]: 121 | if ratio(str(word), str(key)) == 1: 122 | score += 70 123 | 124 | '''Markov chain confusion Not released to the public''' 125 | '''K closest neighbors and cluster analysis (similar to Levenshstein ratios) not released to the public''' 126 | 127 | #Oh China.... 128 | if 'xn--' not in phishy and phishy.count('-') >= 4: 129 | score += phishy.count('-') * 3 130 | 131 | # Humans rarely, rationally pick 3+ subdomains deep 132 | if phishy.count('.') >= 3: 133 | score += phishy.count('.') * 3 134 | 135 | return score 136 | 137 | 138 | def verisign_certstream(handle_symantec): 139 | """Handlers to consume various verisign / symantec certificate streams 140 | input: 141 | handle_symantec - a dictionary of various symantec / verisign certificate streams 142 | 143 | returns - N/A in public version 144 | """ 145 | 146 | ##Nothing here in the public version 147 | 148 | return 1 149 | 150 | def palo_alto_networks(pan_content): 151 | """Publish to a PAN service or appliance to enable deceptive routing. 152 | input: 153 | pan_content - the base content used to create the PAN policy 154 | 155 | returns - N/A in public version 156 | """ 157 | 158 | ##Nothing here in the public version 159 | 160 | return 1 161 | 162 | 163 | def ids_export(regex_pattern): 164 | """Publish to a Suricata, Bro, and / or Snort API. Also create the written ids rules in the corresponding directory 165 | input: 166 | regex_pattern - the base regex used to construct a generic IDS pattern. Then highly customized / tweaked 167 | for specific IDS engines and pattern matching algorithms. 168 | 169 | returns - N/A in public version 170 | """ 171 | 172 | ##Nothing here in the public version 173 | 174 | return 1 175 | 176 | 177 | 178 | def log_me(bad_fish, weight): 179 | """Takes the weight of an alleged evil domain and communicates it as appropriate 180 | input: 181 | bad_fish - the domain (str) 182 | weight - the quantitative evil (int or float) 183 | 184 | returns - success just because?! 185 | """ 186 | 187 | '''Mean in a normal distribution with a width of 2, 4, and 6 standard deviations''' 188 | if weight >= 68: 189 | status = live_status_check(bad_fish) 190 | LOGGER.info("time={0} weight={1} bad_fish={2} http_status={3}\n".format(int(time()), weight, bad_fish, status)) 191 | 192 | return 1 193 | 194 | def callback(message, context): 195 | """Specifying the function as an entity. 196 | input: 197 | message - entity's message 198 | context - in case future needs dictate a calling code context 199 | 200 | returns - much success 201 | """ 202 | if message['message_type'] == "heartbeat": 203 | return 204 | 205 | if message['message_type'] == "certificate_update": 206 | _cert_firehose = message['data']['leaf_cert']['all_domains'] 207 | 208 | for _smelly_domain in _cert_firehose: 209 | score = alleged_domain(_smelly_domain.lower()) 210 | STATUSCLI.update(1) 211 | 212 | # If issued from a free CA = more suspicious 213 | if "Let's Encrypt" in message['data']['chain'][0]['subject']['aggregated']: 214 | score += 10 215 | 216 | log_me(_smelly_domain, score) 217 | 218 | if __name__ == "__main__": 219 | certstream.listen_for_events(callback) 220 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | setuptools==38.2.4 2 | tld==0.7.9 3 | tqdm==4.19.4 4 | entropy==0.10 5 | requests==2.18.1 6 | certstream==1.8 7 | python_Levenshtein==0.12.0 8 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup 2 | 3 | setup( 4 | name='PoorOpsSec', 5 | version='.1', 6 | packages=[''], 7 | url='https://securesql.info', 8 | license=' Copyright 2016 John Menerick Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.', 9 | author='John Menerick', 10 | author_email='john@syn.agency', 11 | description='A very simple setup for detecting those who practice poor opssec' 12 | ) 13 | -------------------------------------------------------------------------------- /test/scoring.py: -------------------------------------------------------------------------------- 1 | from pooropssec import alleged_domain 2 | 3 | 4 | def test_score_domain(): 5 | '''simple functional red green light test for expected and unexpected quant. measures''' 6 | #Unexpected 7 | assert alleged_domain('go.jpmorgan.com') > 75 8 | assert alleged_domain('security.coinbase.com') > 75 9 | assert alleged_domain('xn----paypal.com----yourmom.work') > 55 10 | #Expected 11 | assert alleged_domain('www.etrade.com') < 50 12 | --------------------------------------------------------------------------------