FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
pyt/pyt/usage.py at master · python-security/pyt · GitHub
python-security
pyt
Repository navigation
Code
Issues
26
(26)
Pull requests
2
(2)
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
pyt
/
pyt
/
usage.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
156 lines (142 loc) · 4.46 KB
Breadcrumbs
pyt
/
pyt
/
usage.py
Copy path
File metadata and controls
156 lines (142 loc) · 4.46 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
import
argparse
import
os
import
sys
from
.
formatters
import
json
,
screen
,
text
default_blackbox_mapping_file
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'vulnerability_definitions'
,
'blackbox_mapping.json'
)
default_trigger_word_file
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'vulnerability_definitions'
,
'all_trigger_words.pyt'
)
def
_add_required_group
(
parser
):
required_group
=
parser
.
add_argument_group
(
'required arguments'
)
required_group
.
add_argument
(
'targets'
,
metavar
=
'targets'
,
nargs
=
'+'
,
help
=
'source file(s) or directory(s) to be scanned'
,
type
=
str
)
def
_add_optional_group
(
parser
):
optional_group
=
parser
.
add_argument_group
(
'optional arguments'
)
optional_group
.
add_argument
(
'-v'
,
'--verbose'
,
action
=
'count'
,
help
=
'Increase logging verbosity. Can repeated e.g. -vvv'
,
)
optional_group
.
add_argument
(
'-a'
,
'--adaptor'
,
help
=
'Choose a web framework adaptor: '
'Flask(Default), Django, Every or Pylons'
,
type
=
str
)
optional_group
.
add_argument
(
'-pr'
,
'--project-root'
,
help
=
'Add project root, only important when the entry '
'file is not at the root of the project.'
,
type
=
str
)
optional_group
.
add_argument
(
'-b'
,
'--baseline'
,
help
=
'Path of a baseline report to compare against '
'(only JSON-formatted files are accepted)'
,
type
=
str
,
default
=
False
,
metavar
=
'BASELINE_JSON_FILE'
,
)
optional_group
.
add_argument
(
'-t'
,
'--trigger-word-file'
,
help
=
'Input file with a list of sources and sinks'
,
type
=
str
,
default
=
default_trigger_word_file
)
optional_group
.
add_argument
(
'-m'
,
'--blackbox-mapping-file'
,
help
=
'Input blackbox mapping file.'
,
type
=
str
,
default
=
default_blackbox_mapping_file
)
optional_group
.
add_argument
(
'-i'
,
'--interactive'
,
help
=
'Will ask you about each blackbox function call in vulnerability chains.'
,
action
=
'store_true'
,
default
=
False
)
optional_group
.
add_argument
(
'-o'
,
'--output'
,
help
=
'Write report to filename'
,
dest
=
'output_file'
,
action
=
'store'
,
type
=
argparse
.
FileType
(
'w'
),
default
=
sys
.
stdout
,
)
optional_group
.
add_argument
(
'--ignore-nosec'
,
dest
=
'ignore_nosec'
,
action
=
'store_true'
,
help
=
'Do not skip lines with # nosec comments'
)
optional_group
.
add_argument
(
'-r'
,
'--recursive'
,
dest
=
'recursive'
,
action
=
'store_true'
,
help
=
'Find and process files in subdirectories'
)
optional_group
.
add_argument
(
'-x'
,
'--exclude'
,
dest
=
'excluded_paths'
,
action
=
'store'
,
default
=
''
,
help
=
'Separate files with commas'
)
optional_group
.
add_argument
(
'--dont-prepend-root'
,
help
=
"In project root e.g. /app, imports are not prepended with app.*"
,
action
=
'store_false'
,
default
=
True
,
dest
=
'prepend_module_root'
)
optional_group
.
add_argument
(
'--no-local-imports'
,
help
=
'If set, absolute imports must be relative to the project root. '
'If not set, modules in the same directory can be imported just by their names.'
,
action
=
'store_false'
,
default
=
True
,
dest
=
'allow_local_imports'
)
optional_group
.
add_argument
(
'-u'
,
'--only-unsanitised'
,
help
=
"Don't print sanitised vulnerabilities."
,
action
=
'store_true'
,
default
=
False
,
)
parser
.
set_defaults
(
formatter
=
text
)
formatter_group
=
optional_group
.
add_mutually_exclusive_group
()
formatter_group
.
add_argument
(
'-j'
,
'--json'
,
help
=
'Prints JSON instead of report.'
,
action
=
'store_const'
,
const
=
json
,
dest
=
'formatter'
,
)
formatter_group
.
add_argument
(
'-s'
,
'--screen'
,
help
=
'Prints colorful report.'
,
action
=
'store_const'
,
const
=
screen
,
dest
=
'formatter'
,
)
def
parse_args
(
args
):
if
len
(
args
)
==
0
:
args
.
append
(
'-h'
)
parser
=
argparse
.
ArgumentParser
(
prog
=
'python -m pyt'
)
# Hack to in order to list required args above optional
parser
.
_action_groups
.
pop
()
_add_required_group
(
parser
)
_add_optional_group
(
parser
)
args
=
parser
.
parse_args
(
args
)
if
args
.
targets
is
None
:
parser
.
error
(
'The targets argument is required'
)
return
args
Back
|
FazBrowse Home
|
New Git URL