Skip to content

Commit 032c54d

Browse files
authored
Merge branch 'master' into master
2 parents eca9fe0 + be735f7 commit 032c54d

File tree

8 files changed

+42
-46
lines changed

8 files changed

+42
-46
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
#ignore IDE settings
55
*.idea*
6+
*.vscode*
67

78
#setup
89
build/*

api/engine.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
from database.db import search_logs
4040
from database.db import logs_to_report_html
4141
from config import nettacker_global_config
42-
from core.scan_targers import start_scan_processes
42+
from core.scan_targets import start_scan_processes
4343
from core.args_loader import check_all_required
4444

4545
app = Flask(

core/parse.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# -*- coding: utf-8 -*-
33

44

5-
from core.scan_targers import start_scan_processes
5+
from core.scan_targets import start_scan_processes
66
from core.alert import info
77
from core.alert import write
88
from core.alert import messages

core/readme.md

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,18 @@ OWASP Nettacker core functions
33

44
OWASP Nettacker core functions are stored in here.
55

6-
* `die.py` exit functions
7-
* `time.py` time functions
86
* `alert.py` user alerts and printing functions
97
* `args_loader.py` ARGV commands and apply rules
10-
* `attack.py` start new attacks and multi-processing managements
11-
* `color.py` color founds for windows and linux/mac.
8+
* `color.py` color founds for windows and linux/mac
129
* `compatible.py` compatibility functions
13-
* `config.py` user configs (could be modify by user)
14-
* `config_builder.py` core static configs (same as user configs but should not be change by users)
15-
* `get_input.py` get inputs from users functions
10+
* `die.py` exit functions
11+
* `graph.py` graph representation
1612
* `ip.py` IPv4 and IPv6 functions
17-
* `load_modules` load modules, requirements, paths functions
18-
* `log.py` log the scans and generate reports
13+
* `load_modules.py` load modules, requirements, paths functions
14+
* `messages.py` class messages
1915
* `parse.py` parse the ARGV and pass it
20-
* `targets.py` process, calculate and count targets
21-
* `update.py` updates functions of the framework
22-
* `wizard.py` wizard mode for the framework
16+
* `scan_targets.py` start new attacks and multi-processing managements
17+
* `socks_proxy.py` use SOCKS5 proxy
18+
* `targets.py` process, calculate and count targets
19+
* `time.py` time functions
20+
* `utility.py` support functions
File renamed without changes.

core/targets.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def expand_targets(options, scan_unique_id):
3232
Returns:
3333
a generator
3434
"""
35-
from core.scan_targers import multi_processor
35+
from core.scan_targets import multi_processor
3636
targets = []
3737
for target in options.targets:
3838
if '://' in target:

database/db.py

Lines changed: 27 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@
2525

2626
def db_inputs(connection_type):
2727
"""
28-
a function to determine the type of database the user wants to work with and
29-
selects the corresponding connection to the db
28+
a function to determine the type of database the user wants to work with and
29+
selects the corresponding connection to the db
3030
31-
Args:
32-
connection_type: type of db we are working with
31+
Args:
32+
connection_type: type of db we are working with
3333
34-
Returns:
35-
corresponding command to connect to the db
36-
"""
34+
Returns:
35+
corresponding command to connect to the db
36+
"""
3737
return {
3838
"postgres": 'postgres+psycopg2://{0}:{1}@{2}:{3}/{4}'.format(USER, PASSWORD, HOST, PORT, DATABASE),
3939
"mysql": 'mysql://{0}:{1}@{2}:{3}/{4}'.format(USER, PASSWORD, HOST, PORT, DATABASE),
@@ -43,25 +43,22 @@ def db_inputs(connection_type):
4343

4444
def create_connection():
4545
"""
46-
a function to create connections to db, it retries 100 times if connection returned an error
46+
a function to create connections to db with pessimistic approach
4747
4848
Returns:
4949
connection if success otherwise False
5050
"""
5151
try:
52-
for _ in range(0, 100):
53-
try:
54-
db_engine = create_engine(
55-
db_inputs(DB),
56-
connect_args={
57-
'check_same_thread': False
58-
}
59-
)
60-
Session = sessionmaker(bind=db_engine)
61-
session = Session()
62-
return session
63-
except Exception:
64-
time.sleep(0.1)
52+
db_engine = create_engine(
53+
db_inputs(DB),
54+
connect_args={
55+
'check_same_thread': False
56+
},
57+
pool_pre_ping=True
58+
)
59+
Session = sessionmaker(bind=db_engine)
60+
session = Session()
61+
return session
6562
except Exception:
6663
warn(messages("database_connect_fail"))
6764
return False
@@ -196,17 +193,17 @@ def submit_temp_logs_to_db(log):
196193

197194
def find_temp_events(target, module_name, scan_unique_id, event_name):
198195
"""
199-
select all events by scan_unique id, target, module_name
196+
select all events by scan_unique id, target, module_name
200197
201-
Args:
202-
target: target
203-
module_name: module name
204-
scan_unique_id: unique scan identifier
205-
event_name: event_name
198+
Args:
199+
target: target
200+
module_name: module name
201+
scan_unique_id: unique scan identifier
202+
event_name: event_name
206203
207-
Returns:
208-
an array with JSON events or an empty array
209-
"""
204+
Returns:
205+
an array with JSON events or an empty array
206+
"""
210207
session = create_connection()
211208
try:
212209
for _ in range(1, 100):

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ texttable==1.6.7
99
PySocks==1.7.1 # library_name=socks # module name is not equal to socks name; this is required to be checked on startup
1010
pyOpenSSL==23.2.0 # library_name=OpenSSL
1111
flask==2.3.2
12-
SQLAlchemy>=1.3.0 # library_name=sqlalchemy
12+
SQLAlchemy>=1.4.43 # library_name=sqlalchemy
1313
py3DNS==3.2.1 # library_name=DNS
1414
numpy==1.24.3
1515
terminable_thread==0.7.1

0 commit comments

Comments
 (0)